You are on page 1of 27
ERC20Detalled Optional functions from the ERC20 standard. FUNCTIONS © constructor(name, symbol, decimals) © name() symbol() decimals() IeRC20 totalSupply() balanceOf(account ) © transfer(recipient, amount) © allowance(owner, spender) © approve(spender, amount) © transferFrom(send er, recipient, amount) EVENTS 1ERC20 © Transfer(from, to, value) © Approval(owner, spender, value) ERC20Mintable Extension of ERC20 that adds a set of accounts with the MinterRole, which have permission to mint (create) new tokens as they see fit. At construction, the deployer of the contract is the only minter. MODIFIERS MINTERROLE © onlyMinter) FUNCTIONS. * mint(account, amount) MINTERROLE constructor() isMinter(account) * addMinter(account ) renounceMinter() _addMinter(accoun i © removeMinter(ace ount) ERC20 totalSupply() balanceOf(account ) * transfer(recipient, amount) * allowance(owner, spender) © approve(spender, amount) © transferFrom(send er, recipient, amount) © increasellowance( spender, addedValue) * decreaseAllowance (spender, subtractedValue) © -transfer(sender, recipient, amount) ¢_mint(account, amount) © _bur(account, amount) -approve(owner, spender, amount) ¢ _bunFrom(account amount) CONTEXT # _msgSender() «© _msgData() EVENTS MINTERROLE © MinterAdded(acco unt) © MinterRemoved(ac count) 1ERC20, *- Transfer(from, to, value) © Approval(owner, spender, value) t(address account, uint256 amount) — boolpublic See ERC20. mint. ERC20Burnable Extension of ERC20 that allows token holders to destroy both their own tokens and those that they have an allowance for, ina way that can be recognized off-chain (via event analysis) FUNCTIONS © burn(amount) © burnFrom(account, amount) ERC20 © totalSupply() © balanceOf(account ) © transfer(recipient, amount) © allowance(owner, spender) ‘© approve(spender, amount) * transferFrom(send er, recipient, amount) * increaseAllowance( spender, addedValue) © decreaseAllowance (spender, subtractedValue) © -transfer(sender, recipient, amount) © _mint(account, amount) * -burn(account, amount) © -approve(owner, spender, amount) * _burnFrom(account amount) CONTEXT © constructor() * _msgSender() * _msgDataQ) EVENTS IERC20 © Transfer(from, to, value) © Approval(owner, spender, value) burn(uint256 amount)public Destroys amount tokens from the caller. See ERC20. burn. burnFrom(address account, uint256 amount)public See ERC20, burnFrom ERC20Pausable ERC20 with pausable transfers and allowances. Useful if you want to stop trades until the end of a crowdsale, or have an emergency switch for freezing all token transfers in the event of a large bug. MODIFIERS PAUSABLE © whenNotPaused() © whenPaused() PAUSERROLE © onlyPauser() FUNCTIONS © transfer(to, value) © transferFrom(from, to, value) © approve(spender, value) * increaseAllowance( spender, addedValue) © decreasedllowance (spender, subtractedValue) PAUSABLE constructor() paused() pause) unpause() PAUSERROLE isPauser(account) addPauser(account ) renouncePauser() -addPauser(accou nt) © -removePauser(ac count) ERC20 totalSupply() balanceOf(account ) © allowance(owner, spender) © transfer(sender, recipient, amount) _mint(account, amount) © -burn(account, amount) © -approve(owner, spender, amount) _burnFrom(account amount) CONTEXT * _msgSender() * _msgDataQ) EVENTS PAUSABLE © Paused(account) © Unpaused{account ) PAUSERROLE * PauserAdded(acco unt) ‘© PauserRemoved(ac count) 1ERC20 © Transfer(from, to, value) * Approval(owner, spender, value) transfer(address to, uint256 value) —> boolpublic transferFrom(address from, address to, uint256 value) — boolpublic approve(address spender, uint256 value) —> boolpublic increaseAllowance(a ddress spender, uint256 addedValue) = boolpublic decreaseAllowance(a ddress spender, uint256 subtractedValue) — boolpublic ERC20Capped Extension of ERC20Mintable that adds a cap to the supply of tokens MODIFIERS MINTERROLE © onlyMinter() FUNCTIONS constructor(cap) cap) _mint(account, value) ERC20MINTABLE © mint(account, amount) MINTERROLE isMinter(account) addMinter(account ) renounceMinter() -addMinter(accoun » @ -removeMinter(ace unt) ERC20 © totalSupply() * balanceof(account ) © transfer(recipient, amount) * allowance(owner, spender) ‘© approve(spender, amount) *- transferFrom(send er, recipient, amount) * increaseAllowance( spender, addedValue) © decreaseAllowance (spender, subtractedValue) © -transfer(sender, recipient, amount) © -burn(account, amount) © -approve(owner, spender, amount) © _bumFrom(account , amount) CONTEXT * _msgSender() * _msgDataQ) EVENTS MINTERROLE © MinterAdded(acco unt) © MinterRemoved(ac count) lERC20 © Transfer(from, to, value) © Approvalowner, spender, value) constructor(uint256 ‘cap)public Sets the value of the cap. This value is immutable, it can only be set once during construction. cap > uint256public Returns the cap on the token's total supply. -mint(address account, uint256 value)internal See ERC20Mintable.mint. Requirements: © value must not cause the total supply to go over the cap. Utilities ‘SafeERC20 Wrappers around ERC20 operations that throw on failure (when the token contract returns false) Tokens that return no value (and instead revert or throw on failure) are also supported, non-reverting calls are assumed to be successful To use this library you can add a using SafeERC20 for ERC20; statement to your contract, which allows you to call the safe operations as token. safeTransfer(..), etc. FUNCTIONS © safeTransfer(token, to, value) © safeTransferFrom(t ‘oken, from, to, value) © safeApprove(token, spender, value) ¢ safelncreaseAllowa nce(token, spender, value) e safeDecreaseAllow ance(token, spender, value) safeTransfer(contract IERC20 token, address to, uint256 value)internal safeTransferFrom(co ntract IERC20 token, address from, address to, uint256 value)internal safeApprove(contract IERC20 token, address spender, uint256 value)internal safelncreaseAllowan ce(contract IERC20 token, address spender, uint256 value)internal safeDecreaseAllowan ce(contract IERC20 token, address spender, uint256 value)internal TokenTimelock Atoken holder contract that will allow a beneficiary to extract the tokens after a given release time. Useful for simple vesting schedules like "advisors get all of their tokens after T year’. For a more complete vesting schedule, see TokenVesting. FUNCTIONS * constructor(token, beneficiary, releaseTime) token() beneficiary() © releaseTime() * release) constructor(contract IERC20 token, address beneficiary, uint256 releaseTime)public token() — contract IERC20public releaseTime() —> uint256public release() 1ERC721 Required interface of an ERC721 compliant contract. FUNCTIONS balanceOf(owner) ownerOf(tokenid) safeTransferFrom(f rom, to, tokenld) © transferFrom(from, to, tokenid) © approve(to, tokenld) © getApproved(token Id) © setApprovalForAll( operator, _approved) © isApprovedForAll(o wner, operator) © safeTransferFrom(f rom, to, tokenld, data) IERC165 © supportsinterface(i nterfaceld) EVENTS © Transfer(from, to, tokenld) © Approval(owner, approved, tokenld) © ApprovalForAll(ow her, operator, approved) balanceOf(address owner) — uint256 balancepublic Returns the number of NFTs in ‘owner's account, ownerOf(uint256 tokenld) — address ‘ownerpublic Returns the owner of the NFT specified by tokenld safeTransferFrom(ad dress from, address to, uint256 tokenld)public Transfers a specific NFT (tokenid) from ‘one account (from) to another (to). Requirements: - from, to cannot be zero. - tokenid must be ‘owned by from. - If the caller is not from, it must be have been allowed to move this NFT by either approve or setApprovalForAll transferFrom(address from, address to, uint256 tokenld)public Transfers a specific NFT (tokenId) from ‘one account (from) to another (to). Requirements: - If the caller is not from, it must be approved to move this NFT by either approve or setApprovalForAll approve(address to, uint256 tokenid)public getApproved(uint256 tokenid) — address operatorpublic setApprovalForAll(ad dress operator, bool -approved)public isApprovedForAll(add ress owner, address operator) —> boolpublic safeTransferFrom(ad dress from, address to, uint256 tokentd, bytes data)public Transfer(address from, address to, uint256 tokenid)event Approval(address owner, address approved, uint256 tokenld)event ApprovalForAll(addre ss owner, address operator, bool approved)event ERC721 see https://eips.ethereum.ora/ EIPS/eip-721 FUNCTIONS balanceOf(owner) ownerOf(tokenid) approve(to, tokenld) getApproved(token Id) setApprovalForAll(t ©, approved) isApprovedForAll(o wner, operator) transferFrom(from, to, tokenid) safeTransferFrom(f rom, to, tokenld) safeTransferFrom(f rom, to, tokenld, data) _safeTransferFrom( from, to, tokenld, data) -exists(tokenid) * _isApprovedorown er(spender, tokenld) © _safeMint(to, tokenid) © _safeMint(to, tokenld, data) _mint(to, tokenid) _burn(owner, tokenld) -burn(tokenId) -transferFrom(from to, tokenld) * _checkOnERC721R eceived(from, to, tokenld, data) ERC165 constructor) supportsinterface(i nterfaceld) © -registerinterface(i nterfaceld) CONTEXT * _msgSender() * _msgDataQ, EVENTS IERC721 © Transfer(from, to, tokenld) © Approval(owner, approved, tokenld) © ApprovalForAll(ow ner, operator, approved) balanceOf(address owner) — uint256public Gets the balance of the specified address, ‘ownerOf(uint256 tokenid) > addresspublic Gets the owner of the specified token ID. approve(address to, uint256 tokenld)public Approves another address to transfer the given token ID The zero address indicates there is no approved address. There can only be one approved address per token at a given time. Can only be callled by the token owner or an approved operator. getApproved(uint256 tokenld) addresspublic Gets the approved address for a token ID, or zero if no address set Reverts if the token ID does not exist setApprovalForAll(ad dress to, bool approved)public Sets or unsets the approval of a given operator An operator is allowed to transfer all tokens of the sender on their behalf. isApprovedForAll(add ress owner, address operator) > boolpublic Tells whether an operator is approved by a given owner. transferFrom(address from, address to, uint256 tokenId)public Transfers the ‘ownership of a given token ID to another address. Usage of this method is discouraged, use safeTransferFrom whenever possible, Requires the msg.sender to be the ‘owner, approved, or operator. safeTransferFrom(ad dress from, address to, uint256 tokenld)public Safely transfers the ‘ownership of a given token ID to another address If the target address is a contract, it must implement Re iver.on! RC721 Received, which is called upon a safe transfer, and return the magic value bytes4(keceak256('on ERC721Received(addr ess,address,uint256,b ytes)’)); otherwise, the transfer is reverted. Requires the msg.sender to be the ‘owner, approved, or operator safeTransferFrom(ad dress from, address to, uint256 tokentd, bytes _data)public Safely transfers the ownership of a given token ID to another address If the target address is a contract, it must implement IERC721Receiver.onE RC721Received, which is called upon a safe transfer, and return the magic value bytes4(keccak256(‘on ERC721Received(addr essaddress,uint256,b ytes)")); otherwise, the transfer is reverted. Requires the _msgSender() to be the owner, approved, of operator -SafeTransferFrom(a ddress from, address to, uint256 tokenld, bytes _data)internal Safely transfers the ownership of a given token ID to another address If the target address is a contract, it must implement onERC721Received, which is called upon a safe transfer, and return the magic value bytes4(keccak256(‘on ERC721Received(addr essaddress,uint256,b ytes)’)); otherwise, the transfer is reverted. Requires the msg.sender to be the owner, approved, or operator _exists(uint256 tokenid) > Returns whether the specified token exists. -isApprovedOrOwner( address spender, uint256 tokenld) —> boolinternal Returns whether the given spender can transfer a given token ID. =safeMint(address to, uint256 tokenld)internal Internal function to safely mint anew token. Reverts if the given token ID already exists, If the target address is a contract, it must implement onERC721Received, which is called upon a safe transfer, and return the magic value bytes4(keceak256(‘on ERC721Received(addr essaddress,uint256,b ytes)’)); otherwise, the transfer is reverted. _safeMint(address to, Uuint256 tokenld, bytes _data)internal Internal function to safely mint a new token, Reverts if the given token ID already exists, Ifthe target address is a contract, it must implement onERC721Received, which is called upon a safe transfer, and return the magic value bytes4(keceak256('on ERC721Received(addr ess,address,uint256,b ytes)')); otherwise, the transfer is reverted. _mint(address to, uint256 tokenld)internal Internal function to mint a new token Reverts if the given token ID already exists. _burn(address owner, uint256 tokenid)internal Internal function to bum a specific token, Reverts if the token does not exist. Deprecated, use burn instead. _burn(uint256 tokenid)internal, Internal function to burn a specific token, Reverts if the token does not exist -transferFrom(addres from, address to, uint256 tokenld)internal Internal function to transfer ownership of a given token ID to another address. As opposed to transferFrom, this imposes no msg.sender. _checkOnERC721Rec eived(address from, address to, uint256 tokenld, bytes data) — boolinternal Internal function to invoke IERC721Receiver.onE RC721Received on a target address. The call is not executed if the target address is not a contract. This is an internal detail of the ERC721 contract and its use is deprecated IERC721 Metadata See httpsi/eips.ethereum org/ EIPS/eip-721 FUNCTIONS © name() © symbol() *- tokenURI(tokenld) 1ERC721 balanceOf(owner) ownerOf(tokenid) safeTransferFrom(f rom, to, tokenld) © transferFrom(from, to, tokenld) © approve(to, tokenld) * getApproved(token Id) © setApprovalForAll( operator, _approved) © isApprovedForAll(o wner, operator) * safeTransferFrom(f rom, to, tokenld, data) IERC165 © supportsinterface(i nterfaceld) EVENTS IERC721 © Transfer(from, to, tokenld) © Approval(owner, approved, tokenld) © ApprovalForAll(ow ner, operator, approved) name() > stringexternal symbol() > stringexternal tokenURI 256 tokenld) — stringexternal ERC721Metadata FUNCTIONS constructor(name, symbol) name() symbol() tokenURI(tokenid) _setTokenURI(toke nid, _tokenUR!) -SetBaseURI(baseU RI) baseURI() -burn(owner, tokenld) ERC721 balanceOf(owner) ownerOf(tokenid) approve(to, tokenld) getApproved(token oo) setApprovalForAll(t ©, approved) isApprovedForAll(o wner, operator) transferFrom(from, to, tokenid) safeTransferFrom(f rom, to, tokenid) safeTransferFrom(f rom, to, tokenld, _data) _safeTransferFrom( from, to, tokenld, data) -exists(tokenid) isApprovedOrOwn er(spender, tokenld) -safeMint(to, tokenld) -safeMint(to, tokenld, data) _mint(to, tokenld) _burn(tokenid) _transferFrom(from , to, tokenid) _checkOnERC721R eceived(from, to, tokenld, _data) ERCT65 supportsinterface(i nterfaceld) _registerinterface(i nterfaceld) CONTEXT _msgSender() _msgData() EVENTS 1ERC721 Transfer(from, to, tokenld) © Approval(owner, approved, tokenld) © ApprovalForAll(ow ner, operator, approved) constructor(string name, string ‘symbol)public Constructor function Gets the token name. symbol() —> external Gets the token symbol. tokenURI(uint256 tokenld) ingexternal Returns the URI for a given token ID. May return an empty string. If the token's URI is non-empty and a base URI was set (via setBaseUR)), it will be added to the token ID's URI as a prefix. Reverts if the token ID does not exist. -setTokenURI(uint25 6 tokentd, string -tokenURIinternal Internal function to set the token URI for a given token. Reverts if the token ID does not exist. if all token IDs share a prefix (e.g. if your URIs look like http://apimypro} ect.com/token/< id>), use -SetBaseURI to store it and save gas. -setBaseURI(string Internal function to set the base URI for all token IDs. Itis automatically added as a prefix to the value returned in tokenURI Available since v2.5.0. baseURI() — stringexternal Retums the base URI set via _setBaseURI. This will be automatically added as a preffix in tokenURI to each token’s URI, when they are non-empty. Available since v2.5.0. -burn(address owner, uint256 tokenld)internal Internal function to burn a specific token, Reverts if the token does not exist. Deprecated, use -burn(uint256) instead. ERC721Enumerable See https://eips.ethereum.org/ EIPS/eip-721 FUNCTIONS constructor() tokenOfOwnerByin dex(owner, index) totalSupply() tokenByIndex(index ) -transferFrom(from . to, tokenld) _mint(to, tokenid) _burn(owner, tokenid) -tokensOfOwner(o wner) ERC721 balanceOf(owner) ownerOf(tokenld) approve(to, tokenid) getApproved(token Id) setApprovalForAll(t ©, approved) isApprovedForAll(o wner, operator) transferFrom(from, to, tokenld) safeTransferFrom(f rom, to, tokenid) safeTransferFrom(f rom, to, tokenld, data) _safeTransferFrom( from, to, tokenld, data) _exists(tokenid) -isApprovedOrOwn er(spender, tokenld) _safeMint(to, tokenld) _safeMint(to, tokenld, _data) -burn(tokenld) © -checkOnERC721R eceived(from, to, tokenld, data) ERC165 © supportsinterface(i nterfaceld) © -registerinterface(i nterfaceld) CONTEXT # _msgSender() © _msgData() EVENTS IERC721 * Transfer(from, to, tokenld) * Approval(owner, approved, tokenld) * ApprovalForAll(ow ner, operator, approved) constructor()pul Constructor function tokenOfOwnerByinde x(address owner, uint256 index) — uint256public Gets the token ID at a given index of the tokens list of the requested owner. totalSupply > uint256public Gets the total amount of tokens stored by the contract. tokenByindex(uint25 \dex) > uint256public Gets the token ID at a given index of all the tokens in this contract Reverts if the index is greater or equal to the total number of tokens. _transferFrom(addres s from, address to, uint256 tokenId)internal Internal function to transfer ownership of a given token ID to another address. As opposed to transferFrom, this imposes no restrictions on msg.sender. _mint(address to, uint256 tokenld)internal Internal function to mint a new token. Reverts if the given token ID already exists _burn(address owner, uint256 tokentd)internal Internal function to burn a specific token Reverts if the token does not exist. Deprecated, use ERC721, burn instead. -tokensOfowner(addr ess owner) —> Lvar-type]uint256[]I. item-kind}#internal Gets the list of token IDs of the requested owner. IERC721Enumerable See https://eips.ethereum.org/ EIPS/eip-721 FUNCTIONS totalSupply() tokenOfOwnerByin dex(owner, index) # tokenByIndex(index ) IERC721 balanceof(owner) ownerOf{(token!d) safeTransferFrom(f rom, to, tokenld) # transferFrom(from, to, tokenid) # approvetto, tokenld) # getApproved(token Id) # setApprovalForAll operator, approved) + isApprovedForAll(o wner, operator) # safeTransferFrom(f rom, to, tokenid, data) IERC165 © supportsinterface(i nterfaceld) EVENTS 1ERC721 © Transfer(from, to, tokenld) © Approval(owner, approved, tokenld) © ApprovalForAll(ow her, operator, approved) totalSupply) — uint256public tokenOfOwnerByinde x(address owner, uuint256 index) —> int256 tokenldpublic tokenByindex(uint25 6 index) > uint256public 1ERC721Full See https://eips.ethereum.org/ EIPS/eip-721 FUNCTIONS IERC721 METADATA © name() * symbol() © tokenURI(tokenId) IERC721ENUMERABLE totalSupply() tokenOfOwnerByin dex(owner, index) * tokenByindex(index ) IERC721 balanceOf(owner) ‘ownerOf(tokenld) safeTransferFrom(f rom, to, tokenid) © transferFrom(from, to, tokenld) * approve(to, tokenid) * getApproved(token Id) © setApprovalForAll( operator, _approved) © isApprovedForAll(o wner, operator) © safeTransferFrom(f rom, to, tokenid, data) IERCI6S © supportsinterface(i nterfaceld) EVENTS IERC721 © Transfer(from, to, tokenld) © Approval(owner, approved, tokenld) © ApprovalForAll(ow ner, operator, approved) ERC721Full This implementation includes all the required and some optional functionality of the ERC721 standard Moreover, it includes approve all functionality using operator terminology. See httos://eips.ethereum.org/ EIPS/eip-721 FUNCTIONS © constructor(name, symbol) ERC721METADATA © name() symbol() tokenURI(tokenid) * _setTokenURI(toke nid, _tokenUR!) * _setBaseURI(baseU RI) baseURIQ) -burn(owner, tokenld) ERC721ENUMERABLE © tokenOfOwnerByin dex(owner, index) totalSupply() tokenByindex(index ) © -transferFrom(from , to, tokenid) _mint(to, tokenld) _tokensOfowner(o wner) ERC721 balanceOf(owner) ownerOf(tokenld) approve(to, tokenld) © getApproved(token Id) © setApprovalForAll(t ©, approved) © isApprovedForAll(o wner, operator) * transferFrom(from, to, tokenid) © safeTransferFrom(f rom, to, tokenld) © safeTransferFrom(f rom, to, tokenld, data) ¢-safeTransferFrom( from, to, tokenld, data) -exists(tokenid) isApprovedOrOwn er(spender, tokenld) _safeMint(to, tokenld) * _safeMint(to, tokenld, data) -burn(tokentd) _checkOnERC721R eceived(from, to, tokenld, data) ERC165, © supportsinterface(i nterfaceld) * -registerInterface(i nterfaceld) CONTEXT * _msgSender() * _msgDataQ) EVENTS IERC721 © Transfer(from, to, tokenld) ‘* Approval(owner, approved, tokenld) © ApprovalForAll(ow ner, operator, approved) constructor(string name, string symbol)public IERC721Receiver Interface for any contract that wants to support safeTransfers from ERC721 asset contracts. FUNCTIONS # onERC721Received (operator, from, tokenld, data) ‘onERC721Received(a ddress operator, address from, uint256 tokenld, bytes data) — bytes4pul ‘The ERC721 smart contract calls this function on the recipient after a IERC721_safeTransfer From. This function MUST retum the function selector, otherwise the caller will revert the transaction. The selector to be returned can be obtained as this.onERC721Recelv ed.selector. This function MAY throw to revert and reject the transfer. Note: the ERC721 contract, address is always the message sender. Extensions ERC721Mintable ERC721 minting logic. MODIFIERS MINTERROLE © onlyMinter() FUNCTIONS mint(to, tokenid) safeMint(to, tokenld) © safeMint(to, tokenld, data) MINTERROLE constructor() isMinter(account) addMinter(account ) renounceMinter() -addMinter(accoun D) © _removeMinter(ace ount) R721 © balanceOf(owner) © ownerOf(tokenid) © approve(to, tokenld) ‘* getApproved(token Id) ‘* setApprovalForAll(t ©, approved) © isApprovedForAll(o wner, operator) © transferFrom(from, to, tokenld) © safeTransferFrom(f rom, to, tokenid) © safeTransferFrom(f rom, to, tokenld, data) * _safeTransferFrom( from, to, tokenld, data) _exists(tokenid) -isApprovedOrOwn er(spender, tokenld) © -safeMint(to, tokenld) © -safeMint(to, tokenid, data) * _mint(to, tokenid) * _burn(owner, tokenid) * _burn(tokentd) © transferFrom(from to, tokentd) * _checkOnERC721R eceived(from, to, tokenid, data) ERC165 © supportsinterface(i nterfaceld) * -registerInterface(i nterfaceld) CONTEXT © _msgSender() © _msgData() EVENTS MINTERROLE © MinterAdded(acco unt) © MinterRemoved(ac count) IERC721 © Transfer(from, to, tokenld) © Approval(owner, approved, tokenld) © ApprovalForAll(ow ner, operator, approved) mint(address to, uuint256 tokenld) —> boolpublic Function to mint tokens safeMint(address to, uint256 tokentd) > boolpublic Function to safely mint tokens. safeMint(address to, uint256 tokentd, bytes data) — boolpublic Function to safely mint tokens. ERC721MetadataMintabl e ERC721 minting logic with metadata, MODIFIERS MINTERROLE © onlyMinter() FUNCTIONS ¢ mintWithTokenURIC to, tokenld, ‘tokenURI) MINTERROLE constructor() isMinter(account) addMinter(account ) renounceMinter() -addMinter(accoun ) _femoveMinter(ace ount) ERC721METADATA name() symbol() tokenURI(tokenid) _setTokenURI(toke nid, _tokenUR!) _setBaseURI(baseU RI) baseURIQ -burn(owner, tokenld) ERC721 balanceOf(owner) ‘ownerOf(tokenld) approve(to, tokenid) getApproved(token Id) setApprovalForAll(t ©, approved) isApprovedForAll(o wner, operator) transferFrom(from, to, tokenld) safeTransferFrom(f rom, to, tokenid) safeTransferFrom(f rom, to, tokenid, data) _safeTransferFrom( from, to, tokenld, data) _exists(tokenid) © -isApprovedorown er(spender, tokenld) © _safeMint(to, tokentd) © _safeMint(to, tokenld, data) _mint(to, tokenld) _burn(tokenld) _transferFrom(from to, tokenid) © -checkOnERC721R eceived(from, to, tokenld, -data) ERC165 © supportsinterface(i nterfaceld) © -registerinterface(i nterfaceld) CONTEXT # _msgSender() # _msgData() EVENTS MINTERROLE © MinterAdded(acco unt) * MinterRemoved(ac count) IERC721 © Transfer(from, to, tokenld) © Approval(owner, approved, tokenld) © ApprovalForAll(ow her, operator, approved) mintWithTokenURI(ad dress to, uint256 tokenid, string tokenURI) > boolpublic Function to mint tokens. ERC721Burnable ERC721 Token that can be irreversibly burned (destroyed). FUNCTIONS © burn(tokenid) RC721 balanceOf(owner) ‘ownerOf(tokenid) © approve(to, tokenld) © getApproved(token Id) © setApprovalForAll(t ©, approved) © isApprovedForAll(o wner, operator) © transferFrom(from, to, tokenld) © safeTransferFrom(f rom, to, tokenid) © safeTransferFrom(f rom, to, tokenid, _data) * _safeTransferFrom( from, to, tokenld, data) _exists(tokenld) -isApprovedOrOwn er(spender, tokenld) © _safeMint(to, tokenld) © -safeMint(to, tokenld, data) _mint(to, tokenid) _burn(owner, tokenid) -burn(tokenId) -transferFrom(from to, tokentd) * _checkOnERC721R eceived(from, to, tokenid, data) ERC165 constructor) supportsinterface(i nterfaceld) * -registerInterface(i nterfaceld) CONTEXT *_msgSender() © _msgData() EVENTS IERC721 © Transfer(from, to, tokenld) © Approval(owner, approved, tokenld) © ApprovalForAll(ow ner, operator, approved) burn(uint256 tokenld)public Burns a specific ERC721 token. ERC721Pausable ERC721 modified with pausable transfers. MODIFIERS PAUSABLE * whenNotPaused() © whenPaused() PAUSERROLE © onlyPauser() FUNCTIONS © approvetto, © safeTransferFrom(f * Paused(account) tokenld) rom, to, tokenId, © Unpaused(account © setApprovalForAll(t _data) ) ©, approved) © _safeTransferFrom( -transferFrom(from from, to, tokenld, 1 to, tokenid) data) PAUSERROLE _exists(tokenid) _isApprovedOrOwn PAUSABLE er(spender, © PauserAdded(acco unt) tokenld) « safeMintto, * PauserRemoved(ac © constructor() tokenld) count) * paused) © -safeMint(to, © pause) tokenld, data) © unpause() “mint(t, tokenld) 1ERC721 _burn(owner, tokenid) . Fausenore _burn(tokenld) eas) (rome ~checkOnERC721R «© Approval(owner, © isPauser(account) eceived(from, to, approved, tokenld) * addPauser(account tokenld, -data) © ApprovalForAll(ow ) ner, operator, renouncePauser() approved) _addPauser(accou ERC165 nt) approve(address to, * -removePauser(ac © supportsinterface(i uint256 count) nterfaceld) tokenld)public © registerinterface(i nterfaceld) ERC721 setApprovalForAll(ad dress to, boo! balanceOf(owner) CONTEXT approved) public ownerOf(token'd) getApproved(token © _msgsender() a) © _msgData() _transferFrom(addres © isApprovedForAll(o from, address to, wner, operator) EVENTS nnpse © transferFrom(from, . to tokeni) tokenid)internal © safeTransferFrom(f PAUSABLE rom, to, tokenld) Convenience ERC721Holder FUNCTIONS. © onERC721Received Gas) onERC721Received(a ddress, address, uint256, bytes) — bytes4public 1ERC777 Interface of the ERC777Token standard as defined in the EIP. This contract uses the ERC1820 registry standard to let token holders and recipients react to token movements by using setting implementers for the associated interfaces in said registry. See IERC1820Registry and ERC1820implementer. FUNCTIONS name() symbol() granularity) totalSupply() balanceOf(owner) © send(recipient, amount, data) © burn(amount, data) isOperatorFor(oper ator, tokenHolder) authorizeOperator( operator) revokeOperator(op erator) defaultOperators() operatorSend(send er, recipient, amount, data, operatorData) operatorBurn(acco unt, amount, data, operatorData) EVENTS Sent(operator, from, to, amount, data, operatorData) Minted operator, to, amount, data, operatorData) Burned(operator, from, amount, data, operatorData) AuthorizedOperator (operator, tokenHolder) RevokedOperator(o perator, tokenHolder) Returns the name of the token. symbol() stringexternal Returns the symbol of the token, usually a shorter version of the name granularity() — uint256external Returns the smallest part of the token that is not divisible. This means all token operations (creation, movement and destruction) must have amounts that are a multiple of this number. For most token contracts, this value will equal 1 totalSupply() —> uint256external Returns the amount of tokens in existence. balanceOf(address owner) —» uint256external Returns the amount of tokens owned by an account (owner). send(address recipient, uint256 amount, bytes data)external Moves amount tokens from the caller's account to recipient. If send or receive hooks are registered for the caller and recipient, the corresponding functions will be called with data and empty operatorData, ‘See JERC777Sender and IERC777Recipient Emits a Sent event. Requirements © the caller must have at least amount tokens. © recipient cannot be the zero address. ©. ifrecipientis a contract, it must implement the IERC777Recipi ent interface. burn(uint256 amount, bytes data)external Destroys amount tokens from the caller's account, reducing the total ‘supply. Ifa send hook is registered for the caller, the corresponding function will be called with data and empty operatorData. See IERC777Sender Emits a Burned event, Requirements the caller must have at least amount tokens. isOperatorFor(addres s operator, address tokenHolder) —> boolexternal Returns true if an account is an operator of tokenHolder. Operators can send and burn tokens on behalf of their owners. All accounts are their ‘own operator. See operatorSend and operatorBurn, authorizeOperator(ad dress operator)external Make an account an operator of the caller. See isOperatorFor. Emits an AuthorizedOperator event. Requirements © operator cannot be calling address. revokeOperator(addr ess operator)external Make an account an operator of the caller. See isOperatorFor and defaultOperators. Emits a RevokedOperator event. Requirements © operator cannot be calling address. defaultOperators() —> Lvar-typel#addressill .item-kind}#external Returns the list of default operators. These accounts are operators for all token holders, even if authorizeOperator was never called on them, This list is immutable, but individual holders may revoke these via revokeOperator, in which case isOperatorFor will retum false. operatorSend(addres s sender, address recipient, uint256 amount, bytes data, bytes operatorData)externa 1 Moves amount tokens from sender to recipient. The caller must be an operator of sender, If send or receive hooks are registered for sender and recipient, the corresponding functions will be called with data and operatorData, See IERC777Sender and IERC777Recipient Emits a Sent event. Requirements © sender cannot be the zero address. sender must have at least amount tokens. the caller must be an operator for sender. © recipient cannot be the zero address. © ifrecipient is a contract, it must implement the IERC777Recipi ent interface, operatorBurn(addres s account, uint256 amount, bytes dat bytes operatorData)externa 1 Destoys amount tokens from account, reducing the total supply. The caller must be an operator of account. Ifa send hook is registered for account, the corresponding function will be called with data and operatorData. See IERC777Sender. Emits a Burned event. Requirements account cannot be the zero address. account must have at least amount tokens. the caller must, be an operator for account. Sent(address operator, address from, address to, uint256 amount, bytes data, bytes operatorData)event Minted(address. operator, address to, uint256 amount, bytes data, bytes operatorData)event Burned(address operator, address from, uint256 amount, bytes data, bytes operatorData)event AuthorizedOperator(a ddress operator, address tokenHolder)event RevokedOperator(add ress operator, address tokenHolder)event ERC777 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 int, 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 1ERC20 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. FUNCTIONS © constructor(name, symbol, defaultOperators) name) symbol) decimals) granularity) totalSupply) balanceOf(tokenHo Ider) © send(recipient, amount, data) * transfer(recipient, amount) burn(amount, data) isOperatorFor(oper ator, tokenHolder) ‘© authorizeOperator( operator) © revokeOperator(op erator) defaultOperators() operatorSend(send er, recipient, amount, data, operatorData) © operatorBurn(acco unt, amount, data, operatorData) * allowance(holder, spender) © approve(spender, value) © transferFrom(holde 1 recipient, amount) «_mint(operator, account, amount, userData, operatorData) ¢-send(operator, from, to, amount, userData, operatorData, requireReceptionAc k) # _burn(operator, from, amount, data, operatorData) © -approve(holder, spender, value) * -callTokensToSend (operator, from, to, amount, userData, operatorData) * -callTokensReceive d(operator, from, to, amount, userData, operatorData, requireReceptionAc kK) CONTEXT, © _msgSender() © _msgData() EVENTS 1ERC20, *- Transfer(from, to, value) © Approval(owner, spender, value) 1ERC777 © Sent(operator, from, to, amount, data, operatorData) * Minted(operator, to, amount, data, operatorData) © Burned(operator, from, amount, data, operatorData) © AuthorizedOperator (operator, tokenHolder) © RevokedOperator(o perator, tokenHolder) constructor(string name, string symbol, Lvar-type}itaddress[# defaultOperators)|pu blic defaultOperators may be an empty array. name() > stringpublic See IERC777.name, symbol() —> stringpublic See |ERC777.symbol. decimals() > uint8public See ERC20Detailed.deci als. Always returns 18, as per the [ERC777 ElP|(https://eips.ether eum,org/EIPS/eip-777 #backward-compatibil ity) granularity) uint256public See IERC777.aranularity. This implementation always returns 1 totalSupply() + uuint256public See IERC777.totalSupply. balanceOf(address tokenHolder) > uint256public Returns the amount of tokens owned by an account (tokenHolder). send(address recipient, uint256 amount, bytes data)pul See IERC777.send Also emits a IERC20 Transfer event for ERC20 compatibility transfer(address recipient, uint256 amount) —> boolpublic See IERC20 Transfer. Unlike send, recipient is not required to implement the IERC777Recipient interface if itis a contract Also emits a Sent event. burn(uint256 amount, bytes data)publi See IERC777.burn, Also emits a IERC20.Transfer event for ERC20 compatibility. isOperatorFor(addres s operator, address tokenHolder) —> boolpublic see IERC777.isOperatorFo b authorizeOperator(ad dress operator)public See IERC777.authorizeOp erator. revokeOperator(addr ess operator)public See IERC777.revokeOperat or. defaultOperators() —> Lvar-typel#addressill ind] #public See \ERC777.defaultOpera tors. operatorSend(addres s sender, address, recipient, uint256 amount, bytes data, bytes operatorData)public See IERC777.operatorSen d Emits Sent and IERC20.Transfer events, operatorBurn(addres $ account, uint256 amount, bytes data, bytes operatorData)public See IERC777.operatorBurn Emits Burned and IERC20.Transfer events, allowance(address holder, address spender) uint256public 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. approve(address spender, uint256 value) — boolpublic See IERC20. approve. Note that accounts cannot have allowance issued by their operators, transferFrom(address holder, address recipient, uint256 amount) —> boolpublic 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, _mint(address operator, address account, uint256 amount, bytes userData, bytes operatorData)internal Creates amount tokens and assigns them to account, increasing the total supply. Ifa send hook is registered for account, the corresponding function will be called with operator, data and operatorData. See [ERC777Sender and IERC777Recipient, Emits Minted and IERC20.Transfer events, Requirements account cannot be the zero address. © if account is a contract, it must implement the IERC777Recipi ent interface _send(address operator, address from, address to, uint256 amount, bytes userData, bytes operatorData, bool requireReceptionAck) internal Send tokens -burn(address operator, address from, uint256 amount, bytes data, bytes operatorData)internal Burn tokens -approve(address holder, address spender, uint256 value)internal See ERC20, approve. Note that accounts cannot have allowance issued by their operators, _callTokensToSend(a ddress operator, address from, address to, uint256 amount, bytes userData, bytes operatorData)internal Call from.tokensToSend() if the interface is registered _callTokensReceived( address operator, address from, address to, uint256 amount, bytes userData, bytes operatorData, bool requireReceptionAck) internal Call to.tokensReceived() if the interface is registered. Reverts if the recipient is a contract but tokensReceived() was not registered for the recipient Hooks IERC777Sender Interface of the ERC777TokensSender standard as defined in the EIP. IERC777 Token holders can be notified of operations performed on their tokens by having a contract implement this. interface (contract holders can be their own implementer) and registering it on the ERC1820 global registry. See JERC1820Registry and ERC1820implementer. FUNCTIONS * tokensToSend(oper ator, from, to, amount, userData, operatorData) tokensToSend(addres s operator, address from, address to, uint256 amount, bytes userData, bytes operatorData)externa 1 Called by an IERC777 token contract whenever a registered holder's (from) tokens are about to be moved or destroyed. The type of operation is conveyed by to being the zero address or not This call occurs before the token contract's state is updated, so IERC777.balanceOf, etc., can be used to query the pre-operation state. This function may revert to prevent the operation from being executed. IERC777Recipient Interface of the ERC777TokensRecipient standard as defined in the EIP, Accounts can be notified of IERC777 tokens being sent to them by having a contract implement this interface (contract holders can be their own implementer) and registering it on the ERC1820 global registry. See |ERC1820Reaistry and ERC1820Implementer. FUNCTIONS * tokensReceived(op erator, from, to, amount, userData, operatorData) tokensReceived(addr ess operator, address. from, address to, uint256 amount, bytes userData, bytes operatorData)externa 1 Called by an IERC777 token contract whenever tokens are being moved or created into a registered account (to). The type of operation is conveyed by from being the zero address or not. This call occurs after the token contract's state is updated, so IERC777.balanceOf, etc., can be used to query the post-operation state. This function may revert to prevent the operation from being executed.

You might also like