Ticket

The Ticket extends the standard ERC20 and ControlledToken interfaces with time-weighted average balance functionality. The average balance held by a user between two timestamps can be calculated, as well as the historic balance. The historic total supply is available as well as the average total supply between two timestamps. A user may delegate their balance increasing another user's historic balance while retaining their tokens.

Write methods description

initialize()

Allows to initialize the contract during the deployment. Constructs Ticket with passed parameters.

Parameters:

approve()

Standard ERC20 approve of the ticket token. Sets _amount as the allowance of _spender over the caller's tokens.

Return:

controllerBurn()

Allows the controller to burn tokens from a user account. May be overridden to provide more granular control over burning.

Parameters:

controllerBurnFrom()

Allows an operator via the controller to burn tokens on behalf of a user account. May be overridden to provide more granular control over operator-burning.

Parameters:

controllerMint()

Allows the controller to mint tokens for a user account. May be overridden to provide more granular control over minting.

Parameters:

decreaseAllowance()

Standard ERC20 decreaseAllowance function, atomically decreases the allowance granted to _spender by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}.

Parameters:

Return:

delegate()

Delegate time-weighted average balances to an alternative address. Transfers (including mints) trigger the storage of a TWAB in the delegate(s) account, instead of the targeted sender and/or recipient address(s). To reset the delegate, pass the zero address (0x000) as _to parameter. The current delegate address should be different from the new delegate address _to.

Parameters:

delegateWithSignature()

Allows a user to delegate via signature.

Parameters:

increaseAllowance()

Standard ERC20 increaseAllowance function, atomically increases the allowance granted to _spender by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}.

permit()

Sets _value as the allowance of _spender over _owner's tokens, given _owner's signed approval.

transfer()

Standard ERC20 transfer function, moves _amount tokens from the caller's account to _to. Returns a boolean value indicating whether the operation succeeded.

transferFrom()

Standard ERC20 transferFrom function, moves _amount tokens from _from to _to using the allowance mechanism. _amount is then deducted from the caller's allowance.

Read methods description

DOMAIN_SEPARATOR()

Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.

allowance()

Returns the remaining number of tokens that _spender will be allowed to spend on behalf of _owner through {transferFrom}. This is zero by default. This value changes when {approve} or {transferFrom} are called.

balanceOf()

Returns the amount of tokens owned by _account.

controller()

Interface to the contract responsible for controlling mint/burn.

decimals()

ERC20 controlled token decimals.

delegateOf()

Retrieves the address of the delegate to whom _user has delegated their tickets. The address of the delegate will be the zero address if _user has not delegated their tickets.

Parameters:

getAccountDetails()

Gets a user's TWAB context. This is a struct with their balance, next TWAB index, and cardinality.

Parameters:

getAverageBalanceBetween()

Retrieves the average balance held by a user for a given time frame.

Parameters:

Return:

getAverageBalancesBetween()

Retrieves the average balances held by a user for a given time frames.

Parameters:

Return:

getAverageTotalSuppliesBetween()

Retrieves the average total supply balances for a set of given time frames.

Parameters:

Return:

getBalanceAt()

Retrieves the user's TWAB balance.

Parameters:

Return:

getBalancesAt()

Retrieves the user’s TWAB balances.

Parameters:

Return:

getTotalSuppliesAt()

Retrieves the total supply TWAB balances between the given timestamps range.

Parameters:

Return:

getTotalSupplyAt()

Retrieves the total supply TWAB balance at the given timestamp.

Parameters:

Return:

getTwab()

Gets the TWAB at a specific index for a user.

Parameters:

Return:

name()

Ticket token name.

nonces()

Returns the current nonce for the owner. This value must be included whenever a signature is generated for {permit}. Every successful call to {permit} increases owner's nonce by one. This prevents a signature from being used multiple times.

symbol()

Ticket token symbol.

totalSupply()

Returns the amount of tokens in existence.

Last updated