Request form
Cookbook may introduce a token in the future. Share and contribute to be eligible for future airdrops.
close icon
relevant tag icon
ERC777
copy icon
Aman-Ullah
• version 1.0.0
ERC777

ERC777

this is Simple implementation of ERC777 smart contract

*Visit desktop site to download or deploy

Version

1.0.0

Creator

Aman-Ullah

Last Publish

1/11/2023
Any contract you deploy is yours.
Fully owned and controlled by your wallet.
Documentation
Source Code
name() :
This function is used to receive ERC777 tokens. It is triggered when a user sends tokens to a recipient address. The function takes in the sender address, the amount of tokens being sent, and any data associated with the transaction. It then verifies that the sender has enough tokens to send, and if so, it updates the recipient's balance and sends a confirmation event. (autogenerated documentation)
symbol() :
This function is used to receive ERC777 tokens. It is triggered when a user sends ERC777 tokens to a recipient. The function takes in the sender, the amount of tokens sent, and any data associated with the transaction. It then verifies that the sender is authorized to send the tokens, and if so, it updates the recipient's balance and emits an event to notify the sender and recipient of the transaction. (autogenerated documentation)
granularity() :
function receiveERC777(address operator, address from, uint256 amount, bytes calldata data, bytes calldata operatorData) external;This function is used to receive ERC777 tokens from an operator. It takes in the address of the operator, the address of the sender, the amount of tokens being sent, and two byte arrays containing data and operator data. The function is triggered when an operator sends ERC777 tokens to a recipient. (autogenerated documentation)
totalSupply() :
This function is used to receive ERC777 tokens. It is triggered when a user sends ERC777 tokens to a recipient. The function takes in the sender, the amount of tokens being sent, and any data associated with the transaction. It then verifies that the sender has enough tokens to send, and then sends the tokens to the recipient. The function also emits an event to notify the recipient that they have received the tokens. (autogenerated documentation)
balanceOf(address) :
This function is used to receive ERC777 tokens. It is called when a user sends tokens to a recipient. The function takes in the sender, the amount of tokens being sent, and any data associated with the transaction. It then verifies that the sender has enough tokens to send, and then sends the tokens to the recipient. The function also emits an event to notify the recipient that they have received the tokens. (autogenerated documentation)
send(address,uint256) :
function receive(address sender, uint256 amount, bytes calldata data) external;This function is used to receive tokens from a sender. It takes in the address of the sender, the amount of tokens being sent, and any data associated with the transaction. The function is triggered when a token holder sends tokens to a recipient. (autogenerated documentation)
burn(uint256) :
function receiveERC777(address operator, address from, uint256 amount, bytes calldata data, bytes calldata operatorData) external;This function is used to receive ERC777 tokens from an operator. It takes in the address of the operator, the address of the sender, the amount of tokens being sent, and two byte arrays containing data and operator data. The function is triggered when an operator sends tokens to a recipient. (autogenerated documentation)
isOperatorFor(address,address) :
This function is used to receive ERC777 tokens from a sender. It is called by the ERC777 contract when a token transfer is initiated. The function takes in the sender address, the amount of tokens being sent, and any additional data that may be included in the transfer. The function then processes the transfer and returns a boolean value indicating whether or not the transfer was successful. (autogenerated documentation)
authorizeOperator(address) :
This function is used to authorize an operator to perform certain actions on behalf of the token holder. It takes an address of the operator as an argument and adds it to the list of authorized operators. This allows the operator to perform certain actions such as sending and burning tokens on behalf of the token holder. (autogenerated documentation)
revokeOperator(address) :
function receiveERC777(address operator, address from, uint256 amount, bytes calldata data, bytes calldata operatorData) external;This function is used to receive ERC777 tokens from an operator. The operator address is passed in as an argument, as well as the address of the sender, the amount of tokens being sent, and any data associated with the transaction. The operatorData argument is used to provide additional information about the transaction, such as the type of token being sent. The function is triggered when the operator calls the operatorSend() function on the ERC777 contract. (autogenerated documentation)
defaultOperators() :
function receiveERC777(address operator, address from, uint256 amount, bytes calldata data, bytes calldata operatorData) external;This function is used to receive ERC777 tokens from an operator. The operator is the address of the account sending the tokens, the from address is the address of the account sending the tokens, the amount is the amount of tokens being sent, the data is the data associated with the transaction, and the operatorData is the data associated with the operator. The function is triggered when the operator sends the tokens and is used to update the recipient's balance. (autogenerated documentation)
operatorSend(address,address,uint256) :
function receive(address operator, address from, uint256 amount, bytes calldata data, bytes calldata operatorData) external;}This function is used to receive tokens from an ERC777 contract. It takes in the address of the operator, the address of the sender, the amount of tokens being sent, and two byte arrays containing data and operator data. The function is triggered when a token holder sends tokens to a recipient using the ERC777 contract's operatorSend function. (autogenerated documentation)
operatorBurn(address,uint256) :
This function allows an operator to burn tokens from an account. It takes in four parameters: the address of the account, the amount of tokens to be burned, the data associated with the transaction, and the operator data associated with the transaction. The function then emits a Burned event, which contains the operator address, the from address, the amount of tokens burned, the data, and the operator data. (autogenerated documentation)
tokensReceived(address,address,address) :
This function is used to receive tokens from an ERC777 token contract. It is triggered when a token transfer is initiated from an ERC777 token contract. The function takes in six parameters: the address of the operator, the address of the sender, the address of the receiver, the amount of tokens being transferred, the user data associated with the transfer, and the operator data associated with the transfer. The function then processes the transfer and updates the token balances accordingly. (autogenerated documentation)
tokensToSend(address,address,address) :
This function is used to transfer tokens from one address to another. It takes in the address of the operator, the address of the sender, the address of the recipient, the amount of tokens to be sent, and optional data for the user and operator. The function then calls the transferFrom function of the ERC20 contract, which transfers the tokens from the sender's account to the recipient's account. The optional data can be used to store additional information about the transaction. (autogenerated documentation)
transfer(address,uint256) :
This function is used to transfer tokens from one address to another. It takes two parameters, the recipient address and the amount of tokens to be transferred. It returns a boolean value indicating whether the transfer was successful or not. The function also emits two events, Transfer and Approval, which can be used to track the transfer of tokens. Additionally, the function also has two other helper functions, allowance and approve, which are used to check the allowance of a spender and to approve a spender to transfer tokens from the owner's address, respectively. (autogenerated documentation)
allowance(address,address) :
This function is used to perform safe math operations on unsigned integers. It prevents overflow and underflow errors by reverting the transaction if the result of the operation would be an invalid number. It provides functions for addition, subtraction, multiplication, and division. (autogenerated documentation)
approve(address,uint256) :
This function is used to approve a spender to transfer a certain amount of tokens from the owner's account. It works by setting the allowance of the spender to the amount specified in the function call. This allows the spender to transfer the specified amount of tokens from the owner's account without the owner having to manually approve each transfer. The function also emits an Approval event which can be used to track the approval. (autogenerated documentation)
transferFrom(address,address,uint256) :
This function allows for the transfer of tokens from one address to another. It takes three parameters: the address of the sender, the address of the recipient, and the amount of tokens to be transferred. It returns a boolean value indicating whether the transfer was successful or not. The function also emits two events: Transfer and Approval. The Transfer event is triggered when the transfer is successful and it contains the from, to, and value of the transfer. The Approval event is triggered when the transfer is approved and it contains the owner, spender, and value of the transfer. (autogenerated documentation)
add(uint256,uint256) :
This function adds two uint256 values together and returns the result. It uses a require statement to ensure that the result of the addition does not exceed the maximum value of a uint256. If the addition does exceed the maximum value, an error is thrown. (autogenerated documentation)
sub(uint256,uint256) :
This function is an internal function that subtracts two uint256 values and returns the result. It requires that the second value (b) is less than or equal to the first value (a). If this is not the case, an error is thrown. Otherwise, the difference between the two values is calculated and returned. (autogenerated documentation)
mul(uint256,uint256) :
This function is an internal function that multiplies two uint256 numbers and returns the result. It first checks if the first number is 0, and if so, it returns 0. Otherwise, it multiplies the two numbers and checks if the result is valid by dividing the result by the first number and comparing it to the second number. If the result is valid, it returns the result, otherwise it throws an error. (autogenerated documentation)
div(uint256,uint256) :
This function is an internal function that performs a division operation on two unsigned 256-bit integers (uint256). It requires that the divisor (b) is greater than 0, and returns the quotient (c) of the two numbers. It does this by dividing the dividend (a) by the divisor (b). (autogenerated documentation)
mod(uint256,uint256) :
This function is an internal pure function that calculates the modulo of two uint256 numbers. It requires that the second number (b) is not equal to 0, and if it is, it will throw an error. If the second number is not 0, it will return the modulo of the two numbers (a % b). (autogenerated documentation)
isContract(address) :
This function is used to check if a given address is a contract or not. It does this by using the extcodesize opcode to check the size of the code stored at the given address. If the size is greater than 0, then the address is a contract and the function returns true. Otherwise, it returns false. (autogenerated documentation)
toPayable(address) :
This function takes an address as an argument and returns an address payable. It does this by first converting the address to a uint160 and then casting it to an address payable. This allows the address to be used in a payable function. (autogenerated documentation)
setManager(address,address) :
The setManager function allows a user to set a new manager for an account. This is done by passing in the address of the account and the address of the new manager. The function will then update the manager of the account to the new address. The getManager function can then be used to retrieve the address of the manager for the account. The setInterfaceImplementer function allows a user to set an interface implementer for an account. This is done by passing in the address of the account, the hash of the interface, and the address of the implementer. The function will then update the interface implementer of the account to the new address. The getInterfaceImplementer function can then be used to retrieve (autogenerated documentation)
getManager(address) :
This function allows users to set the manager of a given address. The manager is responsible for setting the interface implementer for a given address and interface hash. The manager is also responsible for updating the ERC165 cache for a given address and interface ID. The manager can also check if a given address implements a given ERC165 interface, with or without caching. Finally, the manager can also check if a given address implements a given ERC20 or ERC777 interface. (autogenerated documentation)
setInterfaceImplementer(address,bytes32,address) :
This function sets the interface implementer for a given account and interface hash. It takes in an account address, an interface hash, and an implementer address as parameters. It then stores the implementer address in a mapping, keyed by the account and interface hash. It also emits an InterfaceImplementerSet event to notify any listeners of the change. (autogenerated documentation)
getInterfaceImplementer(address,bytes32) :
This function is used to get the address of the implementer of a given interface. It takes two parameters, an address of an account and a bytes32 interfaceHash. It then returns the address of the implementer of the given interface. The function works by first using the interfaceHash parameter to look up the interface name in the interfaceHash mapping. It then uses the interface name to look up the address of the implementer in the interfaceImplementer mapping. Finally, it returns the address of the implementer. (autogenerated documentation)
interfaceHash(string) :
This function is used to update the ERC165 cache for a given account and interface ID. It is called when an account implements a new interface or changes its implementation of an existing interface. The function takes two parameters: the account address and the interface ID. It then checks if the account has already implemented the interface, and if not, it sets the implementer address for the interface in the ERC165 cache. Finally, it emits an InterfaceImplementerSet event to notify any interested parties of the change. (autogenerated documentation)
updateERC165Cache(address,bytes4) :
This function updates the ERC165 cache for a given account and interfaceId. It checks if the account implements the given interfaceId and if so, it updates the cache to reflect this. The function uses the implementsERC165InterfaceNoCache function to check if the account implements the interfaceId and if so, it emits an InterfaceImplementerSet event with the account, interfaceHash and implementer address. (autogenerated documentation)
implementsERC165Interface(address,bytes4) :
This function implements the ERC165 interface for a given account and interfaceId. It checks if the account implements the interface specified by the interfaceId and returns a boolean value indicating whether or not it does. It does this by checking the account's list of implemented interfaces and comparing it to the interfaceId. If the interfaceId is found in the list, the function returns true, otherwise it returns false. The function also has a no-cache version which does not use any cached data and always checks the account's list of implemented interfaces. (autogenerated documentation)
implementsERC165InterfaceNoCache(address,bytes4) :
This function checks if an account implements a specific ERC165 interface. It does this by checking the InterfaceImplementerSet event logs for the given account and interfaceId. If the event log exists, it returns true, otherwise it returns false. It does not use a cache, so it will always check the event logs for the most up-to-date information. (autogenerated documentation)
requireMultiple(uint256) :
This function is used to check if a given uint256 value is a multiple of a predefined granularity. It does this by using the modulo operator to check if the remainder of the division of the given value by the granularity is equal to 0. If the remainder is not equal to 0, then an error is thrown. (autogenerated documentation)
doSend(address,address,address,uint256,bool) :
This function is used to send tokens from one address to another. It requires the operator, sender, recipient, amount, data, operator data, and a boolean value to prevent locking. It first calls the sender to ensure that the sender has enough tokens to send. It then moves the tokens from the sender to the recipient. Finally, it calls the recipient to ensure that the recipient has received the tokens. (autogenerated documentation)
doBurn(address,address,uint256) :
This function is used to burn tokens from a given address. It requires the operator, token holder, amount, data, and operator data as parameters. It first calls the sender function with the given parameters. It then checks that the amount is valid and that the token holder has enough funds. It then subtracts the amount from the total supply and the token holder's balance. Finally, it emits the Burned and Transfer events. (autogenerated documentation)
callRecipient(address,address,address,uint256,bool) :
This function is used to call the recipient of a token transfer. It takes in the address of the operator, the address of the sender, the address of the recipient, the amount of tokens being transferred, the data associated with the transfer, the operator data associated with the transfer, and a boolean value to indicate whether or not to prevent locking. The function first checks to see if the recipient has an implementation of the ERC777TokensRecipient interface. If so, it calls the tokensReceived() function on the recipient's implementation, passing in the operator, sender, recipient, amount, data, and operator data. If the boolean value is set to true, it also checks to make sure that the recipient is not (autogenerated documentation)
move(address,address,address,uint256) :
This function is used to transfer tokens from one address to another. It requires that the operator has enough funds to complete the transfer, and then subtracts the amount from the from address and adds it to the to address. It then emits two events, Sent and Transfer, to notify the network of the transfer. (autogenerated documentation)
callSender(address,address,address,uint256) :
This function is used to send tokens from one address to another. It takes in 6 parameters: the operator address, the address of the sender, the address of the recipient, the amount of tokens to be sent, user data, and operator data. It first checks if the sender address has an implementation of the IERC777Sender interface, and if so, it calls the tokensToSend() function on the sender implementation, passing in the operator address, sender address, recipient address, amount of tokens, user data, and operator data as parameters. (autogenerated documentation)
approve(address,address,uint256) :
This function is used to approve a certain amount of tokens to be transferred from one address (the holder) to another address (the spender). It requires that the spender address is not the zero address, and then sets the allowance for the holder and spender to the specified value. Finally, it emits an Approval event with the holder, spender, and value as parameters. (autogenerated documentation)
transferOwnership(address) :
This function allows the owner of a contract to transfer ownership of the contract to a new address. It takes in an address as an argument and sets the _ownerAddress variable to the new address. It then returns a boolean value indicating whether the transfer was successful. (autogenerated documentation)
mintToken(address,address,uint256) :
This function is used to mint new tokens. It requires the operator, account, amount, userData, and operatorData as parameters. It first checks that the total supply is less than the ceiling supply, and that the account is not the zero address. It then adds the amount to the total supply and the account's balance. It then calls the recipient function with the operator, zero address, account, amount, userData, operatorData, and true as parameters. Finally, it emits the Minted and Transfer events. (autogenerated documentation)
mintableToken() :
This function returns the remaining amount of tokens that are available for minting. It does this by subtracting the total supply of tokens from the ceiling supply, which is the maximum amount of tokens that can be minted. (autogenerated documentation)

Get Cookin'
share iconShare

copy iconDownload Source
copy iconnpx cookbookdev i ERC777
copy icon

Last Publish

1/11/2023

Version

1.0.0

Creator

Aman-Ullah

Cookbook is free.
Any contract you deploy is yours.
Your contract is owned and controlled by you.