erc20-transfer-authorization

Simple approval escrow for ERC20 spending
Log | Files | Refs

commit 5071e1051c4c353a664e927f8a753930cc7d911e
parent dccb16a7369805f53498cb2bc441d13141072118
Author: nolash <dev@holbrook.no>
Date:   Tue, 23 Mar 2021 15:42:20 +0100

Rehabilitate deploy runnable

Diffstat:
Mpython/erc20_transfer_authorization/data/ERC20TransferAuthorization.bin | 4++--
Mpython/erc20_transfer_authorization/runnable/deploy.py | 81++++++++++++++++++++++++++++++++++++-------------------------------------------
Dpython/erc20_transfer_authorization/runnable/request.py | 92-------------------------------------------------------------------------------
Mpython/erc20_transfer_authorization/transfer_authorization.py | 5+++++
4 files changed, 44 insertions(+), 138 deletions(-)

diff --git a/python/erc20_transfer_authorization/data/ERC20TransferAuthorization.bin b/python/erc20_transfer_authorization/data/ERC20TransferAuthorization.bin @@ -1 +1 @@ -60806040523480156200001157600080fd5b5033600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160068190555060016007819055506200007d33620000a2640100000000026401000000009004565b506200009b6001600062000282640100000000026401000000009004565b506200051d565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161462000137576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200012e90620003d0565b60405180910390fd5b60001515600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514620001cd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620001c490620003f2565b60405180910390fd5b6001600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600b60008154809291906200023a90620004a0565b91905055507f47d1c22a25bb3a5d4e481b9b1e6944c2eade3181a0a20b495ed61d35b5323f2482604051620002709190620003b3565b60405180910390a1600b549050919050565b6000600b548311156200029457600080fd5b60008311620002a257600080fd5b600b54821115620002b257600080fd5b8260098190555081600a819055507f9f40cfd22fe91777c78f252bd21a710f3fb007dc2f321876891e7644ba0ae175600954600a54600b54604051620002fb9392919062000414565b60405180910390a16001905092915050565b620003188162000462565b82525050565b60006200032d600a8362000451565b91507f4552525f414343455353000000000000000000000000000000000000000000006000830152602082019050919050565b60006200036f600c8362000451565b91507f4552525f4e4f54464f554e4400000000000000000000000000000000000000006000830152602082019050919050565b620003ad8162000496565b82525050565b6000602082019050620003ca60008301846200030d565b92915050565b60006020820190508181036000830152620003eb816200031e565b9050919050565b600060208201905081810360008301526200040d8162000360565b9050919050565b60006060820190506200042b6000830186620003a2565b6200043a6020830185620003a2565b620004496040830184620003a2565b949350505050565b600082825260208201905092915050565b60006200046f8262000476565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000620004ad8262000496565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415620004e357620004e2620004ee565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b61234b806200052d6000396000f3fe608060405234801561001057600080fd5b506004361061015f576000357c010000000000000000000000000000000000000000000000000000000090048063736c0d5b116100d5578063bac911ac11610099578063bac911ac146103ee578063e3064a771461041e578063e9f9d28b1461044e578063eb12d61e1461047e578063ed71262a146104ae578063fba00cbd146104de5761015f565b8063736c0d5b1461031a578063755fd58f1461034a5780637ca548c61461037a57806381d12c58146103985780638da5cb5b146103d05761015f565b80633a9ddc80116101275780633a9ddc801461021e5780634797569a1461024e57806357ec347a1461027e57806358d71f821461029c578063614f427f146102cc5780636e417c69146102ea5761015f565b806302d947ef1461016457806306661abd1461019457806308ae6377146101b25780630e316ab7146101d05780631703a01814610200575b600080fd5b61017e60048036038101906101799190611bd0565b61050e565b60405161018b9190611ee3565b60405180910390f35b61019c61053d565b6040516101a99190611ec8565b60405180910390f35b6101ba610543565b6040516101c79190611fbe565b60405180910390f35b6101ea60048036038101906101e59190611adf565b61056e565b6040516101f79190611fbe565b60405180910390f35b6102086107cf565b6040516102159190611fbe565b60405180910390f35b61023860048036038101906102339190611b6b565b6107d5565b6040516102459190611fbe565b60405180910390f35b61026860048036038101906102639190611ba7565b610806565b6040516102759190611fbe565b60405180910390f35b610286610aaa565b6040516102939190611fbe565b60405180910390f35b6102b660048036038101906102b19190611ba7565b610ac0565b6040516102c39190611fbe565b60405180910390f35b6102d4610d45565b6040516102e19190611fbe565b60405180910390f35b61030460048036038101906102ff9190611ba7565b610d4b565b6040516103119190611ead565b60405180910390f35b610334600480360381019061032f9190611adf565b61114a565b6040516103419190611ead565b60405180910390f35b610364600480360381019061035f9190611b6b565b61116a565b6040516103719190611fbe565b60405180910390f35b61038261119b565b60405161038f9190611fbe565b60405180910390f35b6103b260048036038101906103ad9190611ba7565b6111a1565b6040516103c799989796959493929190611fd9565b60405180910390f35b6103d861125c565b6040516103e59190611e5b565b60405180910390f35b61040860048036038101906104039190611ba7565b611282565b6040516104159190611fbe565b60405180910390f35b61043860048036038101906104339190611c0c565b611311565b6040516104459190611ead565b60405180910390f35b61046860048036038101906104639190611ba7565b611397565b6040516104759190611ead565b60405180910390f35b61049860048036038101906104939190611adf565b6115d0565b6040516104a59190611fbe565b60405180910390f35b6104c860048036038101906104c39190611b08565b6117a6565b6040516104d59190611fbe565b60405180910390f35b6104f860048036038101906104f39190611c0c565b6119f0565b6040516105059190611e5b565b60405180910390f35b60006020528160005260406000206020528060005260406000206000915091509054906101000a900460000b81565b60085481565b60008060075460065461055691906120ed565b1415610565576000905061056b565b60075490505b90565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806105f757508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610636576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161062d90611f1e565b60405180910390fd5b60011515600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515146106c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c090611f3e565b60405180910390fd5b600954600b541180156106df5750600a54600b54115b61071e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161071590611efe565b60405180910390fd5b6000600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600b6000815480929190610789906121fc565b91905055507f3525e22824a8a7df2c9a6029941c824cf95b6447f1e13d5128fd3826d35afe8b826040516107bd9190611e5b565b60405180910390a1600b549050919050565b60095481565b600560205281600052604060002081815481106107f157600080fd5b90600052602060002001600091509150505481565b6000600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610894576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088b90611f1e565b60405180910390fd5b600080600084815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460000b60000b14610936576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161092d90611f5e565b60405180910390fd5b600060036000848152602001908152602001600020905060018160080160009054906101000a900460000b60000b1461096e57600080fd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000808360000154815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908360000b60ff1602179055506001600082600001548152602001908152602001600020339080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550806006016000815480929190610a8a9061226f565b9190505550610a9c8160000154611397565b508060060154915050919050565b60006001600654610abb91906120ed565b905090565b6000600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610b4e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b4590611f1e565b60405180910390fd5b600080600084815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460000b60000b14610bf0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610be790611f5e565b60405180910390fd5b600060036000848152602001908152602001600020905060018160080160009054906101000a900460000b60000b14610c2857600080fd5b60016000808360000154815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908360000b60ff1602179055506001600082600001548152602001908152602001600020339080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550806005016000815480929190610d259061226f565b9190505550610d378160000154611397565b508060050154915050919050565b600a5481565b6000806003600084815260200190815260200160002090506000816000015411610daa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610da190611f7e565b60405180910390fd5b60028160080160009054906101000a900460000b60000b14610e01576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610df890611f9e565b60405180910390fd5b60008160080160006101000a81548160ff021916908360000b60ff1602179055506000808260030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168360010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168460020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168560040154604051602401610ec193929190611e76565b6040516020818303038152906040527f23b872dd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610f4b9190611e44565b6000604051808303816000865af19150503d8060008114610f88576040519150601f19603f3d011682016040523d82523d6000602084013e610f8d565b606091505b5091509150610f9f8360000154611a3e565b50438360070181905550600460008460010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002083600001549080600181540180825580915050600190039060005260206000200160009091909190915055600560008460020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020836000015490806001815401808255809150506001900390600052602060002001600090919091909150558115611107577fbcf6a68a2f901be4a23a41b53acd7697893a7e34def4e28acba584da75283b67856040516110fa9190611fbe565b60405180910390a161113f565b7fdab20a0fcd702cf875c2d715d5c3fc99af66a716c94b3405408c94b7311c99eb856040516111369190611fbe565b60405180910390a15b819350505050919050565b600c6020528060005260406000206000915054906101000a900460ff1681565b6004602052816000526040600020818154811061118657600080fd5b90600052602060002001600091509150505481565b600b5481565b60036020528060005260406000206000915090508060000154908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060040154908060050154908060060154908060070154908060080160009054906101000a900460000b905089565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080600060075490505b60065481101561130557600060036000838152602001908152602001600020905060008160080160009054906101000a900460000b60000b13156112f157848314156112e2578060000154935050505061130c565b82806112ed9061226f565b9350505b5080806112fd9061226f565b91505061128d565b5060009150505b919050565b6000600b5483111561132257600080fd5b6000831161132f57600080fd5b600b5482111561133e57600080fd5b8260098190555081600a819055507f9f40cfd22fe91777c78f252bd21a710f3fb007dc2f321876891e7644ba0ae175600954600a54600b546040516113859392919061208f565b60405180910390a16001905092915050565b600080600060036000858152602001908152602001600020905060018160080160009054906101000a900460000b60000b12156113d85781925050506115cb565b6009548160050154106114555760028160080160006101000a81548160ff021916908360000b60ff16021790555080600001547f36ea04725f8aa40ee603224671681b753f9cba3cb5f67c5a0e24a3b39900c06582600501548360060154604051611444929190612066565b60405180910390a2600191506115c5565b6000600a5411801561146d5750600a54816006015410155b1561150f577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8160080160006101000a81548160ff021916908360000b60ff1602179055506114bf8160000154611a3e565b5080600001547f1ad80b2541a1f52bdc838332d7c23606116a1188a8cbbc4c0948b4b56ce51d14826005015483600601546040516114fe929190612066565b60405180910390a2600191506115c4565b6009548160060154600b5461152491906120ed565b10156115c3577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8160080160006101000a81548160ff021916908360000b60ff1602179055506115778160000154611a3e565b5080600001547f3d61d434b895790b08f040c45261fce3b3bec596278b3a0f25dd9f741d0ba469826005015483600601546040516115b6929190612066565b60405180910390a2600191505b5b5b81925050505b919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611662576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161165990611f1e565b60405180910390fd5b60001515600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515146116f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116ec90611f3e565b60405180910390fd5b6001600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600b60008154809291906117609061226f565b91905055507f47d1c22a25bb3a5d4e481b9b1e6944c2eade3181a0a20b495ed61d35b5323f24826040516117949190611e5b565b60405180910390a1600b549050919050565b60008060036000600654815260200190815260200160002090506006548160000181905550848160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550858160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550838160030160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082816004018190555060018160080160006101000a81548160ff021916908360000b60ff160217905550600860008154809291906118d190612226565b9190505550600660008154809291906118e99061226f565b91905055508060030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168160020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168260010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fb609ae609609ee99268d05bc1371102cafe8d6b964bf082439ab16be2a01c87c846004015485600001546040516119d8929190612066565b60405180910390a48060000154915050949350505050565b60016020528160005260406000208181548110611a0c57600080fd5b906000526020600020016000915091509054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060086000815480929190611a53906121b3565b919050555060006008541315611aa157600754821415611a9c576000611a796000611282565b90506000811415611a9257600654600781905550611a9a565b806007819055505b505b611aab565b6006546007819055505b6007549050919050565b600081359050611ac4816122e7565b92915050565b600081359050611ad9816122fe565b92915050565b600060208284031215611af157600080fd5b6000611aff84828501611ab5565b91505092915050565b60008060008060808587031215611b1e57600080fd5b6000611b2c87828801611ab5565b9450506020611b3d87828801611ab5565b9350506040611b4e87828801611ab5565b9250506060611b5f87828801611aca565b91505092959194509250565b60008060408385031215611b7e57600080fd5b6000611b8c85828601611ab5565b9250506020611b9d85828601611aca565b9150509250929050565b600060208284031215611bb957600080fd5b6000611bc784828501611aca565b91505092915050565b60008060408385031215611be357600080fd5b6000611bf185828601611aca565b9250506020611c0285828601611ab5565b9150509250929050565b60008060408385031215611c1f57600080fd5b6000611c2d85828601611aca565b9250506020611c3e85828601611aca565b9150509250929050565b611c5181612121565b82525050565b611c6081612133565b82525050565b6000611c71826120c6565b611c7b81856120d1565b9350611c8b818560208601612180565b80840191505092915050565b611ca08161213f565b82525050565b611caf81612149565b82525050565b6000611cc2601a836120dc565b91507f4552525f5245445543455f5448524553484f4c445f46495253540000000000006000830152602082019050919050565b6000611d02600a836120dc565b91507f4552525f414343455353000000000000000000000000000000000000000000006000830152602082019050919050565b6000611d42600c836120dc565b91507f4552525f4e4f54464f554e4400000000000000000000000000000000000000006000830152602082019050919050565b6000611d826010836120dc565b91507f4552525f414c5245414459564f544544000000000000000000000000000000006000830152602082019050919050565b6000611dc26013836120dc565b91507f4552525f494e56414c49445f52455155455354000000000000000000000000006000830152602082019050919050565b6000611e026010836120dc565b91507f4552525f4e4f545f454e444f52534544000000000000000000000000000000006000830152602082019050919050565b611e3e81612176565b82525050565b6000611e508284611c66565b915081905092915050565b6000602082019050611e706000830184611c48565b92915050565b6000606082019050611e8b6000830186611c48565b611e986020830185611c48565b611ea56040830184611e35565b949350505050565b6000602082019050611ec26000830184611c57565b92915050565b6000602082019050611edd6000830184611c97565b92915050565b6000602082019050611ef86000830184611ca6565b92915050565b60006020820190508181036000830152611f1781611cb5565b9050919050565b60006020820190508181036000830152611f3781611cf5565b9050919050565b60006020820190508181036000830152611f5781611d35565b9050919050565b60006020820190508181036000830152611f7781611d75565b9050919050565b60006020820190508181036000830152611f9781611db5565b9050919050565b60006020820190508181036000830152611fb781611df5565b9050919050565b6000602082019050611fd36000830184611e35565b92915050565b600061012082019050611fef600083018c611e35565b611ffc602083018b611c48565b612009604083018a611c48565b6120166060830189611c48565b6120236080830188611e35565b61203060a0830187611e35565b61203d60c0830186611e35565b61204a60e0830185611e35565b612058610100830184611ca6565b9a9950505050505050505050565b600060408201905061207b6000830185611e35565b6120886020830184611e35565b9392505050565b60006060820190506120a46000830186611e35565b6120b16020830185611e35565b6120be6040830184611e35565b949350505050565b600081519050919050565b600081905092915050565b600082825260208201905092915050565b60006120f882612176565b915061210383612176565b925082821015612116576121156122b8565b5b828203905092915050565b600061212c82612156565b9050919050565b60008115159050919050565b6000819050919050565b60008160000b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60005b8381101561219e578082015181840152602081019050612183565b838111156121ad576000848401525b50505050565b60006121be8261213f565b91507f80000000000000000000000000000000000000000000000000000000000000008214156121f1576121f06122b8565b5b600182039050919050565b600061220782612176565b9150600082141561221b5761221a6122b8565b5b600182039050919050565b60006122318261213f565b91507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612264576122636122b8565b5b600182019050919050565b600061227a82612176565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156122ad576122ac6122b8565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6122f081612121565b81146122fb57600080fd5b50565b61230781612176565b811461231257600080fd5b5056fea2646970667358221220914d99025bf0f16e0c6b4d9c1c7f57c89c4ea71aaa54a23d5a906f45908d63f764736f6c63430008000033 -\ No newline at end of file +60806040523480156200001157600080fd5b5033600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160068190555060016007819055506200007d33620000a2640100000000026401000000009004565b506200009b6001600062000282640100000000026401000000009004565b5062000539565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161462000137576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200012e906200039a565b60405180910390fd5b60001515600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514620001cd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620001c490620003bc565b60405180910390fd5b6001600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600b60008154809291906200023a906200046a565b91905055507f47d1c22a25bb3a5d4e481b9b1e6944c2eade3181a0a20b495ed61d35b5323f24826040516200027091906200037d565b60405180910390a1600b549050919050565b6000600b548311156200029457600080fd5b60008311620002a257600080fd5b600b54821115620002b257600080fd5b8260098190555081600a819055507f9f40cfd22fe91777c78f252bd21a710f3fb007dc2f321876891e7644ba0ae175600954600a54600b54604051620002fb93929190620003de565b60405180910390a16001905092915050565b62000318816200042c565b82525050565b60006200032d600a836200041b565b91506200033a82620004e7565b602082019050919050565b600062000354600c836200041b565b9150620003618262000510565b602082019050919050565b620003778162000460565b82525050565b60006020820190506200039460008301846200030d565b92915050565b60006020820190508181036000830152620003b5816200031e565b9050919050565b60006020820190508181036000830152620003d78162000345565b9050919050565b6000606082019050620003f560008301866200036c565b6200040460208301856200036c565b6200041360408301846200036c565b949350505050565b600082825260208201905092915050565b6000620004398262000440565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000620004778262000460565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415620004ad57620004ac620004b8565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4552525f41434345535300000000000000000000000000000000000000000000600082015250565b7f4552525f4e4f54464f554e440000000000000000000000000000000000000000600082015250565b61239380620005496000396000f3fe608060405234801561001057600080fd5b506004361061015f576000357c010000000000000000000000000000000000000000000000000000000090048063736c0d5b116100d5578063bac911ac11610099578063bac911ac146103ee578063e3064a771461041e578063e9f9d28b1461044e578063eb12d61e1461047e578063ed71262a146104ae578063fba00cbd146104de5761015f565b8063736c0d5b1461031a578063755fd58f1461034a5780637ca548c61461037a57806381d12c58146103985780638da5cb5b146103d05761015f565b80633a9ddc80116101275780633a9ddc801461021e5780634797569a1461024e57806357ec347a1461027e57806358d71f821461029c578063614f427f146102cc5780636e417c69146102ea5761015f565b806302d947ef1461016457806306661abd1461019457806308ae6377146101b25780630e316ab7146101d05780631703a01814610200575b600080fd5b61017e60048036038101906101799190611bd0565b61050e565b60405161018b9190611e35565b60405180910390f35b61019c61053d565b6040516101a99190611e1a565b60405180910390f35b6101ba610543565b6040516101c79190611f10565b60405180910390f35b6101ea60048036038101906101e59190611adf565b61056e565b6040516101f79190611f10565b60405180910390f35b6102086107cf565b6040516102159190611f10565b60405180910390f35b61023860048036038101906102339190611b6b565b6107d5565b6040516102459190611f10565b60405180910390f35b61026860048036038101906102639190611ba7565b610806565b6040516102759190611f10565b60405180910390f35b610286610aaa565b6040516102939190611f10565b60405180910390f35b6102b660048036038101906102b19190611ba7565b610ac0565b6040516102c39190611f10565b60405180910390f35b6102d4610d45565b6040516102e19190611f10565b60405180910390f35b61030460048036038101906102ff9190611ba7565b610d4b565b6040516103119190611dff565b60405180910390f35b610334600480360381019061032f9190611adf565b61114a565b6040516103419190611dff565b60405180910390f35b610364600480360381019061035f9190611b6b565b61116a565b6040516103719190611f10565b60405180910390f35b61038261119b565b60405161038f9190611f10565b60405180910390f35b6103b260048036038101906103ad9190611ba7565b6111a1565b6040516103c799989796959493929190611f2b565b60405180910390f35b6103d861125c565b6040516103e59190611dad565b60405180910390f35b61040860048036038101906104039190611ba7565b611282565b6040516104159190611f10565b60405180910390f35b61043860048036038101906104339190611c0c565b611311565b6040516104459190611dff565b60405180910390f35b61046860048036038101906104639190611ba7565b611397565b6040516104759190611dff565b60405180910390f35b61049860048036038101906104939190611adf565b6115d0565b6040516104a59190611f10565b60405180910390f35b6104c860048036038101906104c39190611b08565b6117a6565b6040516104d59190611f10565b60405180910390f35b6104f860048036038101906104f39190611c0c565b6119f0565b6040516105059190611dad565b60405180910390f35b60006020528160005260406000206020528060005260406000206000915091509054906101000a900460000b81565b60085481565b600080600754600654610556919061203f565b1415610565576000905061056b565b60075490505b90565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806105f757508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610636576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161062d90611e70565b60405180910390fd5b60011515600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515146106c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c090611e90565b60405180910390fd5b600954600b541180156106df5750600a54600b54115b61071e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161071590611e50565b60405180910390fd5b6000600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600b60008154809291906107899061214e565b91905055507f3525e22824a8a7df2c9a6029941c824cf95b6447f1e13d5128fd3826d35afe8b826040516107bd9190611dad565b60405180910390a1600b549050919050565b60095481565b600560205281600052604060002081815481106107f157600080fd5b90600052602060002001600091509150505481565b6000600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610894576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088b90611e70565b60405180910390fd5b600080600084815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460000b60000b14610936576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161092d90611eb0565b60405180910390fd5b600060036000848152602001908152602001600020905060018160080160009054906101000a900460000b60000b1461096e57600080fd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000808360000154815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908360000b60ff1602179055506001600082600001548152602001908152602001600020339080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550806006016000815480929190610a8a906121c1565b9190505550610a9c8160000154611397565b508060060154915050919050565b60006001600654610abb919061203f565b905090565b6000600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610b4e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b4590611e70565b60405180910390fd5b600080600084815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460000b60000b14610bf0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610be790611eb0565b60405180910390fd5b600060036000848152602001908152602001600020905060018160080160009054906101000a900460000b60000b14610c2857600080fd5b60016000808360000154815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908360000b60ff1602179055506001600082600001548152602001908152602001600020339080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550806005016000815480929190610d25906121c1565b9190505550610d378160000154611397565b508060050154915050919050565b600a5481565b6000806003600084815260200190815260200160002090506000816000015411610daa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610da190611ed0565b60405180910390fd5b60028160080160009054906101000a900460000b60000b14610e01576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610df890611ef0565b60405180910390fd5b60008160080160006101000a81548160ff021916908360000b60ff1602179055506000808260030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168360010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168460020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168560040154604051602401610ec193929190611dc8565b6040516020818303038152906040527f23b872dd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610f4b9190611d96565b6000604051808303816000865af19150503d8060008114610f88576040519150601f19603f3d011682016040523d82523d6000602084013e610f8d565b606091505b5091509150610f9f8360000154611a3e565b50438360070181905550600460008460010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002083600001549080600181540180825580915050600190039060005260206000200160009091909190915055600560008460020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020836000015490806001815401808255809150506001900390600052602060002001600090919091909150558115611107577fbcf6a68a2f901be4a23a41b53acd7697893a7e34def4e28acba584da75283b67856040516110fa9190611f10565b60405180910390a161113f565b7fdab20a0fcd702cf875c2d715d5c3fc99af66a716c94b3405408c94b7311c99eb856040516111369190611f10565b60405180910390a15b819350505050919050565b600c6020528060005260406000206000915054906101000a900460ff1681565b6004602052816000526040600020818154811061118657600080fd5b90600052602060002001600091509150505481565b600b5481565b60036020528060005260406000206000915090508060000154908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060040154908060050154908060060154908060070154908060080160009054906101000a900460000b905089565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080600060075490505b60065481101561130557600060036000838152602001908152602001600020905060008160080160009054906101000a900460000b60000b13156112f157848314156112e2578060000154935050505061130c565b82806112ed906121c1565b9350505b5080806112fd906121c1565b91505061128d565b5060009150505b919050565b6000600b5483111561132257600080fd5b6000831161132f57600080fd5b600b5482111561133e57600080fd5b8260098190555081600a819055507f9f40cfd22fe91777c78f252bd21a710f3fb007dc2f321876891e7644ba0ae175600954600a54600b5460405161138593929190611fe1565b60405180910390a16001905092915050565b600080600060036000858152602001908152602001600020905060018160080160009054906101000a900460000b60000b12156113d85781925050506115cb565b6009548160050154106114555760028160080160006101000a81548160ff021916908360000b60ff16021790555080600001547f36ea04725f8aa40ee603224671681b753f9cba3cb5f67c5a0e24a3b39900c06582600501548360060154604051611444929190611fb8565b60405180910390a2600191506115c5565b6000600a5411801561146d5750600a54816006015410155b1561150f577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8160080160006101000a81548160ff021916908360000b60ff1602179055506114bf8160000154611a3e565b5080600001547f1ad80b2541a1f52bdc838332d7c23606116a1188a8cbbc4c0948b4b56ce51d14826005015483600601546040516114fe929190611fb8565b60405180910390a2600191506115c4565b6009548160060154600b54611524919061203f565b10156115c3577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8160080160006101000a81548160ff021916908360000b60ff1602179055506115778160000154611a3e565b5080600001547f3d61d434b895790b08f040c45261fce3b3bec596278b3a0f25dd9f741d0ba469826005015483600601546040516115b6929190611fb8565b60405180910390a2600191505b5b5b81925050505b919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611662576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161165990611e70565b60405180910390fd5b60001515600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515146116f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116ec90611e90565b60405180910390fd5b6001600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600b6000815480929190611760906121c1565b91905055507f47d1c22a25bb3a5d4e481b9b1e6944c2eade3181a0a20b495ed61d35b5323f24826040516117949190611dad565b60405180910390a1600b549050919050565b60008060036000600654815260200190815260200160002090506006548160000181905550848160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550858160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550838160030160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082816004018190555060018160080160006101000a81548160ff021916908360000b60ff160217905550600860008154809291906118d190612178565b9190505550600660008154809291906118e9906121c1565b91905055508060030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168160020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168260010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fb609ae609609ee99268d05bc1371102cafe8d6b964bf082439ab16be2a01c87c846004015485600001546040516119d8929190611fb8565b60405180910390a48060000154915050949350505050565b60016020528160005260406000208181548110611a0c57600080fd5b906000526020600020016000915091509054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060086000815480929190611a5390612105565b919050555060006008541315611aa157600754821415611a9c576000611a796000611282565b90506000811415611a9257600654600781905550611a9a565b806007819055505b505b611aab565b6006546007819055505b6007549050919050565b600081359050611ac48161232f565b92915050565b600081359050611ad981612346565b92915050565b600060208284031215611af157600080fd5b6000611aff84828501611ab5565b91505092915050565b60008060008060808587031215611b1e57600080fd5b6000611b2c87828801611ab5565b9450506020611b3d87828801611ab5565b9350506040611b4e87828801611ab5565b9250506060611b5f87828801611aca565b91505092959194509250565b60008060408385031215611b7e57600080fd5b6000611b8c85828601611ab5565b9250506020611b9d85828601611aca565b9150509250929050565b600060208284031215611bb957600080fd5b6000611bc784828501611aca565b91505092915050565b60008060408385031215611be357600080fd5b6000611bf185828601611aca565b9250506020611c0285828601611ab5565b9150509250929050565b60008060408385031215611c1f57600080fd5b6000611c2d85828601611aca565b9250506020611c3e85828601611aca565b9150509250929050565b611c5181612073565b82525050565b611c6081612085565b82525050565b6000611c7182612018565b611c7b8185612023565b9350611c8b8185602086016120d2565b80840191505092915050565b611ca081612091565b82525050565b611caf8161209b565b82525050565b6000611cc2601a8361202e565b9150611ccd82612239565b602082019050919050565b6000611ce5600a8361202e565b9150611cf082612262565b602082019050919050565b6000611d08600c8361202e565b9150611d138261228b565b602082019050919050565b6000611d2b60108361202e565b9150611d36826122b4565b602082019050919050565b6000611d4e60138361202e565b9150611d59826122dd565b602082019050919050565b6000611d7160108361202e565b9150611d7c82612306565b602082019050919050565b611d90816120c8565b82525050565b6000611da28284611c66565b915081905092915050565b6000602082019050611dc26000830184611c48565b92915050565b6000606082019050611ddd6000830186611c48565b611dea6020830185611c48565b611df76040830184611d87565b949350505050565b6000602082019050611e146000830184611c57565b92915050565b6000602082019050611e2f6000830184611c97565b92915050565b6000602082019050611e4a6000830184611ca6565b92915050565b60006020820190508181036000830152611e6981611cb5565b9050919050565b60006020820190508181036000830152611e8981611cd8565b9050919050565b60006020820190508181036000830152611ea981611cfb565b9050919050565b60006020820190508181036000830152611ec981611d1e565b9050919050565b60006020820190508181036000830152611ee981611d41565b9050919050565b60006020820190508181036000830152611f0981611d64565b9050919050565b6000602082019050611f256000830184611d87565b92915050565b600061012082019050611f41600083018c611d87565b611f4e602083018b611c48565b611f5b604083018a611c48565b611f686060830189611c48565b611f756080830188611d87565b611f8260a0830187611d87565b611f8f60c0830186611d87565b611f9c60e0830185611d87565b611faa610100830184611ca6565b9a9950505050505050505050565b6000604082019050611fcd6000830185611d87565b611fda6020830184611d87565b9392505050565b6000606082019050611ff66000830186611d87565b6120036020830185611d87565b6120106040830184611d87565b949350505050565b600081519050919050565b600081905092915050565b600082825260208201905092915050565b600061204a826120c8565b9150612055836120c8565b9250828210156120685761206761220a565b5b828203905092915050565b600061207e826120a8565b9050919050565b60008115159050919050565b6000819050919050565b60008160000b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60005b838110156120f05780820151818401526020810190506120d5565b838111156120ff576000848401525b50505050565b600061211082612091565b91507f80000000000000000000000000000000000000000000000000000000000000008214156121435761214261220a565b5b600182039050919050565b6000612159826120c8565b9150600082141561216d5761216c61220a565b5b600182039050919050565b600061218382612091565b91507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156121b6576121b561220a565b5b600182019050919050565b60006121cc826120c8565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156121ff576121fe61220a565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4552525f5245445543455f5448524553484f4c445f4649525354000000000000600082015250565b7f4552525f41434345535300000000000000000000000000000000000000000000600082015250565b7f4552525f4e4f54464f554e440000000000000000000000000000000000000000600082015250565b7f4552525f414c5245414459564f54454400000000000000000000000000000000600082015250565b7f4552525f494e56414c49445f5245515545535400000000000000000000000000600082015250565b7f4552525f4e4f545f454e444f5253454400000000000000000000000000000000600082015250565b61233881612073565b811461234357600080fd5b50565b61234f816120c8565b811461235a57600080fd5b5056fea2646970667358221220db3bb04d4609a28abcde3217e8cc5e6a6573c3ee648d8e7f88e10daa0a5f7ec264736f6c63430008020033 +\ No newline at end of file diff --git a/python/erc20_transfer_authorization/runnable/deploy.py b/python/erc20_transfer_authorization/runnable/deploy.py @@ -6,24 +6,27 @@ """ # standard imports +import sys import os import json import argparse import logging # third-party imports -import web3 from crypto_dev_signer.eth.signer import ReferenceSigner as EIP155Signer -from crypto_dev_signer.keystore import DictKeystore -from crypto_dev_signer.eth.helper import EthTxExecutor +from crypto_dev_signer.keystore.dict import DictKeystore from chainlib.chain import ChainSpec +from chainlib.eth.nonce import RPCNonceOracle +from chainlib.eth.gas import RPCGasOracle +from chainlib.eth.connection import EthHTTPConnection +from chainlib.eth.tx import receipt + +# local imports +from erc20_transfer_authorization import TransferAuthorization logging.basicConfig(level=logging.WARNING) logg = logging.getLogger() -logging.getLogger('web3').setLevel(logging.WARNING) -logging.getLogger('urllib3').setLevel(logging.WARNING) - script_dir = os.path.dirname(__file__) data_dir = os.path.join(script_dir, '..', 'data') @@ -34,10 +37,9 @@ argparser.add_argument('-ww', action='store_true', help='Wait for every transact argparser.add_argument('-i', '--chain-spec', dest='i', type=str, default='Ethereum:1', help='Chain specification string') argparser.add_argument('-a', '--signer-address', dest='a', type=str, help='Signer address') argparser.add_argument('-y', '--key-file', dest='y', type=str, help='Ethereum keystore file to use for signing') -argparser.add_argument('--approver', action='append', type=str, help='approver to add') -argparser.add_argument('--abi-dir', dest='abi_dir', type=str, default=data_dir, help='Directory containing bytecode and abi (default: {})'.format(data_dir)) argparser.add_argument('-v', action='store_true', help='Be verbose') argparser.add_argument('-vv', action='store_true', help='Be more verbose') +argparser.add_argument('--env-prefix', default=os.environ.get('CONFINI_ENV_PREFIX'), dest='env_prefix', type=str, help='environment prefix for variables to overwrite configuration') args = argparser.parse_args() if args.vv: @@ -48,56 +50,47 @@ elif args.v: block_last = args.w block_all = args.ww -w3 = web3.Web3(web3.Web3.HTTPProvider(args.p)) +passphrase_env = 'ETH_PASSPHRASE' +if args.env_prefix != None: + passphrase_env = args.env_prefix + '_' + passphrase_env +passphrase = os.environ.get(passphrase_env) +if passphrase == None: + logg.warning('no passphrase given') + passphrase='' signer_address = None keystore = DictKeystore() if args.y != None: logg.debug('loading keystore file {}'.format(args.y)) - signer_address = keystore.import_keystore_file(args.y) + signer_address = keystore.import_keystore_file(args.y, password=passphrase) logg.debug('now have key for signer address {}'.format(signer_address)) signer = EIP155Signer(keystore) chain_spec = ChainSpec.from_chain_str(args.i) chain_id = chain_spec.network_id() -helper = EthTxExecutor( - w3, - signer_address, - signer, - chain_id, - block=args.ww, - ) +rpc = EthHTTPConnection(args.p) +nonce_oracle = RPCNonceOracle(signer_address, rpc) +gas_oracle = RPCGasOracle(rpc, code_callback=TransferAuthorization.gas) def main(): - f = open(os.path.join(args.abi_dir, 'ERC20TransferAuthorization.json'), 'r') - abi = json.load(f) - f.close() - - f = open(os.path.join(args.abi_dir, 'ERC20TransferAuthorization.bin'), 'r') - bytecode = f.read() - f.close() - - c = w3.eth.contract(abi=abi, bytecode=bytecode) - - approvers = [signer_address] - if args.approver != None: - for a in args.approver: - approvers.append(a) - logg.info('add approver {}'.format(a)) - - #tx_hash = c.constructor(approvers).transact() - (tx_hash, rcpt) = helper.sign_and_send( - [ - c.constructor().buildTransaction - ], - force_wait=True, - ) - - address = rcpt.contractAddress - - print(address) + c = TransferAuthorization(signer=signer, gas_oracle=gas_oracle, nonce_oracle=nonce_oracle, chain_id=chain_id) + (tx_hash_hex, o) = c.constructor(signer_address) + rpc.do(o) + if block_last: + r = rpc.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) + + sys.exit(0) if __name__ == '__main__': diff --git a/python/erc20_transfer_authorization/runnable/request.py b/python/erc20_transfer_authorization/runnable/request.py @@ -1,92 +0,0 @@ -# standard imports -import os -import json -import argparse -import logging - -# third-party imports -import web3 -from crypto_dev_signer.eth.signer import ReferenceSigner as EIP155Signer -from crypto_dev_signer.keystore import DictKeystore -from crypto_dev_signer.eth.helper import EthTxExecutor -from chainlib.chain import ChainSpec - -logging.basicConfig(level=logging.WARNING) -logg = logging.getLogger() - -logging.getLogger('web3').setLevel(logging.WARNING) -logging.getLogger('urllib3').setLevel(logging.WARNING) - -script_dir = os.path.dirname(__file__) -data_dir = os.path.join(script_dir, '..', 'data') - -argparser = argparse.ArgumentParser() -argparser.add_argument('-p', '--provider', dest='p', default='http://localhost:8545', type=str, help='Web3 provider url (http only)') -argparser.add_argument('-w', action='store_true', help='Wait for the last transaction to be confirmed') -argparser.add_argument('-ww', action='store_true', help='Wait for every transaction to be confirmed') -argparser.add_argument('-i', '--chain-spec', dest='i', type=str, default='Ethereum:1', help='Chain specification string') -argparser.add_argument('-a', '--contract-address', required=True, dest='a', type=str, help='Transfer Authorization contract address') -argparser.add_argument('-t', '--token-address', required=True, dest='t', type=str, help='Token address') -argparser.add_argument('-y', '--key-file', dest='y', type=str, help='Ethereum keystore file to use for signing') -argparser.add_argument('--abi-dir', dest='abi_dir', type=str, default=data_dir, help='Directory containing bytecode and abi (default: {})'.format(data_dir)) -argparser.add_argument('-v', action='store_true', help='Be verbose') -argparser.add_argument('-vv', action='store_true', help='Be more verbose') -argparser.add_argument('sender', type=str, help='Spender address') -argparser.add_argument('recipient', type=str, help='Recipient address') -argparser.add_argument('value', type=int, help='Value of allowance') -args = argparser.parse_args() - -if args.vv: - logg.setLevel(logging.DEBUG) -elif args.v: - logg.setLevel(logging.INFO) - -block_last = args.w -block_all = args.ww - -w3 = web3.Web3(web3.Web3.HTTPProvider(args.p)) - -signer_address = None -keystore = DictKeystore() -if args.y != None: - logg.debug('loading keystore file {}'.format(args.y)) - signer_address = keystore.import_keystore_file(args.y) - logg.debug('now have key for signer address {}'.format(signer_address)) -signer = EIP155Signer(keystore) - -chain_spec = ChainSpec.from_chain_str(args.i) -chain_id = chain_spec.network_id() - -helper = EthTxExecutor( - w3, - signer_address, - signer, - chain_id, - block=args.ww, - ) - - -def main(): - f = open(os.path.join(args.abi_dir, 'ERC20TransferAuthorization.json'), 'r') - abi = json.load(f) - f.close() - - c = w3.eth.contract(abi=abi, address=args.a) - - (tx_hash, rcpt) = helper.sign_and_send( - [ - c.functions.createRequest( - args.sender, - args.recipient, - args.t, - args.value, - ).buildTransaction - ], - force_wait=True, - ) - - print(tx_hash) - - -if __name__ == '__main__': - main() diff --git a/python/erc20_transfer_authorization/transfer_authorization.py b/python/erc20_transfer_authorization/transfer_authorization.py @@ -50,6 +50,11 @@ class TransferAuthorization(TxFactory): return TransferAuthorization.__bytecode + @staticmethod + def gas(code=None): + return 2800000 + + def constructor(self, sender_address): code = TransferAuthorization.bytecode() tx = self.template(sender_address, None, use_nonce=True)