EpochBasedTokenClaim

Contract to claim rewards based on epoch and merkle tree (used for Arbitrum STIP trading incentives)

rewardToken

contract IERC20 rewardToken

manager

address manager

epochRoots

mapping(uint256 => bytes32) epochRoots

epochCids

mapping(uint256 => string) epochCids

epochTraderClaimed

mapping(uint256 => mapping(address => bool)) 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:

  1. The _epoch merkle tree root is set

  2. There are enough token rewards in the contract

  3. Rewards for leaf are unclaimed

  4. The leaf and _proof validate against epochRoot_

Was this helpful?