Home

Gas Sponsorhip

How to use a policy rule

This guide demonstrates the steps to use a policy rule

What's a policy rule?#

Policy rules are the conditions that you set to apply the gas policy. The gas policy would be useless without at least setting one rule. Please note that if you're looking to set up a gas policy on Mainnets, you need to top up your account.

There are three kinds of rule models:

  • 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#

When selecting contract_functions as the policy rule, you can decide what asset contract and functions are allowed to be called by your users.

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.

Such functions include:

  • Minting an NFT
  • Burning an asset
  • Transferring an ERC20

You can select All functions instead to allow sponsoring all functions in that specific contract.

policyRules

Account functions#

When selecting account_functions as the policy rule, the policy will allow sponsoring interactions with the smart account.

Such transactions include:

  • Transferring ownership of the account.
  • Registering/revoking a session key.
  • Manual smart account deployment.
Register Session key

Limit rule#

When selecting rate_limit as the policy rule, you'll be able to select three types of rules:

  • gas_per_interval: Limit the amount of gas per interval. For example, sponsoring 1000 WEI per minute.
  • gas_per_transaction: Limit the amount of gas per transaction. For example, sponsoring 100 WEI per transaction.
  • count_per_interval: Limit the number of transactions per interval. For example, sponsoring 10 transactions (value) per minute
Register Session key