Skip to main content

SushiToken

This is the contract for the Sushi Token with governance.

The full contract can be found here.

Functions

mint

function mint(address _to, uint256 _amount) public onlyOwner

Creates _amount token to _to. Can only be called by the owner of the contract.

Parameters

NameTypeDescription
_toaddressaddress to push tokens to
_amountuint256amount of tokens to mint

delegates

function delegates(address delegator)
external
view
returns (address)

View function to return the delegatee for the given delegate address.

Parameters

NameTypeDescription
delegatoraddressaddress to get delegatee for

delegate

function delegate(address delegatee) external

Calls the internal _delegate function, which delegates votes from msg.sender to delegatee.

Parameters

NameTypeDescription
delegateeaddressaddress to delegate votes to

delegateBySig

function delegateBySig(
address delegatee,
uint nonce,
uint expiry,
uint8 v,
bytes32 r,
bytes32 s
)
external

Delegates votes from signatory to delegatee.

Parameters

NameTypeDescription
delegateeaddressaddress to delegate votes to
nonceuint256contract state required to match the signature
expiryuint256time at which to expire the signature
vuint8recovery byte of the signature
rbytes32half of the ECDSA signature pair
sbytes32half of the ECDSA signature pair

getCurrentVotes

function getCurrentVotes(address account)
external
view
returns (uint256)

View function that returns the current votes balance for given account.

Parameters

NameTypeDescription
accountaddressaddress to get votes balance

getPriorVotes

function getPriorVotes(address account, uint blockNumber)
external
view
returns (uint256)

Determines the prior number of votes for an account as of a block number.

Parameters

NameTypeDescription
accountaddressaddress of account to check
blockNumberuint256block number to get the vote balance at

_delegate

function _delegate(address delegator, address delegatee)
internal

Internal function called by delegate, which delegates votes from msg.sender to delegatee.

Parameters

NameTypeDescription
delegatoraddressaddress to delegate votes from
delegateeaddressaddress to delegate votes to

_moveDelegates

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

Internal function called by _delegate, it allows one to move their delegate votes from one delegatee to another.

Parameters

NameTypeDescription
srcRepaddressdelegatee you're moving votes from
dstRepaddressdelegatee you're moving votes to
amountuint256amount of votes to move

_writeCheckpoint

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

Internal function called by _moveDelegates, it writes a new checkpoint.

Parameters

NameTypeDescription
delegateeaddressdelegatee to write the checkpoint for
nCheckpointsuint32number of checkpoints used for calculations
oldVotesuint256amount of previous votes for delegatee
newVotesuint256amount of new votes for delegatee