BGTIncentiveDistributor
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
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.
uint64 public constant MAX_REWARD_CLAIM_DELAY = 3 hours;
PAUSER_ROLE
bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
Structs
Claim
The claim struct for claiming rewards.
struct Claim {
bytes32 identifier;
address account;
uint256 amount;
bytes32[] merkleProof;
}
Properties
Name | Type | Description |
---|---|---|
identifier | bytes32 | The merkle identifier |
account | address | The eligible user account |
amount | uint256 | The reward amount |
merkleProof | bytes32[] | The merkle proof |
Distribution
The distribution struct for reward metadata.
struct Distribution {
bytes32 identifier;
bytes pubkey;
address token;
bytes32 merkleRoot;
bytes32 proof;
}
Properties
Name | Type | Description |
---|---|---|
identifier | bytes32 | The merkle identifier |
pubkey | bytes | The validator pubkey |
token | address | The reward token address |
merkleRoot | bytes32 | The merkle root |
proof | bytes32 | The proof data |
Reward
The reward struct for reward metadata.
struct Reward {
address token;
bytes32 merkleRoot;
bytes32 proof;
uint256 activeAt;
bytes pubkey;
}
Properties
Name | Type | Description |
---|---|---|
token | address | The reward token address |
merkleRoot | bytes32 | The merkle root |
proof | bytes32 | The proof data |
activeAt | uint256 | The timestamp when rewards become claimable |
pubkey | bytes | The validator pubkey |
State Variables
claimed
Tracks the amount of claimed reward for the specified identifier+account.
mapping(bytes32 => mapping(address => uint256)) public claimed;
incentiveTokensPerValidator
Tracks the amount of incentive tokens currently held by the contract for each validator.
mapping(bytes => mapping(address => uint256)) public incentiveTokensPerValidator;
rewardClaimDelay
Delay after which rewards can be claimed after an update of rewards metadata.
uint64 public rewardClaimDelay;
rewards
Maps each of the identifiers to its reward metadata.
mapping(bytes32 => Reward) public rewards;
View Functions
paused
Returns the pause state of the contract.
function paused() public view virtual override returns (bool);
Returns
Name | Type | Description |
---|---|---|
<none> | bool | True if the contract is paused, false otherwise |
Functions
claim
Claim rewards based on the specified metadata
Emits:
function claim(Claim[] calldata _claims) external nonReentrant whenNotPaused;
Parameters
Name | Type | Description |
---|---|---|
_claims | Claim[] | Claim[] List of claim metadata |
initialize
Initializes the BGTIncentiveDistributor contract with the governance address.
function initialize(address _governance) external initializer;
Parameters
Name | Type | Description |
---|---|---|
_governance | address | The governance address to set |
_authorizeUpgrade
Authorizes an upgrade to a new implementation.
Only address with DEFAULT_ADMIN_ROLE can call this function.
function _authorizeUpgrade(address newImplementation) internal override onlyRole(DEFAULT_ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
newImplementation | address | The 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:
function receiveIncentive(bytes calldata pubkey, address token, uint256 _amount) external;
Parameters
Name | Type | Description |
---|---|---|
pubkey | bytes | The pubkey of the validator |
token | address | The address of the incentive token |
_amount | uint256 | The amount of tokens received |
setPauseState
Set the contract's pause state.
Only address with PAUSER_ROLE can call this function
Emits:
function setPauseState(bool state) external onlyRole(PAUSER_ROLE);
Parameters
Name | Type | Description |
---|---|---|
state | bool | Pause state |
setRewardClaimDelay
Set the reward claim delay
Only address with DEFAULT_ADMIN_ROLE can call this function
Emits:
function setRewardClaimDelay(uint64 _delay) external onlyRole(DEFAULT_ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
_delay | uint64 | The delay in seconds |
updateRewardsMetadata
Update the rewards metadata
Only address with MANAGER_ROLE can call this function
Emits:
function updateRewardsMetadata(Distribution[] calldata _distributions) external onlyRole(MANAGER_ROLE);
Parameters
Name | Type | Description |
---|---|---|
_distributions | Distribution[] | Distribution[] List of reward metadata |
upgradeToAndCall
function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual override;
Events
RewardClaimed
Emitted when rewards are claimed.
event RewardClaimed(bytes32 indexed identifier, address indexed token, address indexed account, bytes pubkey, uint256 amount);
Parameters
Name | Type | Description |
---|---|---|
identifier | bytes32 | The merkle identifier |
token | address | The reward token |
account | address | The account claiming rewards |
pubkey | bytes | The validator's public key |
amount | uint256 | The amount claimed |
IncentiveReceived
Emitted when incentive tokens are received.
event IncentiveReceived(bytes indexed pubkey, address indexed token, uint256 amount);
Parameters
Name | Type | Description |
---|---|---|
pubkey | bytes | The validator's public key |
token | address | The incentive token |
amount | uint256 | The amount received |
Initialized
Emitted when the contract is initialized.
event Initialized(uint64 version);
Parameters
Name | Type | Description |
---|---|---|
version | uint64 | The initialization version |
Paused
Emitted when the contract is paused.
event Paused(address account);
Parameters
Name | Type | Description |
---|---|---|
account | address | The account that paused the contract |
RewardClaimDelaySet
Emitted when the reward claim delay is set.
event RewardClaimDelaySet(uint64 delay);
Parameters
Name | Type | Description |
---|---|---|
delay | uint64 | The new reward claim delay |
RewardMetadataUpdated
Emitted when rewards metadata is updated.
event RewardMetadataUpdated(bytes32 indexed identifier, bytes indexed pubkey, address indexed token, bytes32 merkleRoot, bytes32 proof, uint256 activeAt);
Parameters
Name | Type | Description |
---|---|---|
identifier | bytes32 | The merkle identifier |
pubkey | bytes | The validator's public key |
token | address | The reward token |
merkleRoot | bytes32 | The merkle root |
proof | bytes32 | The proof data |
activeAt | uint256 | The timestamp when rewards become claimable |
RoleAdminChanged
Emitted when the admin role for a role is changed.
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
Parameters
Name | Type | Description |
---|---|---|
role | bytes32 | The role whose admin was changed |
previousAdminRole | bytes32 | The previous admin role |
newAdminRole | bytes32 | The new admin role |
RoleGranted
Emitted when a role is granted to an account.
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
Parameters
Name | Type | Description |
---|---|---|
role | bytes32 | The role that was granted |
account | address | The account that received the role |
sender | address | The account that granted the role |
RoleRevoked
Emitted when a role is revoked from an account.
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
Parameters
Name | Type | Description |
---|---|---|
role | bytes32 | The role that was revoked |
account | address | The account that lost the role |
sender | address | The account that revoked the role |
Unpaused
Emitted when the contract is unpaused.
event Unpaused(address account);
Parameters
Name | Type | Description |
---|---|---|
account | address | The account that unpaused the contract |
Upgraded
Emitted when the implementation is upgraded.
event Upgraded(address indexed implementation);
Parameters
Name | Type | Description |
---|---|---|
implementation | address | The new implementation address |