Zen

Functions

constructor

function constructor(
    address account,
    address minter_
) public

Construct a new Zen token

Parameters

NameTypeDescription

account

address

The initial account to grant all the tokens

minter_

address

The account with minting ability

setMinter

function setMinter(
    address minter_
) external

Change the minter address

Parameters

NameTypeDescription

minter_

address

The address of the new minter

mint

function mint(
    address dst,
    uint256 rawAmount
) external

Mint new tokens

Parameters

NameTypeDescription

dst

address

The address of the destination account

rawAmount

uint256

The number of tokens to be minted

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

account

address

The address of the account holding the funds

spender

address

The address of the account spending the funds

Return Values

NameTypeDescription

[0]

uint256

The number of tokens approved

approve

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

Approve spender to transfer up to amount from src

This will overwrite the approval amount for spender and is subject to issues noted here

Parameters

NameTypeDescription

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

NameTypeDescription

[0]

bool

Whether or not the approval succeeded

permit

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

Triggers an approval from owner to spends

Parameters

NameTypeDescription

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

balanceOf

function balanceOf(
    address account
) external returns (uint256)

Get the number of tokens held by the account

Parameters

NameTypeDescription

account

address

The address of the account to get the balance of

Return Values

NameTypeDescription

[0]

uint256

The number of tokens held

transfer

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

Transfer amount tokens from msg.sender to dst

Parameters

NameTypeDescription

dst

address

The address of the destination account

rawAmount

uint256

The number of tokens to transfer

Return Values

NameTypeDescription

[0]

bool

Whether or not the transfer succeeded

transferFrom

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

Transfer amount tokens from src to dst

Parameters

NameTypeDescription

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

NameTypeDescription

[0]

bool

Whether or not the transfer succeeded

delegate

function delegate(
    address delegatee
) public

Delegate votes from msg.sender to delegatee

Parameters

NameTypeDescription

delegatee

address

The 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

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

getCurrentVotes

function getCurrentVotes(
    address account
) external returns (uint96)

Gets the current votes balance for account

Parameters

NameTypeDescription

account

address

The address to get votes balance

Return Values

NameTypeDescription

[0]

uint96

The 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

Block number must be a finalized block or else this function will revert to prevent misinformation.

Parameters

NameTypeDescription

account

address

The address of the account to check

blockNumber

uint256

The block number to get the vote balance at

Return Values

NameTypeDescription

[0]

uint96

The number of votes the account had as of the given block

_delegate

function _delegate(
    address delegator,
    address delegatee
) internal

Parameters

NameTypeDescription

delegator

address

delegatee

address

_transferTokens

function _transferTokens(
    address src,
    address dst,
    uint96 amount
) internal

Parameters

NameTypeDescription

src

address

dst

address

amount

uint96

_moveDelegates

function _moveDelegates(
    address srcRep,
    address dstRep,
    uint96 amount
) internal

Parameters

NameTypeDescription

srcRep

address

dstRep

address

amount

uint96

_writeCheckpoint

function _writeCheckpoint(
    address delegatee,
    uint32 nCheckpoints,
    uint96 oldVotes,
    uint96 newVotes
) internal

Parameters

NameTypeDescription

delegatee

address

nCheckpoints

uint32

oldVotes

uint96

newVotes

uint96

safe32

function safe32(
    uint256 n,
    string errorMessage
) internal returns (uint32)

Parameters

NameTypeDescription

n

uint256

errorMessage

string

safe96

function safe96(
    uint256 n,
    string errorMessage
) internal returns (uint96)

Parameters

NameTypeDescription

n

uint256

errorMessage

string

add96

function add96(
    uint96 a,
    uint96 b,
    string errorMessage
) internal returns (uint96)

Parameters

NameTypeDescription

a

uint96

b

uint96

errorMessage

string

sub96

function sub96(
    uint96 a,
    uint96 b,
    string errorMessage
) internal returns (uint96)

Parameters

NameTypeDescription

a

uint96

b

uint96

errorMessage

string

getChainId

function getChainId() internal returns (uint256)

Events

MinterChanged

event MinterChanged(
    address minter,
    address newMinter
)

An event thats emitted when the minter address is changed

Parameters

NameTypeDescription

minter

address

newMinter

address

### DelegateChanged

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

An event thats emitted when an account changes its delegate

Parameters

NameTypeDescription

delegator

address

fromDelegate

address

toDelegate

address

### DelegateVotesChanged

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

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

Parameters

NameTypeDescription

delegate

address

previousBalance

uint256

newBalance

uint256

### Transfer

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

The standard EIP-20 transfer event

Parameters

NameTypeDescription

from

address

to

address

amount

uint256

### Approval

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

The standard EIP-20 approval event

Parameters

NameTypeDescription

owner

address

spender

address

amount

uint256

Last updated