Skip to content

BGT

0x656b95E550C07a9ffe548bd4085c72418Ceb1dba | ABI JSON

Git Source

The Berachain Governance Token ($BGT) is a soulbound ERC20 token, which cannot be transferred, only earned through Reward Vaults, used for governance proposals and voting, and can be redeemed for $BERA.

Inherits: IBGT, ERC20VotesUpgradeable, OwnableUpgradeable, Multicallable

Structs

QueuedBoost

The queued boost struct for validator boosting.

solidity
struct QueuedBoost {
    uint32 blockNumberLast;
    uint128 balance;
}

Properties

NameTypeDescription
blockNumberLastuint32The last block number boost balance was queued
balanceuint128The queued BGT balance to boost with

QueuedDropBoost

The queued drop boost struct for validator boosting.

solidity
struct QueuedDropBoost {
    uint32 blockNumberLast;
    uint128 balance;
}

Properties

NameTypeDescription
blockNumberLastuint32The last block number boost balance was queued for dropping
balanceuint128The boosted BGT balance to drop boost with

UserBoost

The user boost struct for tracking validator boosts.

solidity
struct UserBoost {
    uint128 boost;
    uint128 queuedBoost;
}

Properties

NameTypeDescription
boostuint128The boost balance being used by the user
queuedBoostuint128The queued boost balance to be used by the user

State Variables

activateBoostDelay

The block delay for activating boosts.

solidity
uint32 public activateBoostDelay;

bgtTermsAndConditions

The BGT terms and conditions.

solidity
string public bgtTermsAndConditions;

boosted

The mapping of balances used to boost validator rewards by an account

solidity
mapping(address account => mapping(bytes pubkey => uint128)) public boosted;

boostedQueue

The mapping of queued boosts on a validator by an account

solidity
mapping(address account => mapping(bytes pubkey => QueuedBoost)) public boostedQueue;

boostees

The mapping of boost balances for a validator

solidity
mapping(bytes pubkey => uint128) public boostees;

dropBoostDelay

The block delay for dropping boosts.

solidity
uint32 public dropBoostDelay;

dropBoostQueue

The mapping of queued drop boosts on a validator by an account

solidity
mapping(address account => mapping(bytes pubkey => QueuedDropBoost)) public dropBoostQueue;

isWhitelistedSender

The mapping of approved senders.

solidity
mapping(address sender => bool) public isWhitelistedSender;

staker

The BGTStaker contract address that we are using to stake and withdraw BGT.

This contract is used to distribute dapp fees to BGT delegators.

solidity
address public staker;

totalBoosts

Total amount of BGT used for validator boosts

solidity
uint128 public totalBoosts;

userBoosts

The mapping of user boosts

solidity
mapping(address account => UserBoost) public userBoosts;

View Functions

minter

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

Functions

activateBoost

Activates a queued boost on a validator.

Emits:

solidity
function activateBoost(address account, bytes calldata pubkey) external;

Parameters

NameTypeDescription
accountaddressThe account to activate boost for
pubkeybytesThe validator public key

burn

Burns BGT tokens from the caller.

solidity
function burn(uint256 amount) external;

cancelQueuedBoost

Cancels a queued boost on a validator.

Emits:

solidity
function cancelQueuedBoost(bytes calldata pubkey) external;

Parameters

NameTypeDescription
pubkeybytesThe validator public key

cancelQueuedDropBoost

Cancels a queued drop boost on a validator.

Emits:

solidity
function cancelQueuedDropBoost(bytes calldata pubkey) external;

Parameters

NameTypeDescription
pubkeybytesThe validator public key

dropBoost

Drops a boost on a validator.

Emits:

solidity
function dropBoost(bytes calldata pubkey, uint128 amount) external;

Parameters

NameTypeDescription
pubkeybytesThe validator public key
amountuint128The amount to drop boost

initialize

Initializes the BGT contract.

solidity
function initialize(address _governance, address _staker) external initializer;

mint

Mints BGT tokens to the specified address.

Only the minter can call this function.

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

queueBoost

Queues a boost on a validator.

Emits:

solidity
function queueBoost(bytes calldata pubkey, uint128 amount) external;

Parameters

NameTypeDescription
pubkeybytesThe validator public key
amountuint128The amount to queue for boost

queueDropBoost

Queues a drop boost on a validator.

Emits:

solidity
function queueDropBoost(bytes calldata pubkey, uint128 amount) external;

Parameters

NameTypeDescription
pubkeybytesThe validator public key
amountuint128The amount to queue for drop boost

redeem

Redeems native tokens for BGT.

Emits:

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

Parameters

NameTypeDescription
receiveraddressThe address to receive native tokens
amountuint256The amount of BGT to redeem

setActivateBoostDelay

Sets the delay for activating boosts.

Emits:

solidity
function setActivateBoostDelay(uint32 _activateBoostDelay) external onlyOwner;

Parameters

NameTypeDescription
_activateBoostDelayuint32The new activate boost delay

setBgtTermsAndConditions

Sets the BGT terms and conditions.

Emits:

solidity
function setBgtTermsAndConditions(string calldata _bgtTermsAndConditions) external onlyOwner;

Parameters

NameTypeDescription
_bgtTermsAndConditionsstringThe new terms and conditions

setDropBoostDelay

Sets the delay for dropping boosts.

Emits:

solidity
function setDropBoostDelay(uint32 _dropBoostDelay) external onlyOwner;

Parameters

NameTypeDescription
_dropBoostDelayuint32The new drop boost delay

setMinter

Sets the minter address.

Emits:

solidity
function setMinter(address _minter) external onlyOwner;

