Skip to main content

HIFI

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)

Get the number of tokens spender is approved to spend on behalf of account

Parameters

NameTypeDescription
accountaddressThe address of the account holding the funds
spenderaddressThe address of the account spending the funds

Return Values

NameTypeDescription
[0]uint256The number of tokens approved

balanceOf

function balanceOf(
address account
) external returns (uint256)

Get the number of tokens held by the account

Parameters

NameTypeDescription
accountaddressThe address of the account to get the balance of

Return Values

NameTypeDescription
[0]uint256The number of tokens held

getCurrentVotes

function getCurrentVotes(
address account
) external returns (uint96)

Gets the current votes balance for account

Parameters

NameTypeDescription
accountaddressThe address to get votes balance

Return Values

NameTypeDescription
[0]uint96The number of current votes for account

getPriorVotes

function getPriorVotes(
address account,
uint256 blockNumber
) public returns (uint96)

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

NameTypeDescription
accountaddressThe address of the account to check
blockNumberuint256The block number to get the vote balance at

Return Values

NameTypeDescription
[0]uint96The 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)

Non-Constant Functions

approve

function approve(
address spender,
uint256 rawAmount
) external returns (bool)

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

NameTypeDescription
spenderaddressThe address of the account which may transfer tokens
rawAmountuint256The number of tokens that are approved (2^256-1 means infinite)

Return Values

NameTypeDescription
[0]boolWhether or not the approval succeeded

burn

function burn(
uint256 rawAmount
) external

Destroys rawAmount tokens from the caller

Parameters

NameTypeDescription
rawAmountuint256The number of tokens to burn

burnFrom

function burnFrom(
address account,
uint256 rawAmount
) external

Destroys rawAmount tokens from account, deducting from the caller's allowance

Parameters

NameTypeDescription
accountaddressThe address of the account to burn from
rawAmountuint256The number of tokens to burn

delegate

function delegate(
address delegatee
) public

Delegate votes from msg.sender to delegatee

Parameters

NameTypeDescription
delegateeaddressThe address to delegate votes to

delegateBySig

function delegateBySig(
address delegatee,
uint256 nonce,
uint256 expiry,
uint8 v,
bytes32 r,
bytes32 s
) public

Delegates votes from signatory to delegatee

Parameters

NameTypeDescription
delegateeaddressThe address to delegate votes to
nonceuint256The contract state required to match the signature
expiryuint256The time at which to expire the signature
vuint8The recovery byte of the signature
rbytes32Half of the ECDSA signature pair
sbytes32Half of the ECDSA signature pair

mint

function mint(
address dst,
uint256 rawAmount
) external

Mint new tokens

Parameters

NameTypeDescription
dstaddressThe address of the destination account
rawAmountuint256The number of tokens to be minted

permit

function permit(
address owner,
address spender,
uint256 rawAmount,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external

Approve by signature. For more details, see https://eips.ethereum.org/EIPS/eip-2612.

Parameters

NameTypeDescription
owneraddressThe address to approve from
spenderaddressThe address to be approved
rawAmountuint256The number of tokens that are approved (2^256-1 means infinite)
deadlineuint256The time at which to expire the signature
vuint8The recovery byte of the signature
rbytes32Half of the ECDSA signature pair
sbytes32Half of the ECDSA signature pair

setMinter

function setMinter(
address minter_
) external

Change the minter address

Parameters

NameTypeDescription
minter_addressThe address of the new minter

swap

function swap(
uint256 mftAmount
) external

Swap MFT tokens for Hifi

Parameters

NameTypeDescription
mftAmountuint256The amount of MFT to swap

transfer

function transfer(
address dst,
uint256 rawAmount
) external returns (bool)

Transfer rawAmount tokens from msg.sender to dst

Parameters

NameTypeDescription
dstaddressThe address of the destination account
rawAmountuint256The number of tokens to transfer

Return Values

NameTypeDescription
[0]boolWhether or not the transfer succeeded

transferFrom

function transferFrom(
address src,
address dst,
uint256 rawAmount
) external returns (bool)

Transfer rawAmount tokens from src to dst

Parameters

NameTypeDescription
srcaddressThe address of the source account
dstaddressThe address of the destination account
rawAmountuint256The number of tokens to transfer

Return Values

NameTypeDescription
[0]boolWhether or not the transfer succeeded

Events

Approval

event Approval(
address owner,
address spender,
uint256 amount
)

The standard EIP-20 approval event

Parameters

NameTypeDescription
owneraddressThe address of the account that owns the tokens
spenderaddressThe address of the account to spend the tokens
amountuint256The number of tokens approved to spend

DelegateChanged

event DelegateChanged(
address delegator,
address fromDelegate,
address toDelegate
)

An event thats emitted when an account changes its delegate

Parameters

NameTypeDescription
delegatoraddressThe address which delegated votes
fromDelegateaddressThe previous address delegated to
toDelegateaddressThe new address delegated to

DelegateVotesChanged

event DelegateVotesChanged(
address delegate,
uint256 previousBalance,
uint256 newBalance
)

An event thats emitted when a delegate account's vote balance changes

Parameters

NameTypeDescription
delegateaddressThe address that delegated votes are cast to
previousBalanceuint256The previous balance of votes for delegate
newBalanceuint256The new balance of votes for delegate

MinterChanged

event MinterChanged(
address minter,
address newMinter
)

An event thats emitted when the minter address is changed

Parameters

NameTypeDescription
minteraddressThe address of the previous minter
newMinteraddressThe address of the new minter

Swap

event Swap(
address sender,
uint256 mftAmount,
uint256 hifiAmount
)

An event thats emitted when MFT tokens are swapped for HIFI

Parameters

NameTypeDescription
senderaddressThe address of the sender
mftAmountuint256The amount of MFT swapped
hifiAmountuint256The amount of HIFI received

Transfer

event Transfer(
address from,
address to,
uint256 amount
)

The standard EIP-20 transfer event

Parameters

NameTypeDescription
fromaddressThe address of the sender
toaddressThe address of the receiver
amountuint256The amount of tokens sent