You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you're making a cross-chain call using xCall, there's a fee that covers the costs of sending the message between different blockchains. `sendCallMessage` is payable, so the fee should be included in the transaction. You can get the fee by calling `getFee`.
4
+
5
+
`getFee(String _net, boolean _rollback)` returns the total fee (relay + protocol) for sending a message to the specified network. If a rollback data is provided, the `_rollback` param should be set as true because there is an additional backward direction fee (from destination back to source) if rollback is used.
6
+
7
+
\
8
+
This fee is split into two parts:
9
+
10
+
**Relay Fee**: This fee is for the service that actually sends your message from one blockchain to another. 
11
+
12
+
**Protocol Fee**: This is the fee for using the cross-chain communication protocol underlying xCall.
13
+
14
+
### Relay Fee
15
+
16
+
* If a relay successfully delivers a cross-chain message, it can claim a reward. The first relay to successfully deliver a cross-chain message gets the reward.
17
+
* The reward claim can be made using the `claimReward` function, which requires the network address of the reward (`_network`) and the address of the receiver (`_receiver`).
18
+
* The accrued reward for each relay can be checked using the `getReward` function.
19
+
20
+
### Protocol Fee
21
+
22
+
* The protocol fee is set on the `xCall` contract by an admin wallet.
23
+
24
+
### Burning Fees and Impact to ICX Tokenomics
25
+
26
+
Native fees generated by protocol fees and relays managed by the ICON Foundation are swapped to native ICX and burned.
27
+
28
+
### Example
29
+
30
+
The process of fetching the cross chain transaction fee is done by making a readonly call to the `getFee(String _net, Boolean _rollback)` method of the xCall contract in the origin chain.
31
+
32
+
The following code sample showcase how to get the fee of a crosschain message originating on the Berlin testnet on ICON and the destination chain being the Sepolia testnet on Ethereum.
**I**f execution fails on the destination chain, `handleCallMessage` may also need to be defined in the source chain Smart Contract A in order to handle the [executeRollback](https://github.com/icon-project/IIPs/blob/master/IIPS/iip-52.md#executerollback) invocation properly. For more information, see [Troubleshooting](error-handling.md).
57
+
**I**f execution fails on the destination chain, `handleCallMessage` may also need to be defined in the source chain Smart Contract A in order to handle the [executeRollback](https://github.com/icon-project/IIPs/blob/master/IIPS/iip-52.md#executerollback) invocation properly. For more information, see [Troubleshooting](../troubleshooting.md).
The following code sample showcase how to wait and fetch the `CallMessage` event of the destination chain in a cross chain message scenario where the destination chain is an EVM chain.
Copy file name to clipboardexpand all lines: build-with-xcall/guides/sending-a-message.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
Sending a call message requires your Smart Contract to call the **pre-deployed** xCall Smart Contract's `sendCallMessage` method.
4
4
5
-
More detailed explanation can be found [here](https://github.com/icon-project/IIPs/blob/master/IIPS/iip-52.md#sendcallmessage). Rollback is covered in the [Troubleshooting ](error-handling.md)section.
5
+
More detailed explanation can be found [here](https://github.com/icon-project/IIPs/blob/master/IIPS/iip-52.md#sendcallmessage). Rollback is covered in the [Troubleshooting ](../troubleshooting.md)section.
Copy file name to clipboardexpand all lines: build-with-xcall/resources/message-lifecycle.md
+3-3
Original file line number
Diff line number
Diff line change
@@ -9,11 +9,11 @@ The simplified lifecycle of an xCall message, only including what is relevant to
9
9
3. EOA then respond to this event by invoking the `executeCall` method in the xCall Smart Contract on the destination chain.
10
10
4. The execution of this method triggers the target dApp's smart contract method.
11
11
5. If the call executes successfully, a `CallExecutedEvent` is emitted.
12
-
6. If an error occurs during execution, and rollback data was included in the original call, an error handling process is initiated, sending a `ResponseMessage` Event back to the source chain for state rollback operations. For more information, see [Troubleshooting](../guides/error-handling.md).
12
+
6. If an error occurs during execution, and rollback data was included in the original call, an error handling process is initiated, sending a `ResponseMessage` Event back to the source chain for state rollback operations. For more information, see [Troubleshooting](../troubleshooting.md).
13
13
14
-
In this process, the dApp developer handles [initiating the cross-chain call](../quickstart/sending-a-message-with-xcall.md), [responding to events](../guides/receiving-a-message.md), and [errors](../guides/error-handling.md).
14
+
In this process, the dApp developer handles [initiating the cross-chain call](../quickstart/sending-a-message-with-xcall.md), [responding to events](../guides/receiving-a-message.md), and [errors](../troubleshooting.md).
15
15
16
-
`sendCallMessage` is a `Payable` method and requires a fee. For more information, see [Handling Fees](fees.md).
16
+
`sendCallMessage` is a `Payable` method and requires a fee. For more information, see [Handling Fees](../guides/handling-fees.md).
If an error occurs during the execution of the call request on the destination chain, and a rollback parameter was provided in the initial `sendCallMessage` method, the xCall contract on the source chain emits a `RollbackMessage` event. This event is triggered when an error occurs on the destination chain and a rollback operation is needed. The `RollbackMessage` event includes the serial number of the original request that needs to be rolled back.
4
4
@@ -8,4 +8,3 @@ The destination chain does not pass back rollback instructions. These are define
8
8
9
9
After the rollback operation is executed, the `RollbackExecuted` event is emitted by the xCall contract. This event notifies that the rollback has been executed and includes the serial number for the rollback, the execution result code, and a result message if any.
0 commit comments