ERC20 Bribe Berachain
Note: Link to existing contract ABI's can be found on Github here.
State Variables
erc20Module
IERC20BankModule public immutable erc20Module = IERC20BankModule(0x0000000000000000000000000000000000696969);
IERC20BankModule public immutable erc20Module = IERC20BankModule(0x0000000000000000000000000000000000696969);
distributionModule
IDistributionModule public immutable distributionModule = IDistributionModule(address(0x69));
IDistributionModule public immutable distributionModule = IDistributionModule(address(0x69));
bribeModule
IBribeModule public immutable bribeModule = IBribeModule(0xfCe07324E0E72e071842374E9997CF65dF990CBc);
IBribeModule public immutable bribeModule = IBribeModule(0xfCe07324E0E72e071842374E9997CF65dF990CBc);
Functions
getBribesForValidator
Get the bribe for a validator.
function getBribesForValidator(address operator, uint64 startEpoch) public view returns (Bribe[] memory);
function getBribesForValidator(address operator, uint64 startEpoch) public view returns (Bribe[] memory);
Parameters
Name | Type | Description |
---|---|---|
operator | address | The operator address of the validator. |
startEpoch | uint64 | The start epoch of the bribe. |
Returns
Name | Type | Description |
---|---|---|
<none> | Bribe[] | bribes The bribes. |
getAllValidatorBribes
Get the bribe for a validator.
function getAllValidatorBribes(address operator) external view returns (Bribe[] memory bribe);
function getAllValidatorBribes(address operator) external view returns (Bribe[] memory bribe);
Parameters
Name | Type | Description |
---|---|---|
operator | address | The operator address of the validator. |
Returns
Name | Type | Description |
---|---|---|
bribe | Bribe[] | all the bribes for the validator. |
getActiveValidatorBribes
Get the active bribe for a validator.
function getActiveValidatorBribes(address operator) external view returns (Bribe[] memory bribe);
function getActiveValidatorBribes(address operator) external view returns (Bribe[] memory bribe);
Parameters
Name | Type | Description |
---|---|---|
operator | address | The operator address of the validator. |
Returns
Name | Type | Description |
---|---|---|
bribe | Bribe[] | all the active bribes for the validator. |
previewClaimValidatorBribes
Returns all the rewards accumulated by a delegator for each validator.
function previewClaimValidatorBribes(address delegator) external view returns (ValidatorReward[] memory rewards);
function previewClaimValidatorBribes(address delegator) external view returns (ValidatorReward[] memory rewards);
Parameters
Name | Type | Description |
---|---|---|
delegator | address | the delegator to query for. |
previewClaimAllBribes
Returns the cumulative bribe reward for a delegator.
function previewClaimAllBribes(address delegator) external view returns (Reward[] memory rewards);
function previewClaimAllBribes(address delegator) external view returns (Reward[] memory rewards);
Parameters
Name | Type | Description |
---|---|---|
delegator | address | the delegator to query for. |
createBribe
Create a bribe.
This method will revert if the erc20/coin does not exist in the ERC20Module.
function createBribe(
address operator,
uint64 startEpoch,
uint64 numBlockProposals,
address[] calldata tokens,
uint256[] calldata amounts
) external payable returns (bool);
function createBribe(
address operator,
uint64 startEpoch,
uint64 numBlockProposals,
address[] calldata tokens,
uint256[] calldata amounts
) external payable returns (bool);
Parameters
Name | Type | Description |
---|---|---|
operator | address | The operator address of the validator. |
startEpoch | uint64 | The start epoch of the bribe. |
numBlockProposals | uint64 | The number of block proposals to bribe. |
tokens | address[] | The tokens to bribe with. |
amounts | uint256[] | The amounts of tokens to bribe with. |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | success Whether the bribe was created. |
fundBribe
function fundBribe(address from, uint256 numBlockProposals) internal returns (bool);
function fundBribe(address from, uint256 numBlockProposals) internal returns (bool);
claimValidatorBribes
Withdraw the bribe rewards accumulated to a delegator for a specific validator. NOTE: the delegator must also withdraw their BGT rewards.
function claimValidatorBribes(address delegator, address validator) external returns (bool);
function claimValidatorBribes(address delegator, address validator) external returns (bool);
Parameters
Name | Type | Description |
---|---|---|
delegator | address | The delegator to withdraw the rewards for. |
validator | address | The validator to withdraw the rewards from. |
claimAllBribes
Withdraw the bribe rewards accumulated to a delegator for all validators. NOTE: the delegator must also withdraw their BGT rewards from all delegations.
function claimAllBribes(address delegator) external returns (bool);
function claimAllBribes(address delegator) external returns (bool);
Parameters
Name | Type | Description |
---|---|---|
delegator | address | The delegator to withdraw the rewards for. |
stringsEqual
function stringsEqual(string memory a, string memory b) internal pure returns (bool);
function stringsEqual(string memory a, string memory b) internal pure returns (bool);
Structs
Bribe
struct Bribe {
address consensusAddress;
uint64 startEpoch;
uint64 numBlockProposals;
uint64 numBlockProposalsBribed;
BribePerProposal bribePerProposal;
}
struct Bribe {
address consensusAddress;
uint64 startEpoch;
uint64 numBlockProposals;
uint64 numBlockProposalsBribed;
BribePerProposal bribePerProposal;
}
BribePerProposal
struct BribePerProposal {
address[] tokens;
uint256[] amounts;
}
struct BribePerProposal {
address[] tokens;
uint256[] amounts;
}
Reward
struct Reward {
address token;
uint256 amount;
}
struct Reward {
address token;
uint256 amount;
}
ValidatorReward
struct ValidatorReward {
address validator;
Reward[] reward;
}
struct ValidatorReward {
address validator;
Reward[] reward;
}