GasSponsor Contract
Contract Address: 0x57bD140dE7a7AdbF3DF8E962D9984B3F473F28c4
The GasSponsor contract is a key component of our Sponsored Transactions feature. It enables atomic gas sponsorship within bundles, allowing users to trade without needing ETH for gas fees.
Etherscan:
View Contract on Etherscan
Core Functions
prefund: A relayer calls this function to pre-fund ETH to a user and record the debt.prefundBatch: Allows a relayer to pre-fund multiple users in a single transaction.repay: A user calls this function (or sends ETH to the contract) to repay their debt.finalizeBundle: A relayer calls this function at the end of a bundle to ensure that all sponsored users have repaid their debts.
Events
Prefunded: Emitted when a user is pre-funded with ETH.Repaid: Emitted when a user repays their debt.BundleFinalized: Emitted when a bundle is successfully finalized.
Sponsorship Flow
- Prefunding: Relayer calls
prefundorprefundBatchto provide ETH to users - User Transaction: User executes their transaction using the prefunded gas
- Repayment: User’s transaction includes a repayment to the GasSponsor contract
- Finalization: Relayer calls
finalizeBundleto verify all debts are settled
Recommendation: For most use cases, we recommend using the Gas Sponsorship Guide and Developer API instead of interacting with contracts directly.
The GasSponsor contract is designed to be non-reentrant and secure, ensuring that all sponsorships and repayments are handled atomically and without risk to the relayers.
Last updated on