Understanding Gas Sponsorship
Gas sponsorship in Openfort offer a flexible way to manage gas payments. These policies are crucial for those looking to customize user experiences, especially when it comes to in-game items and currencies.
What are Gas Policies?#
When users interact with blockchain contracts, they usually incur gas fees. With Openfort's gas policies, you can decide which contracts or functions are free for your users. This way, you can subsidize certain interactions, such as:
- Allowing new users to take on-chain actions without first obtaining native tokens.
- Encouraging game adoption by absorbing gas fees.
- Letting users pay gas fees using ERC20 tokens, including in-game tokens or stablecoins like USDC.
- Promoting in-game actions while having users pay for actions that take them out of your ecosystem.
How to Get Started#
You can use gas policies to specify the contracts and functions that you want your users to interact with without paying gas fees in native tokens. Deep dive into our Gas Sponsorship capabilities.
- Visit the Gas Policies tab.
- Click the
Add Policybutton to define your policy details.
How You Pay for Gas#
Openfort supports two ways to pay for gas fees:
1. Fiat Payments#
Add balance credit to your account and use it to pay for gas fees. With each transaction, the gas fees will be deducted from your balance. This is the default in Openfort, and you only need it when going live with your project.
Head to platform details to learn more.
2. Token Payments#
With Openfort, you can use your own native tokens to pay for gas fees.
Openfort deploys a smart contract in the chains it supports called
Paymaster. This contract is responsible for all gas related operations.
- In testnets the contract address is 0x3210deD2e50363eF645C4eA15339Bec8Ac88e0F5 (e.g. this one is in Polygon Mumbai).
- In mainnets the contract address is 0xd71E61dde321dCDe58886479A47f1142bBF0C6d6 (e.g. this one is in Polygon Mainnet).
Tokens deposited in this contract can always be withdrawn by the owner and you can control its balance at any time checking the its balance.
How to deposit tokens
To deposit tokens, head to the depositFor function and deposit the amount of tokens you want to use to pay for gas fees.
How to register your depositor address
To use the tokens you deposited with the rest of Openfort's infrastructure, you register the wallet you deposited tokens with.
To do so, head to the address book page in you dashboard settings.
How to use your depositor address
Once you've added your depositor address to Openfort, specify you want to use it to pay gas in your policy pressing on Additional options and choosing your desired address when editing or creating a policy:
And you're all set! The deposited amount will be used to pay for gas fees in your policy.
When using a strategy that supports payment in ERC-20 tokens (i.e.
fixed_rate), the depositor address will receive the tokens the user pays for gas fees.