Parameters

NameTypeDescription
_minteraddressThe new minter address

setStaker

Sets the staker contract address.

Emits:

solidity
function setStaker(address _staker) external onlyOwner;

Parameters

NameTypeDescription
_stakeraddressThe new staker contract address

whitelistSender

Whitelists or removes a sender.

Emits:

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

Parameters

NameTypeDescription
senderaddressThe sender address
approvedboolWhether to whitelist or remove

Events

ActivateBoost

Emitted when a boost is activated.

solidity
event ActivateBoost(address indexed account, bytes pubkey, uint128 amount);

Parameters

NameTypeDescription
accountaddressThe account that activated the boost
pubkeybytesThe validator public key
amountuint128The amount of boost activated

Approval

Emitted when an approval is made.

solidity
event Approval(address indexed owner, address indexed spender, uint256 value);

Parameters

NameTypeDescription
owneraddressThe token owner
spenderaddressThe approved spender
valueuint256The approved amount

CancelQueuedBoost

Emitted when a queued boost is cancelled.

solidity
event CancelQueuedBoost(address indexed account, bytes pubkey, uint128 amount);

Parameters

NameTypeDescription
accountaddressThe account that cancelled the boost
pubkeybytesThe validator public key
amountuint128The amount of boost cancelled

CancelQueuedDropBoost

Emitted when a queued drop boost is cancelled.

solidity
event CancelQueuedDropBoost(address indexed account, bytes pubkey, uint128 amount);

Parameters

NameTypeDescription
accountaddressThe account that cancelled the drop boost
pubkeybytesThe validator public key
amountuint128The amount of drop boost cancelled

DelegateChanged

Emitted when a delegate is changed.

solidity
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);

Parameters

NameTypeDescription
delegatoraddressThe delegator address
fromDelegateaddressThe previous delegate
toDelegateaddressThe new delegate

DelegateVotesChanged

Emitted when delegate votes change.

solidity
event DelegateVotesChanged(address indexed delegate, uint256 previousVotes, uint256 newVotes);

Parameters

NameTypeDescription
delegateaddressThe delegate address
previousVotesuint256The previous vote count
newVotesuint256The new vote count

DropBoost

Emitted when a boost is dropped.

solidity
event DropBoost(address indexed account, bytes pubkey, uint128 amount);

Parameters

NameTypeDescription
accountaddressThe account that dropped the boost
pubkeybytesThe validator public key
amountuint128The amount of boost dropped

EIP712DomainChanged

Emitted when the EIP712 domain changes.

solidity
event EIP712DomainChanged();

Initialized

Emitted when the contract is initialized.

solidity
event Initialized(uint64 version);

Parameters

NameTypeDescription
versionuint64The initialization version

OwnershipTransferred

Emitted when ownership is transferred.

solidity
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

Parameters

NameTypeDescription
previousOwneraddressThe previous owner
newOwneraddressThe new owner

QueueBoost

Emitted when a boost is queued.

solidity
event QueueBoost(address indexed account, bytes pubkey, uint128 amount);

Parameters

NameTypeDescription
accountaddressThe account that queued the boost
pubkeybytesThe validator public key
amountuint128The amount of boost queued

QueueDropBoost

Emitted when a drop boost is queued.

solidity
event QueueDropBoost(address indexed account, bytes pubkey, uint128 amount);

Parameters

NameTypeDescription
accountaddressThe account that queued the drop boost
pubkeybytesThe validator public key
amountuint128The amount of drop boost queued

Redeem

Emitted when BGT is redeemed for native tokens.

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

Parameters

NameTypeDescription
accountaddressThe account that redeemed
receiveraddressThe receiver of native tokens
amountuint256The amount redeemed

SetActivateBoostDelay

Emitted when the activate boost delay is set.

solidity
event SetActivateBoostDelay(uint32 activateBoostDelay);

Parameters

NameTypeDescription
activateBoostDelayuint32The new activate boost delay

SetBgtTermsAndConditions

Emitted when BGT terms and conditions are set.

solidity
event SetBgtTermsAndConditions(string bgtTermsAndConditions);

Parameters

NameTypeDescription
bgtTermsAndConditionsstringThe new terms and conditions

SetDropBoostDelay

Emitted when the drop boost delay is set.

solidity
event SetDropBoostDelay(uint32 dropBoostDelay);

Parameters

NameTypeDescription
dropBoostDelayuint32The new drop boost delay

SetMinter

Emitted when the minter is set.

solidity
event SetMinter(address indexed minter);

Parameters

NameTypeDescription
minteraddressThe new minter address

SetStaker

Emitted when the staker is set.

solidity
event SetStaker(address indexed staker);

Parameters

NameTypeDescription
stakeraddressThe new staker address

Transfer

Emitted when tokens are transferred.

solidity
event Transfer(address indexed from, address indexed to, uint256 value);

Parameters

NameTypeDescription
fromaddressThe sender address
toaddressThe recipient address
valueuint256The amount transferred

WhitelistSender

Emitted when a sender is whitelisted or removed.

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

Parameters

NameTypeDescription
senderaddressThe sender address
approvedboolWhether whitelisted or removed

Errors

ZeroAddress

solidity
error ZeroAddress();

Thrown when attempting to initialize with a zero address.

UnauthorizedETHTransfer

solidity
error UnauthorizedETHTransfer();

Thrown when attempting an unauthorized ETH transfer.

VotesExpiredSignature

solidity
error VotesExpiredSignature(uint256 expiry);

Thrown when attempting to use an expired signature for voting.

Parameters

NameTypeDescription
expiryuint256The expiry timestamp of the signature