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 accountaddress The address of the account holding the funds spenderaddress 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 accountaddress 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 accountaddress 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 accountaddress The address of the account to check blockNumberuint256 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 spenderaddress The address of the account which may transfer tokens rawAmountuint256 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 rawAmountuint256 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 accountaddress The address of the account to burn from rawAmountuint256 The number of tokens to burn
delegateโ function delegate( address delegatee ) public Copy Delegate votes from msg.sender to delegatee
Parametersโ Name Type Description delegateeaddress 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 delegateeaddress The address to delegate votes to nonceuint256 The contract state required to match the signature expiryuint256 The time at which to expire the signature vuint8 The recovery byte of the signature rbytes32 Half of the ECDSA signature pair sbytes32 Half of the ECDSA signature pair
function mint( address dst, uint256 rawAmount ) external Copy Mint new tokens
Parametersโ Name Type Description dstaddress The address of the destination account rawAmountuint256 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 owneraddress The address to approve from spenderaddress The address to be approved rawAmountuint256 The number of tokens that are approved (2^256-1 means infinite) deadlineuint256 The time at which to expire the signature vuint8 The recovery byte of the signature rbytes32 Half of the ECDSA signature pair sbytes32 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 mftAmountuint256 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 dstaddress The address of the destination account rawAmountuint256 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 srcaddress The address of the source account dstaddress The address of the destination account rawAmountuint256 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 owneraddress The address of the account that owns the tokens spenderaddress The address of the account to spend the tokens amountuint256 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 delegatoraddress The address which delegated votes fromDelegateaddress The previous address delegated to toDelegateaddress 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 delegateaddress The address that delegated votes are cast to previousBalanceuint256 The previous balance of votes for delegate newBalanceuint256 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 minteraddress The address of the previous minter newMinteraddress 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 senderaddress The address of the sender mftAmountuint256 The amount of MFT swapped hifiAmountuint256 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 fromaddress The address of the sender toaddress The address of the receiver amountuint256 The amount of tokens sent