Skip to main content

Tribe

Functions

constructor

function constructor(
address account,
address minter_
) public

Construct a new Tribe token

Parameters

NameTypeDescription
accountaddressThe initial account to grant all the tokens
minter_addressThe account with minting ability

setMinter

function setMinter(
address minter_
) external

Change the minter address

Parameters

NameTypeDescription
minter_addressThe address of the new minter

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

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

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
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

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
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

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

transfer

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

Transfer amount 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 amount 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

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

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

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

_delegate

function _delegate(
address delegator,
address delegatee
) internal

Parameters

NameTypeDescription
delegatoraddress
delegateeaddress

_transferTokens

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

Parameters

NameTypeDescription
srcaddress
dstaddress
amountuint96

_moveDelegates

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

Parameters

NameTypeDescription
srcRepaddress
dstRepaddress
amountuint96

_writeCheckpoint

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

Parameters

NameTypeDescription
delegateeaddress
nCheckpointsuint32
oldVotesuint96
newVotesuint96

safe32

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

Parameters

NameTypeDescription
nuint256
errorMessagestring

safe96

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

Parameters

NameTypeDescription
nuint256
errorMessagestring

add96

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

Parameters

NameTypeDescription
auint96
buint96
errorMessagestring

sub96

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

Parameters

NameTypeDescription
auint96
buint96
errorMessagestring

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
minteraddress
newMinteraddress

DelegateChanged

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

An event thats emitted when an account changes its delegate

Parameters

NameTypeDescription
delegatoraddress
fromDelegateaddress
toDelegateaddress

DelegateVotesChanged

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

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

Parameters

NameTypeDescription
delegateaddress
previousBalanceuint256
newBalanceuint256

Transfer

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

The standard EIP-20 transfer event

Parameters

NameTypeDescription
fromaddress
toaddress
amountuint256

Approval

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

The standard EIP-20 approval event

Parameters

NameTypeDescription
owneraddress
spenderaddress
amountuint256