Fees

To pay for gas in the delivery network, the protocol charges a sufficient amount in Yar tokens from the user's balance, stored on the YarHub smart contract in the Yar network. For the Relayers network to execute the transaction, the user must first deposit a sufficient amount. If the user does not have a sufficient deposit at the time of transaction execution, the transaction will remain in the queue. This is done by calling the deposit function on the YarRequest smart contract from any supported network.

yarRequest.deposit(amount);

Each network uses its own payment token, usually the native token of the network, but it can also be an EIP20 token. To see which token is used:

address feeToken = yarRequest.feeToken();

If feeToken == address(0), the native token of the network is used; otherwise, the specified EIP20 token is used.

For example, by calling YarRequest.deposit(1e18) on the Ethereum network, 1 ETH will be debited from the user's wallet, which will then be converted at the current rate into YAR tokens and credited to the user's deposit in YarHub.

To perform cross-chain transactions from the address of any smart contract but pay the Yar fee from the user's address, the user must allow the application to debit the deposit on their behalf.

yarRequest.approve(appAddress, yarAmount);

Last updated