HIFI is an ERC-20 token enabling its owner to assign voting rights to any address, including their own. Alterations in an owner's token balance automatically adjust the delegate's voting rights, ensuring a dynamic, transparent, and responsive governance process for the DAO.
Constant Functionsโ allowanceโ function allowance( address account, address spender ) external returns (uint256)
Copy Get the number of tokens spender
is approved to spend on behalf of account
Parametersโ Name Type Description account
address The address of the account holding the funds spender
address The address of the account spending the funds
Return Valuesโ Name Type Description [0]
uint256 The number of tokens approved
balanceOfโ function balanceOf( address account ) external returns (uint256)
Copy Get the number of tokens held by the account
Parametersโ Name Type Description account
address The address of the account to get the balance of
Return Valuesโ Name Type Description [0]
uint256 The number of tokens held
getCurrentVotesโ function getCurrentVotes( address account ) external returns (uint96)
Copy Gets the current votes balance for account
Parametersโ Name Type Description account
address The address to get votes balance
Return Valuesโ Name Type Description [0]
uint96 The number of current votes for account
getPriorVotesโ function getPriorVotes( address account, uint256 blockNumber ) public returns (uint96)
Copy Determine the prior number of votes for an account as of a block number. The block number must be a finalized block or else this function will revert to prevent misinformation.
Parametersโ Name Type Description account
address The address of the account to check blockNumber
uint256 The block number to get the vote balance at
Return Valuesโ Name Type Description [0]
uint96 The number of votes the account had as of the given block
totalSupplyโ Get the total number of tokens in existence
function totalSupply() external returns (uint256)
Copy Non-Constant Functionsโ approveโ function approve( address spender, uint256 rawAmount ) external returns (bool)
Copy Approve spender
to transfer up to rawAmount
from msg.sender
. This will overwrite the approval amount for spender
and is subject to issues noted here
Parametersโ Name Type Description spender
address The address of the account which may transfer tokens rawAmount
uint256 The number of tokens that are approved (2^256-1 means infinite)
Return Valuesโ Name Type Description [0]
bool Whether or not the approval succeeded
function burn( uint256 rawAmount ) external
Copy Destroys rawAmount
tokens from the caller
Parametersโ Name Type Description rawAmount
uint256 The number of tokens to burn
burnFromโ function burnFrom( address account, uint256 rawAmount ) external
Copy Destroys rawAmount
tokens from account
, deducting from the caller's allowance
Parametersโ Name Type Description account
address The address of the account to burn from rawAmount
uint256 The number of tokens to burn
delegateโ function delegate( address delegatee ) public
Copy Delegate votes from msg.sender
to delegatee
Parametersโ Name Type Description delegatee
address The address to delegate votes to
delegateBySigโ function delegateBySig( address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s ) public
Copy Delegates votes from signatory to delegatee
Parametersโ Name Type Description delegatee
address The address to delegate votes to nonce
uint256 The contract state required to match the signature expiry
uint256 The time at which to expire the signature v
uint8 The recovery byte of the signature r
bytes32 Half of the ECDSA signature pair s
bytes32 Half of the ECDSA signature pair
function mint( address dst, uint256 rawAmount ) external
Copy Mint new tokens
Parametersโ Name Type Description dst
address The address of the destination account rawAmount
uint256 The number of tokens to be minted
function permit( address owner, address spender, uint256 rawAmount, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external
Copy Approve by signature. For more details, see https://eips.ethereum.org/EIPS/eip-2612 .
Parametersโ Name Type Description owner
address The address to approve from spender
address The address to be approved rawAmount
uint256 The number of tokens that are approved (2^256-1 means infinite) deadline
uint256 The time at which to expire the signature v
uint8 The recovery byte of the signature r
bytes32 Half of the ECDSA signature pair s
bytes32 Half of the ECDSA signature pair
setMinterโ function setMinter( address minter_ ) external
Copy Change the minter address
Parametersโ Name Type Description minter_
address The address of the new minter
function swap( uint256 mftAmount ) external
Copy Swap MFT tokens for Hifi
Parametersโ Name Type Description mftAmount
uint256 The amount of MFT to swap
transferโ function transfer( address dst, uint256 rawAmount ) external returns (bool)
Copy Transfer rawAmount
tokens from msg.sender
to dst
Parametersโ Name Type Description dst
address The address of the destination account rawAmount
uint256 The number of tokens to transfer
Return Valuesโ Name Type Description [0]
bool Whether or not the transfer succeeded
transferFromโ function transferFrom( address src, address dst, uint256 rawAmount ) external returns (bool)
Copy Transfer rawAmount
tokens from src
to dst
Parametersโ Name Type Description src
address The address of the source account dst
address The address of the destination account rawAmount
uint256 The number of tokens to transfer
Return Valuesโ Name Type Description [0]
bool Whether or not the transfer succeeded
Approvalโ event Approval( address owner, address spender, uint256 amount )
Copy The standard EIP-20 approval event
Parametersโ Name Type Description owner
address The address of the account that owns the tokens spender
address The address of the account to spend the tokens amount
uint256 The number of tokens approved to spend
DelegateChangedโ event DelegateChanged( address delegator, address fromDelegate, address toDelegate )
Copy An event thats emitted when an account changes its delegate
Parametersโ Name Type Description delegator
address The address which delegated votes fromDelegate
address The previous address delegated to toDelegate
address The new address delegated to
DelegateVotesChangedโ event DelegateVotesChanged( address delegate, uint256 previousBalance, uint256 newBalance )
Copy An event thats emitted when a delegate account's vote balance changes
Parametersโ Name Type Description delegate
address The address that delegated votes are cast to previousBalance
uint256 The previous balance of votes for delegate
newBalance
uint256 The new balance of votes for delegate
MinterChangedโ event MinterChanged( address minter, address newMinter )
Copy An event thats emitted when the minter address is changed
Parametersโ Name Type Description minter
address The address of the previous minter newMinter
address The address of the new minter
event Swap( address sender, uint256 mftAmount, uint256 hifiAmount )
Copy An event thats emitted when MFT tokens are swapped for HIFI
Parametersโ Name Type Description sender
address The address of the sender mftAmount
uint256 The amount of MFT swapped hifiAmount
uint256 The amount of HIFI received
Transferโ event Transfer( address from, address to, uint256 amount )
Copy The standard EIP-20 transfer event
Parametersโ Name Type Description from
address The address of the sender to
address The address of the receiver amount
uint256 The amount of tokens sent