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.
bytes32 UPGRADER_ROLE
Role hash for addresses allowed to upgrade the contract
bytes32 PAUSER_ROLE
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() public
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.
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 |
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
function unpause() external
Unpauses the VOT3 contract
Only callable by the admin role
function _authorizeUpgrade(address newImplementation) internal
Authorized upgrading of the contract implementation Only callable by the upgrader role
Name | Type | Description |
---|---|---|
newImplementation | address | Address of the new contract implementation |
function convertedB3trOf(address account) external view returns (uint256)
Retrieves the number of converted B3TR tokens for a specific user
Name | Type | Description |
---|---|---|
account | address | Address of the user to check |
Name | Type | Description |
---|---|---|
[0] | uint256 | uint256 The amount of converted tokens |
function convertToVOT3(uint256 amount) external
Convert B3TR tokens in exchange for VOT3 tokens
Converts B3TR tokens and mints VOT3 tokens in return
Name | Type | Description |
---|---|---|
amount | uint256 | Amount of B3TR tokens to convert |
function convertToB3TR(uint256 amount) external
Convert VOT3 previously converted back to B3TR tokens
Burns VOT3 tokens and transfers B3TR tokens in return
Name | Type | Description |
---|---|---|
amount | uint256 | Amount of VOT3 tokens to convert |
function transfer(address to, uint256 value) public returns (bool)
Transfer VOT3 tokens to a specific address
Override of the ERC20 transferFrom function
Name | Type | Description |
---|---|---|
to | address | Address to transfer to |
value | uint256 | Amount of VOT3 tokens to transfer |
Name | Type | Description |
---|---|---|
[0] | bool | True if transfer was successful |
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
Name | Type | Description |
---|---|---|
spender | address | Address to approve |
value | uint256 | Amount of VOT3 tokens to approve |
Name | Type | Description |
---|---|---|
[0] | bool | True if approval was successful |
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
Name | Type | Description |
---|---|---|
from | address | Address to transfer from |
to | address | Address to transfer to |
value | uint256 | Amount of VOT3 tokens to transfer |
Name | Type | Description |
---|---|---|
[0] | bool | True if transfer was successful |
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
Name | Type | Description |
---|---|---|
from | address | Address to transfer from |
to | address | Address to transfer to |
amount | uint256 | Amount of tokens to transfer |
function nonces(address owner) public view virtual returns (uint256)
Overridees nonnces for ERC20PermitUpgradeable and NoncesUpgradeable
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
Name | Type | Description |
---|---|---|
delegatee | address | The address to which the caller’s voting power will be delegated |
function b3tr() public view returns (contract IERC20)
Gets the B3TR token contract address
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
Name | Type | Description |
---|---|---|
account | address | The address to calculate the voting power for |
Name | Type | Description |
---|---|---|
[0] | uint256 | uint256 The current quadratic voting power |
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
Name | Type | Description |
---|---|---|
account | address | The address to calculate the voting power for |
timepoint | uint256 | The block number to get the past votes from |
Name | Type | Description |
---|---|---|
[0] | uint256 | uint256 The past quadratic voting power |
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
Name | Type | Description |
---|---|---|
[0] | string | string The version of the contract |