Skip to content
🚧 Under Development! May be incomplete.Some pages/links may be incomplete or subject to change.

BeraChef

0xfb81E39E3970076ab2693fA5C45A07Cc724C93c2 | ABI JSON

Interface of the BeraChef module for configuring where Validators are directing their $BGT emissions to different Reward Vaults.

Functions

getActiveRewardAllocation

Returns the active reward allocation for validator with given pubkey

solidity
function getActiveRewardAllocation(bytes calldata valPubkey) external view returns (RewardAllocation memory);

Parameters

NameTypeDescription
valPubkeybytesThe validator's pubkey.

Returns

NameTypeDescription
<none>RewardAllocationrewardAllocation The active reward allocation.

getQueuedRewardAllocation

Returns the queued reward allocation for a validator with given pubkey

solidity
function getQueuedRewardAllocation(bytes calldata valPubkey) external view returns (RewardAllocation memory);

Parameters

NameTypeDescription
valPubkeybytesThe validator's pubkey.

Returns

NameTypeDescription
<none>RewardAllocationrewardAllocation The queued reward allocation.

getSetActiveRewardAllocation

Returns the active reward allocation set by the validator with given pubkey.

This will return active reward allocation set by validators even if its not valid.

solidity
function getSetActiveRewardAllocation(bytes calldata valPubkey) external view returns (RewardAllocation memory);

Parameters

NameTypeDescription
valPubkeybytesThe validator's pubkey.

Returns

NameTypeDescription
<none>RewardAllocationrewardAllocation The reward allocation.

getDefaultRewardAllocation

Returns the default reward allocation for validators that do not have a reward allocation.

solidity
function getDefaultRewardAllocation() external view returns (RewardAllocation memory);

Returns

NameTypeDescription
<none>RewardAllocationrewardAllocation The default reward allocation.

isQueuedRewardAllocationReady

Returns the status of whether a queued reward allocation is ready to be activated.

solidity
function isQueuedRewardAllocationReady(bytes calldata valPubkey, uint256 blockNumber) external view returns (bool);

Parameters

NameTypeDescription
valPubkeybytesThe validator's pubkey.
blockNumberuint256The block number to be queried.

Returns

NameTypeDescription
<none>boolisReady True if the queued reward allocation is ready to be activated, false otherwise.

isReady

Returns the status of whether the BeraChef contract is ready to be used.

This function should be used by all contracts that depend on a system call.

This will return false if the governance module has not set a default reward allocation yet.

solidity
function isReady() external view returns (bool);

Returns

NameTypeDescription
<none>boolisReady True if the BeraChef is ready to be used, false otherwise.

setMaxNumWeightsPerRewardAllocation

Sets the maximum number of weights per reward allocation.

solidity
function setMaxNumWeightsPerRewardAllocation(uint8 _maxNumWeightsPerRewardAllocation) external;

setRewardAllocationBlockDelay

Sets the delay in blocks before a new reward allocation can be queued.

solidity
function setRewardAllocationBlockDelay(uint64 _rewardAllocationBlockDelay) external;

setVaultWhitelistedStatus

Updates the vault's whitelisted status

The caller of this function must be the governance module account.

solidity
function setVaultWhitelistedStatus(address receiver, bool isWhitelisted, string memory metadata) external;

Parameters

NameTypeDescription
receiveraddressThe address to remove or add as whitelisted vault.
isWhitelistedboolThe whitelist status; true if the receiver is being whitelisted, false otherwise.
metadatastringThe metadata of the vault.

updateWhitelistedVaultMetadata

Updates the metadata of a whitelisted vault, reverts if vault is not whitelisted.

The caller of this function must be the governance module account.

solidity
function updateWhitelistedVaultMetadata(address receiver, string memory metadata) external;

Parameters

NameTypeDescription
receiveraddressThe address of the whitelisted vault.
metadatastringThe metadata of the vault, to associate info with the vault in the events log.

setDefaultRewardAllocation

