Optional
layer2Signer: SignerPrivate
rewardPrivate
layer2Private
Optional
layer2The GetProofs
API is used to retrieve proofs that are used to claim rewards from tally; proofs are similar arcade coupons that are collected to claim a prize. A proof can only be used by the EOA-owner. Once a proof is used (i.e. knownClaimed=true
) it cannot be re-used. isValid
is a flag that checks if a proof is still valid. Assuming a proof has not been claimed, isValid=false
means that a proof can no longer be claimed -- typically, to mean that the proof has expired.
let rewardPool = await getSDK('RewardPool', web3);
await rewardPool.getProofs(address, rewardProgramId, safeAddress?, tokenAddress?, knownClaimed?)
Optional
tokenAddress: stringOptional
knownClaimed: booleanOptional
offset: numberOptional
limit: numberOptional
tokenAddress: stringOptional
knownClaimed: booleanOptional
offset: numberOptional
limit: numberOptional
tokenAddress: stringOptional
tokenAddress: stringthe balance of ALL tokens in the RewardPool for prepaid card owners address.
This function takes in a parameter of the prepaid card owner address and , reward token address, and reward program id. This balance also accounts for the claims of a prepaid card owner in the past. The tokens that are part of the rewards are CARDPXD and DAICPXD -- federated tokens of the card protocol.
The RewardPool
API is used to interact with tally (an offchain service similar to relayer) and the reward pool contract. As customers use their prepaid card they will be given rewards based the amount of spend they use and a reward-based algorithm.
let rewardPool = await getSDK('RewardPool', web3);
let balanceForAllTokens = await rewardPool.rewardTokenBalances(address, rewardProgramId)
This call is exactly the same as RewardPool.rewardTokenBalances
except it excludes rewardAmount < gasFees
(crypto dust).
let rewardPool = await getSDK('RewardPool', web3);
let balanceForAllTokens = await rewardPool.rewardTokenBalancesWithoutDust(address, rewardProgramId, rewardSafe)
The AddRewardTokens
API is used to refill the reward pool for a particular reward program with any single owner safe. Currently, the sdk supports using single-owner safe like depot safe or merchant safe to send funds (the protocol supports prepaid card payments too). If a reward program doesn't have any funds inside of the pool rewardees will be unable to claim. Anyone can call this function not only the rewardProgramAdmin.
let rewardPool = await getSDK('RewardPool', web3);
await rewardPool.addRewardTokens(safe, rewardProgramId, tokenAddress, amount)
Optional
txnOptions: TransactionOptionsOptional
contractOptions: ContractOptionsThe Claim
API is used by the rewardee to claim rewards from an associated reward program.
Pre-requisite for this action:
rewardPool.getProofs
let rewardPool = await getSDK('RewardPool', web3);
await rewardPool.claim(safe, leaf, proofArray, acceptPartialClaim)
The leaf item contains most information about the claim, such as the reward program (rewardProgramId
), the expiry of the proof (validFrom
, validTo
), the type of token of the reward (tokenType
, transferData
), the eoa owner of the safe (payee
). This information can be decoded easily.
acceptPartialClaim
is a special scenario whereby a rewardee is willing to compromise his full reward compensation for a partial one. This scneario occurs, for example, when rewardee has 10 card in his proof but the reward pool only has 5 card, the rewardee may opt to just accepting that 5 card by setting acceptPartialClaim=true
.
Optional
txnOptions: TransactionOptionsOptional
contractOptions: ContractOptionsThe claimAll
is used by the rewardee to claim all rewards from a list of proofs. The looping occurs as separate transactions so the failure of one transaction will lead to the failure of all transactions after it (transactions before it will stil succeed). Proofs which have claims rewardAmount < gasFees
(crypto dust) will be excluded; this filter is to decrease the probability of claimAll
failing.
let rewardManagerAPI = await getSDK('RewardManager', web3);
await rewardManagerAPI.claimAll(rewardSafe, rewardProgramId, tokenAddress?)
Optional
tokenAddress: stringOptional
txnOptions: TransactionOptionsOptional
contractOptions: ContractOptionsOptional
txnOptions: TransactionOptionsOptional
contractOptions: ContractOptionsThe claimGasEstimate
returns a gas estimate a claim of a reward. The gas is paid out in tokens of the reward received. For example, if a person recieves 10 CARD, they will receive 10 CARD - (gas fees in CARD)
into their reward safe.
let rewardManagerAPI = await getSDK('RewardManager', web3);
await rewardManagerAPI.claimGasEstimate(rewardSafeAddress, leaf, proofArray, acceptPartialClaim)
Optional
acceptPartialClaim: booleanThe RecoverTokens
API is used by the rewardProgramAdmin to recover the tokens that are previously added inside the pool. This function can be called at anytime throughout the lifecycle of the reward program. The funds recovered will be used to pay for the gas fees to execute the transaction.
let rewardPool = await getSDK('RewardPool', web3);
await rewardPool.recoverTokens(safe, rewardProgramId, tokenAddress, amount?)
Optional
amount: stringOptional
txnOptions: TransactionOptionsOptional
contractOptions: ContractOptionsThe rewardProgramBalances
API is used to query the token balances inside the reward pool for a particular reward program. This is useful if a rewardProgramAdmin wants to assess how much is left inside the pool for the reward program they manage.
let rewardPool = await getSDK('RewardPool', web3);
await rewardPool.rewardProgramBalances(rewardProgramId)
Private
hasPrivate
decodePrivate
getPrivate
getPrivate
getPrivate
adjustGenerated using TypeDoc
The
RewardPool
API is used to interact with tally (an offchain service similar to relayer) and the reward pool contract. As customers use their prepaid card they will be given rewards based the amount of spend they use and a reward-based algorithm.