---
# System prepended metadata

title: Fee preference (EVM precompile)

---

# Fee preference (EVM precompile)

Root network will come with capability of paying transaction fee in a different asset(other than XRP) as long as liquidity for that asset exist in liquidity pool.

If an account doesn’t have CPAY/XRP (fee asset), the transaction fails with an InvalidTransaction::Payment  error. There seems to be a balance check for a native token before executing an EVM transaction.

Steps
1. Create a new asset with 18 dp. On CENNZnet it gets asset id (17000). 
2. Add liquidity to this pool.
    ```
    const amount = 5923731168159260;
    const coreAmount = 104350076;
    const minLiquidity = 1;
    await api.tx.cennzx
          .addLiquidity(17000, minLiquidity, amount, coreAmount)
          .signAndSend(Alice)
    ```
3. Execute 
    ```
    const signer = await ethers.getSigners().then((xs) => xs[0]);

    // Defines the functions, used for the abi to encode the values of that function
    const erc20Abi = ["function transfer_from(address who, uint256 amount)"];
    let iface = new ethers.utils.Interface(erc20Abi);
    const transferInput = iface.encodeFunctionData("transfer", [
        "0xAB8208e1adEBe8Ee6155Ef9A155E2cdA3B880cc7",
        1,
    ]);

    const feeProxyAbi = [
        "function callWithFeePreferences(address asset, uint128 max_payment, address target, bytes input)",
    ];

    const feeProxyAddress = "0x00000000000000000000000000000000000004bb"; // On CENNZnet
    // 1721
    const feeProxy = new ethers.Contract(feeProxyAddress, feeProxyAbi, signer);
   // asset id - 17000 will have the following address
    const newTokenAddress = web3.utils.toChecksumAddress("0xcCCCcCcC00004268000000000000000000000000");

    
    const block = await signer.provider.getBlock(
        await signer.provider.getBlockNumber()
    );
    const maxPayment = '30000000000000000'

    try {
        // Call the fee proxy contract with the above values and input from the previous example.
        const tx = await feeProxy.callWithFeePreferences(
            newTokenAddress,
            maxPayment,
            newTokenAddresssyloTokenAddress,
            transferInput,
            {
                maxFeePerGas: block.baseFeePerGas,
                maxPriorityFeePerGas: ethers.utils.parseUnits("0.5", "gwei")
            }
        );
        console.log('tx::',tx);
        await tx.wait();
        console.log('tx::',tx);
            }
        );
    ```
  