Claiming & Swapping Accumulated Fees

Swap fees are accumulated on the fee collector contract and should be claimed by the operator set on deployment of the fee collector.

Keep in mind that the fees are taken in the tokens being swapped so to claim all these tokens to the fee_destination address the latter must have all the trustlines.

There is a method to claim and immediately swap everything in 1 token, then settle to fee_destination. "Raw" claiming is also available though.

Below there are examples of these operations. Claims can be executed as frequently as necessary.

Option 1: Claim & Immediately Swap

  • Function: claim_fees_and_swap(e, operator: Address, swaps_chain: Vec<โ€ฆ>, token: Address, out_min: u128) -> u128

  • Effect:

    1. Claims all of token.

    2. Swaps via your router along swaps_chain.

    3. Sends resulting tokens to fee_destination.

  • Returns: Final output amount in the target asset.

  • Function: claim_fees_and_swap(e, operator: Address, swaps_chain: Vec<โ€ฆ>, token: Address, out_min: u128) -> u128

  • Effect:

    1. Claims all of token.

    2. Swaps via your router along swaps_chain.

    3. Sends resulting tokens to fee_destination.

  • Returns: Final output amount in the target asset.

Option 2: Claim Raw Fees

  • Function: claim_fees(e, operator: Address, token: Address) -> u128

  • Effect: Transfers entire token balance from the contract to fee_destination.

Last updated