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
holder
address
undefined
spender
address
undefined
Returns
_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
spender
address
undefined
value
uint256
undefined
Returns
_0
bool
undefined
authorizeOperator
function authorizeOperator(address operator) external nonpayable
See {IERC777-authorizeOperator}.
Parameters
operator
address
undefined
balanceOf
function balanceOf(address tokenHolder) external view returns (uint256)
Returns the amount of tokens owned by an account (tokenHolder
).
Parameters
tokenHolder
address
undefined
Returns
_0
uint256
undefined
burn
function burn(uint256 amount, bytes data) external nonpayable
See {IERC777-burn}. Also emits a {IERC20-Transfer} event for ERC20 compatibility.
Parameters
amount
uint256
undefined
data
bytes
undefined
decimals
function decimals() external pure returns (uint8)
See {ERC20-decimals}. Always returns 18, as per the ERC777 EIP.
Returns
_0
uint8
undefined
defaultOperators
function defaultOperators() external view returns (address[])
See {IERC777-defaultOperators}.
Returns
_0
address[]
undefined
granularity
function granularity() external view returns (uint256)
See {IERC777-granularity}. This implementation always returns 1
.
Returns
_0
uint256
undefined
isOperatorFor
function isOperatorFor(address operator, address tokenHolder) external view returns (bool)
See {IERC777-isOperatorFor}.
Parameters
operator
address
undefined
tokenHolder
address
undefined
Returns
_0
bool
undefined
name
function name() external view returns (string)
See {IERC777-name}.
Returns
_0
string
undefined
operatorBurn
function operatorBurn(address account, uint256 amount, bytes data, bytes operatorData) external nonpayable
See {IERC777-operatorBurn}. Emits {Burned} and {IERC20-Transfer} events.
Parameters
account
address
undefined
amount
uint256
undefined
data
bytes
undefined
operatorData
bytes
undefined
operatorSend
function operatorSend(address sender, address recipient, uint256 amount, bytes data, bytes operatorData) external nonpayable
See {IERC777-operatorSend}. Emits {Sent} and {IERC20-Transfer} events.
Parameters
sender
address
undefined
recipient
address
undefined
amount
uint256
undefined
data
bytes
undefined
operatorData
bytes
undefined
revokeOperator
function revokeOperator(address operator) external nonpayable
See {IERC777-revokeOperator}.
Parameters
operator
address
undefined
send
function send(address recipient, uint256 amount, bytes data) external nonpayable
See {IERC777-send}. Also emits a {IERC20-Transfer} event for ERC20 compatibility.
Parameters
recipient
address
undefined
amount
uint256
undefined
data
bytes
undefined
symbol
function symbol() external view returns (string)
See {IERC777-symbol}.
Returns
_0
string
undefined
totalSupply
function totalSupply() external view returns (uint256)
See {IERC777-totalSupply}.
Returns
_0
uint256
undefined
transfer
function transfer(address recipient, uint256 amount) external nonpayable returns (bool)
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
recipient
address
undefined
amount
uint256
undefined
Returns
_0
bool
undefined
transferFrom
function transferFrom(address holder, address recipient, uint256 amount) external nonpayable returns (bool)
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
holder
address
undefined
recipient
address
undefined
amount
uint256
undefined
Returns
_0
bool
undefined
Events
Approval
event Approval(address indexed owner, address indexed spender, uint256 value)
Parameters
owner indexed
address
undefined
spender indexed
address
undefined
value
uint256
undefined
AuthorizedOperator
event AuthorizedOperator(address indexed operator, address indexed tokenHolder)
Parameters
operator indexed
address
undefined
tokenHolder indexed
address
undefined
Burned
event Burned(address indexed operator, address indexed from, uint256 amount, bytes data, bytes operatorData)
Parameters
operator indexed
address
undefined
from indexed
address
undefined
amount
uint256
undefined
data
bytes
undefined
operatorData
bytes
undefined
Minted
event Minted(address indexed operator, address indexed to, uint256 amount, bytes data, bytes operatorData)
Parameters
operator indexed
address
undefined
to indexed
address
undefined
amount
uint256
undefined
data
bytes
undefined
operatorData
bytes
undefined
RevokedOperator
event RevokedOperator(address indexed operator, address indexed tokenHolder)
Parameters
operator indexed
address
undefined
tokenHolder indexed
address
undefined
Sent
event Sent(address indexed operator, address indexed from, address indexed to, uint256 amount, bytes data, bytes operatorData)
Parameters
operator indexed
address
undefined
from indexed
address
undefined
to indexed
address
undefined
amount
uint256
undefined
data
bytes
undefined
operatorData
bytes
undefined
Transfer
event Transfer(address indexed from, address indexed to, uint256 value)
Parameters
from indexed
address
undefined
to indexed
address
undefined
value
uint256
undefined
Last updated