Skip to content

BGTIncentiveDistributor

0xBDDba144482049382eC79CadfA02f0fa0F462dE3

forked from Hidden Hand RewardDistributor Contract: https://github.com/dinero-protocol/hidden-hand-contracts/blob/master/contracts/RewardDistributor.sol

This contract is used to distribute the POL incentives to the BGT boosters. BGT boosters share of incentive from the rewardVault is transferred to the BGTIncentiveDistributor contract. The rewards are then distributed to the BGT boosters based on the merkle root computed off-chain.

State Variables

MAX_REWARD_CLAIM_DELAY

maximum value of delay to claim the rewards after an update of rewards metadata.

solidity
uint64 public constant MAX_REWARD_CLAIM_DELAY = 3 hours;

PAUSER_ROLE

solidity
bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");

MANAGER_ROLE

solidity
bytes32 public constant MANAGER_ROLE = keccak256("MANAGER_ROLE");

rewardClaimDelay

delay after which rewards can be claimed after an update of rewards metadata.

solidity
uint64 public rewardClaimDelay;

rewards

Maps each of the identifiers to its reward metadata.

solidity
mapping(bytes32 => Reward) public rewards;

claimed

Tracks the amount of claimed reward for the specified identifier+account.

solidity
mapping(bytes32 => mapping(address => uint256)) public claimed;

incentiveTokensPerValidator

Tracks the amount of incentive tokens currently held by the contract for each validator.

solidity
mapping(bytes => mapping(address => uint256)) public incentiveTokensPerValidator;

Functions

constructor

Note: oz-upgrades-unsafe-allow: constructor

solidity
constructor();

initialize

solidity
function initialize(address _governance) external initializer;

_authorizeUpgrade

solidity
function _authorizeUpgrade(address newImplementation) internal override onlyRole(DEFAULT_ADMIN_ROLE);

setRewardClaimDelay

Set the reward claim delay

Only address with DEFAULT_ADMIN_ROLE can call this function

solidity
function setRewardClaimDelay(uint64 _delay) external onlyRole(DEFAULT_ADMIN_ROLE);

Parameters

NameTypeDescription
_delayuint64The delay in seconds

updateRewardsMetadata

Update the rewards metadata

Only address with MANAGER_ROLE can call this function

solidity
function updateRewardsMetadata(Distribution[] calldata _distributions) external onlyRole(MANAGER_ROLE);

Parameters

NameTypeDescription
_distributionsDistribution[]Distribution[] List of reward metadata

setPauseState

Set the contract's pause state.

Only address with PAUSER_ROLE can call this function

solidity
function setPauseState(bool state) external onlyRole(PAUSER_ROLE);

Parameters

NameTypeDescription
stateboolPause state

receiveIncentive

Receive incentive tokens from POL reward vaults

Token approval must be given by the caller to this function before calling it.

solidity
function receiveIncentive(bytes calldata pubkey, address token, uint256 _amount) external;

Parameters

NameTypeDescription
pubkeybytesThe pubkey of the validator
tokenaddressThe address of the incentive token
_amountuint256The amount of tokens received

claim

Claim rewards based on the specified metadata

solidity
function claim(Claim[] calldata _claims) external nonReentrant whenNotPaused;

Parameters

NameTypeDescription
_claimsClaim[]Claim[] List of claim metadata

_claim

Claim a reward

solidity
function _claim(bytes32 _identifier, address _account, uint256 _amount, bytes32[] calldata _merkleProof) private;

Parameters

NameTypeDescription
_identifierbytes32Merkle identifier
_accountaddressEligible user account
_amountuint256Reward amount
_merkleProofbytes32[]Merkle proof

_setRewardClaimDelay

Set the reward claim delay

Reverts if the delay is greater than the maximum allowed delay

solidity
function _setRewardClaimDelay(uint64 _delay) internal;

Parameters

NameTypeDescription
_delayuint64The delay in seconds