Skip to content

BGTIncentiveDistributor

0x77DA09bC82652f9A14d1b170a001e759640298e6 | ABI JSON

A contract that distributes POL incentives to BGT boosters using a merkle-based distribution system. When BGT holders boost a validator, they become eligible for a share of the incentives from reward vaults. These incentives are transferred to this contract and distributed based on off-chain computed merkle roots.

Constants

MANAGER_ROLE

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

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");

Structs

Claim

The claim struct for claiming rewards.

solidity
struct Claim {
    bytes32 identifier;
    address account;
    uint256 amount;
    bytes32[] merkleProof;
}

Properties

NameTypeDescription
identifierbytes32The merkle identifier
accountaddressThe eligible user account
amountuint256The reward amount
merkleProofbytes32[]The merkle proof

Distribution

The distribution struct for reward metadata.

solidity
struct Distribution {
    bytes32 identifier;
    bytes pubkey;
    address token;
    bytes32 merkleRoot;
    bytes32 proof;
}

Properties

NameTypeDescription
identifierbytes32The merkle identifier
pubkeybytesThe validator pubkey
tokenaddressThe reward token address
merkleRootbytes32The merkle root
proofbytes32The proof data

Reward

The reward struct for reward metadata.

solidity
struct Reward {
    address token;
    bytes32 merkleRoot;
    bytes32 proof;
    uint256 activeAt;
    bytes pubkey;
}

Properties

NameTypeDescription
tokenaddressThe reward token address
merkleRootbytes32The merkle root
proofbytes32The proof data
activeAtuint256The timestamp when rewards become claimable
pubkeybytesThe validator pubkey

State Variables

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;

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;

View Functions

paused

Returns the pause state of the contract.

solidity
function paused() public view virtual override returns (bool);

Returns

NameTypeDescription
<none>boolTrue if the contract is paused, false otherwise

Functions

claim

Claim rewards based on the specified metadata

Emits:

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

Parameters

NameTypeDescription
_claimsClaim[]Claim[] List of claim metadata

initialize

Initializes the BGTIncentiveDistributor contract with the governance address.

solidity
function initialize(address _governance) external initializer;

Parameters

NameTypeDescription
_governanceaddressThe governance address to set

_authorizeUpgrade

Authorizes an upgrade to a new implementation.

Only address with DEFAULT_ADMIN_ROLE can call this function.

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

Parameters

NameTypeDescription
newImplementationaddressThe new implementation address

receiveIncentive

Receive incentive tokens from POL reward vaults

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

Emits:

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

setPauseState

Set the contract's pause state.

Only address with PAUSER_ROLE can call this function

Emits:

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

Parameters

NameTypeDescription
stateboolPause state

setRewardClaimDelay

Set the reward claim delay

Only address with DEFAULT_ADMIN_ROLE can call this function

Emits:

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

Emits:

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

Parameters

NameTypeDescription
_distributionsDistribution[]Distribution[] List of reward metadata

upgradeToAndCall

solidity
function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual override;

Events

RewardClaimed

Emitted when rewards are claimed.

solidity
event RewardClaimed(bytes32 indexed identifier, address indexed token, address indexed account, bytes pubkey, uint256 amount);

Parameters

NameTypeDescription
identifierbytes32The merkle identifier
tokenaddressThe reward token
accountaddressThe account claiming rewards
pubkeybytesThe validator's public key
amountuint256The amount claimed

IncentiveReceived

Emitted when incentive tokens are received.

solidity
event IncentiveReceived(bytes indexed pubkey, address indexed token, uint256 amount);

Parameters

NameTypeDescription
pubkeybytesThe validator's public key
tokenaddressThe incentive token
amountuint256The amount received

Initialized

Emitted when the contract is initialized.

solidity
event Initialized(uint64 version);

Parameters

NameTypeDescription
versionuint64The initialization version

Paused

Emitted when the contract is paused.

solidity
event Paused(address account);

Parameters

NameTypeDescription
accountaddressThe account that paused the contract

RewardClaimDelaySet

Emitted when the reward claim delay is set.

solidity
event RewardClaimDelaySet(uint64 delay);

Parameters

NameTypeDescription
delayuint64The new reward claim delay

RewardMetadataUpdated

Emitted when rewards metadata is updated.

solidity
event RewardMetadataUpdated(bytes32 indexed identifier, bytes indexed pubkey, address indexed token, bytes32 merkleRoot, bytes32 proof, uint256 activeAt);

Parameters

NameTypeDescription
identifierbytes32The merkle identifier
pubkeybytesThe validator's public key
tokenaddressThe reward token
merkleRootbytes32The merkle root
proofbytes32The proof data
activeAtuint256The timestamp when rewards become claimable

RoleAdminChanged

Emitted when the admin role for a role is changed.

solidity
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

Parameters

NameTypeDescription
rolebytes32The role whose admin was changed
previousAdminRolebytes32The previous admin role
newAdminRolebytes32The new admin role

RoleGranted

Emitted when a role is granted to an account.

solidity
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

Parameters

NameTypeDescription
rolebytes32The role that was granted
accountaddressThe account that received the role
senderaddressThe account that granted the role

RoleRevoked

Emitted when a role is revoked from an account.

solidity
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

Parameters

NameTypeDescription
rolebytes32The role that was revoked
accountaddressThe account that lost the role
senderaddressThe account that revoked the role

Unpaused

Emitted when the contract is unpaused.

solidity
event Unpaused(address account);

Parameters

NameTypeDescription
accountaddressThe account that unpaused the contract

Upgraded

Emitted when the implementation is upgraded.

solidity
event Upgraded(address indexed implementation);

Parameters

NameTypeDescription
implementationaddressThe new implementation address