eth-erc20

ERC20 interface and example giftable token contract
Log | Files | Refs | LICENSE

commit d7fb3f232c2d51c692c1b25f61418938bdd775f1
parent ea7c106fa440e48b7eeb3c1c02ab9afce6b3d161
Author: lash <dev@holbrook.no>
Date:   Tue, 21 Feb 2023 20:28:25 +0000

Add expire option

Diffstat:
Mpython/giftable_erc20_token/data/GiftableToken.bin | 4++--
Mpython/giftable_erc20_token/data/GiftableToken.json | 2+-
Mpython/giftable_erc20_token/factory.py | 16++++++++++------
Dpython/giftable_erc20_token/runnable/deploy.py | 109-------------------------------------------------------------------------------
Apython/giftable_erc20_token/runnable/publish.py | 112+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Apython/giftable_erc20_token/unittest/__init__.py | 1+
Apython/giftable_erc20_token/unittest/base.py | 51+++++++++++++++++++++++++++++++++++++++++++++++++++
Mpython/run_tests.sh | 2++
Mpython/setup.cfg | 6+++---
Mpython/static_token/data/StaticToken.bin | 4++--
Mpython/tests/test_erc20_interface.py | 30+++---------------------------
Apython/tests/test_giftable.py | 84+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Msolidity/GiftableToken.bin | 4++--
Msolidity/GiftableToken.json | 2+-
Msolidity/GiftableToken.sol | 37+++++++++++++++++++++++++++++++++----
Msolidity/StaticToken.bin | 4++--
16 files changed, 309 insertions(+), 159 deletions(-)

