EpochBasedTokenClaim
Contract to claim rewards based on epoch and merkle tree (used for Arbitrum STIP trading incentives)
rewardToken
manager
epochRoots
epochCids
epochTraderClaimed
ManagerUpdated
TokensWithdrawn
EpochMerkleRootSet
TokensClaimed
TokensClaimed
AddressZero
NotManager
RootAlreadySet
RootZero
RewardsZero
CidZero
InvalidEpochs
ArrayLengthMismatch
EpochNotSet
NotEnoughBalance
AlreadyClaimed
InvalidProof
constructor
onlyManager
setManager
Sets manager address to _manager
. Only callable by owner()
(multisig)
setRoot
_Sets Merkle Tree _root
and 'cid' for an _epoch
and transfers _totalRewards
from the owner()
(multisig) to this contract. Only callable by manager
.
withdrawTokens
Prevents stuck tokens in case of misconfiguration; Only owner()
(multisig) can claim the tokens back
claimRewards
Claims trader rewards for a specific _epoch
claimMultipleRewards
Claims trader rewards for multiple _epochs
_hashLeaf
Returns a hashed leaf of _user
+ _amount
_validateClaim
_Validates that:
The
_epoch
merkle tree root is setThere are enough token rewards in the contract
Rewards for leaf are unclaimed
The
leaf
and_proof
validate againstepochRoot
_