Skip to content

IBeraChef

Interface of the BeraChef module

Functions

getActiveCuttingBoard

Returns the active cutting board for validator with given coinbase address

solidity
function getActiveCuttingBoard(address valCoinbase) external view returns (CuttingBoard memory);

Parameters

NameTypeDescription
valCoinbaseaddressThe coinbase address of the validator.

Returns

NameTypeDescription
<none>CuttingBoardcuttingBoard The active cutting board.

getQueuedCuttingBoard

Returns the queued cutting board for a validator with given coinbase address

solidity
function getQueuedCuttingBoard(address valCoinbase) external view returns (CuttingBoard memory);

Parameters

NameTypeDescription
valCoinbaseaddressThe coinbase address of the validator.

Returns

NameTypeDescription
<none>CuttingBoardcuttingBoard The queued cutting board.

getOperator

Returns the operator address for a validator.

solidity
function getOperator(address valCoinbase) external view returns (address);

Parameters

NameTypeDescription
valCoinbaseaddressThe coinbase address of the validator.

Returns

NameTypeDescription
<none>addressoperatorAddress the operator address.

getDefaultCuttingBoard

Returns the default cutting board for validators that do not have a cutting board.

solidity
function getDefaultCuttingBoard() external view returns (CuttingBoard memory);

Returns

NameTypeDescription
<none>CuttingBoardcuttingBoard The default cutting board.

isQueuedCuttingBoardReady

Returns the status of whether a queued cutting board is ready to be activated.

solidity
function isQueuedCuttingBoardReady(address valCoinbase, uint256 blockNumber) external view returns (bool);

Parameters

NameTypeDescription
valCoinbaseaddressThe coinbase address of the validator.
blockNumberuint256The block number to be queried.

Returns

NameTypeDescription
<none>boolisReady True if the queued cutting board 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 cutting board yet.

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

Returns

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

setMaxNumWeightsPerCuttingBoard

Sets the maximum number of weights per cutting board.

solidity
function setMaxNumWeightsPerCuttingBoard(uint8 _maxNumWeightsPerCuttingBoard) external;

setCuttingBoardBlockDelay

Sets the delay in blocks before a new cutting board can be queued.

solidity
function setCuttingBoardBlockDelay(uint64 _cuttingBoardBlockDelay) external;

updateFriendsOfTheChef

Updates the friends of the chef, the status of whether a receiver is whitelisted or not.

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

solidity
function updateFriendsOfTheChef(address receiver, bool isFriend) external;

Parameters

NameTypeDescription
receiveraddressThe address to remove or add as a friend of the chef.
isFriendboolThe whitelist status; true if the receiver is being whitelisted, false otherwise.

setDefaultCuttingBoard

Sets the default cutting board for validators that do not have a cutting board.

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

solidity
function setDefaultCuttingBoard(CuttingBoard calldata cuttingBoard) external;

Parameters

NameTypeDescription
cuttingBoardCuttingBoardThe default cutting board.

queueNewCuttingBoard

Add a new cutting board to the queue for validator with given coinbase address.

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

solidity
function queueNewCuttingBoard(address valCoinbase, uint64 startBlock, Weight[] calldata weights) external;

Parameters

NameTypeDescription
valCoinbaseaddressThe coinbase address of the validator.
startBlockuint64The block that the cutting board goes into effect.
weightsWeight[]The weights of the cutting board.

activateQueuedCuttingBoard

Activates the queued cutting board for a validator.

Should be called by the distribution contract.

solidity
function activateQueuedCuttingBoard(address valCoinbase, uint256 blockNumber) external;

Parameters

NameTypeDescription
valCoinbaseaddressThe coinbase address of the validator.
blockNumberuint256The block number being processed.

setOperator

Sets an address that can set cutting boards on a validator's behalf.

solidity
function setOperator(address operatorAddress) external;

Parameters

NameTypeDescription
operatorAddressaddressThe address that can set cutting boards on a validator's behalf.

Events

MaxNumWeightsPerCuttingBoardSet

Emitted when the maximum number of weights per cutting board has been set.

solidity
event MaxNumWeightsPerCuttingBoardSet(uint8 maxNumWeightsPerCuttingBoard);

Parameters

NameTypeDescription
maxNumWeightsPerCuttingBoarduint8The maximum number of weights per cutting board.

CuttingBoardBlockDelaySet

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

solidity
event CuttingBoardBlockDelaySet(uint64 cuttingBoardBlockDelay);

Parameters

NameTypeDescription
cuttingBoardBlockDelayuint64The delay in blocks before a new cutting board can go into effect.

FriendsOfTheChefUpdated

Emitted when the friends of the chef have been updated.

solidity
event FriendsOfTheChefUpdated(address indexed receiver, bool indexed isFriend);

Parameters

NameTypeDescription
receiveraddressThe address to remove or add as a friend of the chef.
isFriendboolThe whitelist status; true if the receiver is being whitelisted, false otherwise.

QueueCuttingBoard

Emitted when a new cutting board has been queued.

solidity
event QueueCuttingBoard(address indexed valCoinbase, uint64 startBlock, Weight[] weights);

Parameters

NameTypeDescription
valCoinbaseaddressThe validator's coinbase address.
startBlockuint64The block that the cutting board goes into effect.
weightsWeight[]The weights of the cutting board.

ActivateCuttingBoard

Emitted when a new cutting board has been activated.

solidity
event ActivateCuttingBoard(address indexed valCoinbase, uint64 startBlock, Weight[] weights);

Parameters

NameTypeDescription
valCoinbaseaddressThe validator's coinbase address.
startBlockuint64The block that the cutting board goes into effect.
weightsWeight[]The weights of the cutting board.

SetOperator

Emitted when a operator address has been set for a validator.

solidity
event SetOperator(address indexed valCoinbase, address indexed operatorAddress);

Parameters

NameTypeDescription
valCoinbaseaddressThe validator's coinbase address.
operatorAddressaddressThe operator address.

SetDefaultCuttingBoard

Emitted when the governance module has set a new default cutting board.

solidity
event SetDefaultCuttingBoard(CuttingBoard cuttingBoard);

Parameters

NameTypeDescription
cuttingBoardCuttingBoardThe default cutting board.

Structs

CuttingBoard

Represents a CuttingBoard entry

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

Weight

Represents a Weight entry

solidity
struct Weight {
    address receiver;
    uint96 percentageNumerator;
}