Charge a dynamic amount of ERC20 for gas payment
Learn how to charge dynamic amount of ERC20 tokens to pay for gas fees.
Charging (any) ERC-20 tokens you want as a form of payment for transactions (also supports stablecoins like USDC).
What you'll learn:#
- How to charge ERC20 tokens to users to make a minting NFT transaction.
1
Select the contract you want to interact with
- Add the collectible's smart contract.
- Define the smart contract function you want to use. In our case 'mint'.
2
Set up a Dynamic ERC20 Policy
- Create s new policy and select the strategy "charge dynamic amount of ERC20".
- Select the ERC20 Token Contract and the Exchange Rate.
- Select imported contract and the function you want to sponsor.
If you want to update the dynamic rate programmatically, contact us
3
Create a gasless transaction
- Add chainId
- Add contract
- Add policy
- Add function you want to interact with
Note you can make a transaction happen without the need to have a registered user or account deployed at the time of interacting. Once you make the transaction a playerId and accountId will be created.
4
Optional: Add the Account or Player you're using
- Add account or add player