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.
By not including a gas policy, the account you're interacting with must have native tokens to cover transaction fees.
What's a gas manager?#
Gas managers are policies defined by companies that govern how and when a application will sponsor a user's gas fees using the Openfort's paymaster. You can design your user's experiences, such as:
- Encouraging game adoption by abstracting gas fees for new users.
- 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. Learn how the how the gas sponsorship works.
- Visit the Gas Manager tab.
- Click the
Add Policy
button to define your policy details. - When ready to go live, add funds to your account. We'll explain how in the next section.
How to sponsor gas fees#
Developers can sponsor gas on behalf of your users in two ways:
1.Paying with fiat#
Add balance credit to your account and use it to pay for gas fees. With each transaction, the gas cost will be deducted from your balance automatically.
This is the default in Openfort, and you need it when going livemode
with your project.
2.Paying with native tokens#
With Openfort, you can network native tokens to pay for gas fees (ie. ETH in Ethereum).
Openfort deploys a smart contract in the chains it supports called Paymaster
. This contract is responsible for all gas related operations and its address is the same across blockchains.
- In testnets the contract address is 0x3210deD2e50363eF645C4eA15339Bec8Ac88e0F5 (e.g. this one is in Polygon Amoy).
- In mainnets the contract address is 0xd71E61dde321dCDe58886479A47f1142bBF0C6d6 (e.g. this one is in Polygon Mainnet).
Visit the entity addresses page to learn more about the addresses in each blockchain network.
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.
Optional: Using external paymasters#
Openfort allows you to use external paymasters to sponsor gas fees for your users. This feature is useful when you want to use a custom paymaster to sponsor gas fees for your users.
When using an external paymaster, the only supported strategy
is pay_for_user
.
To set up an external paymaster, you need to:
Edit or create your policy and press on additional options.