Adding Fees

There are no protocol fees for AshSwap Aggregator or platform fees on AshSwap UI, however, UI providers may implement platform fees. If a platform fee is set, AshSwap will take 10% of the platform fees charged by integrators.

Overall

Contact us to establish fees for your platforms.

SDK Configuration

First, register with us the wallet you use for collecting the fees and the fees you would like to set for your platform. Then, use that wallet as the protocol argument in your integration.

const swapWithPaths = async () => {
    const integrator = 'erd...'; // your fee wallet
    const agService = new Aggregator({chainId: ChainId.Mainnet, protocol: integrator});

    // use the response to display on the UI
    const sorswap = await agService.getPaths('EGLD', 'ASH-a642d1', 1e18);
    
    if (!sorswap) throw new Error(`Could not find any paths for EGLD to ASH`);
    const interaction = await agService.aggregateFromPaths(sorswap, 100);
    // remember to set the sender (caller) before sending the tx
    const tx = interaction.withSender(new Address('erd...')).check().buildTransaction();
    
    // sign and send tx to the network
    // sendTransactions({
    //     transactions: [tx],
    // })
}

CLI

Query Fee Percentage

100% equals 100,000 in the smart contract. If your fee is 0.1%, the result is 100.

mxpy contract query erd1qqqqqqqqqqqqqpgqcc69ts8409p3h77q5chsaqz57y6hugvc4fvs64k74v --proxy https://gateway.multiversx.com --function getProtocolFeePercent --arguments 0x$(mxpy wallet bech32 --decode [YOUR FEE WALLET])

Query Claimable Fees

mxpy contract query erd1qqqqqqqqqqqqqpgqcc69ts8409p3h77q5chsaqz57y6hugvc4fvs64k74v --proxy https://gateway.multiversx.com --function getClaimabeProtocolFee --arguments 0x$(mxpy wallet bech32 --decode [YOUR FEE WALLET]) 0 100

Fees are taken from token inputs, so over time, fees can consist of multiple tokens, so we allow you to query by indexes. The numbers 0 and 100 at the end of the query are the start index and end index, respectively.

Claim Fees

Claim all fees available in the smart contracts.

mxpy contract call erd1qqqqqqqqqqqqqpgqcc69ts8409p3h77q5chsaqz57y6hugvc4fvs64k74v --proxy=https://gateway.multiversx.com --chain=1 --gas-limit=600000000 --pem=[YOUR FEE WALLET PEM FILE] --recall-nonce --send --wait-result --function=claimProtocolFee --arguments 0x$(mxpy wallet bech32 --decode [YOUR FEE WALLET])

When the number of fee tokens is too large, to make sure the transaction doesn't go over the gas limit or it doesn't make sense economically to claim small fee tokens, you can claim fees by tokens.

mxpy contract call erd1qqqqqqqqqqqqqpgqcc69ts8409p3h77q5chsaqz57y6hugvc4fvs64k74v --proxy=https://gateway.multiversx.com --chain=1 --gas-limit=600000000 --pem=[YOUR FEE WALLET PEM FILE] --recall-nonce --send --wait-result --function=claimProtocolFeeByTokens --arguments 0x$(mxpy wallet bech32 --decode [YOUR FEE WALLET]) 0x$(echo -n "WEGLD-bd4d79" | xxd -p -u | tr -d '\n') 0x$(echo -n "USDC-c76f1f" | xxd -p -u | tr -d '\n')

WEGLD-bd4d79 and USDC-c76f1f are the tokens you want to claim.

Last updated