craft-nft

A standalone NFT implementation for real-world arts and crafts assets
Log | Files | Refs | README

commit bb708756bd7251cd803c2853230f192cc2f644f5
parent ee2df333b0cc104d600cdda7334f6a75d0f29528
Author: lash <dev@holbrook.no>
Date:   Fri, 16 Dec 2022 21:08:02 +0000

Enforce batch limits

Diffstat:
Mpython/eth_craft_nft/data/CraftNFT.bin | 4++--
Mpython/eth_craft_nft/data/CraftNFT.json | 2+-
Mpython/eth_craft_nft/nft.py | 19+++++++++++++++++++
Mpython/tests/test_basic.py | 38++++++++++++++++++++++++++++++++++++--
Msolidity/CraftNFT.sol | 6+++---
5 files changed, 61 insertions(+), 8 deletions(-)

diff --git a/python/eth_craft_nft/data/CraftNFT.bin b/python/eth_craft_nft/data/CraftNFT.bin @@ -1 +1 @@ -60806040523480156200001157600080fd5b506040516200284a3803806200284a833981810160405281019062000037919062000236565b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600690816200008891906200050c565b5080600790816200009a91906200050c565b505050620005f3565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6200010c82620000c1565b810181811067ffffffffffffffff821117156200012e576200012d620000d2565b5b80604052505050565b600062000143620000a3565b905062000151828262000101565b919050565b600067ffffffffffffffff821115620001745762000173620000d2565b5b6200017f82620000c1565b9050602081019050919050565b60005b83811015620001ac5780820151818401526020810190506200018f565b60008484015250505050565b6000620001cf620001c98462000156565b62000137565b905082815260208101848484011115620001ee57620001ed620000bc565b5b620001fb8482856200018c565b509392505050565b600082601f8301126200021b576200021a620000b7565b5b81516200022d848260208601620001b8565b91505092915050565b6000806040838503121562000250576200024f620000ad565b5b600083015167ffffffffffffffff811115620002715762000270620000b2565b5b6200027f8582860162000203565b925050602083015167ffffffffffffffff811115620002a357620002a2620000b2565b5b620002b18582860162000203565b9150509250929050565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806200030e57607f821691505b602082108103620003245762000323620002c6565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b60008160020a8302905092915050565b600060088302620003917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826200034f565b6200039d86836200034f565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b6000620003ea620003e4620003de84620003b5565b620003bf565b620003b5565b9050919050565b6000819050919050565b6200040683620003c9565b6200041e6200041582620003f1565b8484546200035f565b825550505050565b600090565b6200043562000426565b62000442818484620003fb565b505050565b5b818110156200046a576200045e6000826200042b565b60018101905062000448565b5050565b601f821115620004b95762000483816200032a565b6200048e846200033f565b810160208510156200049e578190505b620004b6620004ad856200033f565b83018262000447565b50505b505050565b60008160020a8304905092915050565b6000620004e160001984600802620004be565b1980831691505092915050565b6000620004fc8383620004ce565b9150826002028217905092915050565b6200051782620002bb565b67ffffffffffffffff811115620005335762000532620000d2565b5b6200053f8254620002f5565b6200054c8282856200046e565b600060209050601f8311600181146200058457600084156200056f578287015190505b6200057b8582620004ee565b865550620005eb565b601f19841662000594866200032a565b60005b82811015620005be5784890151825560018201915060208501945060208101905062000597565b86831015620005de5784890151620005da601f891682620004ce565b8355505b6001600288020188555050505b505050505050565b61224780620006036000396000f3fe608060405260043610610147576000357c0100000000000000000000000000000000000000000000000000000000900480636352211e116100c8578063a22cb4651161008c578063a22cb4651461046a578063b88d4fde14610493578063b9adc41b146104af578063bee2c0b5146104ec578063e985e9c514610529578063f9613ab21461056657610147565b80636352211e1461035d57806370a082311461039a5780638da5cb5b146103d757806395d89b4114610402578063a06561aa1461042d57610147565b806342842e0e1161010f57806342842e0e1461024a5780634d03546a146102665780634f64b2be146102a3578063559f5dc9146102e057806357cbf6921461032057610147565b806301ffc9a71461014c57806306fdde0314610189578063081812fc146101b457806323b872dd146101f157806324e0febc1461020d575b600080fd5b34801561015857600080fd5b50610173600480360381019061016e9190611878565b6105a3565b60405161018091906118c0565b60405180910390f35b34801561019557600080fd5b5061019e6106f7565b6040516101ab919061196b565b60405180910390f35b3480156101c057600080fd5b506101db60048036038101906101d691906119c3565b610785565b6040516101e89190611a31565b60405180910390f35b61020b60048036038101906102069190611a78565b6107c2565b005b34801561021957600080fd5b50610234600480360381019061022f9190611b01565b610831565b6040516102419190611b3d565b60405180910390f35b610264600480360381019061025f9190611a78565b610849565b005b34801561027257600080fd5b5061028d60048036038101906102889190611b96565b6108b8565b60405161029a91906118c0565b60405180910390f35b3480156102af57600080fd5b506102ca60048036038101906102c591906119c3565b610b17565b6040516102d79190611b3d565b60405180910390f35b3480156102ec57600080fd5b5061030760048036038101906103029190611bd6565b610b3b565b6040516103179493929190611c41565b60405180910390f35b34801561032c57600080fd5b5061034760048036038101906103429190611c86565b610bc7565b6040516103549190611b3d565b60405180910390f35b34801561036957600080fd5b50610384600480360381019061037f91906119c3565b610c50565b6040516103919190611a31565b60405180910390f35b3480156103a657600080fd5b506103c160048036038101906103bc9190611cc6565b610c8c565b6040516103ce9190611d02565b60405180910390f35b3480156103e357600080fd5b506103ec610c93565b6040516103f99190611a31565b60405180910390f35b34801561040e57600080fd5b50610417610cb7565b604051610424919061196b565b60405180910390f35b34801561043957600080fd5b50610454600480360381019061044f9190611d1d565b610d45565b6040516104619190611b3d565b60405180910390f35b34801561047657600080fd5b50610491600480360381019061048c9190611d9c565b610f4b565b005b6104ad60048036038101906104a89190611f11565b6111ed565b005b3480156104bb57600080fd5b506104d660048036038101906104d19190611b01565b6112c4565b6040516104e391906118c0565b60405180910390f35b3480156104f857600080fd5b50610513600480360381019061050e9190611f94565b6112f6565b6040516105209190612000565b60405180910390f35b34801561053557600080fd5b50610550600480360381019061054b919061201b565b6113c9565b60405161055d91906118c0565b60405180910390f35b34801561057257600080fd5b5061058d60048036038101906105889190611b01565b611461565b60405161059a9190611b3d565b60405180910390f35b60006380ac58cd7c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036105f757600190506106f2565b635b5e139f7c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19160361064957600190506106f2565b63780e9d637c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19160361069b57600190506106f2565b6301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036106ed57600190506106f2565b600090505b919050565b600680546107049061208a565b80601f01602080910402602001604051908101604052809291908181526020018280546107309061208a565b801561077d5780601f106107525761010080835404028352916020019161077d565b820191906000526020600020905b81548152906001019060200180831161076057829003601f168201915b505050505081565b60006004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b60606107d0848484846114ce565b818373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a450505050565b60036020528060005260406000206000915090505481565b6060610857848484846114ce565b818373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a450505050565b60008060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461091657600080fd5b61091e6117c9565b6002600087815260200190815260200160002080549050925060008311156109ee57600060026000888152602001908152602001600020600081548110610968576109676120bb565b5b9060005260206000200160000160019054906101000a900465ffffffffffff1665ffffffffffff161161099a57600080fd5b600260008781526020019081526020016000206001846109ba9190612119565b815481106109cb576109ca6120bb565b5b9060005260206000200160000160079054906101000a900465ffffffffffff1691505b84816020019065ffffffffffff16908165ffffffffffff16815250508482610a16919061214d565b816040019065ffffffffffff16908165ffffffffffff168152505060026000878152602001908152602001600020819080600181540180825580915050600190039060005260206000200160009091909190915060008201518160000160006101000a81548160ff021916908360ff16021790555060208201518160000160016101000a81548165ffffffffffff021916908365ffffffffffff16021790555060408201518160000160076101000a81548165ffffffffffff021916908365ffffffffffff160217905550606082015181600001600d6101000a81548165ffffffffffff021916908365ffffffffffff160217905550505050505092915050565b60018181548110610b2757600080fd5b906000526020600020016000915090505481565b60026020528160005260406000208181548110610b5757600080fd5b90600052602060002001600091509150508060000160009054906101000a900460ff16908060000160019054906101000a900465ffffffffffff16908060000160079054906101000a900465ffffffffffff169080600001600d9054906101000a900465ffffffffffff16905084565b6000806000600102600360008681526020019081526020016000205414610bed57600080fd5b8273ffffffffffffffffffffffffffffffffffffffff1690507f8000000000000000000000000000000000000000000000000000000000000000811790508060010260036000868152602001908152602001600020819055508391505092915050565b600080600360008460010281526020019081526020016000205490506060819060020a026c010000000000000000000000009004915050919050565b6000919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60078054610cc49061208a565b80601f0160208091040260200160405190810160405280929190818152602001828054610cf09061208a565b8015610d3d5780601f10610d1257610100808354040283529160200191610d3d565b820191906000526020600020905b815481529060010190602001808311610d2057829003601f168201915b505050505081565b600080600080600260008881526020019081526020016000208681548110610d7057610d6f6120bb565b5b90600052602060002001905060008160000160019054906101000a900465ffffffffffff1665ffffffffffff16148015610dc8575060008160000160019054906101000a900465ffffffffffff1665ffffffffffff16145b15610de157610dd78786610bc7565b9350505050610f44565b8060000160019054906101000a900465ffffffffffff1665ffffffffffff1681600001600d9054906101000a900465ffffffffffff1665ffffffffffff1610610e2957600080fd5b65ffffffffffff876001900416915060c8829060020a0291507f8000000000000000000000000000000000000000000000000000000000000000821791508473ffffffffffffffffffffffffffffffffffffffff16821791507fffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000087600190041692506028869060020a028317925080600001600d9054906101000a900465ffffffffffff1665ffffffffffff1683179250816001026003600085600102815260200190815260200160002081905550600181600001600d8282829054906101000a900465ffffffffffff16610f1e919061214d565b92506101000a81548165ffffffffffff021916908365ffffffffffff1602179055505050505b9392505050565b801561106c57600073ffffffffffffffffffffffffffffffffffffffff16600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610fe957600080fd5b81600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611184565b600073ffffffffffffffffffffffffffffffffffffffff16600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff160361110457600080fd5b6000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516111e191906118c0565b60405180910390a35050565b6111f9848484846114ce565b818373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4818373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f75c9e114f073c346aac7d1d7e9a3c3c14edabcdd27de07d1d9e425f45d318c5e60006001026040516112b69190611b3d565b60405180910390a450505050565b6000807f8000000000000000000000000000000000000000000000000000000000000000836001900416119050919050565b6000808290505b600260008681526020019081526020016000208054905081101561139d57836fffffffffffffffffffffffffffffffff16600260008781526020019081526020016000208281548110611353576113526120bb565b5b9060005260206000200160000160079054906101000a900465ffffffffffff1665ffffffffffff16111561138a57809150506113c2565b808061139590612187565b9150506112fd565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90505b9392505050565b60008173ffffffffffffffffffffffffffffffffffffffff16600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614905092915050565b60008060036000848152602001908152602001600020549050611483816112c4565b61148c57600080fd5b60a081908060020a820491505090507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000060010283168117905080915050919050565b60003073ffffffffffffffffffffffffffffffffffffffff16636352211e846040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004016115259190611d02565b602060405180830381865afa158015611542573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061156691906121e4565b90508473ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146115a057600080fd5b3373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16146116d4573373ffffffffffffffffffffffffffffffffffffffff166004600085815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614806116ca57503373ffffffffffffffffffffffffffffffffffffffff16600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b6116d357600080fd5b5b60006004600085815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506117318385611738565b5050505050565b60008083600102905060036000828152602001908152602001600020546001900491506000820361176857600080fd5b7fffffffffffffffffffffffff0000000000000000000000000000000000000000821691508273ffffffffffffffffffffffffffffffffffffffff168217915081600102600360008381526020019081526020016000208190555050505050565b6040518060800160405280600060ff168152602001600065ffffffffffff168152602001600065ffffffffffff168152602001600065ffffffffffff1681525090565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b61185581611820565b811461186057600080fd5b50565b6000813590506118728161184c565b92915050565b60006020828403121561188e5761188d611816565b5b600061189c84828501611863565b91505092915050565b60008115159050919050565b6118ba816118a5565b82525050565b60006020820190506118d560008301846118b1565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156119155780820151818401526020810190506118fa565b60008484015250505050565b6000601f19601f8301169050919050565b600061193d826118db565b61194781856118e6565b93506119578185602086016118f7565b61196081611921565b840191505092915050565b600060208201905081810360008301526119858184611932565b905092915050565b6000819050919050565b6119a08161198d565b81146119ab57600080fd5b50565b6000813590506119bd81611997565b92915050565b6000602082840312156119d9576119d8611816565b5b60006119e7848285016119ae565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611a1b826119f0565b9050919050565b611a2b81611a10565b82525050565b6000602082019050611a466000830184611a22565b92915050565b611a5581611a10565b8114611a6057600080fd5b50565b600081359050611a7281611a4c565b92915050565b600080600060608486031215611a9157611a90611816565b5b6000611a9f86828701611a63565b9350506020611ab086828701611a63565b9250506040611ac1868287016119ae565b9150509250925092565b6000819050919050565b611ade81611acb565b8114611ae957600080fd5b50565b600081359050611afb81611ad5565b92915050565b600060208284031215611b1757611b16611816565b5b6000611b2584828501611aec565b91505092915050565b611b3781611acb565b82525050565b6000602082019050611b526000830184611b2e565b92915050565b600065ffffffffffff82169050919050565b611b7381611b58565b8114611b7e57600080fd5b50565b600081359050611b9081611b6a565b92915050565b60008060408385031215611bad57611bac611816565b5b6000611bbb85828601611aec565b9250506020611bcc85828601611b81565b9150509250929050565b60008060408385031215611bed57611bec611816565b5b6000611bfb85828601611aec565b9250506020611c0c858286016119ae565b9150509250929050565b600060ff82169050919050565b611c2c81611c16565b82525050565b611c3b81611b58565b82525050565b6000608082019050611c566000830187611c23565b611c636020830186611c32565b611c706040830185611c32565b611c7d6060830184611c32565b95945050505050565b60008060408385031215611c9d57611c9c611816565b5b6000611cab85828601611aec565b9250506020611cbc85828601611a63565b9150509250929050565b600060208284031215611cdc57611cdb611816565b5b6000611cea84828501611a63565b91505092915050565b611cfc8161198d565b82525050565b6000602082019050611d176000830184611cf3565b92915050565b600080600060608486031215611d3657611d35611816565b5b6000611d4486828701611aec565b9350506020611d55868287016119ae565b9250506040611d6686828701611a63565b9150509250925092565b611d79816118a5565b8114611d8457600080fd5b50565b600081359050611d9681611d70565b92915050565b60008060408385031215611db357611db2611816565b5b6000611dc185828601611a63565b9250506020611dd285828601611d87565b9150509250929050565b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b611e1e82611921565b810181811067ffffffffffffffff82111715611e3d57611e3c611de6565b5b80604052505050565b6000611e5061180c565b9050611e5c8282611e15565b919050565b600067ffffffffffffffff821115611e7c57611e7b611de6565b5b611e8582611921565b9050602081019050919050565b82818337600083830152505050565b6000611eb4611eaf84611e61565b611e46565b905082815260208101848484011115611ed057611ecf611de1565b5b611edb848285611e92565b509392505050565b600082601f830112611ef857611ef7611ddc565b5b8135611f08848260208601611ea1565b91505092915050565b60008060008060808587031215611f2b57611f2a611816565b5b6000611f3987828801611a63565b9450506020611f4a87828801611a63565b9350506040611f5b878288016119ae565b925050606085013567ffffffffffffffff811115611f7c57611f7b61181b565b5b611f8887828801611ee3565b91505092959194509250565b600080600060608486031215611fad57611fac611816565b5b6000611fbb86828701611aec565b9350506020611fcc868287016119ae565b9250506040611fdd868287016119ae565b9150509250925092565b6000819050919050565b611ffa81611fe7565b82525050565b60006020820190506120156000830184611ff1565b92915050565b6000806040838503121561203257612031611816565b5b600061204085828601611a63565b925050602061205185828601611a63565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806120a257607f821691505b6020821081036120b5576120b461205b565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006121248261198d565b915061212f8361198d565b9250828203905081811115612147576121466120ea565b5b92915050565b600061215882611b58565b915061216383611b58565b9250828201905065ffffffffffff811115612181576121806120ea565b5b92915050565b60006121928261198d565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036121c4576121c36120ea565b5b600182019050919050565b6000815190506121de81611a4c565b92915050565b6000602082840312156121fa576121f9611816565b5b6000612208848285016121cf565b9150509291505056fea2646970667358221220a6276d6fde1858023f685db73f817a45cde05eb4e959bae96c34fdffebf3356364736f6c63430008110033 -\ No newline at end of file +60806040523480156200001157600080fd5b506040516200280b3803806200280b833981810160405281019062000037919062000236565b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600690816200008891906200050c565b5080600790816200009a91906200050c565b505050620005f3565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6200010c82620000c1565b810181811067ffffffffffffffff821117156200012e576200012d620000d2565b5b80604052505050565b600062000143620000a3565b905062000151828262000101565b919050565b600067ffffffffffffffff821115620001745762000173620000d2565b5b6200017f82620000c1565b9050602081019050919050565b60005b83811015620001ac5780820151818401526020810190506200018f565b60008484015250505050565b6000620001cf620001c98462000156565b62000137565b905082815260208101848484011115620001ee57620001ed620000bc565b5b620001fb8482856200018c565b509392505050565b600082601f8301126200021b576200021a620000b7565b5b81516200022d848260208601620001b8565b91505092915050565b6000806040838503121562000250576200024f620000ad565b5b600083015167ffffffffffffffff811115620002715762000270620000b2565b5b6200027f8582860162000203565b925050602083015167ffffffffffffffff811115620002a357620002a2620000b2565b5b620002b18582860162000203565b9150509250929050565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806200030e57607f821691505b602082108103620003245762000323620002c6565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b60008160020a8302905092915050565b600060088302620003917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826200034f565b6200039d86836200034f565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b6000620003ea620003e4620003de84620003b5565b620003bf565b620003b5565b9050919050565b6000819050919050565b6200040683620003c9565b6200041e6200041582620003f1565b8484546200035f565b825550505050565b600090565b6200043562000426565b62000442818484620003fb565b505050565b5b818110156200046a576200045e6000826200042b565b60018101905062000448565b5050565b601f821115620004b95762000483816200032a565b6200048e846200033f565b810160208510156200049e578190505b620004b6620004ad856200033f565b83018262000447565b50505b505050565b60008160020a8304905092915050565b6000620004e160001984600802620004be565b1980831691505092915050565b6000620004fc8383620004ce565b9150826002028217905092915050565b6200051782620002bb565b67ffffffffffffffff811115620005335762000532620000d2565b5b6200053f8254620002f5565b6200054c8282856200046e565b600060209050601f8311600181146200058457600084156200056f578287015190505b6200057b8582620004ee565b865550620005eb565b601f19841662000594866200032a565b60005b82811015620005be5784890151825560018201915060208501945060208101905062000597565b86831015620005de5784890151620005da601f891682620004ce565b8355505b6001600288020188555050505b505050505050565b61220880620006036000396000f3fe608060405260043610610147576000357c0100000000000000000000000000000000000000000000000000000000900480636352211e116100c8578063a22cb4651161008c578063a22cb46514610469578063b88d4fde14610492578063b9adc41b146104ae578063bee2c0b5146104eb578063e985e9c514610528578063f9613ab21461056557610147565b80636352211e1461035c57806370a08231146103995780638da5cb5b146103d657806395d89b4114610401578063a06561aa1461042c57610147565b806342842e0e1161010f57806342842e0e1461024a5780634d03546a146102665780634f64b2be146102a3578063559f5dc9146102e057806357cbf6921461031f57610147565b806301ffc9a71461014c57806306fdde0314610189578063081812fc146101b457806323b872dd146101f157806324e0febc1461020d575b600080fd5b34801561015857600080fd5b50610173600480360381019061016e9190611863565b6105a2565b60405161018091906118ab565b60405180910390f35b34801561019557600080fd5b5061019e6106f6565b6040516101ab9190611956565b60405180910390f35b3480156101c057600080fd5b506101db60048036038101906101d691906119ae565b610784565b6040516101e89190611a1c565b60405180910390f35b61020b60048036038101906102069190611a63565b6107c1565b005b34801561021957600080fd5b50610234600480360381019061022f9190611aec565b610830565b6040516102419190611b28565b60405180910390f35b610264600480360381019061025f9190611a63565b610848565b005b34801561027257600080fd5b5061028d60048036038101906102889190611b81565b6108b7565b60405161029a91906118ab565b60405180910390f35b3480156102af57600080fd5b506102ca60048036038101906102c591906119ae565b610af5565b6040516102d79190611b28565b60405180910390f35b3480156102ec57600080fd5b5061030760048036038101906103029190611bc1565b610b19565b60405161031693929190611c10565b60405180910390f35b34801561032b57600080fd5b5061034660048036038101906103419190611c47565b610b92565b6040516103539190611b28565b60405180910390f35b34801561036857600080fd5b50610383600480360381019061037e91906119ae565b610c1b565b6040516103909190611a1c565b60405180910390f35b3480156103a557600080fd5b506103c060048036038101906103bb9190611c87565b610c57565b6040516103cd9190611cc3565b60405180910390f35b3480156103e257600080fd5b506103eb610c5e565b6040516103f89190611a1c565b60405180910390f35b34801561040d57600080fd5b50610416610c82565b6040516104239190611956565b60405180910390f35b34801561043857600080fd5b50610453600480360381019061044e9190611cde565b610d10565b6040516104609190611b28565b60405180910390f35b34801561047557600080fd5b50610490600480360381019061048b9190611d5d565b610f40565b005b6104ac60048036038101906104a79190611ed2565b6111e2565b005b3480156104ba57600080fd5b506104d560048036038101906104d09190611aec565b6112b9565b6040516104e291906118ab565b60405180910390f35b3480156104f757600080fd5b50610512600480360381019061050d9190611f55565b6112eb565b60405161051f9190611fc1565b60405180910390f35b34801561053457600080fd5b5061054f600480360381019061054a9190611fdc565b6113be565b60405161055c91906118ab565b60405180910390f35b34801561057157600080fd5b5061058c60048036038101906105879190611aec565b611456565b6040516105999190611b28565b60405180910390f35b60006380ac58cd7c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036105f657600190506106f1565b635b5e139f7c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19160361064857600190506106f1565b63780e9d637c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19160361069a57600190506106f1565b6301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036106ec57600190506106f1565b600090505b919050565b600680546107039061204b565b80601f016020809104026020016040519081016040528092919081815260200182805461072f9061204b565b801561077c5780601f106107515761010080835404028352916020019161077c565b820191906000526020600020905b81548152906001019060200180831161075f57829003601f168201915b505050505081565b60006004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b60606107cf848484846114c3565b818373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a450505050565b60036020528060005260406000206000915090505481565b6060610856848484846114c3565b818373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a450505050565b60008060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461091557600080fd5b61091d6117be565b6002600087815260200190815260200160002080549050925060008311156109ed576000600260008881526020019081526020016000206000815481106109675761096661207c565b5b9060005260206000200160000160009054906101000a900465ffffffffffff1665ffffffffffff161161099957600080fd5b600260008781526020019081526020016000206001846109b991906120da565b815481106109ca576109c961207c565b5b9060005260206000200160000160069054906101000a900465ffffffffffff1691505b84816000019065ffffffffffff16908165ffffffffffff16815250508482610a15919061210e565b816020019065ffffffffffff16908165ffffffffffff168152505060026000878152602001908152602001600020819080600181540180825580915050600190039060005260206000200160009091909190915060008201518160000160006101000a81548165ffffffffffff021916908365ffffffffffff16021790555060208201518160000160066101000a81548165ffffffffffff021916908365ffffffffffff160217905550604082015181600001600c6101000a81548165ffffffffffff021916908365ffffffffffff160217905550505050505092915050565b60018181548110610b0557600080fd5b906000526020600020016000915090505481565b60026020528160005260406000208181548110610b3557600080fd5b90600052602060002001600091509150508060000160009054906101000a900465ffffffffffff16908060000160069054906101000a900465ffffffffffff169080600001600c9054906101000a900465ffffffffffff16905083565b6000806000600102600360008681526020019081526020016000205414610bb857600080fd5b8273ffffffffffffffffffffffffffffffffffffffff1690507f8000000000000000000000000000000000000000000000000000000000000000811790508060010260036000868152602001908152602001600020819055508391505092915050565b600080600360008460010281526020019081526020016000205490506060819060020a026c010000000000000000000000009004915050919050565b6000919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60078054610c8f9061204b565b80601f0160208091040260200160405190810160405280929190818152602001828054610cbb9061204b565b8015610d085780601f10610cdd57610100808354040283529160200191610d08565b820191906000526020600020905b815481529060010190602001808311610ceb57829003601f168201915b505050505081565b600080600080600260008881526020019081526020016000208681548110610d3b57610d3a61207c565b5b906000526020600020019050600086148015610d75575060008160000160009054906101000a900465ffffffffffff1665ffffffffffff16145b15610dd657600181600001600c8282829054906101000a900465ffffffffffff16610da0919061210e565b92506101000a81548165ffffffffffff021916908365ffffffffffff160217905550610dcc8786610b92565b9350505050610f39565b8060000160009054906101000a900465ffffffffffff1665ffffffffffff1681600001600c9054906101000a900465ffffffffffff1665ffffffffffff1610610e1e57600080fd5b65ffffffffffff876001900416915060c8829060020a0291507f8000000000000000000000000000000000000000000000000000000000000000821791508473ffffffffffffffffffffffffffffffffffffffff16821791507fffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000087600190041692506028869060020a028317925080600001600c9054906101000a900465ffffffffffff1665ffffffffffff1683179250600181600001600c8282829054906101000a900465ffffffffffff16610ef5919061210e565b92506101000a81548165ffffffffffff021916908365ffffffffffff1602179055508160010260036000856001028152602001908152602001600020819055505050505b9392505050565b801561106157600073ffffffffffffffffffffffffffffffffffffffff16600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610fde57600080fd5b81600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611179565b600073ffffffffffffffffffffffffffffffffffffffff16600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16036110f957600080fd5b6000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516111d691906118ab565b60405180910390a35050565b6111ee848484846114c3565b818373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4818373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f75c9e114f073c346aac7d1d7e9a3c3c14edabcdd27de07d1d9e425f45d318c5e60006001026040516112ab9190611b28565b60405180910390a450505050565b6000807f8000000000000000000000000000000000000000000000000000000000000000836001900416119050919050565b6000808290505b600260008681526020019081526020016000208054905081101561139257836fffffffffffffffffffffffffffffffff166002600087815260200190815260200160002082815481106113485761134761207c565b5b9060005260206000200160000160069054906101000a900465ffffffffffff1665ffffffffffff16111561137f57809150506113b7565b808061138a90612148565b9150506112f2565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90505b9392505050565b60008173ffffffffffffffffffffffffffffffffffffffff16600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614905092915050565b60008060036000848152602001908152602001600020549050611478816112b9565b61148157600080fd5b60a081908060020a820491505090507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000060010283168117905080915050919050565b60003073ffffffffffffffffffffffffffffffffffffffff16636352211e846040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040161151a9190611cc3565b602060405180830381865afa158015611537573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061155b91906121a5565b90508473ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161461159557600080fd5b3373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16146116c9573373ffffffffffffffffffffffffffffffffffffffff166004600085815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614806116bf57503373ffffffffffffffffffffffffffffffffffffffff16600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b6116c857600080fd5b5b60006004600085815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611726838561172d565b5050505050565b60008083600102905060036000828152602001908152602001600020546001900491506000820361175d57600080fd5b7fffffffffffffffffffffffff0000000000000000000000000000000000000000821691508273ffffffffffffffffffffffffffffffffffffffff168217915081600102600360008381526020019081526020016000208190555050505050565b6040518060600160405280600065ffffffffffff168152602001600065ffffffffffff168152602001600065ffffffffffff1681525090565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6118408161180b565b811461184b57600080fd5b50565b60008135905061185d81611837565b92915050565b60006020828403121561187957611878611801565b5b60006118878482850161184e565b91505092915050565b60008115159050919050565b6118a581611890565b82525050565b60006020820190506118c0600083018461189c565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156119005780820151818401526020810190506118e5565b60008484015250505050565b6000601f19601f8301169050919050565b6000611928826118c6565b61193281856118d1565b93506119428185602086016118e2565b61194b8161190c565b840191505092915050565b60006020820190508181036000830152611970818461191d565b905092915050565b6000819050919050565b61198b81611978565b811461199657600080fd5b50565b6000813590506119a881611982565b92915050565b6000602082840312156119c4576119c3611801565b5b60006119d284828501611999565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611a06826119db565b9050919050565b611a16816119fb565b82525050565b6000602082019050611a316000830184611a0d565b92915050565b611a40816119fb565b8114611a4b57600080fd5b50565b600081359050611a5d81611a37565b92915050565b600080600060608486031215611a7c57611a7b611801565b5b6000611a8a86828701611a4e565b9350506020611a9b86828701611a4e565b9250506040611aac86828701611999565b9150509250925092565b6000819050919050565b611ac981611ab6565b8114611ad457600080fd5b50565b600081359050611ae681611ac0565b92915050565b600060208284031215611b0257611b01611801565b5b6000611b1084828501611ad7565b91505092915050565b611b2281611ab6565b82525050565b6000602082019050611b3d6000830184611b19565b92915050565b600065ffffffffffff82169050919050565b611b5e81611b43565b8114611b6957600080fd5b50565b600081359050611b7b81611b55565b92915050565b60008060408385031215611b9857611b97611801565b5b6000611ba685828601611ad7565b9250506020611bb785828601611b6c565b9150509250929050565b60008060408385031215611bd857611bd7611801565b5b6000611be685828601611ad7565b9250506020611bf785828601611999565b9150509250929050565b611c0a81611b43565b82525050565b6000606082019050611c256000830186611c01565b611c326020830185611c01565b611c3f6040830184611c01565b949350505050565b60008060408385031215611c5e57611c5d611801565b5b6000611c6c85828601611ad7565b9250506020611c7d85828601611a4e565b9150509250929050565b600060208284031215611c9d57611c9c611801565b5b6000611cab84828501611a4e565b91505092915050565b611cbd81611978565b82525050565b6000602082019050611cd86000830184611cb4565b92915050565b600080600060608486031215611cf757611cf6611801565b5b6000611d0586828701611ad7565b9350506020611d1686828701611999565b9250506040611d2786828701611a4e565b9150509250925092565b611d3a81611890565b8114611d4557600080fd5b50565b600081359050611d5781611d31565b92915050565b60008060408385031215611d7457611d73611801565b5b6000611d8285828601611a4e565b9250506020611d9385828601611d48565b9150509250929050565b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b611ddf8261190c565b810181811067ffffffffffffffff82111715611dfe57611dfd611da7565b5b80604052505050565b6000611e116117f7565b9050611e1d8282611dd6565b919050565b600067ffffffffffffffff821115611e3d57611e3c611da7565b5b611e468261190c565b9050602081019050919050565b82818337600083830152505050565b6000611e75611e7084611e22565b611e07565b905082815260208101848484011115611e9157611e90611da2565b5b611e9c848285611e53565b509392505050565b600082601f830112611eb957611eb8611d9d565b5b8135611ec9848260208601611e62565b91505092915050565b60008060008060808587031215611eec57611eeb611801565b5b6000611efa87828801611a4e565b9450506020611f0b87828801611a4e565b9350506040611f1c87828801611999565b925050606085013567ffffffffffffffff811115611f3d57611f3c611806565b5b611f4987828801611ea4565b91505092959194509250565b600080600060608486031215611f6e57611f6d611801565b5b6000611f7c86828701611ad7565b9350506020611f8d86828701611999565b9250506040611f9e86828701611999565b9150509250925092565b6000819050919050565b611fbb81611fa8565b82525050565b6000602082019050611fd66000830184611fb2565b92915050565b60008060408385031215611ff357611ff2611801565b5b600061200185828601611a4e565b925050602061201285828601611a4e565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061206357607f821691505b6020821081036120765761207561201c565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006120e582611978565b91506120f083611978565b9250828203905081811115612108576121076120ab565b5b92915050565b600061211982611b43565b915061212483611b43565b9250828201905065ffffffffffff811115612142576121416120ab565b5b92915050565b600061215382611978565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612185576121846120ab565b5b600182019050919050565b60008151905061219f81611a37565b92915050565b6000602082840312156121bb576121ba611801565b5b60006121c984828501612190565b9150509291505056fea264697066735822122067f7eec6506b7094b7a03769dda68d351e19fb6492f2e414e3e39740a9a4c7db64736f6c63430008110033 +\ No newline at end of file diff --git a/python/eth_craft_nft/data/CraftNFT.json b/python/eth_craft_nft/data/CraftNFT.json @@ -1 +1 @@ -[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":true,"internalType":"address","name":"_approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":true,"internalType":"address","name":"_operator","type":"address"},{"indexed":false,"internalType":"bool","name":"_approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":true,"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":true,"internalType":"uint256","name":"_tokenId","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"_data","type":"bytes32"}],"name":"TransferWithData","type":"event"},{"inputs":[{"internalType":"bytes32","name":"content","type":"bytes32"},{"internalType":"uint48","name":"count","type":"uint48"}],"name":"allocate","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_content","type":"bytes32"},{"internalType":"uint256","name":"_superIndex","type":"uint256"},{"internalType":"uint256","name":"_startAt","type":"uint256"}],"name":"batchOf","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_truncatedId","type":"bytes32"}],"name":"getDigest","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_tokenContent","type":"bytes32"}],"name":"isActiveContent","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_content","type":"bytes32"},{"internalType":"uint256","name":"_batch","type":"uint256"},{"internalType":"address","name":"_recipient","type":"address"}],"name":"mintFromBatchTo","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_content","type":"bytes32"},{"internalType":"address","name":"_recipient","type":"address"}],"name":"mintTo","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"mintedToken","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_operator","type":"address"},{"internalType":"bool","name":"_approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceID","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"token","outputs":[{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"uint48","name":"count","type":"uint48"},{"internalType":"uint48","name":"cumulativeCount","type":"uint48"},{"internalType":"uint48","name":"cursor","type":"uint48"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokens","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"payable","type":"function"}] +[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":true,"internalType":"address","name":"_approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":true,"internalType":"address","name":"_operator","type":"address"},{"indexed":false,"internalType":"bool","name":"_approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":true,"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":true,"internalType":"uint256","name":"_tokenId","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"_data","type":"bytes32"}],"name":"TransferWithData","type":"event"},{"inputs":[{"internalType":"bytes32","name":"content","type":"bytes32"},{"internalType":"uint48","name":"count","type":"uint48"}],"name":"allocate","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_content","type":"bytes32"},{"internalType":"uint256","name":"_superIndex","type":"uint256"},{"internalType":"uint256","name":"_startAt","type":"uint256"}],"name":"batchOf","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_truncatedId","type":"bytes32"}],"name":"getDigest","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_tokenContent","type":"bytes32"}],"name":"isActiveContent","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_content","type":"bytes32"},{"internalType":"uint256","name":"_batch","type":"uint256"},{"internalType":"address","name":"_recipient","type":"address"}],"name":"mintFromBatchTo","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_content","type":"bytes32"},{"internalType":"address","name":"_recipient","type":"address"}],"name":"mintTo","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"mintedToken","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_operator","type":"address"},{"internalType":"bool","name":"_approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceID","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"token","outputs":[{"internalType":"uint48","name":"count","type":"uint48"},{"internalType":"uint48","name":"cumulativeCount","type":"uint48"},{"internalType":"uint48","name":"cursor","type":"uint48"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokens","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"payable","type":"function"}] diff --git a/python/eth_craft_nft/nft.py b/python/eth_craft_nft/nft.py @@ -95,6 +95,25 @@ class CraftNFT(ERC721): return o + def get_token_spec_raw(self, contract_address, token_id, batch, sender_address=ZERO_ADDRESS, id_generator=None): + j = JSONRPCRequest(id_generator) + o = j.template() + o['method'] = 'eth_call' + enc = ABIContractEncoder() + enc.method('token') + enc.typ(ABIContractType.BYTES32) + enc.typ(ABIContractType.UINT256) + enc.bytes32(token_id) + enc.uint256(batch) + data = add_0x(enc.get()) + tx = self.template(sender_address, contract_address) + tx = self.set_code(tx, data) + o['params'].append(self.normalize(tx)) + o['params'].append('latest') + o = j.finalize(o) + return o + + def get_token_raw(self, contract_address, token_id, sender_address=ZERO_ADDRESS, id_generator=None): j = JSONRPCRequest(id_generator) o = j.template() diff --git a/python/tests/test_basic.py b/python/tests/test_basic.py @@ -129,6 +129,34 @@ class Test(EthTesterCase): self.assertEqual(r['status'], 1) + def test_mint_to_limit(self): + nonce_oracle = RPCNonceOracle(self.accounts[0], self.rpc) + c = CraftNFT(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) + (tx_hash_hex, o) = c.allocate(self.address, self.accounts[0], hash_of_foo, amount=10) + self.rpc.do(o) + o = receipt(tx_hash_hex) + r = self.conn.do(o) + self.assertEqual(r['status'], 1) + + for i in range(10): + o = c.get_token_spec_raw(self.address, hash_of_foo, 0, sender_address=self.accounts[0]) + r = self.rpc.do(o) + + (tx_hash_hex, o) = c.mint_to(self.address, self.accounts[0], hash_of_foo, 0, self.accounts[(i%8)+i]) + self.rpc.do(o) + o = receipt(tx_hash_hex) + r = self.conn.do(o) + self.assertEqual(r['status'], 1) + + + (tx_hash_hex, o) = c.mint_to(self.address, self.accounts[0], hash_of_foo, 0, self.accounts[9]) + self.rpc.do(o) + o = receipt(tx_hash_hex) + r = self.conn.do(o) + self.assertEqual(r['status'], 0) + + + def test_mint_to_single(self): nonce_oracle = RPCNonceOracle(self.accounts[0], self.rpc) c = CraftNFT(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) @@ -258,17 +286,23 @@ class Test(EthTesterCase): (tx_hash_hex, o) = c.allocate(self.address, self.accounts[0], hash_of_foo, amount=4) self.rpc.do(o) - for i in range(4+8+6): + for i in range(6+8+4): o = c.batch_of(self.address, hash_of_foo, i, sender_address=self.accounts[0]) r = self.rpc.do(o) batch = c.parse_batch_of(r) - c.mint_to(self.address, self.accounts[0], hash_of_foo, batch, self.accounts[(i%7)+1]) + (tx_hash_hex, o) = c.mint_to(self.address, self.accounts[0], hash_of_foo, batch, self.accounts[(i%7)+1]) r = self.rpc.do(o) o = receipt(tx_hash_hex) r = self.conn.do(o) self.assertEqual(r['status'], 1) + (tx_hash_hex, o) = c.mint_to(self.address, self.accounts[0], hash_of_foo, 2, self.accounts[9]) + r = self.rpc.do(o) + o = receipt(tx_hash_hex) + r = self.conn.do(o) + self.assertEqual(r['status'], 0) + if __name__ == '__main__': unittest.main() diff --git a/solidity/CraftNFT.sol b/solidity/CraftNFT.sol @@ -4,7 +4,6 @@ pragma solidity >= 0.8.0; contract CraftNFT { struct tokenSpec { - uint8 v; uint48 count; uint48 cumulativeCount; uint48 cursor; @@ -111,7 +110,8 @@ contract CraftNFT { tokenSpec storage spec; spec = token[_content][_batch]; - if (spec.count == 0 && spec.count == 0) { + if (_batch == 0 && spec.count == 0) { + spec.cursor += 1; return mintTo(_content, _recipient); } require(spec.cursor < spec.count); @@ -125,8 +125,8 @@ contract CraftNFT { left |= (_batch << 40); left |= spec.cursor; - mintedToken[bytes32(left)] = bytes32(right); spec.cursor += 1; + mintedToken[bytes32(left)] = bytes32(right); } // ERC-721