# Fees and Wait Times

## Fee Types

Users pay up to four kinds of fees when conducting a swap.

1. **Layer1 Network Fees** (gas): paid by the user when sending the asset to MAYAChain to be swapped. This is controlled by the user's wallet.
2. **Slip Fee**: protects the pool from being manipulated by large swaps. Calculated as a function of transaction size and current pool depth. The slip fee formula is explained here(LINK) and an example implementation is [here](https://gitlab.com/thorchain/asgardex-common/asgardex-util/-/blob/master/src/calc/swap.ts#L57).
3. **Affiliate Fee** - (optional) a percentage skimmed from the inbound amount that can be paid to exchanges or wallet providers. *Wallets can now accept fees in any MAYAChain-supported asset (USDC, BTC, etc).&#x20;*~~*Check the "Preferred Asset for Affiliate Fees" section in*~~ [~~*Fees*~~](https://docs.mayaprotocol.com/mayachain-dev-docs/concepts/fees) ~~*for more details and setup information.*~~
4. **Outbound Fee** - the fee the Network pays on behalf of the user to send the outbound transaction. See Outbound Fee (LINK).

{% hint style="info" %}
The Swap Quote endpoint will calculate and show all fees.
{% endhint %}

See the [fees](https://docs.mayaprotocol.com/mayachain-dev-docs/concepts/fees) section for full details.

### Refunds and Minimum Swap Amount

If a transaction fails, it is refunded, thus it will pay the `outboundFee` for the **SourceChain** not the DestinationChain. Thus devs should always swap an amount that is a maximum of the following, multiplied by at least a 4x buffer to allow for gas spikes:

1. The Destination Chain outboundFee, or
2. The Source Chain outboundFee, or
3. $1.00 (the minimum outboundFee).

For convenience, a `recommended_min_amount_in` is included on the [Swap Quote](https://docs.mayaprotocol.com/mayachain-dev-docs/introduction/swapping-guide/quickstart-guide) endpoint, which is the value described above. This value is priced in the inbound asset of the quote request (in 1e8). This should be the minimum-allowed swap amount for the requested quote.

## Wait Times

There are four phases of a transaction sent to MAYAChain each taking time to complete.

1. **Layer1 Inbound Confirmation -** assuming the inboundTx will be confirmed in the next block, it is the source blockchain block time.
2. **Observation Counting** - time for 67% MAYAChain Nodes to observe and agree on the inboundTx.
3. **Confirmation Counting** - for non-instant finality blockchains, the amount of time MAYAChain will wait before processing to protect against double spends and re-org attacks.
4. **Outbound Delay** - dependent on size and network traffic. Large outbounds will be delayed.
5. **Layer1 Outbound Confirmation** - Outbound blockchain block time.

Wait times can be between a few seconds up to an hour. The assets being swapped, the size of the swap and the current network traffic within MAYAChain will determine the wait time.

{% hint style="info" %}
The Swap Quote endpoint will calculate points 3 and 4.
{% endhint %}

See the [Delays](https://docs.mayaprotocol.com/mayachain-dev-docs/concepts/delays) section for full details.
