Skip to content

IBGT

Functions

whitelistSender

Approve an address to send BGT or approve another address to transfer BGT from it.

This can only be called by the governance module.

BGT should be soul bound to EOAs and only transferable by approved senders.

solidity
function whitelistSender(address sender, bool approved) external;

Parameters

NameTypeDescription
senderaddressThe address of the sender.
approvedboolWhether the sender is approved or not.

mint

Mint BGT to the distributor.

This can only be called by the minter address, which is set by governance.

solidity
function mint(address distributor, uint256 amount) external;

Parameters

NameTypeDescription
distributoraddressThe address of the distributor.
amountuint256The amount of BGT to mint.

queueBoost

Queues a new boost of the validator with an amount of BGT from msg.sender.

Reverts if msg.sender does not have enough unboosted balance to cover amount.

solidity
function queueBoost(address validator, uint128 amount) external;

Parameters

NameTypeDescription
validatoraddressThe address of the validator to be boosted.
amountuint128The amount of BGT to use for the queued boost.

cancelBoost

Cancels a queued boost of the validator removing an amount of BGT for msg.sender.

Reverts if msg.sender does not have enough queued balance to cover amount.

solidity
function cancelBoost(address validator, uint128 amount) external;

Parameters

NameTypeDescription
validatoraddressThe address of the validator to cancel boost for.
amountuint128The amount of BGT to remove from the queued boost.

activateBoost

Boost the validator with an amount of BGT from msg.sender.

Reverts if msg.sender does not have enough unboosted balance to cover amount.

solidity
function activateBoost(address validator) external;

Parameters

NameTypeDescription
validatoraddressThe address of the validator to boost.

dropBoost

Drops an amount of BGT from an existing boost of validator by msg.sender.

solidity
function dropBoost(address validator, uint128 amount) external;

Parameters

NameTypeDescription
validatoraddressThe address of the validator to remove boost from.
amountuint128The amount of BGT to remove from the boost.

setCommission

Sets the commission rate on block rewards to be charged by validator.

Reverts if not called by either validator or operator of validator.

solidity
function setCommission(address validator, uint256 reward) external;

Parameters

NameTypeDescription
validatoraddressThe address of the validator to set the commission rate for.
rewarduint256The new reward rate to charge as commission.

boostedQueue

Returns the amount of BGT queued up to be used by an account to boost a validator.

solidity
function boostedQueue(
    address account,
    address validator
)
    external
    view
    returns (uint32 blockNumberLast, uint128 balance);

Parameters

NameTypeDescription
accountaddressThe address of the account boosting.
validatoraddressThe address of the validator being boosted.

queuedBoost

Returns the amount of BGT queued up to be used by an account for boosts.

solidity
function queuedBoost(address account) external view returns (uint128);

Parameters

NameTypeDescription
accountaddressThe address of the account boosting.

boosted

Returns the amount of BGT used by an account to boost a validator.

solidity
function boosted(address account, address validator) external view returns (uint128);

Parameters

NameTypeDescription
accountaddressThe address of the account boosting.
validatoraddressThe address of the validator being boosted.

boosts

Returns the amount of BGT used by an account for boosts.

solidity
function boosts(address account) external view returns (uint128);

Parameters

NameTypeDescription
accountaddressThe address of the account boosting.

boostees

Returns the amount of BGT attributed to the validator for boosts.

solidity
function boostees(address validator) external view returns (uint128);

Parameters

NameTypeDescription
validatoraddressThe address of the validator being boosted.

totalBoosts

Returns the total boosts for all validators.

solidity
function totalBoosts() external view returns (uint128);

commissions

Returns the commission rate charged by the validator on new block rewards.

solidity
function commissions(address validator) external view returns (uint32 blockTimestampLast, uint224 rate);

Parameters

NameTypeDescription
validatoraddressThe address of the validator charging the commission rate.

boostedRewardRate

Returns the scaled reward rate for the validator given outstanding boosts.

Used by distributor to distribute BGT rewards.

solidity
function boostedRewardRate(address validator, uint256 rewardRate) external view returns (uint256);

Parameters

