Skip to content

ERC20 Bribe Berachain

Git Source

Note: Link to existing contract ABI's can be found on Github here.

State Variables

erc20Module

solidity
IERC20BankModule public immutable erc20Module = IERC20BankModule(0x0000000000000000000000000000000000696969);
IERC20BankModule public immutable erc20Module = IERC20BankModule(0x0000000000000000000000000000000000696969);

distributionModule

solidity
IDistributionModule public immutable distributionModule = IDistributionModule(address(0x69));
IDistributionModule public immutable distributionModule = IDistributionModule(address(0x69));

bribeModule

solidity
IBribeModule public immutable bribeModule = IBribeModule(0xfCe07324E0E72e071842374E9997CF65dF990CBc);
IBribeModule public immutable bribeModule = IBribeModule(0xfCe07324E0E72e071842374E9997CF65dF990CBc);

Functions

getBribesForValidator

Get the bribe for a validator.

solidity
function getBribesForValidator(address operator, uint64 startEpoch) public view returns (Bribe[] memory);
function getBribesForValidator(address operator, uint64 startEpoch) public view returns (Bribe[] memory);

Parameters

NameTypeDescription
operatoraddressThe operator address of the validator.
startEpochuint64The start epoch of the bribe.

Returns

NameTypeDescription
<none>Bribe[]bribes The bribes.

getAllValidatorBribes

Get the bribe for a validator.

solidity
function getAllValidatorBribes(address operator) external view returns (Bribe[] memory bribe);
function getAllValidatorBribes(address operator) external view returns (Bribe[] memory bribe);

Parameters

NameTypeDescription
operatoraddressThe operator address of the validator.

Returns

NameTypeDescription
bribeBribe[]all the bribes for the validator.

getActiveValidatorBribes

Get the active bribe for a validator.

solidity
function getActiveValidatorBribes(address operator) external view returns (Bribe[] memory bribe);
function getActiveValidatorBribes(address operator) external view returns (Bribe[] memory bribe);

Parameters

NameTypeDescription
operatoraddressThe operator address of the validator.

Returns

NameTypeDescription
bribeBribe[]all the active bribes for the validator.

previewClaimValidatorBribes

Returns all the rewards accumulated by a delegator for each validator.

solidity
function previewClaimValidatorBribes(address delegator) external view returns (ValidatorReward[] memory rewards);
function previewClaimValidatorBribes(address delegator) external view returns (ValidatorReward[] memory rewards);

Parameters

NameTypeDescription
delegatoraddressthe delegator to query for.

previewClaimAllBribes

Returns the cumulative bribe reward for a delegator.

solidity
function previewClaimAllBribes(address delegator) external view returns (Reward[] memory rewards);
function previewClaimAllBribes(address delegator) external view returns (Reward[] memory rewards);

Parameters

NameTypeDescription
delegatoraddressthe delegator to query for.

createBribe

Create a bribe.

This method will revert if the erc20/coin does not exist in the ERC20Module.

solidity
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

NameTypeDescription
operatoraddressThe operator address of the validator.
startEpochuint64The start epoch of the bribe.
numBlockProposalsuint64The number of block proposals to bribe.
tokensaddress[]The tokens to bribe with.
amountsuint256[]The amounts of tokens to bribe with.

Returns

NameTypeDescription
<none>boolsuccess Whether the bribe was created.

fundBribe

solidity
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.

solidity
function claimValidatorBribes(address delegator, address validator) external returns (bool);
function claimValidatorBribes(address delegator, address validator) external returns (bool);

Parameters

NameTypeDescription
delegatoraddressThe delegator to withdraw the rewards for.
validatoraddressThe 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.

solidity
function claimAllBribes(address delegator) external returns (bool);
function claimAllBribes(address delegator) external returns (bool);

Parameters

NameTypeDescription
delegatoraddressThe delegator to withdraw the rewards for.

stringsEqual

solidity
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

solidity
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

solidity
struct BribePerProposal {
    address[] tokens;
    uint256[] amounts;
}
struct BribePerProposal {
    address[] tokens;
    uint256[] amounts;
}

Reward

solidity
struct Reward {
    address token;
    uint256 amount;
}
struct Reward {
    address token;
    uint256 amount;
}

ValidatorReward

solidity
struct ValidatorReward {
    address validator;
    Reward[] reward;
}
struct ValidatorReward {
    address validator;
    Reward[] reward;
}