A standalone tool to check pending rewards by verifying nonces on the Permit2 contract for permits stored in the Supabase database.
- ✅ Checks nonce status against Permit2 contract on multiple networks (Ethereum mainnet, Gnosis Chain)
- ✅ Fetches permit data from Supabase with proper joins
- ✅ Batch processing (20 permits per batch) for efficient execution
- ✅ Retry logic for failed requests
- ✅ Exports results to text format
- ✅ Token symbol lookup for better reporting
- ✅ Proper BigNumber handling for large nonce values
You can run this tool directly without installation:
bun x @ubiquity-os/pending-rewardsOr install globally:
bun add -g @ubiquity-os/pending-rewards
pending-rewards- Install dependencies (for local development):
bun install- Copy environment variables:
cp .env.example .env- Make sure your
.envfile contains:
SUPABASE_URL=your_supabase_url
SUPABASE_KEY=your_supabase_key
GITHUB_TOKEN=your_github_personal_access_tokenNote: The
GITHUB_TOKENis required to fetch GitHub usernames. Without it, user names will show asuser-{id}format. You can create a personal access token at https://github.com/settings/tokens
Run the pending rewards checker:
# Using bun x (recommended)
bun x @ubiquity-os/pending-rewards
# If installed globally
pending-rewards
# For local development
bun src/index.tsOr use the bun script:
bun startThe script will:
- Query permits from Supabase
- Process them in batches
- Check each nonce against the Permit2 contract
- Export results to
pending-rewards.txt
The output text file contains:
nonce: The permit nonce valueamount: Token amount in weipartner_address: Address of the permit partnertoken_address: ERC20 token contract addressnetwork: Network ID (1 for Ethereum, 100 for Gnosis)user_address: Beneficiary wallet addressis_claimed: Boolean indicating if nonce is claimedtoken_symbol: Token symbol (e.g., WXDAI, UUSD)
nonce,amount,partner_address,token_address,network,user_address,is_claimed,token_symbol
42883...0621,1330000000000000000,0x9051...7680,0xC6ed...2068,100,0x0BEd...7025,false,UUSD
10317...6401,25000000000000000000,0x054E...7c3C,0xe91D...63a97d,100,0x1133...99B1,true,WXDAI
- Processes ~1000 permits in under 5 minutes
- Uses efficient batch processing to avoid rate limits
- Implements retry logic for failed blockchain calls
- Caches contract instances and providers for better performance
The script handles various error scenarios:
- Missing required data (skips invalid permits)
- Blockchain RPC failures (retries failed requests)
- Token symbol lookup failures (falls back to "UNKNOWN")
- Network connectivity issues (graceful error logging)