Sets the default reward allocation for validators that do not have a reward allocation.

The caller of this function must be the governance module account.

solidity
function setDefaultRewardAllocation(RewardAllocation calldata rewardAllocation) external;

Parameters

NameTypeDescription
rewardAllocationRewardAllocationThe default reward allocation.

queueNewRewardAllocation

Add a new reward allocation to the queue for validator with given pubkey. Does not allow overwriting of existing queued reward allocation.

The weights of the reward allocation must add up to 100% or 1e4. Only whitelisted pools may be used as well.

solidity
function queueNewRewardAllocation(bytes calldata valPubkey, uint64 startBlock, Weight[] calldata weights) external;

Parameters

NameTypeDescription
valPubkeybytesThe validator's pubkey.
startBlockuint64The block that the reward allocation goes into effect.
weightsWeight[]The weights of the reward allocation.

activateReadyQueuedRewardAllocation

Activates the queued reward allocation for a validator if its ready for the current block.

Should be called by the distribution contract.

solidity
function activateReadyQueuedRewardAllocation(bytes calldata valPubkey) external;

Parameters

NameTypeDescription
valPubkeybytesThe validator's pubkey.

Events

MaxNumWeightsPerRewardAllocationSet

Emitted when the maximum number of weights per reward allocation has been set.

solidity
event MaxNumWeightsPerRewardAllocationSet(uint8 maxNumWeightsPerRewardAllocation);

Parameters

NameTypeDescription
maxNumWeightsPerRewardAllocationuint8The maximum number of weights per reward allocation.

RewardAllocationBlockDelaySet

Emitted when the delay in blocks before a new reward allocation can go into effect has been set.

solidity
event RewardAllocationBlockDelaySet(uint64 rewardAllocationBlockDelay);

Parameters

NameTypeDescription
rewardAllocationBlockDelayuint64The delay in blocks before a new reward allocation can go into effect.

VaultWhitelistedStatusUpdated

Emitted when the vault's whitelisted status have been updated.

solidity
event VaultWhitelistedStatusUpdated(address indexed receiver, bool indexed isWhitelisted, string metadata);

Parameters

NameTypeDescription
receiveraddressThe address to remove or add as whitelisted vault.
isWhitelistedboolThe whitelist status; true if the receiver is being whitelisted, false otherwise.
metadatastringThe metadata of the vault.

WhitelistedVaultMetadataUpdated

Emitted when the metadata of a whitelisted vault has been updated.

solidity
event WhitelistedVaultMetadataUpdated(address indexed receiver, string metadata);

Parameters

NameTypeDescription
receiveraddressThe address of the whitelisted vault.
metadatastringThe metadata of the vault.

QueueRewardAllocation

Emitted when a new reward allocation has been queued.

solidity
event QueueRewardAllocation(bytes indexed valPubkey, uint64 startBlock, Weight[] weights);

Parameters

NameTypeDescription
valPubkeybytesThe validator's pubkey.
startBlockuint64The block that the reward allocation goes into effect.
weightsWeight[]The weights of the reward allocation.

ActivateRewardAllocation

Emitted when a new reward allocation has been activated.

solidity
event ActivateRewardAllocation(bytes indexed valPubkey, uint64 startBlock, Weight[] weights);

Parameters

NameTypeDescription
valPubkeybytesThe validator's pubkey.
startBlockuint64The block that the reward allocation goes into effect.
weightsWeight[]The weights of the reward allocation.

SetDefaultRewardAllocation

Emitted when the governance module has set a new default reward allocation.

solidity
event SetDefaultRewardAllocation(RewardAllocation rewardAllocation);

Parameters

NameTypeDescription
rewardAllocationRewardAllocationThe default reward allocation.

Structs

RewardAllocation

Represents a RewardAllocation entry

solidity
struct RewardAllocation {
    uint64 startBlock;
    Weight[] weights;
}

Weight

Represents a Weight entry

solidity
struct Weight {
    address receiver;
    uint96 percentageNumerator;
}