ERC 777

Implementation of the {IERC777} interface. This implementation is agnostic to the way tokens are created. This means that a supply mechanism has to be added in a derived contract using {_mint}. Support for ERC20 is included in this contract, as specified by the EIP: both the ERC777 and ERC20 interfaces can be safely used when interacting with it. Both {IERC777-Sent} and {IERC20-Transfer} events are emitted on token movements. Additionally, the {IERC777-granularity} value is hard-coded to 1, meaning that there are no special restrictions in the amount of tokens that created, moved, or destroyed. This makes integration with ERC20 applications seamless.

Methods

allowance

function allowance(address holder, address spender) external view returns (uint256)

See {IERC20-allowance}. Note that operator and allowance concepts are orthogonal: operators may not have allowance, and accounts with allowance may not be operators themselves.

Parameters

Name
Type
Description

holder

address

undefined

spender

address

undefined

Returns

Name
Type
Description

_0

uint256

undefined

approve

function approve(address spender, uint256 value) external nonpayable returns (bool)

See {IERC20-approve}. Note that accounts cannot have allowance issued by their operators.

Parameters

Name
Type
Description

spender

address

undefined

value

uint256

undefined

Returns

Name
Type
Description

_0

bool

undefined

authorizeOperator

See {IERC777-authorizeOperator}.

Parameters

Name
Type
Description

operator

address

undefined

balanceOf

Returns the amount of tokens owned by an account (tokenHolder).

Parameters

Name
Type
Description

tokenHolder

address

undefined

Returns

Name
Type
Description

_0

uint256

undefined

burn

See {IERC777-burn}. Also emits a {IERC20-Transfer} event for ERC20 compatibility.

Parameters

Name
Type
Description

amount

uint256

undefined

data

bytes

undefined

decimals

See {ERC20-decimals}. Always returns 18, as per the ERC777 EIP.

Returns

Name
Type
Description

_0

uint8

undefined

defaultOperators

See {IERC777-defaultOperators}.

Returns

Name
Type
Description

_0

address[]

undefined

granularity

See {IERC777-granularity}. This implementation always returns 1.

Returns

Name
Type
Description

_0

uint256

undefined

isOperatorFor

See {IERC777-isOperatorFor}.

Parameters

Name
Type
Description

operator

address

undefined

tokenHolder

address

undefined

Returns

Name
Type
Description

_0

bool

undefined

name

See {IERC777-name}.

Returns

Name
Type
Description

_0

string

undefined

operatorBurn

See {IERC777-operatorBurn}. Emits {Burned} and {IERC20-Transfer} events.

Parameters

Name
Type
Description

account

address

undefined

amount

uint256

undefined

data

bytes

undefined

operatorData

bytes

undefined

operatorSend

See {IERC777-operatorSend}. Emits {Sent} and {IERC20-Transfer} events.

Parameters

Name
Type
Description

sender

address

undefined

recipient

address

undefined

amount

uint256

undefined

data

bytes

undefined

operatorData

bytes

undefined

revokeOperator

See {IERC777-revokeOperator}.

Parameters

Name
Type
Description

operator

address

undefined

send

See {IERC777-send}. Also emits a {IERC20-Transfer} event for ERC20 compatibility.

Parameters

Name
Type
Description

recipient

address

undefined

amount

uint256

undefined

data

bytes

undefined

symbol

See {IERC777-symbol}.

Returns

Name
Type
Description

_0

string

undefined

totalSupply

See {IERC777-totalSupply}.

Returns

Name
Type
Description

_0

uint256

undefined

transfer

See {IERC20-transfer}. Unlike send, recipient is not required to implement the {IERC777Recipient} interface if it is a contract. Also emits a {Sent} event.

Parameters

Name
Type
Description

recipient

address

undefined

amount

uint256

undefined

Returns

Name
Type
Description

_0

bool

undefined

transferFrom

See {IERC20-transferFrom}. Note that operator and allowance concepts are orthogonal: operators cannot call transferFrom (unless they have allowance), and accounts with allowance cannot call operatorSend (unless they are operators). Emits {Sent}, {IERC20-Transfer} and {IERC20-Approval} events.

Parameters

Name
Type
Description

holder

address

undefined

recipient

address

undefined

amount

uint256

undefined

Returns

Name
Type
Description

_0

bool

undefined

Events

Approval

Parameters

Name
Type
Description

owner indexed

address

undefined

spender indexed

address

undefined

value

uint256

undefined

AuthorizedOperator

Parameters

Name
Type
Description

operator indexed

address

undefined

tokenHolder indexed

address

undefined

Burned

Parameters

Name
Type
Description

operator indexed

address

undefined

from indexed

address

undefined

amount

uint256

undefined

data

bytes

undefined

operatorData

bytes

undefined

Minted

Parameters

Name
Type
Description

operator indexed

address

undefined

to indexed

address

undefined

amount

uint256

undefined

data

bytes

undefined

operatorData

bytes

undefined

RevokedOperator

Parameters

Name
Type
Description

operator indexed

address

undefined

tokenHolder indexed

address

undefined

Sent

Parameters

Name
Type
Description

operator indexed

address

undefined

from indexed

address

undefined

to indexed

address

undefined

amount

uint256

undefined

data

bytes

undefined

operatorData

bytes

undefined

Transfer

Parameters

Name
Type
Description

from indexed

address

undefined

to indexed

address

undefined

value

uint256

undefined

Last updated