Solidity API

VOT3

This contract governs the issuance and management of VOT3 tokens, which are the tokens used for voting in the VeBetter DAO Ecosystem.

Extends ERC20 Fungible Token Standard basic implementation with upgradeability, pausability, ability for gasless transactions and governance capabilities.

UPGRADER_ROLE

bytes32 UPGRADER_ROLE

Role hash for addresses allowed to upgrade the contract

PAUSER_ROLE

bytes32 PAUSER_ROLE

VOT3Storage

Storage structure for VOT3 contract

VOT3Storage structure holds all the state variables in a single location.

struct VOT3Storage {
  contract IERC20 b3tr;
  mapping(address => uint256) _convertedB3TR;
}

constructor

constructor() public

initialize

function initialize(address _admin, address _upgrader, address _pauser, address _b3tr) external

Initializes the VOT3 token

Sets initial values for all relevant contract properties and state variables.

Parameters

Name Type Description
_admin address Address to grant admin roles
_upgrader address Address to grant upgrader roles
_pauser address Address to grant pauser roles
_b3tr address B3TR token contract address

pause

function pause() external

Pauses the VOT3 contract

pausing the contract will prevent minting, staking, upgrading, and transferring of tokens Only callable by the admin role

unpause

function unpause() external

Unpauses the VOT3 contract

Only callable by the admin role

_authorizeUpgrade

function _authorizeUpgrade(address newImplementation) internal

Authorized upgrading of the contract implementation Only callable by the upgrader role

Parameters

Name Type Description
newImplementation address Address of the new contract implementation

convertedB3trOf

function convertedB3trOf(address account) external view returns (uint256)

Retrieves the number of converted B3TR tokens for a specific user

Parameters

Name Type Description
account address Address of the user to check

Return Values

Name Type Description
[0] uint256 uint256 The amount of converted tokens

convertToVOT3

function convertToVOT3(uint256 amount) external

Convert B3TR tokens in exchange for VOT3 tokens

Converts B3TR tokens and mints VOT3 tokens in return

Parameters

Name Type Description
amount uint256 Amount of B3TR tokens to convert

convertToB3TR

function convertToB3TR(uint256 amount) external

Convert VOT3 previously converted back to B3TR tokens

Burns VOT3 tokens and transfers B3TR tokens in return

Parameters

Name Type Description
amount uint256 Amount of VOT3 tokens to convert

transfer

function transfer(address to, uint256 value) public returns (bool)

Transfer VOT3 tokens to a specific address

Override of the ERC20 transferFrom function

Parameters

Name Type Description
to address Address to transfer to
value uint256 Amount of VOT3 tokens to transfer

Return Values

Name Type Description
[0] bool True if transfer was successful

approve

function approve(address spender, uint256 value) public returns (bool)

Approve the transfer of VOT3 tokens to a specific address

Override of the ERC20 transferFrom function

Parameters

Name Type Description
spender address Address to approve
value uint256 Amount of VOT3 tokens to approve

Return Values

Name Type Description
[0] bool True if approval was successful

transferFrom

function transferFrom(address from, address to, uint256 value) public returns (bool)

Transfer VOT3 tokens from one address to another

Override of the ERC20 transferFrom function

Parameters

Name Type Description
from address Address to transfer from
to address Address to transfer to
value uint256 Amount of VOT3 tokens to transfer

Return Values

Name Type Description
[0] bool True if transfer was successful

_update

function _update(address from, address to, uint256 amount) internal

_Updates the token balance of the sender and receiver upon transfer Overrides the update function to self-delegate if the user is neither unstaking nor has delegated previously nor burning tokens

Parameters

Name Type Description
from address Address to transfer from
to address Address to transfer to
amount uint256 Amount of tokens to transfer

nonces

function nonces(address owner) public view virtual returns (uint256)

Overridees nonnces for ERC20PermitUpgradeable and NoncesUpgradeable

delegate

function delegate(address delegatee) public

Delegates the voting power of the caller to another address

Can only be called when the contract is not paused

Parameters

Name Type Description
delegatee address The address to which the caller’s voting power will be delegated

b3tr

function b3tr() public view returns (contract IERC20)

Gets the B3TR token contract address

getQuadraticVotingPower

function getQuadraticVotingPower(address account) public view returns (uint256)

Calculates the current quadratic voting power of an account

The quadratic voting power is calculated as the square root of the number of votes the account has

Parameters

Name Type Description
account address The address to calculate the voting power for

Return Values

Name Type Description
[0] uint256 uint256 The current quadratic voting power

getPastQuadraticVotingPower

function getPastQuadraticVotingPower(address account, uint256 timepoint) public view returns (uint256)

Calculates the quadratic voting power of an account at a specific past block

The quadratic voting power is calculated as the square root of the number of votes the account had at the specified block

Parameters

Name Type Description
account address The address to calculate the voting power for
timepoint uint256 The block number to get the past votes from

Return Values

Name Type Description
[0] uint256 uint256 The past quadratic voting power

version

function version() public pure virtual returns (string)

Returns the version of the contract

This should be updated every time a new version of implementation is deployed

Return Values

Name Type Description
[0] string string The version of the contract