NameTypeDescription
validatoraddressThe address of the boosted validator.
rewardRateuint256The unscaled reward rate for the block.

commissionRewardRate

Returns the amount of the reward rate to be dedicated to commissions for the given validator.

Used by distributor to distribute BGT rewards.

solidity
function commissionRewardRate(address validator, uint256 rewardRate) external view returns (uint256);

Parameters

NameTypeDescription
validatoraddressThe address of the validator charging commission.
rewardRateuint256The reward rate to take commission from for the block.

minter

Public variable that represents the caller of the mint method.

This is going to be the BlockRewardController contract at first.

solidity
function minter() external view returns (address);

setMinter

Set the minter address.

This can only be called by the governance module.

solidity
function setMinter(address _minter) external;

Parameters

NameTypeDescription
_minteraddressThe address of the minter.

setBeraChef

Set the BeraChef address.

OnlyOwner can call.

solidity
function setBeraChef(address _beraChef) external;

Parameters

NameTypeDescription
_beraChefaddressThe address of the BeraChef contract.

redeem

Redeem the BGT token for the native token at a 1:1 rate.

solidity
function redeem(address receiver, uint256 amount) external;

Parameters

NameTypeDescription
receiveraddressThe receiver's address who will receive the native token.
amountuint256The amount of BGT to redeem.

unboostedBalanceOf

Returns the unboosted balance of an account.

solidity
function unboostedBalanceOf(address account) external view returns (uint256);

Parameters

NameTypeDescription
accountaddressThe address of the account.

Events

MinterChanged

Emitted when the minter address is changed.

solidity
event MinterChanged(address indexed previous, address indexed current);

Parameters

NameTypeDescription
previousaddressThe address of the previous minter.
currentaddressThe address of the current minter.

BeraChefChanged

Emitted when the BeraChef address is changed.

solidity
event BeraChefChanged(address indexed previous, address indexed current);

Parameters

NameTypeDescription
previousaddressThe address of the previous BeraChef.
currentaddressThe address of the current BeraChef.

SenderWhitelisted

Emitted when an address is approved to send BGT.

solidity
event SenderWhitelisted(address indexed sender, bool approved);

Parameters

NameTypeDescription
senderaddressThe address of the sender.
approvedboolWhether the sender is approved or not.

QueueBoost

Emitted when sender queues a new boost for a validator with an amount of BGT

solidity
event QueueBoost(address indexed sender, address indexed validator, uint128 amount);

Parameters

NameTypeDescription
senderaddressThe address of the sender.
validatoraddressThe address of the validator to be boosted.
amountuint128The amount of BGT to boost with.

CancelBoost

Emitted when sender cancels a queued boost for a validator with an amount of BGT

solidity
event CancelBoost(address indexed sender, address indexed validator, uint128 amount);

Parameters

NameTypeDescription
senderaddressThe address of the sender.
validatoraddressThe address of the validator to be boosted.
amountuint128The amount of BGT to cancel from queued boosts.

ActivateBoost

Emitted when sender activates a new boost for a validator

solidity
event ActivateBoost(address indexed sender, address indexed validator, uint128 amount);

Parameters

NameTypeDescription
senderaddressThe address of the sender.
validatoraddressThe address of the validator to boost.
amountuint128The amount of BGT to boost with.

DropBoost

Emitted when sender removes an amount of BGT boost from a validator

solidity
event DropBoost(address indexed sender, address indexed validator, uint128 amount);

Parameters

NameTypeDescription
senderaddressThe address of the sender.
validatoraddressThe address of the validator to remove boost from.
amountuint128The amount of BGT boost to remove.

Redeem

Emitted when the BGT token is redeemed for the native token.

solidity
event Redeem(address indexed from, address indexed receiver, uint256 amount);

UpdateCommission

Emitted when validator sets their commission rate charged on block reward distribution

solidity
event UpdateCommission(address indexed validator, uint256 oldRate, uint256 newRate);

Parameters

NameTypeDescription
validatoraddressThe address of the validator charging the commission.
oldRateuint256The old commission rate charged by the validator.
newRateuint256The new commission rate charged by the validator.