Claim UBI (Ethers v5/ React)

Every verified person is eligible to claim daily free UBI in the form of G$ tokens.

Make sure user wallet is whitelisted, see Identity.

First, create the SDK. The first argument should be an ethers Web3Provider, since the user will need to sign transactions. Second argument is which environment and chain contract set to use.

Every user can claim every day from every chain that has a UBI pool

import { ClaimSDK } from "@gooddollar/web3sdk-v2"

const sdk = new ClaimSDK(web3provider, "production" | "production-celo")

Check if the user is currently eligible to claim today:

const claimAmount = await sdk.checkEntitlement() // if claimAmount > 0 user can claim

Then, perform claim:

await sdk.claim()

You can also get the next Date when the user will be eligible to claim again

const nextClaimTime = await sdk.getNextClaimTime()

React hooks

You can also use our react hooks to manage claim.

See the Claim/Identity react hooks code here. Storybook examples here. You will need to first setup our context provider as explained here.

Win Rewards: Building something on GoodDollar!

There are various ways to earn rewards while working within the GoodDollar Ecosystem. Scoutgame: Scoutgame rewards builders who take up pre-defined tasks. Contribute to GoodDollar repositories and earn bounty rewards! More information about the program can be found on our ScoutGame page. GoodDollar OpenSource Contributors Pool: The GoodDollar OpenSource Contributors pool is for anyone who wants to contribute more autonomously. Maybe you have ideas of your own to build into GoodDapp or GoodCollective? Maybe you have ideas for expanding the core protocol? Please read up on our GoodDollar OpenSource Contributors covenant on how to participate and apply. GoodBuilders program: Be sure to check out the GoodBuilders Program! offering mentorship and funding to support promising projects in their growth. Any project that demonstrates meaningful new integrations with the GoodDollar Protocol is eligible to apply! Share your ideas, or ask for development support: For discussion on Discord or various program events: GoodDollar Builders We are also on Discord: GoodDollar Discord Development

Last updated

Was this helpful?