diff --git a/python/giftable_erc20_token/data/GiftableToken.bin b/python/giftable_erc20_token/data/GiftableToken.bin @@ -1 +1 @@ -60806040523480156200001157600080fd5b506040516200199f3803806200199f8339818101604052810190620000379190620003af565b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600290805190602001906200008f92919062000124565b508160039080519060200190620000a892919062000124565b5080600460006101000a81548160ff021916908360ff16021790555060018060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550505050620004ad565b828054620001329062000478565b90600052602060002090601f016020900481019282620001565760008555620001a2565b82601f106200017157805160ff1916838001178555620001a2565b82800160010185558215620001a2579182015b82811115620001a157825182559160200191906001019062000184565b5b509050620001b19190620001b5565b5090565b5b80821115620001d0576000816000905550600101620001b6565b5090565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6200023d82620001f2565b810181811067ffffffffffffffff821117156200025f576200025e62000203565b5b80604052505050565b600062000274620001d4565b905062000282828262000232565b919050565b600067ffffffffffffffff821115620002a557620002a462000203565b5b620002b082620001f2565b9050602081019050919050565b60005b83811015620002dd578082015181840152602081019050620002c0565b83811115620002ed576000848401525b50505050565b60006200030a620003048462000287565b62000268565b905082815260208101848484011115620003295762000328620001ed565b5b62000336848285620002bd565b509392505050565b600082601f830112620003565762000355620001e8565b5b815162000368848260208601620002f3565b91505092915050565b600060ff82169050919050565b620003898162000371565b81146200039557600080fd5b50565b600081519050620003a9816200037e565b92915050565b600080600060608486031215620003cb57620003ca620001de565b5b600084015167ffffffffffffffff811115620003ec57620003eb620001e3565b5b620003fa868287016200033e565b935050602084015167ffffffffffffffff8111156200041e576200041d620001e3565b5b6200042c868287016200033e565b92505060406200043f8682870162000398565b9150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806200049157607f821691505b602082108103620004a757620004a662000449565b5b50919050565b6114e280620004bd6000396000f3fe608060405234801561001057600080fd5b5060043610610112576000357c010000000000000000000000000000000000000000000000000000000090048063449a52f8116100b4578063983b2d5611610083578063983b2d56146102cd578063a9059cbb146102fd578063dd62ed3e1461032d578063f2fde38b1461035d57610112565b8063449a52f81461023157806370a08231146102615780638da5cb5b1461029157806395d89b41146102af57610112565b806318160ddd116100f057806318160ddd1461019557806323b872dd146101b35780633092afd5146101e3578063313ce5671461021357610112565b806301ffc9a71461011757806306fdde0314610147578063095ea7b314610165575b600080fd5b610131600480360381019061012c9190611056565b61038d565b60405161013e919061109e565b60405180910390f35b61014f6104e1565b60405161015c9190611152565b60405180910390f35b61017f600480360381019061017a9190611208565b61056f565b60405161018c919061109e565b60405180910390f35b61019d6106f3565b6040516101aa9190611257565b60405180910390f35b6101cd60048036038101906101c89190611272565b6106f9565b6040516101da919061109e565b60405180910390f35b6101fd60048036038101906101f891906112c5565b610a0b565b60405161020a919061109e565b60405180910390f35b61021b610afd565b604051610228919061130e565b60405180910390f35b61024b60048036038101906102469190611208565b610b10565b604051610258919061109e565b60405180910390f35b61027b600480360381019061027691906112c5565b610c46565b6040516102889190611257565b60405180910390f35b610299610c5e565b6040516102a69190611338565b60405180910390f35b6102b7610c82565b6040516102c49190611152565b60405180910390f35b6102e760048036038101906102e291906112c5565b610d10565b6040516102f4919061109e565b60405180910390f35b61031760048036038101906103129190611208565b610dcb565b604051610324919061109e565b60405180910390f35b61034760048036038101906103429190611353565b610f34565b6040516103549190611257565b60405180910390f35b610377600480360381019061037291906112c5565b610f59565b604051610384919061109e565b60405180910390f35b600063c6bb4b707c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036103e157600190506104dc565b63449a52f87c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19160361043357600190506104dc565b6301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19160361048557600190506104dc565b639493f8b27c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036104d757600190506104dc565b600090505b919050565b600280546104ee906113c2565b80601f016020809104026020016040519081016040528092919081815260200182805461051a906113c2565b80156105675780601f1061053c57610100808354040283529160200191610567565b820191906000526020600020905b81548152906001019060200180831161054a57829003601f168201915b505050505081565b600080821115610603576000600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541461060257600080fd5b5b81600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516106e19190611257565b60405180910390a36001905092915050565b60055481565b600081600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561078457600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156107d057600080fd5b81600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546108589190611422565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546109279190611422565b9250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461097d9190611456565b925050819055503373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f5f7542858008eeb041631f30e6109ae94b83a58e9a58261dd2c42c508850f939856040516109f89190611257565b60405180910390a4600190509392505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610a9357508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610a9c57600080fd5b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060019050919050565b600460009054906101000a900460ff1681565b6000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610b6857600080fd5b81600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610bb79190611456565b925050819055508160056000828254610bd09190611456565b925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fab8530f87dc9b59234c4623bf917212bb2536d647574c8e7e5da92c2ede0c9f884604051610c349190611257565b60405180910390a36001905092915050565b60066020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60038054610c8f906113c2565b80601f0160208091040260200160405190810160405280929190818152602001828054610cbb906113c2565b8015610d085780601f10610cdd57610100808354040283529160200191610d08565b820191906000526020600020905b815481529060010190602001808311610ceb57829003601f168201915b505050505081565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610d6b57600080fd5b60018060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060019050919050565b600081600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610e1957600080fd5b81600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610e689190611422565b9250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610ebe9190611456565b925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610f229190611257565b60405180910390a36001905092915050565b6007602052816000526040600020602052806000526040600020600091509150505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610fb457600080fd5b816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550919050565b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b61103381610ffe565b811461103e57600080fd5b50565b6000813590506110508161102a565b92915050565b60006020828403121561106c5761106b610ff9565b5b600061107a84828501611041565b91505092915050565b60008115159050919050565b61109881611083565b82525050565b60006020820190506110b3600083018461108f565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156110f35780820151818401526020810190506110d8565b83811115611102576000848401525b50505050565b6000601f19601f8301169050919050565b6000611124826110b9565b61112e81856110c4565b935061113e8185602086016110d5565b61114781611108565b840191505092915050565b6000602082019050818103600083015261116c8184611119565b905092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061119f82611174565b9050919050565b6111af81611194565b81146111ba57600080fd5b50565b6000813590506111cc816111a6565b92915050565b6000819050919050565b6111e5816111d2565b81146111f057600080fd5b50565b600081359050611202816111dc565b92915050565b6000806040838503121561121f5761121e610ff9565b5b600061122d858286016111bd565b925050602061123e858286016111f3565b9150509250929050565b611251816111d2565b82525050565b600060208201905061126c6000830184611248565b92915050565b60008060006060848603121561128b5761128a610ff9565b5b6000611299868287016111bd565b93505060206112aa868287016111bd565b92505060406112bb868287016111f3565b9150509250925092565b6000602082840312156112db576112da610ff9565b5b60006112e9848285016111bd565b91505092915050565b600060ff82169050919050565b611308816112f2565b82525050565b600060208201905061132360008301846112ff565b92915050565b61133281611194565b82525050565b600060208201905061134d6000830184611329565b92915050565b6000806040838503121561136a57611369610ff9565b5b6000611378858286016111bd565b9250506020611389858286016111bd565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806113da57607f821691505b6020821081036113ed576113ec611393565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061142d826111d2565b9150611438836111d2565b92508282101561144b5761144a6113f3565b5b828203905092915050565b6000611461826111d2565b915061146c836111d2565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156114a1576114a06113f3565b5b82820190509291505056fea26469706673582212205fc8b9ae105c30de7717077cd1d886d62671d0141cc27c3db4575e24bd82c4d264736f6c634300080d0033 -\ No newline at end of file +60806040523480156200001157600080fd5b5060405162001e4538038062001e4583398181016040528101906200003791906200032a565b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550836002908162000088919062000621565b5082600390816200009a919062000621565b5081600460006101000a81548160ff021916908360ff16021790555060018060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550806008819055505050505062000708565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b62000187826200013c565b810181811067ffffffffffffffff82111715620001a957620001a86200014d565b5b80604052505050565b6000620001be6200011e565b9050620001cc82826200017c565b919050565b600067ffffffffffffffff821115620001ef57620001ee6200014d565b5b620001fa826200013c565b9050602081019050919050565b60005b83811015620002275780820151818401526020810190506200020a565b60008484015250505050565b60006200024a6200024484620001d1565b620001b2565b90508281526020810184848401111562000269576200026862000137565b5b6200027684828562000207565b509392505050565b600082601f83011262000296576200029562000132565b5b8151620002a884826020860162000233565b91505092915050565b600060ff82169050919050565b620002c981620002b1565b8114620002d557600080fd5b50565b600081519050620002e981620002be565b92915050565b6000819050919050565b6200030481620002ef565b81146200031057600080fd5b50565b6000815190506200032481620002f9565b92915050565b6000806000806080858703121562000347576200034662000128565b5b600085015167ffffffffffffffff8111156200036857620003676200012d565b5b62000376878288016200027e565b945050602085015167ffffffffffffffff8111156200039a57620003996200012d565b5b620003a8878288016200027e565b9350506040620003bb87828801620002d8565b9250506060620003ce8782880162000313565b91505092959194509250565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806200042d57607f821691505b602082108103620004435762000442620003e5565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b60008160020a8302905092915050565b600060088302620004b07fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826200046e565b620004bc86836200046e565b95508019841693508086168417925050509392505050565b6000819050919050565b6000620004ff620004f9620004f384620002ef565b620004d4565b620002ef565b9050919050565b6000819050919050565b6200051b83620004de565b620005336200052a8262000506565b8484546200047e565b825550505050565b600090565b6200054a6200053b565b6200055781848462000510565b505050565b5b818110156200057f576200057360008262000540565b6001810190506200055d565b5050565b601f821115620005ce57620005988162000449565b620005a3846200045e565b81016020851015620005b3578190505b620005cb620005c2856200045e565b8301826200055c565b50505b505050565b60008160020a8304905092915050565b6000620005f660001984600802620005d3565b1980831691505092915050565b6000620006118383620005e3565b9150826002028217905092915050565b6200062c82620003da565b67ffffffffffffffff8111156200064857620006476200014d565b5b62000654825462000414565b6200066182828562000583565b600060209050601f83116001811462000699576000841562000684578287015190505b62000690858262000603565b86555062000700565b601f198416620006a98662000449565b60005b82811015620006d357848901518255600182019150602085019450602081019050620006ac565b86831015620006f35784890151620006ef601f891682620005e3565b8355505b6001600288020188555050505b505050505050565b61172d80620007186000396000f3fe608060405234801561001057600080fd5b5060043610610133576000357c0100000000000000000000000000000000000000000000000000000000900480635f408c04116100bf578063a9059cbb1161008e578063a9059cbb1461033c578063b1cb0db31461036c578063da2824a81461038a578063dd62ed3e146103ba578063f2fde38b146103ea57610133565b80635f408c04146102b257806370a08231146102d05780638da5cb5b1461030057806395d89b411461031e57610133565b806323b872dd1161010657806323b872dd146101d45780632b29ba2314610204578063313ce56714610234578063449a52f8146102525780635356dddc1461028257610133565b806301ffc9a71461013857806306fdde0314610168578063095ea7b31461018657806318160ddd146101b6575b600080fd5b610152600480360381019061014d91906112cc565b61041a565b60405161015f9190611314565b60405180910390f35b61017061056e565b60405161017d91906113bf565b60405180910390f35b6101a0600480360381019061019b9190611475565b6105fc565b6040516101ad9190611314565b60405180910390f35b6101be610797565b6040516101cb91906114c4565b60405180910390f35b6101ee60048036038101906101e991906114df565b61079d565b6040516101fb9190611314565b60405180910390f35b61021e60048036038101906102199190611532565b610ac5565b60405161022b9190611314565b60405180910390f35b61023c610b71565b604051610249919061157b565b60405180910390f35b61026c60048036038101906102679190611475565b610b84565b6040516102799190611314565b60405180910390f35b61029c60048036038101906102979190611532565b610d10565b6040516102a99190611314565b60405180910390f35b6102ba610e02565b6040516102c7919061157b565b60405180910390f35b6102ea60048036038101906102e59190611532565b610ea0565b6040516102f791906114c4565b60405180910390f35b610308610eb8565b60405161031591906115a5565b60405180910390f35b610326610edc565b60405161033391906113bf565b60405180910390f35b61035660048036038101906103519190611475565b610f6a565b6040516103639190611314565b60405180910390f35b6103746110e9565b60405161038191906114c4565b60405180910390f35b6103a4600480360381019061039f9190611532565b6110ef565b6040516103b19190611314565b60405180910390f35b6103d460048036038101906103cf91906115c0565b6111aa565b6040516103e191906114c4565b60405180910390f35b61040460048036038101906103ff9190611532565b6111cf565b6040516104119190611314565b60405180910390f35b600063c6bb4b707c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19160361046e5760019050610569565b63449a52f87c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036104c05760019050610569565b6301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036105125760019050610569565b639493f8b27c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036105645760019050610569565b600090505b919050565b6002805461057b9061162f565b80601f01602080910402602001604051908101604052809291908181526020018280546105a79061162f565b80156105f45780601f106105c9576101008083540402835291602001916105f4565b820191906000526020600020905b8154815290600101906020018083116105d757829003601f168201915b505050505081565b600080610607610e02565b60ff161461061457600080fd5b60008211156106a7576000600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054146106a657600080fd5b5b81600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161078591906114c4565b60405180910390a36001905092915050565b60055481565b6000806107a8610e02565b60ff16146107b557600080fd5b81600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561083e57600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561088a57600080fd5b81600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610912919061168f565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546109e1919061168f565b9250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610a3791906116c3565b925050819055503373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f5f7542858008eeb041631f30e6109ae94b83a58e9a58261dd2c42c508850f93985604051610ab291906114c4565b60405180910390a4600190509392505050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680610b6a575060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b9050919050565b600460009054906101000a900460ff1681565b6000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680610c29575060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610c3257600080fd5b81600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610c8191906116c3565b925050819055508160056000828254610c9a91906116c3565b925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fab8530f87dc9b59234c4623bf917212bb2536d647574c8e7e5da92c2ede0c9f884604051610cfe91906114c4565b60405180910390a36001905092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610d9857508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610da157600080fd5b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060019050919050565b60008060085403610e165760009050610e9d565b600960009054906101000a900460ff1615610e345760019050610e9d565b6008544210610e98576001600960006101000a81548160ff0219169083151502179055507ff80dbaea4785589e52984ca36a31de106adc77759539a5c7d92883bf49692fe942604051610e8791906114c4565b60405180910390a160029050610e9d565b600090505b90565b60066020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60038054610ee99061162f565b80601f0160208091040260200160405190810160405280929190818152602001828054610f159061162f565b8015610f625780601f10610f3757610100808354040283529160200191610f62565b820191906000526020600020905b815481529060010190602001808311610f4557829003601f168201915b505050505081565b600080610f75610e02565b60ff1614610f8257600080fd5b81600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610fce57600080fd5b81600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461101d919061168f565b9250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461107391906116c3565b925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516110d791906114c4565b60405180910390a36001905092915050565b60085481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461114a57600080fd5b60018060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060019050919050565b6007602052816000526040600020602052806000526040600020600091509150505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461122a57600080fd5b816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550919050565b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6112a981611274565b81146112b457600080fd5b50565b6000813590506112c6816112a0565b92915050565b6000602082840312156112e2576112e161126f565b5b60006112f0848285016112b7565b91505092915050565b60008115159050919050565b61130e816112f9565b82525050565b60006020820190506113296000830184611305565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561136957808201518184015260208101905061134e565b60008484015250505050565b6000601f19601f8301169050919050565b60006113918261132f565b61139b818561133a565b93506113ab81856020860161134b565b6113b481611375565b840191505092915050565b600060208201905081810360008301526113d98184611386565b905092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061140c826113e1565b9050919050565b61141c81611401565b811461142757600080fd5b50565b60008135905061143981611413565b92915050565b6000819050919050565b6114528161143f565b811461145d57600080fd5b50565b60008135905061146f81611449565b92915050565b6000806040838503121561148c5761148b61126f565b5b600061149a8582860161142a565b92505060206114ab85828601611460565b9150509250929050565b6114be8161143f565b82525050565b60006020820190506114d960008301846114b5565b92915050565b6000806000606084860312156114f8576114f761126f565b5b60006115068682870161142a565b93505060206115178682870161142a565b925050604061152886828701611460565b9150509250925092565b6000602082840312156115485761154761126f565b5b60006115568482850161142a565b91505092915050565b600060ff82169050919050565b6115758161155f565b82525050565b6000602082019050611590600083018461156c565b92915050565b61159f81611401565b82525050565b60006020820190506115ba6000830184611596565b92915050565b600080604083850312156115d7576115d661126f565b5b60006115e58582860161142a565b92505060206115f68582860161142a565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061164757607f821691505b60208210810361165a57611659611600565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061169a8261143f565b91506116a58361143f565b92508282039050818111156116bd576116bc611660565b5b92915050565b60006116ce8261143f565b91506116d98361143f565b92508282019050808211156116f1576116f0611660565b5b9291505056fea26469706673582212208aaa32a1e19a38a9c677c12685cac0eef1e83a25fdccc90a49a414e40771e53c64736f6c63430008120033 +\ No newline at end of file diff --git a/python/giftable_erc20_token/data/GiftableToken.json b/python/giftable_erc20_token/data/GiftableToken.json @@ -1 +1 @@ -[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"uint8","name":"_decimals","type":"uint8"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":true,"internalType":"address","name":"_spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_minter","type":"address"},{"indexed":true,"internalType":"address","name":"_beneficiary","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","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":"address","name":"_spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"TransferFrom","type":"event"},{"inputs":[{"internalType":"address","name":"_minter","type":"address"}],"name":"addMinter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spender","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"mintTo","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","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":"address","name":"_minter","type":"address"}],"name":"removeMinter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_sum","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}] +[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"uint8","name":"_decimals","type":"uint8"},{"internalType":"uint256","name":"_expireTimestamp","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":true,"internalType":"address","name":"_spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_timestamp","type":"uint256"}],"name":"Expired","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_minter","type":"address"},{"indexed":true,"internalType":"address","name":"_beneficiary","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","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":"address","name":"_spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"TransferFrom","type":"event"},{"inputs":[{"internalType":"address","name":"_minter","type":"address"}],"name":"addWriter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"applyExpiry","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_spender","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"expires","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_minter","type":"address"}],"name":"isWriter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"mintTo","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","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":"address","name":"_minter","type":"address"}],"name":"removeWriter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_sum","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}] diff --git a/python/giftable_erc20_token/factory.py b/python/giftable_erc20_token/factory.py @@ -15,29 +15,33 @@ from chainlib.eth.contract import ( # local imports from giftable_erc20_token.data import data_dir +from eth_erc20 import ERC20 logg = logging.getLogger(__name__) -class GiftableToken(TxFactory): +class GiftableToken(ERC20): __abi = None __bytecode = None - def constructor(self, sender_address, name, symbol, decimals, tx_format=TxFormat.JSONRPC, version=None): - code = self.cargs(name, symbol, decimals) + def constructor(self, sender_address, name, symbol, decimals, expire=0, tx_format=TxFormat.JSONRPC, version=None): + code = self.cargs(name, symbol, decimals, expire=expire) tx = self.template(sender_address, None, use_nonce=True) tx = self.set_code(tx, code) return self.finalize(tx, tx_format) @staticmethod - def cargs(name, symbol, decimals, version=None): + def cargs(name, symbol, decimals, expire=0, version=None): + if expire == None: + expire = 0 code = GiftableToken.bytecode(version=version) enc = ABIContractEncoder() enc.string(name) enc.string(symbol) enc.uint256(decimals) + enc.uint256(expire) code += enc.get() return code @@ -108,12 +112,12 @@ def bytecode(**kwargs): def create(**kwargs): - return GiftableToken.cargs(kwargs['name'], kwargs['symbol'], kwargs['decimals'], version=kwargs.get('version')) + return GiftableToken.cargs(kwargs['name'], kwargs['symbol'], kwargs['decimals'], expire=kwargs.get('expire'), version=kwargs.get('version')) def args(v): if v == 'create': - return (['name', 'symbol', 'decimals'], ['version'],) + return (['name', 'symbol', 'decimals'], ['expire', 'version'],) elif v == 'default' or v == 'bytecode': return ([], ['version'],) raise ValueError('unknown command: ' + v) diff --git a/python/giftable_erc20_token/runnable/deploy.py b/python/giftable_erc20_token/runnable/deploy.py @@ -1,109 +0,0 @@ -#!python3 - -"""Deploys giftable token - -.. moduleauthor:: Louis Holbrook <dev@holbrook.no> -.. pgp:: 0826EDA1702D1E87C6E2875121D2E7BB88C2A746 - -""" - -# SPDX-License-Identifier: GPL-3.0-or-later - -# standard imports -import sys -import os -import json -import argparse -import logging -import time -from enum import Enum - -# external imports -import chainlib.eth.cli -from chainlib.eth.tx import receipt -from chainlib.settings import ChainSettings -from chainlib.eth.cli.log import process_log -from chainlib.eth.settings import process_settings -from chainlib.eth.cli.arg import ( - Arg, - ArgFlag, - process_args, - ) -from chainlib.eth.cli.config import ( - Config, - process_config, - ) - - -# local imports -from giftable_erc20_token import GiftableToken - -logg = logging.getLogger() - - -def process_config_local(config, arg, args, flags): - config.add(args.token_name, '_TOKEN_NAME', False) - config.add(args.token_symbol, '_TOKEN_SYMBOL', False) - config.add(args.token_decimals, '_TOKEN_DECIMALS', False) - return config - - -arg_flags = ArgFlag() -arg = Arg(arg_flags) -flags = arg_flags.STD_WRITE | arg_flags.WALLET - -argparser = chainlib.eth.cli.ArgumentParser() -argparser = process_args(argparser, arg, flags) -argparser.add_argument('--name', dest='token_name', required=True, type=str, help='Token name') -argparser.add_argument('--symbol', dest='token_symbol', required=True, type=str, help='Token symbol') -argparser.add_argument('--decimals', dest='token_decimals', default=18, type=int, help='Token decimals') -args = argparser.parse_args() - -logg = process_log(args, logg) - -config = Config() -config = process_config(config, arg, args, flags) -config = process_config_local(config, arg, args, flags) -logg.debug('config loaded:\n{}'.format(config)) - -settings = ChainSettings() -settings = process_settings(settings, config) -logg.debug('settings loaded:\n{}'.format(settings)) - - -def main(): - signer_address = settings.get('SENDER_ADDRESS') - conn = settings.get('CONN') - - c = GiftableToken( - settings.get('CHAIN_SPEC'), - signer=settings.get('SIGNER'), - gas_oracle=settings.get('GAS_ORACLE'), - nonce_oracle=settings.get('NONCE_ORACLE'), - ) - - (tx_hash_hex, o) = c.constructor( - signer_address, - config.get('_TOKEN_NAME'), - config.get('_TOKEN_SYMBOL'), - config.get('_TOKEN_DECIMALS'), - ) - if settings.get('RPC_SEND'): - conn.do(o) - if settings.get('WAIT'): - r = conn.wait(tx_hash_hex) - if r['status'] == 0: - sys.stderr.write('EVM revert while deploying contract. Wish I had more to tell you') - sys.exit(1) - # TODO: pass through translator for keys (evm tester uses underscore instead of camelcase) - address = r['contractAddress'] - - print(address) - else: - print(tx_hash_hex) - else: - print(o) - - -if __name__ == '__main__': - main() diff --git a/python/giftable_erc20_token/runnable/publish.py b/python/giftable_erc20_token/runnable/publish.py @@ -0,0 +1,112 @@ +#!python3 + +"""Deploys giftable token + +.. moduleauthor:: Louis Holbrook <dev@holbrook.no> +.. pgp:: 0826EDA1702D1E87C6E2875121D2E7BB88C2A746 + +""" + +# SPDX-License-Identifier: GPL-3.0-or-later + +# standard imports +import sys +import os +import json +import argparse +import logging +import time +from enum import Enum + +# external imports +import chainlib.eth.cli +from chainlib.eth.tx import receipt +from chainlib.settings import ChainSettings +from chainlib.eth.cli.log import process_log +from chainlib.eth.settings import process_settings +from chainlib.eth.cli.arg import ( + Arg, + ArgFlag, + process_args, + ) +from chainlib.eth.cli.config import ( + Config, + process_config, + ) + + +# local imports +from giftable_erc20_token import GiftableToken + +logg = logging.getLogger() + + +def process_config_local(config, arg, args, flags): + config.add(args.token_name, '_TOKEN_NAME', False) + config.add(args.token_symbol, '_TOKEN_SYMBOL', False) + config.add(args.token_decimals, '_TOKEN_DECIMALS', False) + config.add(args.token_expire, '_TOKEN_EXPIRE', False) + return config + + +arg_flags = ArgFlag() +arg = Arg(arg_flags) +flags = arg_flags.STD_WRITE | arg_flags.WALLET + +argparser = chainlib.eth.cli.ArgumentParser() +argparser = process_args(argparser, arg, flags) +argparser.add_argument('--name', dest='token_name', required=True, type=str, help='Token name') +argparser.add_argument('--symbol', dest='token_symbol', required=True, type=str, help='Token symbol') +argparser.add_argument('--decimals', dest='token_decimals', default=18, type=int, help='Token decimals') +argparser.add_argument('--expire', dest='token_expire', default=0, type=int, help='Token expiry timestamp (after which token cannot be traded)') +args = argparser.parse_args() + +logg = process_log(args, logg) + +config = Config() +config = process_config(config, arg, args, flags) +config = process_config_local(config, arg, args, flags) +logg.debug('config loaded:\n{}'.format(config)) + +settings = ChainSettings() +settings = process_settings(settings, config) +logg.debug('settings loaded:\n{}'.format(settings)) + + +def main(): + signer_address = settings.get('SENDER_ADDRESS') + conn = settings.get('CONN') + + c = GiftableToken( + settings.get('CHAIN_SPEC'), + signer=settings.get('SIGNER'), + gas_oracle=settings.get('GAS_ORACLE'), + nonce_oracle=settings.get('NONCE_ORACLE'), + ) + + (tx_hash_hex, o) = c.constructor( + signer_address, + config.get('_TOKEN_NAME'), + config.get('_TOKEN_SYMBOL'), + config.get('_TOKEN_DECIMALS'), + expire=config.get('_TOKEN_EXPIRE'), + ) + if settings.get('RPC_SEND'): + conn.do(o) + if settings.get('WAIT'): + r = conn.wait(tx_hash_hex) + if r['status'] == 0: + sys.stderr.write('EVM revert while deploying contract. Wish I had more to tell you') + sys.exit(1) + # TODO: pass through translator for keys (evm tester uses underscore instead of camelcase) + address = r['contractAddress'] + + print(address) + else: + print(tx_hash_hex) + else: + print(o) + + +if __name__ == '__main__': + main() diff --git a/python/giftable_erc20_token/unittest/__init__.py b/python/giftable_erc20_token/unittest/__init__.py @@ -0,0 +1 @@ +from .base import * diff --git a/python/giftable_erc20_token/unittest/base.py b/python/giftable_erc20_token/unittest/base.py @@ -0,0 +1,51 @@ +# standard imports +import logging +import time + +# external imports +from chainlib.eth.unittest.ethtester import EthTesterCase +from chainlib.connection import RPCConnection +from chainlib.eth.nonce import RPCNonceOracle +from chainlib.eth.tx import receipt +from chainlib.eth.address import to_checksum_address + +# local imports +from giftable_erc20_token import GiftableToken + +logg = logging.getLogger(__name__) + + +class TestGiftableToken(EthTesterCase): + + expire = 0 + + def setUp(self): + super(TestGiftableToken, self).setUp() + self.conn = RPCConnection.connect(self.chain_spec, 'default') + nonce_oracle = RPCNonceOracle(self.accounts[0], conn=self.conn) + c = GiftableToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) + self.symbol = 'FOO' + self.name = 'Foo Token' + self.decimals = 16 + (tx_hash, o) = c.constructor(self.accounts[0], self.name, self.symbol, self.decimals, expire=self.expire) + self.rpc.do(o) + o = receipt(tx_hash) + r = self.rpc.do(o) + self.assertEqual(r['status'], 1) + self.address = to_checksum_address(r['contract_address']) + logg.debug('published on address {} with hash {}'.format(self.address, tx_hash)) + + self.initial_supply = 1 << 40 + (tx_hash, o) = c.mint_to(self.address, self.accounts[0], self.accounts[0], self.initial_supply) + r = self.conn.do(o) + o = receipt(tx_hash) + r = self.conn.do(o) + self.assertEqual(r['status'], 1) + + +class TestGiftableExpireToken(TestGiftableToken): + + expire = int(time.time()) + 100000 + + def setUp(self): + super(TestGiftableExpireToken, self).setUp() diff --git a/python/run_tests.sh b/python/run_tests.sh @@ -1,5 +1,7 @@ #!/bin/bash +export PYTHONPATH=${PYTHONPATH}:. + set -e set -x for f in `ls tests/*.py`; do diff --git a/python/setup.cfg b/python/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = eth-erc20 -version = 0.5.6 +version = 0.6.0 description = ERC20 interface and simple contract with deployment script that lets any address mint and gift itself tokens. author = Louis Holbrook author_email = dev@holbrook.no @@ -30,6 +30,7 @@ python_requires = >= 3.7 packages = giftable_erc20_token giftable_erc20_token.runnable + giftable_erc20_token.unittest giftable_erc20_token.data eth_erc20 eth_erc20.data @@ -46,9 +47,8 @@ packages = [options.entry_points] console_scripts = - giftable-token-deploy = giftable_erc20_token.runnable.deploy:main + giftable-token-publish = giftable_erc20_token.runnable.publish:main giftable-token-gift = giftable_erc20_token.runnable.gift:main - giftable-token-minter = giftable_erc20_token.runnable.minter:main erc20-transfer = eth_erc20.runnable.transfer:main erc20-balance = eth_erc20.runnable.balance:main erc20-info = eth_erc20.runnable.info:main diff --git a/python/static_token/data/StaticToken.bin b/python/static_token/data/StaticToken.bin @@ -1 +1 @@ -60806040523480156200001157600080fd5b506040516200145c3803806200145c833981810160405281019062000037919062000400565b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555083600290805190602001906200008f9291906200013a565b508260039080519060200190620000a89291906200013a565b5081600460006101000a81548160ff021916908360ff1602179055508060058190555080600660008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050505062000514565b8280546200014890620004df565b90600052602060002090601f0160209004810192826200016c5760008555620001b8565b82601f106200018757805160ff1916838001178555620001b8565b82800160010185558215620001b8579182015b82811115620001b75782518255916020019190600101906200019a565b5b509050620001c79190620001cb565b5090565b5b80821115620001e6576000816000905550600101620001cc565b5090565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b620002538262000208565b810181811067ffffffffffffffff8211171562000275576200027462000219565b5b80604052505050565b60006200028a620001ea565b905062000298828262000248565b919050565b600067ffffffffffffffff821115620002bb57620002ba62000219565b5b620002c68262000208565b9050602081019050919050565b60005b83811015620002f3578082015181840152602081019050620002d6565b8381111562000303576000848401525b50505050565b6000620003206200031a846200029d565b6200027e565b9050828152602081018484840111156200033f576200033e62000203565b5b6200034c848285620002d3565b509392505050565b600082601f8301126200036c576200036b620001fe565b5b81516200037e84826020860162000309565b91505092915050565b600060ff82169050919050565b6200039f8162000387565b8114620003ab57600080fd5b50565b600081519050620003bf8162000394565b92915050565b6000819050919050565b620003da81620003c5565b8114620003e657600080fd5b50565b600081519050620003fa81620003cf565b92915050565b600080600080608085870312156200041d576200041c620001f4565b5b600085015167ffffffffffffffff8111156200043e576200043d620001f9565b5b6200044c8782880162000354565b945050602085015167ffffffffffffffff81111562000470576200046f620001f9565b5b6200047e8782880162000354565b93505060406200049187828801620003ae565b9250506060620004a487828801620003e9565b91505092959194509250565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680620004f857607f821691505b6020821081036200050e576200050d620004b0565b5b50919050565b610f3880620005246000396000f3fe608060405234801561001057600080fd5b50600436106100bb576000357c010000000000000000000000000000000000000000000000000000000090048063313ce56711610083578063313ce5671461018c57806370a08231146101aa57806395d89b41146101da578063a9059cbb146101f8578063dd62ed3e14610228576100bb565b806301ffc9a7146100c057806306fdde03146100f0578063095ea7b31461010e57806318160ddd1461013e57806323b872dd1461015c575b600080fd5b6100da60048036038101906100d59190610ad6565b610258565b6040516100e79190610b1e565b60405180910390f35b6100f8610308565b6040516101059190610bd2565b60405180910390f35b61012860048036038101906101239190610c88565b610396565b6040516101359190610b1e565b60405180910390f35b61014661051a565b6040516101539190610cd7565b60405180910390f35b61017660048036038101906101719190610cf2565b610520565b6040516101839190610b1e565b60405180910390f35b610194610832565b6040516101a19190610d61565b60405180910390f35b6101c460048036038101906101bf9190610d7c565b610845565b6040516101d19190610cd7565b60405180910390f35b6101e261085d565b6040516101ef9190610bd2565b60405180910390f35b610212600480360381019061020d9190610c88565b6108eb565b60405161021f9190610b1e565b60405180910390f35b610242600480360381019061023d9190610da9565b610a54565b60405161024f9190610cd7565b60405180910390f35b600063c6bb4b707c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036102ac5760019050610303565b6301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036102fe5760019050610303565b600090505b919050565b6002805461031590610e18565b80601f016020809104026020016040519081016040528092919081815260200182805461034190610e18565b801561038e5780601f106103635761010080835404028352916020019161038e565b820191906000526020600020905b81548152906001019060200180831161037157829003601f168201915b505050505081565b60008082111561042a576000600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541461042957600080fd5b5b81600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516105089190610cd7565b60405180910390a36001905092915050565b60055481565b600081600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156105ab57600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156105f757600080fd5b81600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461067f9190610e78565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461074e9190610e78565b9250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546107a49190610eac565b925050819055503373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f5f7542858008eeb041631f30e6109ae94b83a58e9a58261dd2c42c508850f9398560405161081f9190610cd7565b60405180910390a4600190509392505050565b600460009054906101000a900460ff1681565b60066020528060005260406000206000915090505481565b6003805461086a90610e18565b80601f016020809104026020016040519081016040528092919081815260200182805461089690610e18565b80156108e35780601f106108b8576101008083540402835291602001916108e3565b820191906000526020600020905b8154815290600101906020018083116108c657829003601f168201915b505050505081565b600081600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561093957600080fd5b81600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546109889190610e78565b9250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546109de9190610eac565b925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610a429190610cd7565b60405180910390a36001905092915050565b6007602052816000526040600020602052806000526040600020600091509150505481565b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b610ab381610a7e565b8114610abe57600080fd5b50565b600081359050610ad081610aaa565b92915050565b600060208284031215610aec57610aeb610a79565b5b6000610afa84828501610ac1565b91505092915050565b60008115159050919050565b610b1881610b03565b82525050565b6000602082019050610b336000830184610b0f565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610b73578082015181840152602081019050610b58565b83811115610b82576000848401525b50505050565b6000601f19601f8301169050919050565b6000610ba482610b39565b610bae8185610b44565b9350610bbe818560208601610b55565b610bc781610b88565b840191505092915050565b60006020820190508181036000830152610bec8184610b99565b905092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610c1f82610bf4565b9050919050565b610c2f81610c14565b8114610c3a57600080fd5b50565b600081359050610c4c81610c26565b92915050565b6000819050919050565b610c6581610c52565b8114610c7057600080fd5b50565b600081359050610c8281610c5c565b92915050565b60008060408385031215610c9f57610c9e610a79565b5b6000610cad85828601610c3d565b9250506020610cbe85828601610c73565b9150509250929050565b610cd181610c52565b82525050565b6000602082019050610cec6000830184610cc8565b92915050565b600080600060608486031215610d0b57610d0a610a79565b5b6000610d1986828701610c3d565b9350506020610d2a86828701610c3d565b9250506040610d3b86828701610c73565b9150509250925092565b600060ff82169050919050565b610d5b81610d45565b82525050565b6000602082019050610d766000830184610d52565b92915050565b600060208284031215610d9257610d91610a79565b5b6000610da084828501610c3d565b91505092915050565b60008060408385031215610dc057610dbf610a79565b5b6000610dce85828601610c3d565b9250506020610ddf85828601610c3d565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680610e3057607f821691505b602082108103610e4357610e42610de9565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610e8382610c52565b9150610e8e83610c52565b925082821015610ea157610ea0610e49565b5b828203905092915050565b6000610eb782610c52565b9150610ec283610c52565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610ef757610ef6610e49565b5b82820190509291505056fea2646970667358221220bafee9924aff7624f09b6f4830e10b7d6de45c027b6dc360d549303b3b89f83164736f6c634300080d0033 -\ No newline at end of file +60806040523480156200001157600080fd5b506040516200163338038062001633833981810160405281019062000037919062000338565b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555083600290816200008891906200062f565b5082600390816200009a91906200062f565b5081600460006101000a81548160ff021916908360ff1602179055508060058190555080600660008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050505062000716565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b62000195826200014a565b810181811067ffffffffffffffff82111715620001b757620001b66200015b565b5b80604052505050565b6000620001cc6200012c565b9050620001da82826200018a565b919050565b600067ffffffffffffffff821115620001fd57620001fc6200015b565b5b62000208826200014a565b9050602081019050919050565b60005b838110156200023557808201518184015260208101905062000218565b60008484015250505050565b6000620002586200025284620001df565b620001c0565b90508281526020810184848401111562000277576200027662000145565b5b6200028484828562000215565b509392505050565b600082601f830112620002a457620002a362000140565b5b8151620002b684826020860162000241565b91505092915050565b600060ff82169050919050565b620002d781620002bf565b8114620002e357600080fd5b50565b600081519050620002f781620002cc565b92915050565b6000819050919050565b6200031281620002fd565b81146200031e57600080fd5b50565b600081519050620003328162000307565b92915050565b6000806000806080858703121562000355576200035462000136565b5b600085015167ffffffffffffffff8111156200037657620003756200013b565b5b62000384878288016200028c565b945050602085015167ffffffffffffffff811115620003a857620003a76200013b565b5b620003b6878288016200028c565b9350506040620003c987828801620002e6565b9250506060620003dc8782880162000321565b91505092959194509250565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806200043b57607f821691505b602082108103620004515762000450620003f3565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b60008160020a8302905092915050565b600060088302620004be7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826200047c565b620004ca86836200047c565b95508019841693508086168417925050509392505050565b6000819050919050565b60006200050d620005076200050184620002fd565b620004e2565b620002fd565b9050919050565b6000819050919050565b6200052983620004ec565b62000541620005388262000514565b8484546200048c565b825550505050565b600090565b6200055862000549565b620005658184846200051e565b505050565b5b818110156200058d57620005816000826200054e565b6001810190506200056b565b5050565b601f821115620005dc57620005a68162000457565b620005b1846200046c565b81016020851015620005c1578190505b620005d9620005d0856200046c565b8301826200056a565b50505b505050565b60008160020a8304905092915050565b60006200060460001984600802620005e1565b1980831691505092915050565b60006200061f8383620005f1565b9150826002028217905092915050565b6200063a82620003e8565b67ffffffffffffffff8111156200065657620006556200015b565b5b62000662825462000422565b6200066f82828562000591565b600060209050601f831160018114620006a7576000841562000692578287015190505b6200069e858262000611565b8655506200070e565b601f198416620006b78662000457565b60005b82811015620006e157848901518255600182019150602085019450602081019050620006ba565b86831015620007015784890151620006fd601f891682620005f1565b8355505b6001600288020188555050505b505050505050565b610f0d80620007266000396000f3fe608060405234801561001057600080fd5b50600436106100bb576000357c010000000000000000000000000000000000000000000000000000000090048063313ce56711610083578063313ce5671461018c57806370a08231146101aa57806395d89b41146101da578063a9059cbb146101f8578063dd62ed3e14610228576100bb565b806301ffc9a7146100c057806306fdde03146100f0578063095ea7b31461010e57806318160ddd1461013e57806323b872dd1461015c575b600080fd5b6100da60048036038101906100d59190610ad6565b610258565b6040516100e79190610b1e565b60405180910390f35b6100f8610308565b6040516101059190610bc9565b60405180910390f35b61012860048036038101906101239190610c7f565b610396565b6040516101359190610b1e565b60405180910390f35b61014661051a565b6040516101539190610cce565b60405180910390f35b61017660048036038101906101719190610ce9565b610520565b6040516101839190610b1e565b60405180910390f35b610194610832565b6040516101a19190610d58565b60405180910390f35b6101c460048036038101906101bf9190610d73565b610845565b6040516101d19190610cce565b60405180910390f35b6101e261085d565b6040516101ef9190610bc9565b60405180910390f35b610212600480360381019061020d9190610c7f565b6108eb565b60405161021f9190610b1e565b60405180910390f35b610242600480360381019061023d9190610da0565b610a54565b60405161024f9190610cce565b60405180910390f35b600063c6bb4b707c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036102ac5760019050610303565b6301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036102fe5760019050610303565b600090505b919050565b6002805461031590610e0f565b80601f016020809104026020016040519081016040528092919081815260200182805461034190610e0f565b801561038e5780601f106103635761010080835404028352916020019161038e565b820191906000526020600020905b81548152906001019060200180831161037157829003601f168201915b505050505081565b60008082111561042a576000600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541461042957600080fd5b5b81600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516105089190610cce565b60405180910390a36001905092915050565b60055481565b600081600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156105ab57600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156105f757600080fd5b81600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461067f9190610e6f565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461074e9190610e6f565b9250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546107a49190610ea3565b925050819055503373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f5f7542858008eeb041631f30e6109ae94b83a58e9a58261dd2c42c508850f9398560405161081f9190610cce565b60405180910390a4600190509392505050565b600460009054906101000a900460ff1681565b60066020528060005260406000206000915090505481565b6003805461086a90610e0f565b80601f016020809104026020016040519081016040528092919081815260200182805461089690610e0f565b80156108e35780601f106108b8576101008083540402835291602001916108e3565b820191906000526020600020905b8154815290600101906020018083116108c657829003601f168201915b505050505081565b600081600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561093957600080fd5b81600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546109889190610e6f565b9250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546109de9190610ea3565b925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610a429190610cce565b60405180910390a36001905092915050565b6007602052816000526040600020602052806000526040600020600091509150505481565b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b610ab381610a7e565b8114610abe57600080fd5b50565b600081359050610ad081610aaa565b92915050565b600060208284031215610aec57610aeb610a79565b5b6000610afa84828501610ac1565b91505092915050565b60008115159050919050565b610b1881610b03565b82525050565b6000602082019050610b336000830184610b0f565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610b73578082015181840152602081019050610b58565b60008484015250505050565b6000601f19601f8301169050919050565b6000610b9b82610b39565b610ba58185610b44565b9350610bb5818560208601610b55565b610bbe81610b7f565b840191505092915050565b60006020820190508181036000830152610be38184610b90565b905092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610c1682610beb565b9050919050565b610c2681610c0b565b8114610c3157600080fd5b50565b600081359050610c4381610c1d565b92915050565b6000819050919050565b610c5c81610c49565b8114610c6757600080fd5b50565b600081359050610c7981610c53565b92915050565b60008060408385031215610c9657610c95610a79565b5b6000610ca485828601610c34565b9250506020610cb585828601610c6a565b9150509250929050565b610cc881610c49565b82525050565b6000602082019050610ce36000830184610cbf565b92915050565b600080600060608486031215610d0257610d01610a79565b5b6000610d1086828701610c34565b9350506020610d2186828701610c34565b9250506040610d3286828701610c6a565b9150509250925092565b600060ff82169050919050565b610d5281610d3c565b82525050565b6000602082019050610d6d6000830184610d49565b92915050565b600060208284031215610d8957610d88610a79565b5b6000610d9784828501610c34565b91505092915050565b60008060408385031215610db757610db6610a79565b5b6000610dc585828601610c34565b9250506020610dd685828601610c34565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680610e2757607f821691505b602082108103610e3a57610e39610de0565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610e7a82610c49565b9150610e8583610c49565b9250828203905081811115610e9d57610e9c610e40565b5b92915050565b6000610eae82610c49565b9150610eb983610c49565b9250828201905080821115610ed157610ed0610e40565b5b9291505056fea2646970667358221220ae6705885ea8b737b251b421191a646a538f30726eb75668ada7b6bcea18788564736f6c63430008120033 +\ No newline at end of file diff --git a/python/tests/test_erc20_interface.py b/python/tests/test_erc20_interface.py @@ -15,38 +15,14 @@ from chainlib.eth.address import to_checksum_address from hexathon import strip_0x # local imports -from giftable_erc20_token import GiftableToken +from giftable_erc20_token.unittest import TestGiftableToken from eth_erc20 import ERC20 logging.basicConfig(level=logging.DEBUG) -logg = logging.getLogger(__name__) +logg = logging.getLogger() -class TestToken(EthTesterCase): - - def setUp(self): - super(TestToken, self).setUp() - self.conn = RPCConnection.connect(self.chain_spec, 'default') - nonce_oracle = RPCNonceOracle(self.accounts[0], conn=self.conn) - c = GiftableToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) - self.symbol = 'FOO' - self.name = 'Foo Token' - self.decimals = 16 - (tx_hash, o) = c.constructor(self.accounts[0], self.name, self.symbol, self.decimals) - r = self.conn.do(o) - logg.debug('deployed with hash {}'.format(r)) - - o = receipt(r) - r = self.conn.do(o) - self.address = to_checksum_address(r['contract_address']) - - self.initial_supply = 1 << 40 - (tx_hash, o) = c.mint_to(self.address, self.accounts[0], self.accounts[0], self.initial_supply) - r = self.conn.do(o) - o = receipt(tx_hash) - r = self.conn.do(o) - self.assertEqual(r['status'], 1) - +class TestToken(TestGiftableToken): def test_balance(self): c = ERC20(self.chain_spec) diff --git a/python/tests/test_giftable.py b/python/tests/test_giftable.py @@ -0,0 +1,84 @@ +# standard imports +import os +import unittest +import json +import logging +import datetime + +# external imports +from chainlib.eth.constant import ZERO_ADDRESS +from chainlib.eth.nonce import RPCNonceOracle +from chainlib.eth.tx import receipt +from chainlib.eth.block import ( + block_latest, + block_by_number, + ) + +# local imports +from giftable_erc20_token import GiftableToken +from giftable_erc20_token.unittest import TestGiftableExpireToken + +logging.basicConfig(level=logging.DEBUG) +logg = logging.getLogger() + +testdir = os.path.dirname(__file__) + + +class TestExpire(TestGiftableExpireToken): + + def setUp(self): + super(TestExpire, self).setUp() + + + def test_expires(self): + mint_amount = self.initial_supply + nonce_oracle = RPCNonceOracle(self.accounts[0], self.rpc) + c = GiftableToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) + + (tx_hash, o) = c.transfer(self.address, self.accounts[0], self.accounts[1], int(mint_amount / 2)) + r = self.rpc.do(o) + o = receipt(tx_hash) + r = self.rpc.do(o) + self.assertEqual(r['status'], 1) + + self.backend.time_travel(self.expire + 60) + o = block_latest() + r = self.rpc.do(o) + o = block_by_number(r) + r = self.rpc.do(o) + self.assertGreaterEqual(r['timestamp'], self.expire) + + nonce_oracle = RPCNonceOracle(self.accounts[0], self.rpc) + c = GiftableToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) + (tx_hash, o) = c.transfer(self.address, self.accounts[0], self.accounts[1], 1) + r = self.rpc.do(o) + o = receipt(tx_hash) + r = self.rpc.do(o) + self.assertEqual(r['status'], 0) + + nonce_oracle = RPCNonceOracle(self.accounts[1], self.rpc) + c = GiftableToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) + (tx_hash, o) = c.transfer(self.address, self.accounts[1], self.accounts[0], 1) + r = self.rpc.do(o) + o = receipt(tx_hash) + r = self.rpc.do(o) + self.assertEqual(r['status'], 0) + + o = c.balance_of(self.address, self.accounts[0], sender_address=self.accounts[0]) + r = self.rpc.do(o) + balance = c.parse_balance(r) + self.assertEqual(balance, int(mint_amount / 2)) + + o = c.balance_of(self.address, self.accounts[1], sender_address=self.accounts[0]) + r = self.rpc.do(o) + balance += c.parse_balance(r) + self.assertEqual(balance, mint_amount) + + o = c.total_supply(self.address, sender_address=self.accounts[0]) + r = self.rpc.do(o) + supply = c.parse_balance(r) + self.assertEqual(supply, mint_amount) + + +if __name__ == '__main__': + unittest.main() diff --git a/solidity/GiftableToken.bin b/solidity/GiftableToken.bin @@ -1 +1 @@ -60806040523480156200001157600080fd5b5060405162001b8038038062001b808339818101604052810190620000379190620002e7565b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508260029081620000889190620005d2565b5081600390816200009a9190620005d2565b5080600460006101000a81548160ff021916908360ff16021790555060018060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550505050620006b9565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6200017f8262000134565b810181811067ffffffffffffffff82111715620001a157620001a062000145565b5b80604052505050565b6000620001b662000116565b9050620001c4828262000174565b919050565b600067ffffffffffffffff821115620001e757620001e662000145565b5b620001f28262000134565b9050602081019050919050565b60005b838110156200021f57808201518184015260208101905062000202565b60008484015250505050565b6000620002426200023c84620001c9565b620001aa565b9050828152602081018484840111156200026157620002606200012f565b5b6200026e848285620001ff565b509392505050565b600082601f8301126200028e576200028d6200012a565b5b8151620002a08482602086016200022b565b91505092915050565b600060ff82169050919050565b620002c181620002a9565b8114620002cd57600080fd5b50565b600081519050620002e181620002b6565b92915050565b60008060006060848603121562000303576200030262000120565b5b600084015167ffffffffffffffff81111562000324576200032362000125565b5b620003328682870162000276565b935050602084015167ffffffffffffffff81111562000356576200035562000125565b5b620003648682870162000276565b92505060406200037786828701620002d0565b9150509250925092565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680620003d457607f821691505b602082108103620003ea57620003e96200038c565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b60008160020a8302905092915050565b600060088302620004577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8262000415565b62000463868362000415565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b6000620004b0620004aa620004a4846200047b565b62000485565b6200047b565b9050919050565b6000819050919050565b620004cc836200048f565b620004e4620004db82620004b7565b84845462000425565b825550505050565b600090565b620004fb620004ec565b62000508818484620004c1565b505050565b5b81811015620005305762000524600082620004f1565b6001810190506200050e565b5050565b601f8211156200057f576200054981620003f0565b620005548462000405565b8101602085101562000564578190505b6200057c620005738562000405565b8301826200050d565b50505b505050565b60008160020a8304905092915050565b6000620005a76000198460080262000584565b1980831691505092915050565b6000620005c2838362000594565b9150826002028217905092915050565b620005dd8262000381565b67ffffffffffffffff811115620005f957620005f862000145565b5b620006058254620003bb565b6200061282828562000534565b600060209050601f8311600181146200064a576000841562000635578287015190505b620006418582620005b4565b865550620006b1565b601f1984166200065a86620003f0565b60005b8281101562000684578489015182556001820191506020850194506020810190506200065d565b86831015620006a45784890151620006a0601f89168262000594565b8355505b6001600288020188555050505b505050505050565b6114b780620006c96000396000f3fe608060405234801561001057600080fd5b5060043610610112576000357c010000000000000000000000000000000000000000000000000000000090048063449a52f8116100b4578063983b2d5611610083578063983b2d56146102cd578063a9059cbb146102fd578063dd62ed3e1461032d578063f2fde38b1461035d57610112565b8063449a52f81461023157806370a08231146102615780638da5cb5b1461029157806395d89b41146102af57610112565b806318160ddd116100f057806318160ddd1461019557806323b872dd146101b35780633092afd5146101e3578063313ce5671461021357610112565b806301ffc9a71461011757806306fdde0314610147578063095ea7b314610165575b600080fd5b610131600480360381019061012c9190611056565b61038d565b60405161013e919061109e565b60405180910390f35b61014f6104e1565b60405161015c9190611149565b60405180910390f35b61017f600480360381019061017a91906111ff565b61056f565b60405161018c919061109e565b60405180910390f35b61019d6106f3565b6040516101aa919061124e565b60405180910390f35b6101cd60048036038101906101c89190611269565b6106f9565b6040516101da919061109e565b60405180910390f35b6101fd60048036038101906101f891906112bc565b610a0b565b60405161020a919061109e565b60405180910390f35b61021b610afd565b6040516102289190611305565b60405180910390f35b61024b600480360381019061024691906111ff565b610b10565b604051610258919061109e565b60405180910390f35b61027b600480360381019061027691906112bc565b610c46565b604051610288919061124e565b60405180910390f35b610299610c5e565b6040516102a6919061132f565b60405180910390f35b6102b7610c82565b6040516102c49190611149565b60405180910390f35b6102e760048036038101906102e291906112bc565b610d10565b6040516102f4919061109e565b60405180910390f35b610317600480360381019061031291906111ff565b610dcb565b604051610324919061109e565b60405180910390f35b6103476004803603810190610342919061134a565b610f34565b604051610354919061124e565b60405180910390f35b610377600480360381019061037291906112bc565b610f59565b604051610384919061109e565b60405180910390f35b600063c6bb4b707c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036103e157600190506104dc565b63449a52f87c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19160361043357600190506104dc565b6301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19160361048557600190506104dc565b639493f8b27c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036104d757600190506104dc565b600090505b919050565b600280546104ee906113b9565b80601f016020809104026020016040519081016040528092919081815260200182805461051a906113b9565b80156105675780601f1061053c57610100808354040283529160200191610567565b820191906000526020600020905b81548152906001019060200180831161054a57829003601f168201915b505050505081565b600080821115610603576000600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541461060257600080fd5b5b81600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516106e1919061124e565b60405180910390a36001905092915050565b60055481565b600081600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561078457600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156107d057600080fd5b81600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546108589190611419565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546109279190611419565b9250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461097d919061144d565b925050819055503373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f5f7542858008eeb041631f30e6109ae94b83a58e9a58261dd2c42c508850f939856040516109f8919061124e565b60405180910390a4600190509392505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610a9357508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610a9c57600080fd5b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060019050919050565b600460009054906101000a900460ff1681565b6000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610b6857600080fd5b81600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610bb7919061144d565b925050819055508160056000828254610bd0919061144d565b925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fab8530f87dc9b59234c4623bf917212bb2536d647574c8e7e5da92c2ede0c9f884604051610c34919061124e565b60405180910390a36001905092915050565b60066020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60038054610c8f906113b9565b80601f0160208091040260200160405190810160405280929190818152602001828054610cbb906113b9565b8015610d085780601f10610cdd57610100808354040283529160200191610d08565b820191906000526020600020905b815481529060010190602001808311610ceb57829003601f168201915b505050505081565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610d6b57600080fd5b60018060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060019050919050565b600081600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610e1957600080fd5b81600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610e689190611419565b9250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610ebe919061144d565b925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610f22919061124e565b60405180910390a36001905092915050565b6007602052816000526040600020602052806000526040600020600091509150505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610fb457600080fd5b816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550919050565b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b61103381610ffe565b811461103e57600080fd5b50565b6000813590506110508161102a565b92915050565b60006020828403121561106c5761106b610ff9565b5b600061107a84828501611041565b91505092915050565b60008115159050919050565b61109881611083565b82525050565b60006020820190506110b3600083018461108f565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156110f35780820151818401526020810190506110d8565b60008484015250505050565b6000601f19601f8301169050919050565b600061111b826110b9565b61112581856110c4565b93506111358185602086016110d5565b61113e816110ff565b840191505092915050565b600060208201905081810360008301526111638184611110565b905092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006111968261116b565b9050919050565b6111a68161118b565b81146111b157600080fd5b50565b6000813590506111c38161119d565b92915050565b6000819050919050565b6111dc816111c9565b81146111e757600080fd5b50565b6000813590506111f9816111d3565b92915050565b6000806040838503121561121657611215610ff9565b5b6000611224858286016111b4565b9250506020611235858286016111ea565b9150509250929050565b611248816111c9565b82525050565b6000602082019050611263600083018461123f565b92915050565b60008060006060848603121561128257611281610ff9565b5b6000611290868287016111b4565b93505060206112a1868287016111b4565b92505060406112b2868287016111ea565b9150509250925092565b6000602082840312156112d2576112d1610ff9565b5b60006112e0848285016111b4565b91505092915050565b600060ff82169050919050565b6112ff816112e9565b82525050565b600060208201905061131a60008301846112f6565b92915050565b6113298161118b565b82525050565b60006020820190506113446000830184611320565b92915050565b6000806040838503121561136157611360610ff9565b5b600061136f858286016111b4565b9250506020611380858286016111b4565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806113d157607f821691505b6020821081036113e4576113e361138a565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000611424826111c9565b915061142f836111c9565b9250828203905081811115611447576114466113ea565b5b92915050565b6000611458826111c9565b9150611463836111c9565b925082820190508082111561147b5761147a6113ea565b5b9291505056fea2646970667358221220e2a42897323e3c91e89d281271f2465e848b8fcacf8710047b9f694e059389e764736f6c63430008110033 -\ No newline at end of file +60806040523480156200001157600080fd5b5060405162001e4538038062001e4583398181016040528101906200003791906200032a565b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550836002908162000088919062000621565b5082600390816200009a919062000621565b5081600460006101000a81548160ff021916908360ff16021790555060018060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550806008819055505050505062000708565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b62000187826200013c565b810181811067ffffffffffffffff82111715620001a957620001a86200014d565b5b80604052505050565b6000620001be6200011e565b9050620001cc82826200017c565b919050565b600067ffffffffffffffff821115620001ef57620001ee6200014d565b5b620001fa826200013c565b9050602081019050919050565b60005b83811015620002275780820151818401526020810190506200020a565b60008484015250505050565b60006200024a6200024484620001d1565b620001b2565b90508281526020810184848401111562000269576200026862000137565b5b6200027684828562000207565b509392505050565b600082601f83011262000296576200029562000132565b5b8151620002a884826020860162000233565b91505092915050565b600060ff82169050919050565b620002c981620002b1565b8114620002d557600080fd5b50565b600081519050620002e981620002be565b92915050565b6000819050919050565b6200030481620002ef565b81146200031057600080fd5b50565b6000815190506200032481620002f9565b92915050565b6000806000806080858703121562000347576200034662000128565b5b600085015167ffffffffffffffff8111156200036857620003676200012d565b5b62000376878288016200027e565b945050602085015167ffffffffffffffff8111156200039a57620003996200012d565b5b620003a8878288016200027e565b9350506040620003bb87828801620002d8565b9250506060620003ce8782880162000313565b91505092959194509250565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806200042d57607f821691505b602082108103620004435762000442620003e5565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b60008160020a8302905092915050565b600060088302620004b07fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826200046e565b620004bc86836200046e565b95508019841693508086168417925050509392505050565b6000819050919050565b6000620004ff620004f9620004f384620002ef565b620004d4565b620002ef565b9050919050565b6000819050919050565b6200051b83620004de565b620005336200052a8262000506565b8484546200047e565b825550505050565b600090565b6200054a6200053b565b6200055781848462000510565b505050565b5b818110156200057f576200057360008262000540565b6001810190506200055d565b5050565b601f821115620005ce57620005988162000449565b620005a3846200045e565b81016020851015620005b3578190505b620005cb620005c2856200045e565b8301826200055c565b50505b505050565b60008160020a8304905092915050565b6000620005f660001984600802620005d3565b1980831691505092915050565b6000620006118383620005e3565b9150826002028217905092915050565b6200062c82620003da565b67ffffffffffffffff8111156200064857620006476200014d565b5b62000654825462000414565b6200066182828562000583565b600060209050601f83116001811462000699576000841562000684578287015190505b62000690858262000603565b86555062000700565b601f198416620006a98662000449565b60005b82811015620006d357848901518255600182019150602085019450602081019050620006ac565b86831015620006f35784890151620006ef601f891682620005e3565b8355505b6001600288020188555050505b505050505050565b61172d80620007186000396000f3fe608060405234801561001057600080fd5b5060043610610133576000357c0100000000000000000000000000000000000000000000000000000000900480635f408c04116100bf578063a9059cbb1161008e578063a9059cbb1461033c578063b1cb0db31461036c578063da2824a81461038a578063dd62ed3e146103ba578063f2fde38b146103ea57610133565b80635f408c04146102b257806370a08231146102d05780638da5cb5b1461030057806395d89b411461031e57610133565b806323b872dd1161010657806323b872dd146101d45780632b29ba2314610204578063313ce56714610234578063449a52f8146102525780635356dddc1461028257610133565b806301ffc9a71461013857806306fdde0314610168578063095ea7b31461018657806318160ddd146101b6575b600080fd5b610152600480360381019061014d91906112cc565b61041a565b60405161015f9190611314565b60405180910390f35b61017061056e565b60405161017d91906113bf565b60405180910390f35b6101a0600480360381019061019b9190611475565b6105fc565b6040516101ad9190611314565b60405180910390f35b6101be610797565b6040516101cb91906114c4565b60405180910390f35b6101ee60048036038101906101e991906114df565b61079d565b6040516101fb9190611314565b60405180910390f35b61021e60048036038101906102199190611532565b610ac5565b60405161022b9190611314565b60405180910390f35b61023c610b71565b604051610249919061157b565b60405180910390f35b61026c60048036038101906102679190611475565b610b84565b6040516102799190611314565b60405180910390f35b61029c60048036038101906102979190611532565b610d10565b6040516102a99190611314565b60405180910390f35b6102ba610e02565b6040516102c7919061157b565b60405180910390f35b6102ea60048036038101906102e59190611532565b610ea0565b6040516102f791906114c4565b60405180910390f35b610308610eb8565b60405161031591906115a5565b60405180910390f35b610326610edc565b60405161033391906113bf565b60405180910390f35b61035660048036038101906103519190611475565b610f6a565b6040516103639190611314565b60405180910390f35b6103746110e9565b60405161038191906114c4565b60405180910390f35b6103a4600480360381019061039f9190611532565b6110ef565b6040516103b19190611314565b60405180910390f35b6103d460048036038101906103cf91906115c0565b6111aa565b6040516103e191906114c4565b60405180910390f35b61040460048036038101906103ff9190611532565b6111cf565b6040516104119190611314565b60405180910390f35b600063c6bb4b707c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19160361046e5760019050610569565b63449a52f87c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036104c05760019050610569565b6301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036105125760019050610569565b639493f8b27c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036105645760019050610569565b600090505b919050565b6002805461057b9061162f565b80601f01602080910402602001604051908101604052809291908181526020018280546105a79061162f565b80156105f45780601f106105c9576101008083540402835291602001916105f4565b820191906000526020600020905b8154815290600101906020018083116105d757829003601f168201915b505050505081565b600080610607610e02565b60ff161461061457600080fd5b60008211156106a7576000600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054146106a657600080fd5b5b81600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161078591906114c4565b60405180910390a36001905092915050565b60055481565b6000806107a8610e02565b60ff16146107b557600080fd5b81600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561083e57600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561088a57600080fd5b81600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610912919061168f565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546109e1919061168f565b9250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610a3791906116c3565b925050819055503373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f5f7542858008eeb041631f30e6109ae94b83a58e9a58261dd2c42c508850f93985604051610ab291906114c4565b60405180910390a4600190509392505050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680610b6a575060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b9050919050565b600460009054906101000a900460ff1681565b6000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680610c29575060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610c3257600080fd5b81600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610c8191906116c3565b925050819055508160056000828254610c9a91906116c3565b925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fab8530f87dc9b59234c4623bf917212bb2536d647574c8e7e5da92c2ede0c9f884604051610cfe91906114c4565b60405180910390a36001905092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610d9857508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610da157600080fd5b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060019050919050565b60008060085403610e165760009050610e9d565b600960009054906101000a900460ff1615610e345760019050610e9d565b6008544210610e98576001600960006101000a81548160ff0219169083151502179055507ff80dbaea4785589e52984ca36a31de106adc77759539a5c7d92883bf49692fe942604051610e8791906114c4565b60405180910390a160029050610e9d565b600090505b90565b60066020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60038054610ee99061162f565b80601f0160208091040260200160405190810160405280929190818152602001828054610f159061162f565b8015610f625780601f10610f3757610100808354040283529160200191610f62565b820191906000526020600020905b815481529060010190602001808311610f4557829003601f168201915b505050505081565b600080610f75610e02565b60ff1614610f8257600080fd5b81600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610fce57600080fd5b81600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461101d919061168f565b9250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461107391906116c3565b925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516110d791906114c4565b60405180910390a36001905092915050565b60085481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461114a57600080fd5b60018060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060019050919050565b6007602052816000526040600020602052806000526040600020600091509150505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461122a57600080fd5b816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550919050565b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6112a981611274565b81146112b457600080fd5b50565b6000813590506112c6816112a0565b92915050565b6000602082840312156112e2576112e161126f565b5b60006112f0848285016112b7565b91505092915050565b60008115159050919050565b61130e816112f9565b82525050565b60006020820190506113296000830184611305565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561136957808201518184015260208101905061134e565b60008484015250505050565b6000601f19601f8301169050919050565b60006113918261132f565b61139b818561133a565b93506113ab81856020860161134b565b6113b481611375565b840191505092915050565b600060208201905081810360008301526113d98184611386565b905092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061140c826113e1565b9050919050565b61141c81611401565b811461142757600080fd5b50565b60008135905061143981611413565b92915050565b6000819050919050565b6114528161143f565b811461145d57600080fd5b50565b60008135905061146f81611449565b92915050565b6000806040838503121561148c5761148b61126f565b5b600061149a8582860161142a565b92505060206114ab85828601611460565b9150509250929050565b6114be8161143f565b82525050565b60006020820190506114d960008301846114b5565b92915050565b6000806000606084860312156114f8576114f761126f565b5b60006115068682870161142a565b93505060206115178682870161142a565b925050604061152886828701611460565b9150509250925092565b6000602082840312156115485761154761126f565b5b60006115568482850161142a565b91505092915050565b600060ff82169050919050565b6115758161155f565b82525050565b6000602082019050611590600083018461156c565b92915050565b61159f81611401565b82525050565b60006020820190506115ba6000830184611596565b92915050565b600080604083850312156115d7576115d661126f565b5b60006115e58582860161142a565b92505060206115f68582860161142a565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061164757607f821691505b60208210810361165a57611659611600565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061169a8261143f565b91506116a58361143f565b92508282039050818111156116bd576116bc611660565b5b92915050565b60006116ce8261143f565b91506116d98361143f565b92508282019050808211156116f1576116f0611660565b5b9291505056fea26469706673582212208aaa32a1e19a38a9c677c12685cac0eef1e83a25fdccc90a49a414e40771e53c64736f6c63430008120033 +\ No newline at end of file diff --git a/solidity/GiftableToken.json b/solidity/GiftableToken.json @@ -1 +1 @@ -[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"uint8","name":"_decimals","type":"uint8"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":true,"internalType":"address","name":"_spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_minter","type":"address"},{"indexed":true,"internalType":"address","name":"_beneficiary","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","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":"address","name":"_spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"TransferFrom","type":"event"},{"inputs":[{"internalType":"address","name":"_minter","type":"address"}],"name":"addMinter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spender","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"mintTo","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","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":"address","name":"_minter","type":"address"}],"name":"removeMinter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_sum","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}] +[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"uint8","name":"_decimals","type":"uint8"},{"internalType":"uint256","name":"_expireTimestamp","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":true,"internalType":"address","name":"_spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_timestamp","type":"uint256"}],"name":"Expired","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_minter","type":"address"},{"indexed":true,"internalType":"address","name":"_beneficiary","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","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":"address","name":"_spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"TransferFrom","type":"event"},{"inputs":[{"internalType":"address","name":"_minter","type":"address"}],"name":"addWriter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"applyExpiry","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_spender","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"expires","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_minter","type":"address"}],"name":"isWriter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"mintTo","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","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":"address","name":"_minter","type":"address"}],"name":"removeWriter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_sum","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}] diff --git a/solidity/GiftableToken.sol b/solidity/GiftableToken.sol @@ -21,21 +21,27 @@ contract GiftableToken { // Implements ERC20 mapping (address => mapping (address => uint256)) public allowance; + // timestamp when token contract expires + uint256 public expires; + bool expired; + event Transfer(address indexed _from, address indexed _to, uint256 _value); event TransferFrom(address indexed _from, address indexed _to, address indexed _spender, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); event Mint(address indexed _minter, address indexed _beneficiary, uint256 _value); + event Expired(uint256 _timestamp); - constructor(string memory _name, string memory _symbol, uint8 _decimals) public { + constructor(string memory _name, string memory _symbol, uint8 _decimals, uint256 _expireTimestamp) public { owner = msg.sender; name = _name; symbol = _symbol; decimals = _decimals; minters[msg.sender] = true; + expires = _expireTimestamp; } function mintTo(address _to, uint256 _value) public returns (bool) { - require(minters[msg.sender]); + require(minters[msg.sender] || msg.sender == owner); balanceOf[_to] += _value; totalSupply += _value; @@ -45,7 +51,7 @@ contract GiftableToken { return true; } - function addMinter(address _minter) public returns (bool) { + function addWriter(address _minter) public returns (bool) { require(msg.sender == owner); minters[_minter] = true; @@ -53,7 +59,7 @@ contract GiftableToken { return true; } - function removeMinter(address _minter) public returns (bool) { + function removeWriter(address _minter) public returns (bool) { require(msg.sender == owner || msg.sender == _minter); minters[_minter] = false; @@ -61,8 +67,29 @@ contract GiftableToken { return true; } + function isWriter(address _minter) public view returns(bool) { + return minters[_minter] || _minter == owner; + } + + function applyExpiry() public returns(uint8) { + if (expires == 0) { + return 0; + } + if (expired) { + return 1; + } + if (block.timestamp >= expires) { + expired = true; + emit Expired(block.timestamp); + return 2; + } + return 0; + + } + // Implements ERC20 function transfer(address _to, uint256 _value) public returns (bool) { + require(applyExpiry() == 0); require(balanceOf[msg.sender] >= _value); balanceOf[msg.sender] -= _value; balanceOf[_to] += _value; @@ -72,6 +99,7 @@ contract GiftableToken { // Implements ERC20 function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { + require(applyExpiry() == 0); require(allowance[_from][msg.sender] >= _value); require(balanceOf[_from] >= _value); allowance[_from][msg.sender] = allowance[_from][msg.sender] - _value; @@ -83,6 +111,7 @@ contract GiftableToken { // Implements ERC20 function approve(address _spender, uint256 _value) public returns (bool) { + require(applyExpiry() == 0); if (_value > 0) { require(allowance[msg.sender][_spender] == 0); } diff --git a/solidity/StaticToken.bin b/solidity/StaticToken.bin @@ -1 +1 @@ -60806040523480156200001157600080fd5b506040516200163338038062001633833981810160405281019062000037919062000338565b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555083600290816200008891906200062f565b5082600390816200009a91906200062f565b5081600460006101000a81548160ff021916908360ff1602179055508060058190555080600660008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050505062000716565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b62000195826200014a565b810181811067ffffffffffffffff82111715620001b757620001b66200015b565b5b80604052505050565b6000620001cc6200012c565b9050620001da82826200018a565b919050565b600067ffffffffffffffff821115620001fd57620001fc6200015b565b5b62000208826200014a565b9050602081019050919050565b60005b838110156200023557808201518184015260208101905062000218565b60008484015250505050565b6000620002586200025284620001df565b620001c0565b90508281526020810184848401111562000277576200027662000145565b5b6200028484828562000215565b509392505050565b600082601f830112620002a457620002a362000140565b5b8151620002b684826020860162000241565b91505092915050565b600060ff82169050919050565b620002d781620002bf565b8114620002e357600080fd5b50565b600081519050620002f781620002cc565b92915050565b6000819050919050565b6200031281620002fd565b81146200031e57600080fd5b50565b600081519050620003328162000307565b92915050565b6000806000806080858703121562000355576200035462000136565b5b600085015167ffffffffffffffff8111156200037657620003756200013b565b5b62000384878288016200028c565b945050602085015167ffffffffffffffff811115620003a857620003a76200013b565b5b620003b6878288016200028c565b9350506040620003c987828801620002e6565b9250506060620003dc8782880162000321565b91505092959194509250565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806200043b57607f821691505b602082108103620004515762000450620003f3565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b60008160020a8302905092915050565b600060088302620004be7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826200047c565b620004ca86836200047c565b95508019841693508086168417925050509392505050565b6000819050919050565b60006200050d620005076200050184620002fd565b620004e2565b620002fd565b9050919050565b6000819050919050565b6200052983620004ec565b62000541620005388262000514565b8484546200048c565b825550505050565b600090565b6200055862000549565b620005658184846200051e565b505050565b5b818110156200058d57620005816000826200054e565b6001810190506200056b565b5050565b601f821115620005dc57620005a68162000457565b620005b1846200046c565b81016020851015620005c1578190505b620005d9620005d0856200046c565b8301826200056a565b50505b505050565b60008160020a8304905092915050565b60006200060460001984600802620005e1565b1980831691505092915050565b60006200061f8383620005f1565b9150826002028217905092915050565b6200063a82620003e8565b67ffffffffffffffff8111156200065657620006556200015b565b5b62000662825462000422565b6200066f82828562000591565b600060209050601f831160018114620006a7576000841562000692578287015190505b6200069e858262000611565b8655506200070e565b601f198416620006b78662000457565b60005b82811015620006e157848901518255600182019150602085019450602081019050620006ba565b86831015620007015784890151620006fd601f891682620005f1565b8355505b6001600288020188555050505b505050505050565b610f0d80620007266000396000f3fe608060405234801561001057600080fd5b50600436106100bb576000357c010000000000000000000000000000000000000000000000000000000090048063313ce56711610083578063313ce5671461018c57806370a08231146101aa57806395d89b41146101da578063a9059cbb146101f8578063dd62ed3e14610228576100bb565b806301ffc9a7146100c057806306fdde03146100f0578063095ea7b31461010e57806318160ddd1461013e57806323b872dd1461015c575b600080fd5b6100da60048036038101906100d59190610ad6565b610258565b6040516100e79190610b1e565b60405180910390f35b6100f8610308565b6040516101059190610bc9565b60405180910390f35b61012860048036038101906101239190610c7f565b610396565b6040516101359190610b1e565b60405180910390f35b61014661051a565b6040516101539190610cce565b60405180910390f35b61017660048036038101906101719190610ce9565b610520565b6040516101839190610b1e565b60405180910390f35b610194610832565b6040516101a19190610d58565b60405180910390f35b6101c460048036038101906101bf9190610d73565b610845565b6040516101d19190610cce565b60405180910390f35b6101e261085d565b6040516101ef9190610bc9565b60405180910390f35b610212600480360381019061020d9190610c7f565b6108eb565b60405161021f9190610b1e565b60405180910390f35b610242600480360381019061023d9190610da0565b610a54565b60405161024f9190610cce565b60405180910390f35b600063c6bb4b707c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036102ac5760019050610303565b6301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036102fe5760019050610303565b600090505b919050565b6002805461031590610e0f565b80601f016020809104026020016040519081016040528092919081815260200182805461034190610e0f565b801561038e5780601f106103635761010080835404028352916020019161038e565b820191906000526020600020905b81548152906001019060200180831161037157829003601f168201915b505050505081565b60008082111561042a576000600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541461042957600080fd5b5b81600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516105089190610cce565b60405180910390a36001905092915050565b60055481565b600081600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156105ab57600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156105f757600080fd5b81600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461067f9190610e6f565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461074e9190610e6f565b9250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546107a49190610ea3565b925050819055503373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f5f7542858008eeb041631f30e6109ae94b83a58e9a58261dd2c42c508850f9398560405161081f9190610cce565b60405180910390a4600190509392505050565b600460009054906101000a900460ff1681565b60066020528060005260406000206000915090505481565b6003805461086a90610e0f565b80601f016020809104026020016040519081016040528092919081815260200182805461089690610e0f565b80156108e35780601f106108b8576101008083540402835291602001916108e3565b820191906000526020600020905b8154815290600101906020018083116108c657829003601f168201915b505050505081565b600081600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561093957600080fd5b81600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546109889190610e6f565b9250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546109de9190610ea3565b925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610a429190610cce565b60405180910390a36001905092915050565b6007602052816000526040600020602052806000526040600020600091509150505481565b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b610ab381610a7e565b8114610abe57600080fd5b50565b600081359050610ad081610aaa565b92915050565b600060208284031215610aec57610aeb610a79565b5b6000610afa84828501610ac1565b91505092915050565b60008115159050919050565b610b1881610b03565b82525050565b6000602082019050610b336000830184610b0f565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610b73578082015181840152602081019050610b58565b60008484015250505050565b6000601f19601f8301169050919050565b6000610b9b82610b39565b610ba58185610b44565b9350610bb5818560208601610b55565b610bbe81610b7f565b840191505092915050565b60006020820190508181036000830152610be38184610b90565b905092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610c1682610beb565b9050919050565b610c2681610c0b565b8114610c3157600080fd5b50565b600081359050610c4381610c1d565b92915050565b6000819050919050565b610c5c81610c49565b8114610c6757600080fd5b50565b600081359050610c7981610c53565b92915050565b60008060408385031215610c9657610c95610a79565b5b6000610ca485828601610c34565b9250506020610cb585828601610c6a565b9150509250929050565b610cc881610c49565b82525050565b6000602082019050610ce36000830184610cbf565b92915050565b600080600060608486031215610d0257610d01610a79565b5b6000610d1086828701610c34565b9350506020610d2186828701610c34565b9250506040610d3286828701610c6a565b9150509250925092565b600060ff82169050919050565b610d5281610d3c565b82525050565b6000602082019050610d6d6000830184610d49565b92915050565b600060208284031215610d8957610d88610a79565b5b6000610d9784828501610c34565b91505092915050565b60008060408385031215610db757610db6610a79565b5b6000610dc585828601610c34565b9250506020610dd685828601610c34565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680610e2757607f821691505b602082108103610e3a57610e39610de0565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610e7a82610c49565b9150610e8583610c49565b9250828203905081811115610e9d57610e9c610e40565b5b92915050565b6000610eae82610c49565b9150610eb983610c49565b9250828201905080821115610ed157610ed0610e40565b5b9291505056fea2646970667358221220755c477962182ceac261aad365f8966b6630c338f915e0432cb3bd146f69e93164736f6c63430008110033 -\ No newline at end of file +60806040523480156200001157600080fd5b506040516200163338038062001633833981810160405281019062000037919062000338565b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555083600290816200008891906200062f565b5082600390816200009a91906200062f565b5081600460006101000a81548160ff021916908360ff1602179055508060058190555080600660008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050505062000716565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b62000195826200014a565b810181811067ffffffffffffffff82111715620001b757620001b66200015b565b5b80604052505050565b6000620001cc6200012c565b9050620001da82826200018a565b919050565b600067ffffffffffffffff821115620001fd57620001fc6200015b565b5b62000208826200014a565b9050602081019050919050565b60005b838110156200023557808201518184015260208101905062000218565b60008484015250505050565b6000620002586200025284620001df565b620001c0565b90508281526020810184848401111562000277576200027662000145565b5b6200028484828562000215565b509392505050565b600082601f830112620002a457620002a362000140565b5b8151620002b684826020860162000241565b91505092915050565b600060ff82169050919050565b620002d781620002bf565b8114620002e357600080fd5b50565b600081519050620002f781620002cc565b92915050565b6000819050919050565b6200031281620002fd565b81146200031e57600080fd5b50565b600081519050620003328162000307565b92915050565b6000806000806080858703121562000355576200035462000136565b5b600085015167ffffffffffffffff8111156200037657620003756200013b565b5b62000384878288016200028c565b945050602085015167ffffffffffffffff811115620003a857620003a76200013b565b5b620003b6878288016200028c565b9350506040620003c987828801620002e6565b9250506060620003dc8782880162000321565b91505092959194509250565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806200043b57607f821691505b602082108103620004515762000450620003f3565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b60008160020a8302905092915050565b600060088302620004be7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826200047c565b620004ca86836200047c565b95508019841693508086168417925050509392505050565b6000819050919050565b60006200050d620005076200050184620002fd565b620004e2565b620002fd565b9050919050565b6000819050919050565b6200052983620004ec565b62000541620005388262000514565b8484546200048c565b825550505050565b600090565b6200055862000549565b620005658184846200051e565b505050565b5b818110156200058d57620005816000826200054e565b6001810190506200056b565b5050565b601f821115620005dc57620005a68162000457565b620005b1846200046c565b81016020851015620005c1578190505b620005d9620005d0856200046c565b8301826200056a565b50505b505050565b60008160020a8304905092915050565b60006200060460001984600802620005e1565b1980831691505092915050565b60006200061f8383620005f1565b9150826002028217905092915050565b6200063a82620003e8565b67ffffffffffffffff8111156200065657620006556200015b565b5b62000662825462000422565b6200066f82828562000591565b600060209050601f831160018114620006a7576000841562000692578287015190505b6200069e858262000611565b8655506200070e565b601f198416620006b78662000457565b60005b82811015620006e157848901518255600182019150602085019450602081019050620006ba565b86831015620007015784890151620006fd601f891682620005f1565b8355505b6001600288020188555050505b505050505050565b610f0d80620007266000396000f3fe608060405234801561001057600080fd5b50600436106100bb576000357c010000000000000000000000000000000000000000000000000000000090048063313ce56711610083578063313ce5671461018c57806370a08231146101aa57806395d89b41146101da578063a9059cbb146101f8578063dd62ed3e14610228576100bb565b806301ffc9a7146100c057806306fdde03146100f0578063095ea7b31461010e57806318160ddd1461013e57806323b872dd1461015c575b600080fd5b6100da60048036038101906100d59190610ad6565b610258565b6040516100e79190610b1e565b60405180910390f35b6100f8610308565b6040516101059190610bc9565b60405180910390f35b61012860048036038101906101239190610c7f565b610396565b6040516101359190610b1e565b60405180910390f35b61014661051a565b6040516101539190610cce565b60405180910390f35b61017660048036038101906101719190610ce9565b610520565b6040516101839190610b1e565b60405180910390f35b610194610832565b6040516101a19190610d58565b60405180910390f35b6101c460048036038101906101bf9190610d73565b610845565b6040516101d19190610cce565b60405180910390f35b6101e261085d565b6040516101ef9190610bc9565b60405180910390f35b610212600480360381019061020d9190610c7f565b6108eb565b60405161021f9190610b1e565b60405180910390f35b610242600480360381019061023d9190610da0565b610a54565b60405161024f9190610cce565b60405180910390f35b600063c6bb4b707c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036102ac5760019050610303565b6301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036102fe5760019050610303565b600090505b919050565b6002805461031590610e0f565b80601f016020809104026020016040519081016040528092919081815260200182805461034190610e0f565b801561038e5780601f106103635761010080835404028352916020019161038e565b820191906000526020600020905b81548152906001019060200180831161037157829003601f168201915b505050505081565b60008082111561042a576000600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541461042957600080fd5b5b81600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516105089190610cce565b60405180910390a36001905092915050565b60055481565b600081600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156105ab57600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156105f757600080fd5b81600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461067f9190610e6f565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461074e9190610e6f565b9250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546107a49190610ea3565b925050819055503373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f5f7542858008eeb041631f30e6109ae94b83a58e9a58261dd2c42c508850f9398560405161081f9190610cce565b60405180910390a4600190509392505050565b600460009054906101000a900460ff1681565b60066020528060005260406000206000915090505481565b6003805461086a90610e0f565b80601f016020809104026020016040519081016040528092919081815260200182805461089690610e0f565b80156108e35780601f106108b8576101008083540402835291602001916108e3565b820191906000526020600020905b8154815290600101906020018083116108c657829003601f168201915b505050505081565b600081600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561093957600080fd5b81600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546109889190610e6f565b9250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546109de9190610ea3565b925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610a429190610cce565b60405180910390a36001905092915050565b6007602052816000526040600020602052806000526040600020600091509150505481565b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b610ab381610a7e565b8114610abe57600080fd5b50565b600081359050610ad081610aaa565b92915050565b600060208284031215610aec57610aeb610a79565b5b6000610afa84828501610ac1565b91505092915050565b60008115159050919050565b610b1881610b03565b82525050565b6000602082019050610b336000830184610b0f565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610b73578082015181840152602081019050610b58565b60008484015250505050565b6000601f19601f8301169050919050565b6000610b9b82610b39565b610ba58185610b44565b9350610bb5818560208601610b55565b610bbe81610b7f565b840191505092915050565b60006020820190508181036000830152610be38184610b90565b905092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610c1682610beb565b9050919050565b610c2681610c0b565b8114610c3157600080fd5b50565b600081359050610c4381610c1d565b92915050565b6000819050919050565b610c5c81610c49565b8114610c6757600080fd5b50565b600081359050610c7981610c53565b92915050565b60008060408385031215610c9657610c95610a79565b5b6000610ca485828601610c34565b9250506020610cb585828601610c6a565b9150509250929050565b610cc881610c49565b82525050565b6000602082019050610ce36000830184610cbf565b92915050565b600080600060608486031215610d0257610d01610a79565b5b6000610d1086828701610c34565b9350506020610d2186828701610c34565b9250506040610d3286828701610c6a565b9150509250925092565b600060ff82169050919050565b610d5281610d3c565b82525050565b6000602082019050610d6d6000830184610d49565b92915050565b600060208284031215610d8957610d88610a79565b5b6000610d9784828501610c34565b91505092915050565b60008060408385031215610db757610db6610a79565b5b6000610dc585828601610c34565b9250506020610dd685828601610c34565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680610e2757607f821691505b602082108103610e3a57610e39610de0565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610e7a82610c49565b9150610e8583610c49565b9250828203905081811115610e9d57610e9c610e40565b5b92915050565b6000610eae82610c49565b9150610eb983610c49565b9250828201905080821115610ed157610ed0610e40565b5b9291505056fea2646970667358221220ae6705885ea8b737b251b421191a646a538f30726eb75668ada7b6bcea18788564736f6c63430008120033 +\ No newline at end of file