# 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.

```solidity
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:

```solidity
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.

```solidity
yarRequest.approve(appAddress, yarAmount);
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.yarchain.org/dev-docs/fees.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
