import "./erc721.sol"; contract ZombieOwnership is ZombieAttack, ERC721 { function balanceOf(address _owner) public view returns (uint256 _balance) { return ownerZombieCount[_owner]; } function ownerOf(uint256 _tokenId) public view returns (address _owner) { return zombieToOwner[_tokenId]...
注意:此为一份ERC721合约样例的简要声明。 contract ERC721 { // ERC20 compatible functions function name() constant returns (string name); function symbol() constant returns (string symbol); function totalSupply() constant returns (uint256 totalSupply); function balanceOf(address _owner) constant r...
-- 1.CryptoKitties Deployed Contract. 2.XXXXERC7213.ERC721ExampleDeed--> 参考文献 EIPS-165 EIPS-721 ☛深入浅出区块链- 系统学习区块链,打造最好的区块链技术博客。 ☛ 我的知识星球为各位解答区块链技术问题,欢迎加入讨论。 ☛ 关注公众号“深入浅出区块链技术”第一时间获取区块链技术信息。
所以在讲 ERC721 的主合约之前,我们会花两讲在引用的库合约和接口合约上。ERC721 相关库 Address 库 Address 库是 Address 变量相关函数的合集,包括判断某地址是否为合约,更安全的 function call。ERC721 用到其中的 isContract():这个函数利用了非合约地址 account.code 的长度为 0 的特性,从而区分某个...
contractMyNFT{functionname() constantreturns(string name){return"My Non-FungibleToken"; } } AI代码助手复制代码 Symbol - 符号 该函数应当返回通证的符号,它有助于提高与ERC20的兼容性。例如: contractMyNFT{functionsymbol() constantreturns(stringsymbol){return"MNFT"; ...
When transfer is complete, this function /// checks if `_to` is a smart contract (code size > 0). If so, it calls /// `onERC721Received` on `_to` and throws if the return value is not /// `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`. /// @...
contract Alchemy is ERC721, ERC721Enumerable, ERC721URIStorage, Ownable { constructor() ERC721("Alchemy", "ALC") {} function safeMint(address to, uint256 tokenId, string memory uri) public onlyOwner { _safeMint(to, tokenId); _setTokenURI(tokenId, uri); ...
在合约地址上使用附加数据(input data)0x01ffc9a701ffc9a700000000000000000000000000000000000000000000000000000000和 gas 30,000 进行STATICCALL调用,相当于contract.supportsInterface(0x01ffc9a7)。 如果调用失败或返回false , 说明合约不兼容ERC-165标准 如果返回true,则使用输入数据0x01ffc9a7ffffffff000000000000000000000000000...
ERC721Pausable: A primitive to pause contract operation. ERC721Burnable: A way for token holders to burn their own tokens. ERC721Wrapper: Wrapper to create an ERC-721 backed by another ERC-721, with deposit and withdraw methods. Useful in conjunction with ERC721Votes. This core set of con...
ERC-721 为 NFT 引入了一个标准,换言之, 这种类型的代币是独一无二的,并且可能与来自同一智能合约的另一代币有不同的价值,也许是因为它的年份、稀有性、甚至是它的观感。 稍等,看起来怎么样呢? 是的。 所有 NFTs 都有一个uint256变量,名为tokenId,所以对于任何 ERC-721 合约,这对值contract address, tok...