Conditional gas sponsorship


Do you want to sponsor gas for your users, but only if certain conditions are met? For example, you can sponsor gas for users voting on DAO proposals and other forms of governance. For example, you could only sponsor proposal votes if a user has more than 20 governance tokens, or only if they have held governance tokens for at least 30 days.
You set eligibility checks that dictate when you will sponsor a user's transactions, and the Supercool SDK automatically takes care of either sponsoring the transaction for the user or requesting them to pay for their own transaction. Conditional gas sponsorship gives you fine-grained control to reward your most engaged users, prevent spammers from taking advantage of your gas sponsorship, and more.

How it works

Conditional gas sponsorship works very similarly to standard gas sponsorship, but you can add eligibility checks to your relayer API calls. You can use either an HTTP API or our Javascript/Typescript SDK that provides an Ethers.js signer and provider.
When a user wants to create a transaction, your dapp or wallet can call the Supercool API and provide the eligibility checks to be checked. If the user passes the checks, then their transaction will be relayed by Supercool. If it does not pass the checks, the Supercool API will return the transaction parameters which can be forwarded to the user's wallet for them to sign and pay for normally through their connected wallet.
The eligibility checks query view or pure Solidity functions before submitting the transaction to the relayer. Eligibility could change over time, and there are various ways to solve this, such as checking eligibility at a particular block snapshot or ensuring that the eligibility checks occur in the same block the transaction is relayed.


Here is an example using conditional gas sponsorship for DAO proposal voting:
import {supercool} from '@supercoolxyz/relayer-client'
import {ethers} from 'ethers'
// replace this with whatever function creates your EOA (Metamask, etc.) signer
const eoaSigner = getEOASigner()
const provider = new supercool.RelayerProvider({apiKey: ..., apiSecret: ...})
const signer = supercool.GaslessForwarderSigner.fromEOASigner(
provider, eoaSigner
const contract = new ethers.Contract(contractAddress, abi, signer)
const inter = new ethers.Interface(abi)
const eligibilityChecks = [
new supercool.EligibilityCheck({
chain: 'ethereum',
address: '0xabc123',
functionFragment: inter.getFunction('checkEligibility')
// If the return value is a boolean, `true` means the vote is
// eligible for sponsorship.
// If the return value is not a boolean, you can provide a
// "resultCheck". For example, this checks that an integer
// return value is > 5.
resultCheck: new supercool.EligibilityResultCheck(
[val1, val2]
// Submit the vote transaction gaslessly if the user passes eligibility checks.
// Otherwise, ask the user to pay for gas.
await contract.castVote(proposalId, voteValue, {
eligibility: eligibilityChecks
Note that the @supercoolxyz/relayer-client package is not published yet, but you can reach out to us at [email protected] for early access.