erc20-transfer-authorization

Simple approval escrow for ERC20 spending
Log | Files | Refs

commit 700edcab7369a45b20bfefa3c22b98c5047e3333
parent 40231e18dac09460700678fef2039d675312cae3
Author: nolash <dev@holbrook.no>
Date:   Tue, 16 Feb 2021 11:04:05 +0100

Complete quorum tests

Diffstat:
Mpython/erc20_approval_escrow/data/TransferApproval.bin | 4++--
Mpython/erc20_approval_escrow/data/TransferApproval.json | 2+-
Mpython/tests/test_quorum.py | 128++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------
Msolidity/TransferApproval.bin | 4++--
Msolidity/TransferApproval.json | 2+-
Msolidity/TransferApproval.sol | 23+++++++++++------------
6 files changed, 128 insertions(+), 35 deletions(-)

diff --git a/python/erc20_approval_escrow/data/TransferApproval.bin b/python/erc20_approval_escrow/data/TransferApproval.bin @@ -1 +1 @@ -60806040523480156200001157600080fd5b5033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060016003819055506001600481905550600160068190555060016008819055506200008760016000620000a060201b60201c565b5062000099336200012b60201b60201c565b50620003d2565b6000600854831115620000b257600080fd5b60008311620000c057600080fd5b600854821115620000d057600080fd5b82600681905550816007819055507f9f40cfd22fe91777c78f252bd21a710f3fb007dc2f321876891e7644ba0ae1756006546007546008546040516200011993929190620002da565b60405180910390a16001905092915050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146200018857600080fd5b60001515600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514620001e657600080fd5b6001600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060086000815480929190620002539062000355565b91905055507f47d1c22a25bb3a5d4e481b9b1e6944c2eade3181a0a20b495ed61d35b5323f2482604051620002899190620002bd565b60405180910390a16008549050919050565b620002a68162000317565b82525050565b620002b7816200034b565b82525050565b6000602082019050620002d460008301846200029b565b92915050565b6000606082019050620002f16000830186620002ac565b620003006020830185620002ac565b6200030f6040830184620002ac565b949350505050565b600062000324826200032b565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600062000362826200034b565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415620003985762000397620003a3565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b611af480620003e26000396000f3fe608060405234801561001057600080fd5b50600436106101005760003560e01c80636e417c6911610097578063b0addede11610066578063b0addede146102e2578063bac911ac14610312578063e3064a7714610342578063eb12d61e1461037257610100565b80636e417c691461022b578063736c0d5b1461025b57806381d12c581461028b5780638da5cb5b146102c457610100565b80634797569a116100d35780634797569a1461018f57806357ec347a146101bf57806358d71f82146101dd578063614f427f1461020d57610100565b806306661abd1461010557806308ae6377146101235780630e316ab7146101415780631703a01814610171575b600080fd5b61010d6103a2565b60405161011a91906117f4565b60405180910390f35b61012b6103a8565b60405161013891906117f4565b60405180910390f35b61015b60048036038101906101569190611566565b6103d3565b60405161016891906117f4565b60405180910390f35b6101796105ce565b60405161018691906117f4565b60405180910390f35b6101a960048036038101906101a491906115de565b6105d4565b6040516101b691906117f4565b60405180910390f35b6101c7610850565b6040516101d491906117f4565b60405180910390f35b6101f760048036038101906101f291906115de565b610866565b60405161020491906117f4565b60405180910390f35b610215610a1e565b60405161022291906117f4565b60405180910390f35b610245600480360381019061024091906115de565b610a24565b6040516102529190611799565b60405180910390f35b61027560048036038101906102709190611566565b610cfd565b6040516102829190611799565b60405180910390f35b6102a560048036038101906102a091906115de565b610d1d565b6040516102bb9a9998979695949392919061180f565b60405180910390f35b6102cc610dde565b6040516102d99190611747565b60405180910390f35b6102fc60048036038101906102f7919061158f565b610e04565b60405161030991906117f4565b60405180910390f35b61032c600480360381019061032791906115de565b6110f9565b60405161033991906117f4565b60405180910390f35b61035c60048036038101906103579190611607565b611178565b6040516103699190611799565b60405180910390f35b61038c60048036038101906103879190611566565b6111fe565b60405161039991906117f4565b60405180910390f35b60055481565b6000806004546003546103bb9190611932565b14156103ca57600090506103d0565b60045490505b90565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561043057600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806104b757508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6104c057600080fd5b60011515600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151461051d57600080fd5b6000600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060086000815480929190610588906119ee565b91905055507f3525e22824a8a7df2c9a6029941c824cf95b6447f1e13d5128fd3826d35afe8b826040516105bc9190611747565b60405180910390a16008549050919050565b60065481565b60008060026000848152602001908152602001600020905060008160090160009054906101000a900460000b60000b1461060d57600080fd5b600080600085815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460000b60000b1461067957600080fd5b600160008085815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908360000b60ff1602179055508060080160008154809291906106fa90611a18565b9190505550806005015481600801546008546107169190611932565b14156107a1577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8160090160006101000a81548160ff021916908360000b60ff16021790555061076583611368565b7f94064f919a02d0565c6790e0615fb4ba6cf1be1dd679f0161be914613a1b9bb58360405161079491906117f4565b60405180910390a1610843565b600081600601541180156107bc575080600601548160080154145b15610842577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8160090160006101000a81548160ff021916908360000b60ff16021790555061080a83611368565b7f2ae00ba9813199478b6f22f0c9b606daa70f8efc319c8d2fa6af63f66ea317638360405161083991906117f4565b60405180910390a15b5b8060080154915050919050565b600060016003546108619190611932565b905090565b60008060026000848152602001908152602001600020905060008160090160009054906101000a900460000b60000b1461089f57600080fd5b600080600085815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460000b60000b1461090b57600080fd5b600160008085815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908360000b60ff16021790555080600701600081548092919061098c90611a18565b9190505550806005015481600701546008546109a89190611932565b1415610a115760018160090160006101000a81548160ff021916908360000b60ff1602179055507f3ad93af63cb7967b23e4fb500b7d7d28b07516325dcf341f88bebf959d82c1cb836040516109fe91906117f4565b60405180910390a1610a0f83610a24565b505b8060070154915050919050565b60075481565b6000806002600084815260200190815260200160002090506000816000015411610a83576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a7a906117b4565b60405180910390fd5b60018160090160009054906101000a900460000b60000b14610ada576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ad1906117d4565b60405180910390fd5b60028160090160006101000a81548160ff021916908360000b60ff1602179055506000808260030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168360010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168460020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168560040154604051602401610b9a93929190611762565b6040516020818303038152906040527f23b872dd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610c249190611730565b6000604051808303816000865af19150503d8060008114610c61576040519150601f19603f3d011682016040523d82523d6000602084013e610c66565b606091505b5091509150610c788360000154611368565b8115610cba577fbcf6a68a2f901be4a23a41b53acd7697893a7e34def4e28acba584da75283b6785604051610cad91906117f4565b60405180910390a1610cf2565b7fdab20a0fcd702cf875c2d715d5c3fc99af66a716c94b3405408c94b7311c99eb85604051610ce991906117f4565b60405180910390a15b819350505050919050565b60096020528060005260406000206000915054906101000a900460ff1681565b60026020528060005260406000206000915090508060000154908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060040154908060050154908060060154908060070154908060080154908060090160009054906101000a900460000b90508a565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000610e0e6114a5565b60035481600001818152505084816040019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505033816020019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505083816060019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050828160800181815250506006548160a0018181525050806002600060035481526020019081526020016000206000820151816000015560208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060608201518160030160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506080820151816004015560a0820151816005015560c0820151816006015560e0820151816007015561010082015181600801556101208201518160090160006101000a81548160ff021916908360000b60ff1602179055509050506005600081548092919061103b90611a18565b91905055506003600081548092919061105390611a18565b9190505550806060015173ffffffffffffffffffffffffffffffffffffffff16816040015173ffffffffffffffffffffffffffffffffffffffff16826020015173ffffffffffffffffffffffffffffffffffffffff167fb609ae609609ee99268d05bc1371102cafe8d6b964bf082439ab16be2a01c87c846080015185600001516040516110e29291906118ab565b60405180910390a480600001519150509392505050565b600080600060045490505b60035481101561116c57600060026000838152602001908152602001600020905060008160000154111561115857848314156111495780600001549350505050611173565b828061115490611a18565b9350505b50808061116490611a18565b915050611104565b5060009150505b919050565b600060085483111561118957600080fd5b6000831161119657600080fd5b6008548211156111a557600080fd5b82600681905550816007819055507f9f40cfd22fe91777c78f252bd21a710f3fb007dc2f321876891e7644ba0ae1756006546007546008546040516111ec939291906118d4565b60405180910390a16001905092915050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461125a57600080fd5b60001515600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515146112b757600080fd5b6001600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506008600081548092919061132290611a18565b91905055507f47d1c22a25bb3a5d4e481b9b1e6944c2eade3181a0a20b495ed61d35b5323f24826040516113569190611747565b60405180910390a16008549050919050565b600260008281526020019081526020016000206000808201600090556001820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556002820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556003820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055600482016000905560058201600090556006820160009055600782016000905560088201600090556009820160006101000a81549060ff021916905550506005600081548092919061144a906119ee565b9190505550600060055411156114985760045481141561149357600061147060006110f9565b9050600081141561148957600354600481905550611491565b806004819055505b505b6114a2565b6003546004819055505b50565b60405180610140016040528060008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081526020016000815260200160008152602001600081526020016000800b81525090565b60008135905061154b81611a90565b92915050565b60008135905061156081611aa7565b92915050565b60006020828403121561157857600080fd5b60006115868482850161153c565b91505092915050565b6000806000606084860312156115a457600080fd5b60006115b28682870161153c565b93505060206115c38682870161153c565b92505060406115d486828701611551565b9150509250925092565b6000602082840312156115f057600080fd5b60006115fe84828501611551565b91505092915050565b6000806040838503121561161a57600080fd5b600061162885828601611551565b925050602061163985828601611551565b9150509250929050565b61164c81611966565b82525050565b61165b81611978565b82525050565b600061166c8261190b565b6116768185611916565b93506116868185602086016119bb565b80840191505092915050565b61169b81611984565b82525050565b60006116ae601383611921565b91507f4552525f494e56414c49445f52455155455354000000000000000000000000006000830152602082019050919050565b60006116ee601083611921565b91507f4552525f4e4f545f454e444f52534544000000000000000000000000000000006000830152602082019050919050565b61172a816119b1565b82525050565b600061173c8284611661565b915081905092915050565b600060208201905061175c6000830184611643565b92915050565b60006060820190506117776000830186611643565b6117846020830185611643565b6117916040830184611721565b949350505050565b60006020820190506117ae6000830184611652565b92915050565b600060208201905081810360008301526117cd816116a1565b9050919050565b600060208201905081810360008301526117ed816116e1565b9050919050565b60006020820190506118096000830184611721565b92915050565b600061014082019050611825600083018d611721565b611832602083018c611643565b61183f604083018b611643565b61184c606083018a611643565b6118596080830189611721565b61186660a0830188611721565b61187360c0830187611721565b61188060e0830186611721565b61188e610100830185611721565b61189c610120830184611692565b9b9a5050505050505050505050565b60006040820190506118c06000830185611721565b6118cd6020830184611721565b9392505050565b60006060820190506118e96000830186611721565b6118f66020830185611721565b6119036040830184611721565b949350505050565b600081519050919050565b600081905092915050565b600082825260208201905092915050565b600061193d826119b1565b9150611948836119b1565b92508282101561195b5761195a611a61565b5b828203905092915050565b600061197182611991565b9050919050565b60008115159050919050565b60008160000b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60005b838110156119d95780820151818401526020810190506119be565b838111156119e8576000848401525b50505050565b60006119f9826119b1565b91506000821415611a0d57611a0c611a61565b5b600182039050919050565b6000611a23826119b1565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415611a5657611a55611a61565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b611a9981611966565b8114611aa457600080fd5b50565b611ab0816119b1565b8114611abb57600080fd5b5056fea2646970667358221220989e15437637b2784d71c40db502cba46cee9c1b27adaec2d1865049b91b754764736f6c63430008000033 -\ No newline at end of file +60806040523480156200001157600080fd5b5033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060016003819055506001600481905550600160068190555060016008819055506200008760016000620000a060201b60201c565b5062000099336200012b60201b60201c565b50620003d2565b6000600854831115620000b257600080fd5b60008311620000c057600080fd5b600854821115620000d057600080fd5b82600681905550816007819055507f9f40cfd22fe91777c78f252bd21a710f3fb007dc2f321876891e7644ba0ae1756006546007546008546040516200011993929190620002da565b60405180910390a16001905092915050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146200018857600080fd5b60001515600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514620001e657600080fd5b6001600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060086000815480929190620002539062000355565b91905055507f47d1c22a25bb3a5d4e481b9b1e6944c2eade3181a0a20b495ed61d35b5323f2482604051620002899190620002bd565b60405180910390a16008549050919050565b620002a68162000317565b82525050565b620002b7816200034b565b82525050565b6000602082019050620002d460008301846200029b565b92915050565b6000606082019050620002f16000830186620002ac565b620003006020830185620002ac565b6200030f6040830184620002ac565b949350505050565b600062000324826200032b565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600062000362826200034b565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415620003985762000397620003a3565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b611a5b80620003e26000396000f3fe608060405234801561001057600080fd5b506004361061010b5760003560e01c8063614f427f116100a25780638da5cb5b116100715780638da5cb5b146102ff578063b0addede1461031d578063bac911ac1461034d578063e3064a771461037d578063eb12d61e146103ad5761010b565b8063614f427f146102485780636e417c6914610266578063736c0d5b1461029657806381d12c58146102c65761010b565b80631703a018116100de5780631703a018146101ac5780634797569a146101ca57806357ec347a146101fa57806358d71f82146102185761010b565b806302d947ef1461011057806306661abd1461014057806308ae63771461015e5780630e316ab71461017c575b600080fd5b61012a60048036038101906101259190611517565b6103dd565b6040516101379190611700565b60405180910390f35b61014861040c565b604051610155919061175b565b60405180910390f35b610166610412565b604051610173919061175b565b60405180910390f35b61019660048036038101906101919190611476565b61043d565b6040516101a3919061175b565b60405180910390f35b6101b4610638565b6040516101c1919061175b565b60405180910390f35b6101e460048036038101906101df91906114ee565b61063e565b6040516101f1919061175b565b60405180910390f35b610202610930565b60405161020f919061175b565b60405180910390f35b610232600480360381019061022d91906114ee565b610946565b60405161023f919061175b565b60405180910390f35b610250610b4b565b60405161025d919061175b565b60405180910390f35b610280600480360381019061027b91906114ee565b610b51565b60405161028d91906116e5565b60405180910390f35b6102b060048036038101906102ab9190611476565b610e2a565b6040516102bd91906116e5565b60405180910390f35b6102e060048036038101906102db91906114ee565b610e4a565b6040516102f69a99989796959493929190611776565b60405180910390f35b610307610f0b565b6040516103149190611693565b60405180910390f35b6103376004803603810190610332919061149f565b610f31565b604051610344919061175b565b60405180910390f35b610367600480360381019061036291906114ee565b61116f565b604051610374919061175b565b60405180910390f35b61039760048036038101906103929190611553565b6111ee565b6040516103a491906116e5565b60405180910390f35b6103c760048036038101906103c29190611476565b611274565b6040516103d4919061175b565b60405180910390f35b60006020528160005260406000206020528060005260406000206000915091509054906101000a900460000b81565b60055481565b6000806004546003546104259190611899565b1415610434576000905061043a565b60045490505b90565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561049a57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061052157508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b61052a57600080fd5b60011515600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151461058757600080fd5b6000600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600860008154809291906105f290611955565b91905055507f3525e22824a8a7df2c9a6029941c824cf95b6447f1e13d5128fd3826d35afe8b826040516106269190611693565b60405180910390a16008549050919050565b60065481565b6000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661069657600080fd5b600080600084815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460000b60000b1461070257600080fd5b600060026000848152602001908152602001600020905060008160090160009054906101000a900460000b60000b1461073a57600080fd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60008085815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908360000b60ff1602179055508060080160008154809291906107da9061197f565b9190505550806005015481600801546008546107f69190611899565b1415610881577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8160090160006101000a81548160ff021916908360000b60ff160217905550610845836113de565b7f94064f919a02d0565c6790e0615fb4ba6cf1be1dd679f0161be914613a1b9bb583604051610874919061175b565b60405180910390a1610923565b6000816006015411801561089c575080600601548160080154145b15610922577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8160090160006101000a81548160ff021916908360000b60ff1602179055506108ea836113de565b7f2ae00ba9813199478b6f22f0c9b606daa70f8efc319c8d2fa6af63f66ea3176383604051610919919061175b565b60405180910390a15b5b8060080154915050919050565b600060016003546109419190611899565b905090565b6000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661099e57600080fd5b600080600084815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460000b60000b14610a0a57600080fd5b600060026000848152602001908152602001600020905060008160090160009054906101000a900460000b60000b14610a4257600080fd5b600160008085815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908360000b60ff160217905550806007016000815480929190610ac39061197f565b919050555080600501548160070154600854610adf9190611899565b1415610b3e5760018160090160006101000a81548160ff021916908360000b60ff1602179055507f3ad93af63cb7967b23e4fb500b7d7d28b07516325dcf341f88bebf959d82c1cb83604051610b35919061175b565b60405180910390a15b8060070154915050919050565b60075481565b6000806002600084815260200190815260200160002090506000816000015411610bb0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ba79061171b565b60405180910390fd5b60018160090160009054906101000a900460000b60000b14610c07576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bfe9061173b565b60405180910390fd5b60028160090160006101000a81548160ff021916908360000b60ff1602179055506000808260030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168360010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168460020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168560040154604051602401610cc7939291906116ae565b6040516020818303038152906040527f23b872dd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610d51919061167c565b6000604051808303816000865af19150503d8060008114610d8e576040519150601f19603f3d011682016040523d82523d6000602084013e610d93565b606091505b5091509150610da583600001546113de565b8115610de7577fbcf6a68a2f901be4a23a41b53acd7697893a7e34def4e28acba584da75283b6785604051610dda919061175b565b60405180910390a1610e1f565b7fdab20a0fcd702cf875c2d715d5c3fc99af66a716c94b3405408c94b7311c99eb85604051610e16919061175b565b60405180910390a15b819350505050919050565b60096020528060005260406000206000915054906101000a900460ff1681565b60026020528060005260406000206000915090508060000154908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060040154908060050154908060060154908060070154908060080154908060090160009054906101000a900460000b90508a565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060026000600354815260200190815260200160002090506003548160000181905550848160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550338160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550838160030160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082816004018190555060065481600501819055506007548160060181905550600560008154809291906110519061197f565b9190505550600360008154809291906110699061197f565b91905055508060030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168160020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168260010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fb609ae609609ee99268d05bc1371102cafe8d6b964bf082439ab16be2a01c87c84600401548560000154604051611158929190611812565b60405180910390a480600001549150509392505050565b600080600060045490505b6003548110156111e25760006002600083815260200190815260200160002090506000816000015411156111ce57848314156111bf57806000015493505050506111e9565b82806111ca9061197f565b9350505b5080806111da9061197f565b91505061117a565b5060009150505b919050565b60006008548311156111ff57600080fd5b6000831161120c57600080fd5b60085482111561121b57600080fd5b82600681905550816007819055507f9f40cfd22fe91777c78f252bd21a710f3fb007dc2f321876891e7644ba0ae1756006546007546008546040516112629392919061183b565b60405180910390a16001905092915050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146112d057600080fd5b60001515600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151461132d57600080fd5b6001600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600860008154809291906113989061197f565b91905055507f47d1c22a25bb3a5d4e481b9b1e6944c2eade3181a0a20b495ed61d35b5323f24826040516113cc9190611693565b60405180910390a16008549050919050565b600560008154809291906113f190611955565b91905055506000600554111561143f5760045481141561143a576000611417600061116f565b9050600081141561143057600354600481905550611438565b806004819055505b505b611449565b6003546004819055505b50565b60008135905061145b816119f7565b92915050565b60008135905061147081611a0e565b92915050565b60006020828403121561148857600080fd5b60006114968482850161144c565b91505092915050565b6000806000606084860312156114b457600080fd5b60006114c28682870161144c565b93505060206114d38682870161144c565b92505060406114e486828701611461565b9150509250925092565b60006020828403121561150057600080fd5b600061150e84828501611461565b91505092915050565b6000806040838503121561152a57600080fd5b600061153885828601611461565b92505060206115498582860161144c565b9150509250929050565b6000806040838503121561156657600080fd5b600061157485828601611461565b925050602061158585828601611461565b9150509250929050565b611598816118cd565b82525050565b6115a7816118df565b82525050565b60006115b882611872565b6115c2818561187d565b93506115d2818560208601611922565b80840191505092915050565b6115e7816118eb565b82525050565b60006115fa601383611888565b91507f4552525f494e56414c49445f52455155455354000000000000000000000000006000830152602082019050919050565b600061163a601083611888565b91507f4552525f4e4f545f454e444f52534544000000000000000000000000000000006000830152602082019050919050565b61167681611918565b82525050565b600061168882846115ad565b915081905092915050565b60006020820190506116a8600083018461158f565b92915050565b60006060820190506116c3600083018661158f565b6116d0602083018561158f565b6116dd604083018461166d565b949350505050565b60006020820190506116fa600083018461159e565b92915050565b600060208201905061171560008301846115de565b92915050565b60006020820190508181036000830152611734816115ed565b9050919050565b600060208201905081810360008301526117548161162d565b9050919050565b6000602082019050611770600083018461166d565b92915050565b60006101408201905061178c600083018d61166d565b611799602083018c61158f565b6117a6604083018b61158f565b6117b3606083018a61158f565b6117c0608083018961166d565b6117cd60a083018861166d565b6117da60c083018761166d565b6117e760e083018661166d565b6117f561010083018561166d565b6118036101208301846115de565b9b9a5050505050505050505050565b6000604082019050611827600083018561166d565b611834602083018461166d565b9392505050565b6000606082019050611850600083018661166d565b61185d602083018561166d565b61186a604083018461166d565b949350505050565b600081519050919050565b600081905092915050565b600082825260208201905092915050565b60006118a482611918565b91506118af83611918565b9250828210156118c2576118c16119c8565b5b828203905092915050565b60006118d8826118f8565b9050919050565b60008115159050919050565b60008160000b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60005b83811015611940578082015181840152602081019050611925565b8381111561194f576000848401525b50505050565b600061196082611918565b91506000821415611974576119736119c8565b5b600182039050919050565b600061198a82611918565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156119bd576119bc6119c8565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b611a00816118cd565b8114611a0b57600080fd5b50565b611a1781611918565b8114611a2257600080fd5b5056fea2646970667358221220c17d0764fe33a9b1217529656b2598c39654db4c96db0c61f11c4057f0d608df64736f6c63430008000033 +\ No newline at end of file diff --git a/python/erc20_approval_escrow/data/TransferApproval.json b/python/erc20_approval_escrow/data/TransferApproval.json @@ -1 +1 @@ -[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"Approved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"Executed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_sender","type":"address"},{"indexed":true,"internalType":"address","name":"_recipient","type":"address"},{"indexed":true,"internalType":"address","name":"_token","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"NewRequest","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_quorum","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_vetoThreshold","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_signerCount","type":"uint256"}],"name":"QuorumSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"Rejected","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_signer","type":"address"}],"name":"SignerAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_signer","type":"address"}],"name":"SignerRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"TransferFail","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"Vetoed","type":"event"},{"inputs":[{"internalType":"address","name":"_signer","type":"address"}],"name":"addSigner","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"count","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"createRequest","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"executeRequest","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_idx","type":"uint256"}],"name":"getSerialAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastSerial","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"nay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"nextSerial","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"quorum","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_signer","type":"address"}],"name":"removeSigner","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"requests","outputs":[{"internalType":"uint256","name":"serial","type":"uint256"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"quorum","type":"uint256"},{"internalType":"uint256","name":"vetoThreshold","type":"uint256"},{"internalType":"uint256","name":"yay","type":"uint256"},{"internalType":"uint256","name":"nay","type":"uint256"},{"internalType":"int8","name":"result","type":"int8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_quorum","type":"uint256"},{"internalType":"uint256","name":"_vetoThreshold","type":"uint256"}],"name":"setThresholds","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"signers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vetoThreshold","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"yay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}] +[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"Approved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"Executed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_sender","type":"address"},{"indexed":true,"internalType":"address","name":"_recipient","type":"address"},{"indexed":true,"internalType":"address","name":"_token","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"NewRequest","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_quorum","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_vetoThreshold","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_signerCount","type":"uint256"}],"name":"QuorumSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"Rejected","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_signer","type":"address"}],"name":"SignerAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_signer","type":"address"}],"name":"SignerRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"TransferFail","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"Vetoed","type":"event"},{"inputs":[{"internalType":"address","name":"_signer","type":"address"}],"name":"addSigner","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"count","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"createRequest","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"executeRequest","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_idx","type":"uint256"}],"name":"getSerialAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastSerial","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"nay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"nextSerial","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"quorum","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_signer","type":"address"}],"name":"removeSigner","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"requests","outputs":[{"internalType":"uint256","name":"serial","type":"uint256"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"quorum","type":"uint256"},{"internalType":"uint256","name":"vetoThreshold","type":"uint256"},{"internalType":"uint256","name":"yay","type":"uint256"},{"internalType":"uint256","name":"nay","type":"uint256"},{"internalType":"int8","name":"result","type":"int8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_quorum","type":"uint256"},{"internalType":"uint256","name":"_vetoThreshold","type":"uint256"}],"name":"setThresholds","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"signers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vetoThreshold","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"vote","outputs":[{"internalType":"int8","name":"","type":"int8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"yay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}] diff --git a/python/tests/test_quorum.py b/python/tests/test_quorum.py @@ -10,7 +10,6 @@ logg = logging.getLogger() class ERC20TransferAuthorizationQuorumTest(TestBase): - def test_vote_access(self): w = self.w3.eth.contract(abi=self.abi_wallet, address=self.address_wallet) t = self.w3.eth.contract(abi=self.abi_token, address=self.address_token) @@ -29,7 +28,6 @@ class ERC20TransferAuthorizationQuorumTest(TestBase): topic = log.topics[0] self.assertEqual(topic.hex()[2:], topic_match) serial = int(log.data[66:], 16) - logg.debug('mined with serial {}'.format(serial)) # only signers may vote with self.assertRaises(Exception): @@ -51,8 +49,16 @@ class ERC20TransferAuthorizationQuorumTest(TestBase): tx_hashh = w.functions.nay(serial).transact({'from': self.w3.eth.accounts[5]}) + # may not vote twice + with self.assertRaises(Exception): + tx_hashh = w.functions.nay(serial).transact({'from': self.w3.eth.accounts[5]}) + + # may not change vote + with self.assertRaises(Exception): + tx_hashh = w.functions.yay(serial).transact({'from': self.w3.eth.accounts[5]}) + + - @unittest.skip('wip') def test_minimal_quorum(self): w = self.w3.eth.contract(abi=self.abi_wallet, address=self.address_wallet) t = self.w3.eth.contract(abi=self.abi_token, address=self.address_token) @@ -68,7 +74,6 @@ class ERC20TransferAuthorizationQuorumTest(TestBase): topic = log.topics[0] self.assertEqual(topic.hex()[2:], topic_match) serial = int(log.data[66:], 16) - logg.debug('mined with serial {}'.format(serial)) with self.assertRaises(Exception): w.functions.executeRequest(serial).transact({'from': self.w3.eth.accounts[0]}) @@ -80,17 +85,23 @@ class ERC20TransferAuthorizationQuorumTest(TestBase): tx_hashh = w.functions.yay(serial).transact({'from': self.w3.eth.accounts[0]}) r = self.w3.eth.getTransactionReceipt(tx_hashh) + topic_match = '3ad93af63cb7967b23e4fb500b7d7d28b07516325dcf341f88bebf959d82c1cb' + log = r.logs[0] + topic = log.topics[0] + self.assertEqual(topic.hex()[2:], topic_match) + + tx_hashh = w.functions.executeRequest(serial).transact({'from': self.w3.eth.accounts[0]}) + r = self.w3.eth.getTransactionReceipt(tx_hashh) + topic_match = 'bcf6a68a2f901be4a23a41b53acd7697893a7e34def4e28acba584da75283b67' # Executed(serial) - log = r.logs[2] + log = r.logs[1] topic = log.topics[0].hex()[2:] - logg.debug('topic {}'.format(topic)) self.assertEqual(topic, topic_match) self.assertEqual(t.functions.balanceOf(self.w3.eth.accounts[2]).call(), 90) self.assertEqual(t.functions.balanceOf(self.w3.eth.accounts[3]).call(), 10) - @unittest.skip('wip') def test_simple_quorum(self): w = self.w3.eth.contract(abi=self.abi_wallet, address=self.address_wallet) t = self.w3.eth.contract(abi=self.abi_token, address=self.address_token) @@ -110,7 +121,6 @@ class ERC20TransferAuthorizationQuorumTest(TestBase): topic = log.topics[0] self.assertEqual(topic.hex()[2:], topic_match) serial = int(log.data[66:], 16) - logg.debug('mined with serial {}'.format(serial)) tx_hashh = w.functions.yay(serial).transact({'from': self.w3.eth.accounts[0]}) r = self.w3.eth.getTransactionReceipt(tx_hashh) @@ -120,20 +130,50 @@ class ERC20TransferAuthorizationQuorumTest(TestBase): with self.assertRaises(Exception): w.functions.executeRequest(serial).transact({'from': self.w3.eth.accounts[0]}) - # verify we cannot vote twice - with self.assertRaises(Exception): - w.functions.yay(serial).transact({'from': self.w3.eth.accounts[0]}) - # dough is still there self.assertEqual(t.functions.balanceOf(self.w3.eth.accounts[2]).call(), 100) w.functions.yay(serial).transact({'from': self.w3.eth.accounts[5]}) + + w.functions.executeRequest(serial).transact({'from': self.w3.eth.accounts[0]}) self.assertEqual(t.functions.balanceOf(self.w3.eth.accounts[2]).call(), 90) self.assertEqual(t.functions.balanceOf(self.w3.eth.accounts[3]).call(), 10) + # additional votes not possible + with self.assertRaises(Exception): + w.functions.yay(serial).transact({'from': self.w3.eth.accounts[6]}) + + with self.assertRaises(Exception): + w.functions.nay(serial).transact({'from': self.w3.eth.accounts[6]}) + + + def test_minimal_rejection(self): + w = self.w3.eth.contract(abi=self.abi_wallet, address=self.address_wallet) + t = self.w3.eth.contract(abi=self.abi_token, address=self.address_token) + + tx_hash = w.functions.createRequest(self.w3.eth.accounts[3], t.address, 10).transact({'from': self.w3.eth.accounts[2]}) + r = self.w3.eth.getTransactionReceipt(tx_hash) + + topic_match = 'b609ae609609ee99268d05bc1371102cafe8d6b964bf082439ab16be2a01c87c' + log = r.logs[0] + topic = log.topics[0] + self.assertEqual(topic.hex()[2:], topic_match) + serial = int(log.data[66:], 16) + + tx_hashh = w.functions.nay(serial).transact({'from': self.w3.eth.accounts[0]}) + r = self.w3.eth.getTransactionReceipt(tx_hashh) + + topic_match = '94064f919a02d0565c6790e0615fb4ba6cf1be1dd679f0161be914613a1b9bb5' + log = r.logs[0] + topic = log.topics[0] + self.assertEqual(topic.hex()[2:], topic_match) + + # cannot execute + with self.assertRaises(Exception): + w.functions.executeRequest(serial).transact({'from': self.w3.eth.accounts[0]}) + - @unittest.skip('wip') def test_simple_rejection(self): w = self.w3.eth.contract(abi=self.abi_wallet, address=self.address_wallet) t = self.w3.eth.contract(abi=self.abi_token, address=self.address_token) @@ -153,17 +193,71 @@ class ERC20TransferAuthorizationQuorumTest(TestBase): topic = log.topics[0] self.assertEqual(topic.hex()[2:], topic_match) serial = int(log.data[66:], 16) - logg.debug('mined with serial {}'.format(serial)) tx_hashh = w.functions.nay(serial).transact({'from': self.w3.eth.accounts[0]}) r = self.w3.eth.getTransactionReceipt(tx_hashh) self.assertEqual(len(r.logs), 0) - # verify we cannot vote nay twice + tx_hashh = w.functions.nay(serial).transact({'from': self.w3.eth.accounts[5]}) + r = self.w3.eth.getTransactionReceipt(tx_hashh) + + topic_match = '94064f919a02d0565c6790e0615fb4ba6cf1be1dd679f0161be914613a1b9bb5' + log = r.logs[0] + topic = log.topics[0] + self.assertEqual(topic.hex()[2:], topic_match) + + # cannot execute with self.assertRaises(Exception): - w.functions.nay(serial).transact({'from': self.w3.eth.accounts[0]}) - + w.functions.executeRequest(serial).transact({'from': self.w3.eth.accounts[0]}) + + # additional votes not possible + with self.assertRaises(Exception): + w.functions.yay(serial).transact({'from': self.w3.eth.accounts[6]}) + + with self.assertRaises(Exception): + w.functions.nay(serial).transact({'from': self.w3.eth.accounts[6]}) + + + def test_veto(self): + w = self.w3.eth.contract(abi=self.abi_wallet, address=self.address_wallet) + t = self.w3.eth.contract(abi=self.abi_token, address=self.address_token) + + t.functions.approve(w.address, 10).transact({'from': self.w3.eth.accounts[2]}) + self.eth_tester.mine_block() + + w.functions.addSigner(self.w3.eth.accounts[5]).transact({'from': self.w3.eth.accounts[0]}) + w.functions.addSigner(self.w3.eth.accounts[6]).transact({'from': self.w3.eth.accounts[0]}) + w.functions.setThresholds(2, 1).transact({'from': self.w3.eth.accounts[0]}) + + tx_hash = w.functions.createRequest(self.w3.eth.accounts[3], t.address, 10).transact({'from': self.w3.eth.accounts[2]}) + r = self.w3.eth.getTransactionReceipt(tx_hash) + + topic_match = 'b609ae609609ee99268d05bc1371102cafe8d6b964bf082439ab16be2a01c87c' + log = r.logs[0] + topic = log.topics[0] + self.assertEqual(topic.hex()[2:], topic_match) + serial = int(log.data[66:], 16) + + w.functions.yay(serial).transact({'from': self.w3.eth.accounts[0]}) tx_hashh = w.functions.nay(serial).transact({'from': self.w3.eth.accounts[5]}) + r = self.w3.eth.getTransactionReceipt(tx_hashh) + + topic_match = '2ae00ba9813199478b6f22f0c9b606daa70f8efc319c8d2fa6af63f66ea31763' + log = r.logs[0] + topic = log.topics[0] + self.assertEqual(topic.hex()[2:], topic_match) + + # cannot execute + with self.assertRaises(Exception): + w.functions.executeRequest(serial).transact({'from': self.w3.eth.accounts[0]}) + + # additional votes not possible + with self.assertRaises(Exception): + w.functions.yay(serial).transact({'from': self.w3.eth.accounts[6]}) + + with self.assertRaises(Exception): + w.functions.nay(serial).transact({'from': self.w3.eth.accounts[6]}) + if __name__ == '__main__': unittest.main() diff --git a/solidity/TransferApproval.bin b/solidity/TransferApproval.bin @@ -1 +1 @@ -60806040523480156200001157600080fd5b5033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060016003819055506001600481905550600160068190555060016008819055506200008760016000620000a060201b60201c565b5062000099336200012b60201b60201c565b50620003d2565b6000600854831115620000b257600080fd5b60008311620000c057600080fd5b600854821115620000d057600080fd5b82600681905550816007819055507f9f40cfd22fe91777c78f252bd21a710f3fb007dc2f321876891e7644ba0ae1756006546007546008546040516200011993929190620002da565b60405180910390a16001905092915050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146200018857600080fd5b60001515600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514620001e657600080fd5b6001600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060086000815480929190620002539062000355565b91905055507f47d1c22a25bb3a5d4e481b9b1e6944c2eade3181a0a20b495ed61d35b5323f2482604051620002899190620002bd565b60405180910390a16008549050919050565b620002a68162000317565b82525050565b620002b7816200034b565b82525050565b6000602082019050620002d460008301846200029b565b92915050565b6000606082019050620002f16000830186620002ac565b620003006020830185620002ac565b6200030f6040830184620002ac565b949350505050565b600062000324826200032b565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600062000362826200034b565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415620003985762000397620003a3565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b611af480620003e26000396000f3fe608060405234801561001057600080fd5b50600436106101005760003560e01c80636e417c6911610097578063b0addede11610066578063b0addede146102e2578063bac911ac14610312578063e3064a7714610342578063eb12d61e1461037257610100565b80636e417c691461022b578063736c0d5b1461025b57806381d12c581461028b5780638da5cb5b146102c457610100565b80634797569a116100d35780634797569a1461018f57806357ec347a146101bf57806358d71f82146101dd578063614f427f1461020d57610100565b806306661abd1461010557806308ae6377146101235780630e316ab7146101415780631703a01814610171575b600080fd5b61010d6103a2565b60405161011a91906117f4565b60405180910390f35b61012b6103a8565b60405161013891906117f4565b60405180910390f35b61015b60048036038101906101569190611566565b6103d3565b60405161016891906117f4565b60405180910390f35b6101796105ce565b60405161018691906117f4565b60405180910390f35b6101a960048036038101906101a491906115de565b6105d4565b6040516101b691906117f4565b60405180910390f35b6101c7610850565b6040516101d491906117f4565b60405180910390f35b6101f760048036038101906101f291906115de565b610866565b60405161020491906117f4565b60405180910390f35b610215610a1e565b60405161022291906117f4565b60405180910390f35b610245600480360381019061024091906115de565b610a24565b6040516102529190611799565b60405180910390f35b61027560048036038101906102709190611566565b610cfd565b6040516102829190611799565b60405180910390f35b6102a560048036038101906102a091906115de565b610d1d565b6040516102bb9a9998979695949392919061180f565b60405180910390f35b6102cc610dde565b6040516102d99190611747565b60405180910390f35b6102fc60048036038101906102f7919061158f565b610e04565b60405161030991906117f4565b60405180910390f35b61032c600480360381019061032791906115de565b6110f9565b60405161033991906117f4565b60405180910390f35b61035c60048036038101906103579190611607565b611178565b6040516103699190611799565b60405180910390f35b61038c60048036038101906103879190611566565b6111fe565b60405161039991906117f4565b60405180910390f35b60055481565b6000806004546003546103bb9190611932565b14156103ca57600090506103d0565b60045490505b90565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561043057600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806104b757508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6104c057600080fd5b60011515600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151461051d57600080fd5b6000600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060086000815480929190610588906119ee565b91905055507f3525e22824a8a7df2c9a6029941c824cf95b6447f1e13d5128fd3826d35afe8b826040516105bc9190611747565b60405180910390a16008549050919050565b60065481565b60008060026000848152602001908152602001600020905060008160090160009054906101000a900460000b60000b1461060d57600080fd5b600080600085815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460000b60000b1461067957600080fd5b600160008085815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908360000b60ff1602179055508060080160008154809291906106fa90611a18565b9190505550806005015481600801546008546107169190611932565b14156107a1577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8160090160006101000a81548160ff021916908360000b60ff16021790555061076583611368565b7f94064f919a02d0565c6790e0615fb4ba6cf1be1dd679f0161be914613a1b9bb58360405161079491906117f4565b60405180910390a1610843565b600081600601541180156107bc575080600601548160080154145b15610842577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8160090160006101000a81548160ff021916908360000b60ff16021790555061080a83611368565b7f2ae00ba9813199478b6f22f0c9b606daa70f8efc319c8d2fa6af63f66ea317638360405161083991906117f4565b60405180910390a15b5b8060080154915050919050565b600060016003546108619190611932565b905090565b60008060026000848152602001908152602001600020905060008160090160009054906101000a900460000b60000b1461089f57600080fd5b600080600085815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460000b60000b1461090b57600080fd5b600160008085815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908360000b60ff16021790555080600701600081548092919061098c90611a18565b9190505550806005015481600701546008546109a89190611932565b1415610a115760018160090160006101000a81548160ff021916908360000b60ff1602179055507f3ad93af63cb7967b23e4fb500b7d7d28b07516325dcf341f88bebf959d82c1cb836040516109fe91906117f4565b60405180910390a1610a0f83610a24565b505b8060070154915050919050565b60075481565b6000806002600084815260200190815260200160002090506000816000015411610a83576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a7a906117b4565b60405180910390fd5b60018160090160009054906101000a900460000b60000b14610ada576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ad1906117d4565b60405180910390fd5b60028160090160006101000a81548160ff021916908360000b60ff1602179055506000808260030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168360010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168460020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168560040154604051602401610b9a93929190611762565b6040516020818303038152906040527f23b872dd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610c249190611730565b6000604051808303816000865af19150503d8060008114610c61576040519150601f19603f3d011682016040523d82523d6000602084013e610c66565b606091505b5091509150610c788360000154611368565b8115610cba577fbcf6a68a2f901be4a23a41b53acd7697893a7e34def4e28acba584da75283b6785604051610cad91906117f4565b60405180910390a1610cf2565b7fdab20a0fcd702cf875c2d715d5c3fc99af66a716c94b3405408c94b7311c99eb85604051610ce991906117f4565b60405180910390a15b819350505050919050565b60096020528060005260406000206000915054906101000a900460ff1681565b60026020528060005260406000206000915090508060000154908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060040154908060050154908060060154908060070154908060080154908060090160009054906101000a900460000b90508a565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000610e0e6114a5565b60035481600001818152505084816040019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505033816020019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505083816060019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050828160800181815250506006548160a0018181525050806002600060035481526020019081526020016000206000820151816000015560208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060608201518160030160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506080820151816004015560a0820151816005015560c0820151816006015560e0820151816007015561010082015181600801556101208201518160090160006101000a81548160ff021916908360000b60ff1602179055509050506005600081548092919061103b90611a18565b91905055506003600081548092919061105390611a18565b9190505550806060015173ffffffffffffffffffffffffffffffffffffffff16816040015173ffffffffffffffffffffffffffffffffffffffff16826020015173ffffffffffffffffffffffffffffffffffffffff167fb609ae609609ee99268d05bc1371102cafe8d6b964bf082439ab16be2a01c87c846080015185600001516040516110e29291906118ab565b60405180910390a480600001519150509392505050565b600080600060045490505b60035481101561116c57600060026000838152602001908152602001600020905060008160000154111561115857848314156111495780600001549350505050611173565b828061115490611a18565b9350505b50808061116490611a18565b915050611104565b5060009150505b919050565b600060085483111561118957600080fd5b6000831161119657600080fd5b6008548211156111a557600080fd5b82600681905550816007819055507f9f40cfd22fe91777c78f252bd21a710f3fb007dc2f321876891e7644ba0ae1756006546007546008546040516111ec939291906118d4565b60405180910390a16001905092915050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461125a57600080fd5b60001515600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515146112b757600080fd5b6001600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506008600081548092919061132290611a18565b91905055507f47d1c22a25bb3a5d4e481b9b1e6944c2eade3181a0a20b495ed61d35b5323f24826040516113569190611747565b60405180910390a16008549050919050565b600260008281526020019081526020016000206000808201600090556001820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556002820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556003820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055600482016000905560058201600090556006820160009055600782016000905560088201600090556009820160006101000a81549060ff021916905550506005600081548092919061144a906119ee565b9190505550600060055411156114985760045481141561149357600061147060006110f9565b9050600081141561148957600354600481905550611491565b806004819055505b505b6114a2565b6003546004819055505b50565b60405180610140016040528060008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081526020016000815260200160008152602001600081526020016000800b81525090565b60008135905061154b81611a90565b92915050565b60008135905061156081611aa7565b92915050565b60006020828403121561157857600080fd5b60006115868482850161153c565b91505092915050565b6000806000606084860312156115a457600080fd5b60006115b28682870161153c565b93505060206115c38682870161153c565b92505060406115d486828701611551565b9150509250925092565b6000602082840312156115f057600080fd5b60006115fe84828501611551565b91505092915050565b6000806040838503121561161a57600080fd5b600061162885828601611551565b925050602061163985828601611551565b9150509250929050565b61164c81611966565b82525050565b61165b81611978565b82525050565b600061166c8261190b565b6116768185611916565b93506116868185602086016119bb565b80840191505092915050565b61169b81611984565b82525050565b60006116ae601383611921565b91507f4552525f494e56414c49445f52455155455354000000000000000000000000006000830152602082019050919050565b60006116ee601083611921565b91507f4552525f4e4f545f454e444f52534544000000000000000000000000000000006000830152602082019050919050565b61172a816119b1565b82525050565b600061173c8284611661565b915081905092915050565b600060208201905061175c6000830184611643565b92915050565b60006060820190506117776000830186611643565b6117846020830185611643565b6117916040830184611721565b949350505050565b60006020820190506117ae6000830184611652565b92915050565b600060208201905081810360008301526117cd816116a1565b9050919050565b600060208201905081810360008301526117ed816116e1565b9050919050565b60006020820190506118096000830184611721565b92915050565b600061014082019050611825600083018d611721565b611832602083018c611643565b61183f604083018b611643565b61184c606083018a611643565b6118596080830189611721565b61186660a0830188611721565b61187360c0830187611721565b61188060e0830186611721565b61188e610100830185611721565b61189c610120830184611692565b9b9a5050505050505050505050565b60006040820190506118c06000830185611721565b6118cd6020830184611721565b9392505050565b60006060820190506118e96000830186611721565b6118f66020830185611721565b6119036040830184611721565b949350505050565b600081519050919050565b600081905092915050565b600082825260208201905092915050565b600061193d826119b1565b9150611948836119b1565b92508282101561195b5761195a611a61565b5b828203905092915050565b600061197182611991565b9050919050565b60008115159050919050565b60008160000b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60005b838110156119d95780820151818401526020810190506119be565b838111156119e8576000848401525b50505050565b60006119f9826119b1565b91506000821415611a0d57611a0c611a61565b5b600182039050919050565b6000611a23826119b1565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415611a5657611a55611a61565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b611a9981611966565b8114611aa457600080fd5b50565b611ab0816119b1565b8114611abb57600080fd5b5056fea2646970667358221220989e15437637b2784d71c40db502cba46cee9c1b27adaec2d1865049b91b754764736f6c63430008000033 -\ No newline at end of file +60806040523480156200001157600080fd5b5033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060016003819055506001600481905550600160068190555060016008819055506200008760016000620000a060201b60201c565b5062000099336200012b60201b60201c565b50620003d2565b6000600854831115620000b257600080fd5b60008311620000c057600080fd5b600854821115620000d057600080fd5b82600681905550816007819055507f9f40cfd22fe91777c78f252bd21a710f3fb007dc2f321876891e7644ba0ae1756006546007546008546040516200011993929190620002da565b60405180910390a16001905092915050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146200018857600080fd5b60001515600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514620001e657600080fd5b6001600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060086000815480929190620002539062000355565b91905055507f47d1c22a25bb3a5d4e481b9b1e6944c2eade3181a0a20b495ed61d35b5323f2482604051620002899190620002bd565b60405180910390a16008549050919050565b620002a68162000317565b82525050565b620002b7816200034b565b82525050565b6000602082019050620002d460008301846200029b565b92915050565b6000606082019050620002f16000830186620002ac565b620003006020830185620002ac565b6200030f6040830184620002ac565b949350505050565b600062000324826200032b565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600062000362826200034b565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415620003985762000397620003a3565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b611a5b80620003e26000396000f3fe608060405234801561001057600080fd5b506004361061010b5760003560e01c8063614f427f116100a25780638da5cb5b116100715780638da5cb5b146102ff578063b0addede1461031d578063bac911ac1461034d578063e3064a771461037d578063eb12d61e146103ad5761010b565b8063614f427f146102485780636e417c6914610266578063736c0d5b1461029657806381d12c58146102c65761010b565b80631703a018116100de5780631703a018146101ac5780634797569a146101ca57806357ec347a146101fa57806358d71f82146102185761010b565b806302d947ef1461011057806306661abd1461014057806308ae63771461015e5780630e316ab71461017c575b600080fd5b61012a60048036038101906101259190611517565b6103dd565b6040516101379190611700565b60405180910390f35b61014861040c565b604051610155919061175b565b60405180910390f35b610166610412565b604051610173919061175b565b60405180910390f35b61019660048036038101906101919190611476565b61043d565b6040516101a3919061175b565b60405180910390f35b6101b4610638565b6040516101c1919061175b565b60405180910390f35b6101e460048036038101906101df91906114ee565b61063e565b6040516101f1919061175b565b60405180910390f35b610202610930565b60405161020f919061175b565b60405180910390f35b610232600480360381019061022d91906114ee565b610946565b60405161023f919061175b565b60405180910390f35b610250610b4b565b60405161025d919061175b565b60405180910390f35b610280600480360381019061027b91906114ee565b610b51565b60405161028d91906116e5565b60405180910390f35b6102b060048036038101906102ab9190611476565b610e2a565b6040516102bd91906116e5565b60405180910390f35b6102e060048036038101906102db91906114ee565b610e4a565b6040516102f69a99989796959493929190611776565b60405180910390f35b610307610f0b565b6040516103149190611693565b60405180910390f35b6103376004803603810190610332919061149f565b610f31565b604051610344919061175b565b60405180910390f35b610367600480360381019061036291906114ee565b61116f565b604051610374919061175b565b60405180910390f35b61039760048036038101906103929190611553565b6111ee565b6040516103a491906116e5565b60405180910390f35b6103c760048036038101906103c29190611476565b611274565b6040516103d4919061175b565b60405180910390f35b60006020528160005260406000206020528060005260406000206000915091509054906101000a900460000b81565b60055481565b6000806004546003546104259190611899565b1415610434576000905061043a565b60045490505b90565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561049a57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061052157508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b61052a57600080fd5b60011515600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151461058757600080fd5b6000600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600860008154809291906105f290611955565b91905055507f3525e22824a8a7df2c9a6029941c824cf95b6447f1e13d5128fd3826d35afe8b826040516106269190611693565b60405180910390a16008549050919050565b60065481565b6000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661069657600080fd5b600080600084815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460000b60000b1461070257600080fd5b600060026000848152602001908152602001600020905060008160090160009054906101000a900460000b60000b1461073a57600080fd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60008085815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908360000b60ff1602179055508060080160008154809291906107da9061197f565b9190505550806005015481600801546008546107f69190611899565b1415610881577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8160090160006101000a81548160ff021916908360000b60ff160217905550610845836113de565b7f94064f919a02d0565c6790e0615fb4ba6cf1be1dd679f0161be914613a1b9bb583604051610874919061175b565b60405180910390a1610923565b6000816006015411801561089c575080600601548160080154145b15610922577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8160090160006101000a81548160ff021916908360000b60ff1602179055506108ea836113de565b7f2ae00ba9813199478b6f22f0c9b606daa70f8efc319c8d2fa6af63f66ea3176383604051610919919061175b565b60405180910390a15b5b8060080154915050919050565b600060016003546109419190611899565b905090565b6000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661099e57600080fd5b600080600084815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460000b60000b14610a0a57600080fd5b600060026000848152602001908152602001600020905060008160090160009054906101000a900460000b60000b14610a4257600080fd5b600160008085815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908360000b60ff160217905550806007016000815480929190610ac39061197f565b919050555080600501548160070154600854610adf9190611899565b1415610b3e5760018160090160006101000a81548160ff021916908360000b60ff1602179055507f3ad93af63cb7967b23e4fb500b7d7d28b07516325dcf341f88bebf959d82c1cb83604051610b35919061175b565b60405180910390a15b8060070154915050919050565b60075481565b6000806002600084815260200190815260200160002090506000816000015411610bb0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ba79061171b565b60405180910390fd5b60018160090160009054906101000a900460000b60000b14610c07576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bfe9061173b565b60405180910390fd5b60028160090160006101000a81548160ff021916908360000b60ff1602179055506000808260030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168360010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168460020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168560040154604051602401610cc7939291906116ae565b6040516020818303038152906040527f23b872dd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610d51919061167c565b6000604051808303816000865af19150503d8060008114610d8e576040519150601f19603f3d011682016040523d82523d6000602084013e610d93565b606091505b5091509150610da583600001546113de565b8115610de7577fbcf6a68a2f901be4a23a41b53acd7697893a7e34def4e28acba584da75283b6785604051610dda919061175b565b60405180910390a1610e1f565b7fdab20a0fcd702cf875c2d715d5c3fc99af66a716c94b3405408c94b7311c99eb85604051610e16919061175b565b60405180910390a15b819350505050919050565b60096020528060005260406000206000915054906101000a900460ff1681565b60026020528060005260406000206000915090508060000154908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060040154908060050154908060060154908060070154908060080154908060090160009054906101000a900460000b90508a565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060026000600354815260200190815260200160002090506003548160000181905550848160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550338160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550838160030160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082816004018190555060065481600501819055506007548160060181905550600560008154809291906110519061197f565b9190505550600360008154809291906110699061197f565b91905055508060030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168160020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168260010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fb609ae609609ee99268d05bc1371102cafe8d6b964bf082439ab16be2a01c87c84600401548560000154604051611158929190611812565b60405180910390a480600001549150509392505050565b600080600060045490505b6003548110156111e25760006002600083815260200190815260200160002090506000816000015411156111ce57848314156111bf57806000015493505050506111e9565b82806111ca9061197f565b9350505b5080806111da9061197f565b91505061117a565b5060009150505b919050565b60006008548311156111ff57600080fd5b6000831161120c57600080fd5b60085482111561121b57600080fd5b82600681905550816007819055507f9f40cfd22fe91777c78f252bd21a710f3fb007dc2f321876891e7644ba0ae1756006546007546008546040516112629392919061183b565b60405180910390a16001905092915050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146112d057600080fd5b60001515600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151461132d57600080fd5b6001600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600860008154809291906113989061197f565b91905055507f47d1c22a25bb3a5d4e481b9b1e6944c2eade3181a0a20b495ed61d35b5323f24826040516113cc9190611693565b60405180910390a16008549050919050565b600560008154809291906113f190611955565b91905055506000600554111561143f5760045481141561143a576000611417600061116f565b9050600081141561143057600354600481905550611438565b806004819055505b505b611449565b6003546004819055505b50565b60008135905061145b816119f7565b92915050565b60008135905061147081611a0e565b92915050565b60006020828403121561148857600080fd5b60006114968482850161144c565b91505092915050565b6000806000606084860312156114b457600080fd5b60006114c28682870161144c565b93505060206114d38682870161144c565b92505060406114e486828701611461565b9150509250925092565b60006020828403121561150057600080fd5b600061150e84828501611461565b91505092915050565b6000806040838503121561152a57600080fd5b600061153885828601611461565b92505060206115498582860161144c565b9150509250929050565b6000806040838503121561156657600080fd5b600061157485828601611461565b925050602061158585828601611461565b9150509250929050565b611598816118cd565b82525050565b6115a7816118df565b82525050565b60006115b882611872565b6115c2818561187d565b93506115d2818560208601611922565b80840191505092915050565b6115e7816118eb565b82525050565b60006115fa601383611888565b91507f4552525f494e56414c49445f52455155455354000000000000000000000000006000830152602082019050919050565b600061163a601083611888565b91507f4552525f4e4f545f454e444f52534544000000000000000000000000000000006000830152602082019050919050565b61167681611918565b82525050565b600061168882846115ad565b915081905092915050565b60006020820190506116a8600083018461158f565b92915050565b60006060820190506116c3600083018661158f565b6116d0602083018561158f565b6116dd604083018461166d565b949350505050565b60006020820190506116fa600083018461159e565b92915050565b600060208201905061171560008301846115de565b92915050565b60006020820190508181036000830152611734816115ed565b9050919050565b600060208201905081810360008301526117548161162d565b9050919050565b6000602082019050611770600083018461166d565b92915050565b60006101408201905061178c600083018d61166d565b611799602083018c61158f565b6117a6604083018b61158f565b6117b3606083018a61158f565b6117c0608083018961166d565b6117cd60a083018861166d565b6117da60c083018761166d565b6117e760e083018661166d565b6117f561010083018561166d565b6118036101208301846115de565b9b9a5050505050505050505050565b6000604082019050611827600083018561166d565b611834602083018461166d565b9392505050565b6000606082019050611850600083018661166d565b61185d602083018561166d565b61186a604083018461166d565b949350505050565b600081519050919050565b600081905092915050565b600082825260208201905092915050565b60006118a482611918565b91506118af83611918565b9250828210156118c2576118c16119c8565b5b828203905092915050565b60006118d8826118f8565b9050919050565b60008115159050919050565b60008160000b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60005b83811015611940578082015181840152602081019050611925565b8381111561194f576000848401525b50505050565b600061196082611918565b91506000821415611974576119736119c8565b5b600182039050919050565b600061198a82611918565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156119bd576119bc6119c8565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b611a00816118cd565b8114611a0b57600080fd5b50565b611a1781611918565b8114611a2257600080fd5b5056fea2646970667358221220c17d0764fe33a9b1217529656b2598c39654db4c96db0c61f11c4057f0d608df64736f6c63430008000033 +\ No newline at end of file diff --git a/solidity/TransferApproval.json b/solidity/TransferApproval.json @@ -1 +1 @@ -[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"Approved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"Executed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_sender","type":"address"},{"indexed":true,"internalType":"address","name":"_recipient","type":"address"},{"indexed":true,"internalType":"address","name":"_token","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"NewRequest","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_quorum","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_vetoThreshold","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_signerCount","type":"uint256"}],"name":"QuorumSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"Rejected","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_signer","type":"address"}],"name":"SignerAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_signer","type":"address"}],"name":"SignerRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"TransferFail","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"Vetoed","type":"event"},{"inputs":[{"internalType":"address","name":"_signer","type":"address"}],"name":"addSigner","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"count","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"createRequest","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"executeRequest","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_idx","type":"uint256"}],"name":"getSerialAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastSerial","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"nay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"nextSerial","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"quorum","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_signer","type":"address"}],"name":"removeSigner","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"requests","outputs":[{"internalType":"uint256","name":"serial","type":"uint256"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"quorum","type":"uint256"},{"internalType":"uint256","name":"vetoThreshold","type":"uint256"},{"internalType":"uint256","name":"yay","type":"uint256"},{"internalType":"uint256","name":"nay","type":"uint256"},{"internalType":"int8","name":"result","type":"int8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_quorum","type":"uint256"},{"internalType":"uint256","name":"_vetoThreshold","type":"uint256"}],"name":"setThresholds","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"signers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vetoThreshold","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"yay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}] +[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"Approved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"Executed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_sender","type":"address"},{"indexed":true,"internalType":"address","name":"_recipient","type":"address"},{"indexed":true,"internalType":"address","name":"_token","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"NewRequest","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_quorum","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_vetoThreshold","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_signerCount","type":"uint256"}],"name":"QuorumSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"Rejected","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_signer","type":"address"}],"name":"SignerAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_signer","type":"address"}],"name":"SignerRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"TransferFail","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"Vetoed","type":"event"},{"inputs":[{"internalType":"address","name":"_signer","type":"address"}],"name":"addSigner","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"count","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"createRequest","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"executeRequest","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_idx","type":"uint256"}],"name":"getSerialAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastSerial","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"nay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"nextSerial","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"quorum","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_signer","type":"address"}],"name":"removeSigner","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"requests","outputs":[{"internalType":"uint256","name":"serial","type":"uint256"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"quorum","type":"uint256"},{"internalType":"uint256","name":"vetoThreshold","type":"uint256"},{"internalType":"uint256","name":"yay","type":"uint256"},{"internalType":"uint256","name":"nay","type":"uint256"},{"internalType":"int8","name":"result","type":"int8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_quorum","type":"uint256"},{"internalType":"uint256","name":"_vetoThreshold","type":"uint256"}],"name":"setThresholds","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"signers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vetoThreshold","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"vote","outputs":[{"internalType":"int8","name":"","type":"int8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"yay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}] diff --git a/solidity/TransferApproval.sol b/solidity/TransferApproval.sol @@ -16,7 +16,7 @@ contract ERC20ApprovalEscrow { int8 result; // -1 rejected/vetoed, 0 = voting, 1 = approved, 2 = completed } - mapping ( uint256 => mapping ( address => int8 )) vote; + mapping ( uint256 => mapping ( address => int8 )) public vote; address public owner; mapping(uint256 => Transaction) public requests; uint256 hi; @@ -81,7 +81,7 @@ contract ERC20ApprovalEscrow { } function createRequest(address _recipient, address _token, uint256 _value) public returns (uint256) { - Transaction memory txx; + Transaction storage txx = requests[hi]; txx.serial = hi; txx.recipient = _recipient; @@ -89,8 +89,7 @@ contract ERC20ApprovalEscrow { txx.token = _token; txx.value = _value; txx.quorum = quorum; - - requests[hi] = txx; + txx.vetoThreshold = vetoThreshold; count++; hi++; @@ -101,7 +100,6 @@ contract ERC20ApprovalEscrow { } function removeItem(uint256 serialToRemove) private { - delete requests[serialToRemove]; count--; if (count > 0) { @@ -145,10 +143,11 @@ contract ERC20ApprovalEscrow { } function yay(uint256 _serial) public returns (uint256) { + require(signers[msg.sender]); + require(vote[_serial][msg.sender] == 0); + Transaction storage txx = requests[_serial]; - require(txx.result == 0); - require(vote[_serial][msg.sender] == 0); vote[_serial][msg.sender] = 1; txx.yay++; @@ -156,19 +155,20 @@ contract ERC20ApprovalEscrow { if (signerCount - txx.yay == txx.quorum) { txx.result = 1; emit Approved(_serial); - executeRequest(_serial); } return txx.yay; } function nay(uint256 _serial) public returns (uint256) { - Transaction storage txx = requests[_serial]; + require(signers[msg.sender]); + require(vote[_serial][msg.sender] == 0); + Transaction storage txx = requests[_serial]; require(txx.result == 0); - require(vote[_serial][msg.sender] == 0); - vote[_serial][msg.sender] = 1; + + vote[_serial][msg.sender] = -1; txx.nay++; if (signerCount - txx.nay == txx.quorum) { @@ -187,7 +187,6 @@ contract ERC20ApprovalEscrow { function executeRequest(uint256 _serial) public returns (bool) { Transaction storage txx = requests[_serial]; - //require(txx.serial > 0, 'ERR_INVALID_REQUEST'); require(txx.serial > 0, 'ERR_INVALID_REQUEST'); require(txx.result == 1, 'ERR_NOT_ENDORSED');