Gas Policy Strategies & Rules
Covers the detailed configuration of gas policies, including available strategies and rule types
Gas Policy Strategies#
Gas policies offer three distinct strategies for handling transaction fees:
1. Sponsored Transactions#
Developers cover all gas fees, removing the need for users to hold native tokens.
2. Dynamic ERC20 Payment#
Users pay gas fees using ERC20 tokens at a dynamic exchange rate.
3. Fixed ERC20 Payment#
Users pay a fixed amount of ERC20 tokens per transaction.
Policy Rules#
While strategies determine how gas fees are paid, rules define when and how your gas policy applies. Every policy needs at least one rule to function, and you can choose from three types:
Rule Model | Description |
---|---|
contract_functions | Sponsor interactions with smart contracts. |
account_functions | Sponsor interactions with the smart account. |
limit_rules | Limit the amount of gas or number of transactions over an interval. |
Contract functions#
These rules let you specify which smart contract interactions your policy covers. You might want to sponsor all interactions with your game contracts but not with external marketplaces, for instance.
Wildcard policies allow you to sponsor any transaction for any contract without the need to add them in the policy. Enable "Catch-all sponsorship".
To create a policy rule, you need first to add a contract to Openfort:
Once you've selected your contract, you can then choose what function you whish to enable sponsorship for. You can select All functions
instead to allow sponsoring all functions in that specific contract.
Account functions#
These rules cover account-related operations, such as transferring ownership of accounts, managing session keys, or deploying smart accounts. They're essential for maintaining smooth account management operations within your application.
Limit rule#
Limit rules help you control usage of your gas policy. You can set limits based on:
Rule Type | Description | Example Use Case |
---|---|---|
Gas per Interval | Total gas limit in timeframe | 1000 WEI/minute |
Gas per Transaction | Gas limit per transaction | 100 WEI/transaction |
Count per Interval | Transaction count limit | 10 transactions/minute |