Skip to content

Bribe Berachain

Git Source

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

This precompile is responsible for managing bribes directed at validators in the network. Below are functions that allow for viewing, and creating bribes.

Functions

getBribes

Gets the bribes for a given validator, start epoch pair.

solidity
function getBribes(address operator, uint64 startEpoch) external view returns (Bribe[] memory bribes);
function getBribes(address operator, uint64 startEpoch) external view returns (Bribe[] memory bribes);

Parameters

NameTypeDescription
operatoraddressThe validator operator address.
startEpochuint64the epoch that the bribe begins at.

Returns

NameTypeDescription
bribesBribe[]An array of bribes

getAllValidatorBribes

Gets all the bribes from the store for a given validator.

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

Parameters

NameTypeDescription
operatoraddressThe validator operator address.

Returns

NameTypeDescription
bribesBribe[]An array of bribes.

getActiveValidatorBribes

Gets all the active bribes from the store for a given validator.

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

Parameters

NameTypeDescription
operatoraddressThe validator operator address.

Returns

NameTypeDescription
bribesBribe[]An array of bribes.

getBribeFees

Gets the bribe fee from the store.

solidity
function getBribeFees() external view returns (Cosmos.Coin[] memory fee);
function getBribeFees() external view returns (Cosmos.Coin[] memory fee);

Returns

NameTypeDescription
feeCosmos.Coin[]An array of bribe fees.

updateParams

Updates the params. Only the authority can call this method.

solidity
function updateParams(Cosmos.Coin[] memory fee) external returns (bool);
function updateParams(Cosmos.Coin[] memory fee) external returns (bool);

Parameters

NameTypeDescription
feeCosmos.Coin[]The new fee

createBribe

Creates a new bribe. Only the authority can call this method. Note: Only one bribe can be created per validator per epoch.

solidity
function createBribe(
    address operator,
    uint64 startEpoch,
    uint64 numBlockProposals,
    Cosmos.Coin[] memory bribePerProposal
) external payable returns (bool);
function createBribe(
    address operator,
    uint64 startEpoch,
    uint64 numBlockProposals,
    Cosmos.Coin[] memory bribePerProposal
) external payable returns (bool);

Parameters

NameTypeDescription
operatoraddressThe validator operator address.
startEpochuint64the epoch that the bribe begins at.
numBlockProposalsuint64
bribePerProposalCosmos.Coin[]

Returns

NameTypeDescription
<none>boolnumBlockProposals The number of block proposals to bribe.

Events

BribeCreated

Emitted when a bribe is created.

solidity
event BribeCreated(
    address bribeCreator,
    address consensusAddr,
    uint64 startEpoch,
    uint64 numBlockProposals,
    Cosmos.Coin[] bribePerProposal
);
event BribeCreated(
    address bribeCreator,
    address consensusAddr,
    uint64 startEpoch,
    uint64 numBlockProposals,
    Cosmos.Coin[] bribePerProposal
);

Parameters

NameTypeDescription
bribeCreatoraddressThe address of the bribe creator.
consensusAddraddressThe validator's consensus address.
startEpochuint64the epoch that the bribe matures.
numBlockProposalsuint64
bribePerProposalCosmos.Coin[]Cosmos.Coin[] memory bribePerProposal

Structs

Bribe

The struct for a bribe.

solidity
struct Bribe {
    address consensusAddress;
    uint64 startEpoch;
    uint64 numBlockProposals;
    uint64 numBlockProposalsBribed;
    Cosmos.Coin[] bribePerProposal;
}
struct Bribe {
    address consensusAddress;
    uint64 startEpoch;
    uint64 numBlockProposals;
    uint64 numBlockProposalsBribed;
    Cosmos.Coin[] bribePerProposal;
}

Properties

NameTypeDescription
consensusAddressaddressThe validator consensus address.
startEpochuint64the epoch that the bribe matures.
numBlockProposalsuint64The number of block proposals to bribe.
numBlockProposalsBribeduint64The number of block proposals bribed so far.
bribePerProposalCosmos.Coin[]The amount to be paid per block proposal.