> For the complete documentation index, see [llms.txt](https://docs.yarchain.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.yarchain.org/dev-docs/fees.md).

# 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
