erc20-transfer-authorization

Simple approval escrow for ERC20 spending
Log | Files | Refs

commit 90c67a2be57660bd4cc03672e8d325e4cdf987a5
parent d78d75d605c67180ea325397e267d03f01535699
Author: nolash <dev@holbrook.no>
Date:   Tue, 16 Feb 2021 13:21:06 +0100

Fix faulty login in request processing, allow decrease to zero in count

Diffstat:
Mpython/erc20_transfer_authorization/data/ERC20TransferAuthorization.bin | 4++--
Mpython/erc20_transfer_authorization/data/ERC20TransferAuthorization.json | 2+-
Mpython/tests/test_app.py | 41++++++++++++++++++++++++++---------------
Mpython/tests/test_quorum.py | 59++++++++++++++++++++++++++++++++++++++++++++---------------
Msolidity/ERC20TransferAuthorization.sol | 66++++++++++++++++++++++++++++++++++++++++++------------------------
5 files changed, 115 insertions(+), 57 deletions(-)

diff --git a/python/erc20_transfer_authorization/data/ERC20TransferAuthorization.bin b/python/erc20_transfer_authorization/data/ERC20TransferAuthorization.bin @@ -1 +1 @@ -60806040523480156200001157600080fd5b5033600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060016004819055506001600581905550600160078190555060016009819055506200008760016000620000a060201b60201c565b5062000099336200012b60201b60201c565b506200051b565b6000600954831115620000b257600080fd5b60008311620000c057600080fd5b600954821115620000d057600080fd5b82600781905550816008819055507f9f40cfd22fe91777c78f252bd21a710f3fb007dc2f321876891e7644ba0ae175600754600854600954604051620001199392919062000412565b60405180910390a16001905092915050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614620001c0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620001b790620003ce565b60405180910390fd5b60001515600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151462000256576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200024d90620003f0565b60405180910390fd5b6001600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060096000815480929190620002c3906200049e565b91905055507f47d1c22a25bb3a5d4e481b9b1e6944c2eade3181a0a20b495ed61d35b5323f2482604051620002f99190620003b1565b60405180910390a16009549050919050565b620003168162000460565b82525050565b60006200032b600a836200044f565b91507f4552525f414343455353000000000000000000000000000000000000000000006000830152602082019050919050565b60006200036d600c836200044f565b91507f4552525f4e4f54464f554e4400000000000000000000000000000000000000006000830152602082019050919050565b620003ab8162000494565b82525050565b6000602082019050620003c860008301846200030b565b92915050565b60006020820190508181036000830152620003e9816200031c565b9050919050565b600060208201905081810360008301526200040b816200035e565b9050919050565b6000606082019050620004296000830186620003a0565b620004386020830185620003a0565b620004476040830184620003a0565b949350505050565b600082825260208201905092915050565b60006200046d8262000474565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000620004ab8262000494565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415620004e157620004e0620004ec565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b611e39806200052b6000396000f3fe608060405234801561001057600080fd5b50600436106101215760003560e01c80636e417c69116100ad578063bac911ac11610071578063bac911ac14610361578063e3064a7714610391578063e9f9d28b146103c1578063eb12d61e146103f1578063fba00cbd1461042157610121565b80636e417c691461027c578063736c0d5b146102ac57806381d12c58146102dc5780638da5cb5b14610313578063b0addede1461033157610121565b80631703a018116100f45780631703a018146101c25780634797569a146101e057806357ec347a1461021057806358d71f821461022e578063614f427f1461025e57610121565b806302d947ef1461012657806306661abd1461015657806308ae6377146101745780630e316ab714610192575b600080fd5b610140600480360381019061013b91906117f3565b610451565b60405161014d9190611a9c565b60405180910390f35b61015e610480565b60405161016b9190611b57565b60405180910390f35b61017c610486565b6040516101899190611b57565b60405180910390f35b6101ac60048036038101906101a79190611752565b6104b1565b6040516101b99190611b57565b60405180910390f35b6101ca610712565b6040516101d79190611b57565b60405180910390f35b6101fa60048036038101906101f591906117ca565b610718565b6040516102079190611b57565b60405180910390f35b610218610950565b6040516102259190611b57565b60405180910390f35b610248600480360381019061024391906117ca565b610966565b6040516102559190611b57565b60405180910390f35b610266610b7f565b6040516102739190611b57565b60405180910390f35b610296600480360381019061029191906117ca565b610b85565b6040516102a39190611a81565b60405180910390f35b6102c660048036038101906102c19190611752565b610e5e565b6040516102d39190611a81565b60405180910390f35b6102f660048036038101906102f191906117ca565b610e7e565b60405161030a989796959493929190611b72565b60405180910390f35b61031b610f33565b6040516103289190611a2f565b60405180910390f35b61034b6004803603810190610346919061177b565b610f59565b6040516103589190611b57565b60405180910390f35b61037b600480360381019061037691906117ca565b6111a2565b6040516103889190611b57565b60405180910390f35b6103ab60048036038101906103a6919061182f565b611231565b6040516103b89190611a81565b60405180910390f35b6103db60048036038101906103d691906117ca565b6112b7565b6040516103e89190611a81565b60405180910390f35b61040b60048036038101906104069190611752565b611496565b6040516104189190611b57565b60405180910390f35b61043b6004803603810190610436919061182f565b61166c565b6040516104489190611a2f565b60405180910390f35b60006020528160005260406000206020528060005260406000206000915091509054906101000a900460000b81565b60065481565b6000806005546004546104999190611c77565b14156104a857600090506104ae565b60055490505b90565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061053a57508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610579576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161057090611ad7565b60405180910390fd5b60011515600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151461060c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161060390611af7565b60405180910390fd5b6007546009541180156106225750600854600954115b610661576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065890611ab7565b60405180910390fd5b6000600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600960008154809291906106cc90611d33565b91905055507f3525e22824a8a7df2c9a6029941c824cf95b6447f1e13d5128fd3826d35afe8b826040516107009190611a2f565b60405180910390a16009549050919050565b60075481565b6000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661077057600080fd5b600080600084815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460000b60000b146107dc57600080fd5b600060036000848152602001908152602001600020905060018160070160009054906101000a900460000b60000b1461081457600080fd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000808360000154815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908360000b60ff1602179055506001600082600001548152602001908152602001600020339080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600601600081548092919061093090611d5d565b919050555061094281600001546112b7565b508060060154915050919050565b600060016004546109619190611c77565b905090565b6000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166109be57600080fd5b600080600084815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460000b60000b14610a2a57600080fd5b600060036000848152602001908152602001600020905060018160070160009054906101000a900460000b60000b14610a6257600080fd5b60016000808360000154815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908360000b60ff1602179055506001600082600001548152602001908152602001600020339080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550806005016000815480929190610b5f90611d5d565b9190505550610b7181600001546112b7565b508060050154915050919050565b60085481565b6000806003600084815260200190815260200160002090506000816000015411610be4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bdb90611b17565b60405180910390fd5b60028160070160009054906101000a900460000b60000b14610c3b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c3290611b37565b60405180910390fd5b60008160070160006101000a81548160ff021916908360000b60ff1602179055506000808260030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168360010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168460020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168560040154604051602401610cfb93929190611a4a565b6040516020818303038152906040527f23b872dd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610d859190611a18565b6000604051808303816000865af19150503d8060008114610dc2576040519150601f19603f3d011682016040523d82523d6000602084013e610dc7565b606091505b5091509150610dd983600001546116ba565b8115610e1b577fbcf6a68a2f901be4a23a41b53acd7697893a7e34def4e28acba584da75283b6785604051610e0e9190611b57565b60405180910390a1610e53565b7fdab20a0fcd702cf875c2d715d5c3fc99af66a716c94b3405408c94b7311c99eb85604051610e4a9190611b57565b60405180910390a15b819350505050919050565b600a6020528060005260406000206000915054906101000a900460ff1681565b60036020528060005260406000206000915090508060000154908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060040154908060050154908060060154908060070160009054906101000a900460000b905088565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060036000600454815260200190815260200160002090506004548160000181905550848160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550338160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550838160030160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082816004018190555060018160070160006101000a81548160ff021916908360000b60ff1602179055506006600081548092919061108490611d5d565b91905055506004600081548092919061109c90611d5d565b91905055508060030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168160020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168260010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fb609ae609609ee99268d05bc1371102cafe8d6b964bf082439ab16be2a01c87c8460040154856000015460405161118b929190611bf0565b60405180910390a480600001549150509392505050565b600080600060055490505b60045481101561122557600060036000838152602001908152602001600020905060008160070160009054906101000a900460000b60000b13156112115784831415611202578060000154935050505061122c565b828061120d90611d5d565b9350505b50808061121d90611d5d565b9150506111ad565b5060009150505b919050565b600060095483111561124257600080fd5b6000831161124f57600080fd5b60095482111561125e57600080fd5b82600781905550816008819055507f9f40cfd22fe91777c78f252bd21a710f3fb007dc2f321876891e7644ba0ae1756007546008546009546040516112a593929190611c19565b60405180910390a16001905092915050565b600080600060036000858152602001908152602001600020905060075481600501546009546112e69190611c77565b141561134d5760028160070160006101000a81548160ff021916908360000b60ff1602179055507f3ad93af63cb7967b23e4fb500b7d7d28b07516325dcf341f88bebf959d82c1cb8460405161133c9190611b57565b60405180910390a16001915061148c565b60075481600601546009546113629190611c77565b14156113ed577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8160070160006101000a81548160ff021916908360000b60ff1602179055506113b1846116ba565b7f94064f919a02d0565c6790e0615fb4ba6cf1be1dd679f0161be914613a1b9bb5846040516113e09190611b57565b60405180910390a161148b565b600060085411801561140457506008548160060154145b1561148a577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8160070160006101000a81548160ff021916908360000b60ff160217905550611452846116ba565b7f2ae00ba9813199478b6f22f0c9b606daa70f8efc319c8d2fa6af63f66ea31763846040516114819190611b57565b60405180910390a15b5b5b8192505050919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611528576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161151f90611ad7565b60405180910390fd5b60001515600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515146115bb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115b290611af7565b60405180910390fd5b6001600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506009600081548092919061162690611d5d565b91905055507f47d1c22a25bb3a5d4e481b9b1e6944c2eade3181a0a20b495ed61d35b5323f248260405161165a9190611a2f565b60405180910390a16009549050919050565b6001602052816000526040600020818154811061168857600080fd5b906000526020600020016000915091509054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600660008154809291906116cd90611d33565b91905055506000600654111561171b576005548114156117165760006116f360006111a2565b9050600081141561170c57600454600581905550611714565b806005819055505b505b611725565b6004546005819055505b50565b60008135905061173781611dd5565b92915050565b60008135905061174c81611dec565b92915050565b60006020828403121561176457600080fd5b600061177284828501611728565b91505092915050565b60008060006060848603121561179057600080fd5b600061179e86828701611728565b93505060206117af86828701611728565b92505060406117c08682870161173d565b9150509250925092565b6000602082840312156117dc57600080fd5b60006117ea8482850161173d565b91505092915050565b6000806040838503121561180657600080fd5b60006118148582860161173d565b925050602061182585828601611728565b9150509250929050565b6000806040838503121561184257600080fd5b60006118508582860161173d565b92505060206118618582860161173d565b9150509250929050565b61187481611cab565b82525050565b61188381611cbd565b82525050565b600061189482611c50565b61189e8185611c5b565b93506118ae818560208601611d00565b80840191505092915050565b6118c381611cc9565b82525050565b60006118d6601a83611c66565b91507f4552525f5245445543455f5448524553484f4c445f46495253540000000000006000830152602082019050919050565b6000611916600a83611c66565b91507f4552525f414343455353000000000000000000000000000000000000000000006000830152602082019050919050565b6000611956600c83611c66565b91507f4552525f4e4f54464f554e4400000000000000000000000000000000000000006000830152602082019050919050565b6000611996601383611c66565b91507f4552525f494e56414c49445f52455155455354000000000000000000000000006000830152602082019050919050565b60006119d6601083611c66565b91507f4552525f4e4f545f454e444f52534544000000000000000000000000000000006000830152602082019050919050565b611a1281611cf6565b82525050565b6000611a248284611889565b915081905092915050565b6000602082019050611a44600083018461186b565b92915050565b6000606082019050611a5f600083018661186b565b611a6c602083018561186b565b611a796040830184611a09565b949350505050565b6000602082019050611a96600083018461187a565b92915050565b6000602082019050611ab160008301846118ba565b92915050565b60006020820190508181036000830152611ad0816118c9565b9050919050565b60006020820190508181036000830152611af081611909565b9050919050565b60006020820190508181036000830152611b1081611949565b9050919050565b60006020820190508181036000830152611b3081611989565b9050919050565b60006020820190508181036000830152611b50816119c9565b9050919050565b6000602082019050611b6c6000830184611a09565b92915050565b600061010082019050611b88600083018b611a09565b611b95602083018a61186b565b611ba2604083018961186b565b611baf606083018861186b565b611bbc6080830187611a09565b611bc960a0830186611a09565b611bd660c0830185611a09565b611be360e08301846118ba565b9998505050505050505050565b6000604082019050611c056000830185611a09565b611c126020830184611a09565b9392505050565b6000606082019050611c2e6000830186611a09565b611c3b6020830185611a09565b611c486040830184611a09565b949350505050565b600081519050919050565b600081905092915050565b600082825260208201905092915050565b6000611c8282611cf6565b9150611c8d83611cf6565b925082821015611ca057611c9f611da6565b5b828203905092915050565b6000611cb682611cd6565b9050919050565b60008115159050919050565b60008160000b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60005b83811015611d1e578082015181840152602081019050611d03565b83811115611d2d576000848401525b50505050565b6000611d3e82611cf6565b91506000821415611d5257611d51611da6565b5b600182039050919050565b6000611d6882611cf6565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415611d9b57611d9a611da6565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b611dde81611cab565b8114611de957600080fd5b50565b611df581611cf6565b8114611e0057600080fd5b5056fea2646970667358221220604943dcb457fecebf6a1db2691533b784d976c6e021e0af473f8d8627588eaf64736f6c63430008000033 -\ No newline at end of file +60806040523480156200001157600080fd5b5033600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001600481905550600160058190555062000074336200009060201b60201c565b5062000089600160006200027060201b60201c565b506200050b565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161462000125576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200011c90620003be565b60405180910390fd5b60001515600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514620001bb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620001b290620003e0565b60405180910390fd5b6001600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506009600081548092919062000228906200048e565b91905055507f47d1c22a25bb3a5d4e481b9b1e6944c2eade3181a0a20b495ed61d35b5323f24826040516200025e9190620003a1565b60405180910390a16009549050919050565b60006009548311156200028257600080fd5b600083116200029057600080fd5b600954821115620002a057600080fd5b82600781905550816008819055507f9f40cfd22fe91777c78f252bd21a710f3fb007dc2f321876891e7644ba0ae175600754600854600954604051620002e99392919062000402565b60405180910390a16001905092915050565b620003068162000450565b82525050565b60006200031b600a836200043f565b91507f4552525f414343455353000000000000000000000000000000000000000000006000830152602082019050919050565b60006200035d600c836200043f565b91507f4552525f4e4f54464f554e4400000000000000000000000000000000000000006000830152602082019050919050565b6200039b8162000484565b82525050565b6000602082019050620003b86000830184620002fb565b92915050565b60006020820190508181036000830152620003d9816200030c565b9050919050565b60006020820190508181036000830152620003fb816200034e565b9050919050565b600060608201905062000419600083018662000390565b62000428602083018562000390565b62000437604083018462000390565b949350505050565b600082825260208201905092915050565b60006200045d8262000464565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60006200049b8262000484565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415620004d157620004d0620004dc565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6120df806200051b6000396000f3fe608060405234801561001057600080fd5b506004361061012c5760003560e01c8063736c0d5b116100ad578063e3064a7711610071578063e3064a771461038a578063e9f9d28b146103ba578063eb12d61e146103ea578063ed71262a1461041a578063fba00cbd1461044a5761012c565b8063736c0d5b146102b75780637ca548c6146102e757806381d12c58146103055780638da5cb5b1461033c578063bac911ac1461035a5761012c565b80634797569a116100f45780634797569a146101eb57806357ec347a1461021b57806358d71f8214610239578063614f427f146102695780636e417c69146102875761012c565b806302d947ef1461013157806306661abd1461016157806308ae63771461017f5780630e316ab71461019d5780631703a018146101cd575b600080fd5b61014b60048036038101906101469190611973565b61047a565b6040516101589190611c86565b60405180910390f35b6101696104a9565b6040516101769190611c6b565b60405180910390f35b6101876104af565b6040516101949190611d61565b60405180910390f35b6101b760048036038101906101b291906118be565b6104da565b6040516101c49190611d61565b60405180910390f35b6101d561073b565b6040516101e29190611d61565b60405180910390f35b6102056004803603810190610200919061194a565b610741565b6040516102129190611d61565b60405180910390f35b6102236109e5565b6040516102309190611d61565b60405180910390f35b610253600480360381019061024e919061194a565b6109fb565b6040516102609190611d61565b60405180910390f35b610271610c80565b60405161027e9190611d61565b60405180910390f35b6102a1600480360381019061029c919061194a565b610c86565b6040516102ae9190611c50565b60405180910390f35b6102d160048036038101906102cc91906118be565b610f60565b6040516102de9190611c50565b60405180910390f35b6102ef610f80565b6040516102fc9190611d61565b60405180910390f35b61031f600480360381019061031a919061194a565b610f86565b604051610333989796959493929190611d7c565b60405180910390f35b61034461103b565b6040516103519190611bfe565b60405180910390f35b610374600480360381019061036f919061194a565b611061565b6040516103819190611d61565b60405180910390f35b6103a4600480360381019061039f91906119af565b6110f0565b6040516103b19190611c50565b60405180910390f35b6103d460048036038101906103cf919061194a565b611176565b6040516103e19190611c50565b60405180910390f35b61040460048036038101906103ff91906118be565b6113af565b6040516104119190611d61565b60405180910390f35b610434600480360381019061042f91906118e7565b611585565b6040516104419190611d61565b60405180910390f35b610464600480360381019061045f91906119af565b6117cf565b6040516104719190611bfe565b60405180910390f35b60006020528160005260406000206020528060005260406000206000915091509054906101000a900460000b81565b60065481565b6000806005546004546104c29190611e81565b14156104d157600090506104d7565b60055490505b90565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061056357508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6105a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161059990611cc1565b60405180910390fd5b60011515600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514610635576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161062c90611ce1565b60405180910390fd5b60075460095411801561064b5750600854600954115b61068a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068190611ca1565b60405180910390fd5b6000600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600960008154809291906106f590611f90565b91905055507f3525e22824a8a7df2c9a6029941c824cf95b6447f1e13d5128fd3826d35afe8b826040516107299190611bfe565b60405180910390a16009549050919050565b60075481565b6000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166107cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107c690611cc1565b60405180910390fd5b600080600084815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460000b60000b14610871576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086890611d01565b60405180910390fd5b600060036000848152602001908152602001600020905060018160070160009054906101000a900460000b60000b146108a957600080fd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000808360000154815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908360000b60ff1602179055506001600082600001548152602001908152602001600020339080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508060060160008154809291906109c590612003565b91905055506109d78160000154611176565b508060060154915050919050565b600060016004546109f69190611e81565b905090565b6000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610a89576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a8090611cc1565b60405180910390fd5b600080600084815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460000b60000b14610b2b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b2290611d01565b60405180910390fd5b600060036000848152602001908152602001600020905060018160070160009054906101000a900460000b60000b14610b6357600080fd5b60016000808360000154815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908360000b60ff1602179055506001600082600001548152602001908152602001600020339080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550806005016000815480929190610c6090612003565b9190505550610c728160000154611176565b508060050154915050919050565b60085481565b6000806003600084815260200190815260200160002090506000816000015411610ce5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cdc90611d21565b60405180910390fd5b60028160070160009054906101000a900460000b60000b14610d3c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d3390611d41565b60405180910390fd5b60008160070160006101000a81548160ff021916908360000b60ff1602179055506000808260030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168360010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168460020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168560040154604051602401610dfc93929190611c19565b6040516020818303038152906040527f23b872dd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610e869190611be7565b6000604051808303816000865af19150503d8060008114610ec3576040519150601f19603f3d011682016040523d82523d6000602084013e610ec8565b606091505b5091509150610eda836000015461181d565b508115610f1d577fbcf6a68a2f901be4a23a41b53acd7697893a7e34def4e28acba584da75283b6785604051610f109190611d61565b60405180910390a1610f55565b7fdab20a0fcd702cf875c2d715d5c3fc99af66a716c94b3405408c94b7311c99eb85604051610f4c9190611d61565b60405180910390a15b819350505050919050565b600a6020528060005260406000206000915054906101000a900460ff1681565b60095481565b60036020528060005260406000206000915090508060000154908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060040154908060050154908060060154908060070160009054906101000a900460000b905088565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080600060055490505b6004548110156110e457600060036000838152602001908152602001600020905060008160070160009054906101000a900460000b60000b13156110d057848314156110c157806000015493505050506110eb565b82806110cc90612003565b9350505b5080806110dc90612003565b91505061106c565b5060009150505b919050565b600060095483111561110157600080fd5b6000831161110e57600080fd5b60095482111561111d57600080fd5b82600781905550816008819055507f9f40cfd22fe91777c78f252bd21a710f3fb007dc2f321876891e7644ba0ae17560075460085460095460405161116493929190611e23565b60405180910390a16001905092915050565b600080600060036000858152602001908152602001600020905060018160070160009054906101000a900460000b60000b12156111b75781925050506113aa565b6007548160050154106112345760028160070160006101000a81548160ff021916908360000b60ff16021790555080600001547f36ea04725f8aa40ee603224671681b753f9cba3cb5f67c5a0e24a3b39900c06582600501548360060154604051611223929190611dfa565b60405180910390a2600191506113a4565b600060085411801561124c5750600854816006015410155b156112ee577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8160070160006101000a81548160ff021916908360000b60ff16021790555061129e816000015461181d565b5080600001547f1ad80b2541a1f52bdc838332d7c23606116a1188a8cbbc4c0948b4b56ce51d14826005015483600601546040516112dd929190611dfa565b60405180910390a2600191506113a3565b60075481600601546009546113039190611e81565b10156113a2577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8160070160006101000a81548160ff021916908360000b60ff160217905550611356816000015461181d565b5080600001547f3d61d434b895790b08f040c45261fce3b3bec596278b3a0f25dd9f741d0ba46982600501548360060154604051611395929190611dfa565b60405180910390a2600191505b5b5b81925050505b919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611441576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161143890611cc1565b60405180910390fd5b60001515600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515146114d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114cb90611ce1565b60405180910390fd5b6001600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506009600081548092919061153f90612003565b91905055507f47d1c22a25bb3a5d4e481b9b1e6944c2eade3181a0a20b495ed61d35b5323f24826040516115739190611bfe565b60405180910390a16009549050919050565b60008060036000600454815260200190815260200160002090506004548160000181905550848160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550858160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550838160030160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082816004018190555060018160070160006101000a81548160ff021916908360000b60ff160217905550600660008154809291906116b090611fba565b9190505550600460008154809291906116c890612003565b91905055508060030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168160020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168260010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fb609ae609609ee99268d05bc1371102cafe8d6b964bf082439ab16be2a01c87c846004015485600001546040516117b7929190611dfa565b60405180910390a48060000154915050949350505050565b600160205281600052604060002081815481106117eb57600080fd5b906000526020600020016000915091509054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006006600081548092919061183290611f47565b9190505550600060065413156118805760055482141561187b5760006118586000611061565b9050600081141561187157600454600581905550611879565b806005819055505b505b61188a565b6004546005819055505b6005549050919050565b6000813590506118a38161207b565b92915050565b6000813590506118b881612092565b92915050565b6000602082840312156118d057600080fd5b60006118de84828501611894565b91505092915050565b600080600080608085870312156118fd57600080fd5b600061190b87828801611894565b945050602061191c87828801611894565b935050604061192d87828801611894565b925050606061193e878288016118a9565b91505092959194509250565b60006020828403121561195c57600080fd5b600061196a848285016118a9565b91505092915050565b6000806040838503121561198657600080fd5b6000611994858286016118a9565b92505060206119a585828601611894565b9150509250929050565b600080604083850312156119c257600080fd5b60006119d0858286016118a9565b92505060206119e1858286016118a9565b9150509250929050565b6119f481611eb5565b82525050565b611a0381611ec7565b82525050565b6000611a1482611e5a565b611a1e8185611e65565b9350611a2e818560208601611f14565b80840191505092915050565b611a4381611ed3565b82525050565b611a5281611edd565b82525050565b6000611a65601a83611e70565b91507f4552525f5245445543455f5448524553484f4c445f46495253540000000000006000830152602082019050919050565b6000611aa5600a83611e70565b91507f4552525f414343455353000000000000000000000000000000000000000000006000830152602082019050919050565b6000611ae5600c83611e70565b91507f4552525f4e4f54464f554e4400000000000000000000000000000000000000006000830152602082019050919050565b6000611b25601083611e70565b91507f4552525f414c5245414459564f544544000000000000000000000000000000006000830152602082019050919050565b6000611b65601383611e70565b91507f4552525f494e56414c49445f52455155455354000000000000000000000000006000830152602082019050919050565b6000611ba5601083611e70565b91507f4552525f4e4f545f454e444f52534544000000000000000000000000000000006000830152602082019050919050565b611be181611f0a565b82525050565b6000611bf38284611a09565b915081905092915050565b6000602082019050611c1360008301846119eb565b92915050565b6000606082019050611c2e60008301866119eb565b611c3b60208301856119eb565b611c486040830184611bd8565b949350505050565b6000602082019050611c6560008301846119fa565b92915050565b6000602082019050611c806000830184611a3a565b92915050565b6000602082019050611c9b6000830184611a49565b92915050565b60006020820190508181036000830152611cba81611a58565b9050919050565b60006020820190508181036000830152611cda81611a98565b9050919050565b60006020820190508181036000830152611cfa81611ad8565b9050919050565b60006020820190508181036000830152611d1a81611b18565b9050919050565b60006020820190508181036000830152611d3a81611b58565b9050919050565b60006020820190508181036000830152611d5a81611b98565b9050919050565b6000602082019050611d766000830184611bd8565b92915050565b600061010082019050611d92600083018b611bd8565b611d9f602083018a6119eb565b611dac60408301896119eb565b611db960608301886119eb565b611dc66080830187611bd8565b611dd360a0830186611bd8565b611de060c0830185611bd8565b611ded60e0830184611a49565b9998505050505050505050565b6000604082019050611e0f6000830185611bd8565b611e1c6020830184611bd8565b9392505050565b6000606082019050611e386000830186611bd8565b611e456020830185611bd8565b611e526040830184611bd8565b949350505050565b600081519050919050565b600081905092915050565b600082825260208201905092915050565b6000611e8c82611f0a565b9150611e9783611f0a565b925082821015611eaa57611ea961204c565b5b828203905092915050565b6000611ec082611eea565b9050919050565b60008115159050919050565b6000819050919050565b60008160000b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60005b83811015611f32578082015181840152602081019050611f17565b83811115611f41576000848401525b50505050565b6000611f5282611ed3565b91507f8000000000000000000000000000000000000000000000000000000000000000821415611f8557611f8461204c565b5b600182039050919050565b6000611f9b82611f0a565b91506000821415611faf57611fae61204c565b5b600182039050919050565b6000611fc582611ed3565b91507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415611ff857611ff761204c565b5b600182019050919050565b600061200e82611f0a565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156120415761204061204c565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b61208481611eb5565b811461208f57600080fd5b50565b61209b81611f0a565b81146120a657600080fd5b5056fea2646970667358221220cf5ec498c503d460d54980770a2d0ad609d44aca46862ead18030676b3ca3cb764736f6c63430008000033 +\ No newline at end of file diff --git a/python/erc20_transfer_authorization/data/ERC20TransferAuthorization.json b/python/erc20_transfer_authorization/data/ERC20TransferAuthorization.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":[{"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"checkResult","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":"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":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"voters","outputs":[{"internalType":"address","name":"","type":"address"}],"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":true,"internalType":"uint256","name":"_serial","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_yays","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_nays","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":true,"internalType":"uint256","name":"_serial","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_yays","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_nays","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":true,"internalType":"uint256","name":"_serial","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_yays","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_nays","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":[{"internalType":"uint256","name":"_serial","type":"uint256"}],"name":"checkResult","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"count","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_sender","type":"address"},{"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":"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":[],"name":"signerCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"voters","outputs":[{"internalType":"address","name":"","type":"address"}],"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_app.py b/python/tests/test_app.py @@ -18,12 +18,12 @@ class ERC20TransferAuthorizationBasicTest(TestBase): self.assertTrue(c.functions.signers(self.w3.eth.accounts[0]).call()) self.assertFalse(c.functions.signers(self.w3.eth.accounts[1]).call()) - + def test_get(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]}) + tx_hash = w.functions.createRequest(self.w3.eth.accounts[2], self.w3.eth.accounts[3], t.address, 10).transact({'from': self.w3.eth.accounts[9]}) r = self.w3.eth.getTransactionReceipt(tx_hash) topic_match = 'b609ae609609ee99268d05bc1371102cafe8d6b964bf082439ab16be2a01c87c' @@ -33,7 +33,7 @@ class ERC20TransferAuthorizationBasicTest(TestBase): serial = int(log.data[66:], 16) for i in range(1, 3): - tx_hash = w.functions.createRequest(self.w3.eth.accounts[3+i], t.address, 10*(i+1)).transact({'from': self.w3.eth.accounts[2]}) + tx_hash = w.functions.createRequest(self.w3.eth.accounts[2], self.w3.eth.accounts[3+i], t.address, 10*(i+1)).transact({'from': self.w3.eth.accounts[2]}) tq_count = w.functions.count().call() assert (tq_count == 3); @@ -41,11 +41,22 @@ class ERC20TransferAuthorizationBasicTest(TestBase): for i in range(w.functions.nextSerial().call(), w.functions.lastSerial().call()): tqg = w.functions.requests(i).call() - assert (tqg[0] == i) - assert (tqg[1] == self.w3.eth.accounts[2]) - assert (tqg[2] == self.w3.eth.accounts[3+(i-1)]) - assert (tqg[3] == t.address) - assert (tqg[4] == 10*i) + self.assertEqual(tqg[0], i) + self.assertEqual(tqg[1], self.w3.eth.accounts[2]) + self.assertEqual(tqg[2], self.w3.eth.accounts[3+(i-1)]) + self.assertEqual(tqg[3], t.address) + self.assertEqual(tqg[4], 10*i) + + + def test_get_vote(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[2], self.w3.eth.accounts[3], t.address, 10).transact({'from': self.w3.eth.accounts[9]}) + w.functions.nay(1).transact({'from': self.w3.eth.accounts[0]}) + + self.assertEqual(w.functions.voters(1, 0).call(), self.w3.eth.accounts[0]) + self.assertEqual(w.functions.vote(1, self.w3.eth.accounts[0]).call(), -1) def test_indexes(self): @@ -55,14 +66,14 @@ class ERC20TransferAuthorizationBasicTest(TestBase): for i in range(0, 5): amount = 10*(i+1) sender = self.w3.eth.accounts[3+i]; - tx_hash = w.functions.createRequest(sender, t.address, amount).transact({'from': self.w3.eth.accounts[2]}) + tx_hash = w.functions.createRequest(self.w3.eth.accounts[2], sender, t.address, amount).transact({'from': self.w3.eth.accounts[2]}) w.functions.nay(1).transact({'from': self.w3.eth.accounts[0]}) w.functions.nay(4).transact({'from': self.w3.eth.accounts[0]}) - assert w.functions.getSerialAt(0).call() == 2 - assert w.functions.getSerialAt(1).call() == 3 - assert w.functions.getSerialAt(2).call() == 5 + self.assertEqual(w.functions.getSerialAt(0).call(), 2) + self.assertEqual(w.functions.getSerialAt(1).call(), 3) + self.assertEqual(w.functions.getSerialAt(2).call(), 5) def test_index_after_removal(self): @@ -72,7 +83,7 @@ class ERC20TransferAuthorizationBasicTest(TestBase): for i in range(0, 4): amount = 10*(i+1) sender = self.w3.eth.accounts[3+i]; - tx_hash = w.functions.createRequest(sender, t.address, amount).transact({'from': self.w3.eth.accounts[2]}) + tx_hash = w.functions.createRequest(self.w3.eth.accounts[2], sender, t.address, amount).transact({'from': self.w3.eth.accounts[2]}) tq_count = w.functions.count().call() self.assertEqual(tq_count, 4); @@ -89,7 +100,7 @@ class ERC20TransferAuthorizationBasicTest(TestBase): self.assertEqual(w.functions.nextSerial().call(), 3) self.assertEqual(w.functions.lastSerial().call(), 4) - w.functions.createRequest(self.w3.eth.accounts[3], t.address, 42).transact({'from': self.w3.eth.accounts[2]}) + w.functions.createRequest(self.w3.eth.accounts[2], self.w3.eth.accounts[3], t.address, 42).transact({'from': self.w3.eth.accounts[2]}) self.assertEqual(w.functions.count().call(), 3) self.assertEqual(w.functions.lastSerial().call(), 5) self.assertEqual(w.functions.nextSerial().call(), 3) @@ -116,7 +127,7 @@ class ERC20TransferAuthorizationBasicTest(TestBase): self.eth_tester.mine_block() - w.functions.createRequest(self.w3.eth.accounts[3], t.address, 10).transact({'from': self.w3.eth.accounts[2]}) + w.functions.createRequest(self.w3.eth.accounts[2], self.w3.eth.accounts[3], t.address, 10).transact({'from': self.w3.eth.accounts[2]}) w.functions.yay(1).transact({'from': self.w3.eth.accounts[0]}) self.eth_tester.mine_block() diff --git a/python/tests/test_quorum.py b/python/tests/test_quorum.py @@ -7,6 +7,10 @@ from tests.base import TestBase logg = logging.getLogger() +rejected_log_signature = '3d61d434b895790b08f040c45261fce3b3bec596278b3a0f25dd9f741d0ba469' +vetoed_log_signature = '1ad80b2541a1f52bdc838332d7c23606116a1188a8cbbc4c0948b4b56ce51d14' +approved_log_signature = '36ea04725f8aa40ee603224671681b753f9cba3cb5f67c5a0e24a3b39900c065' + class ERC20TransferAuthorizationQuorumTest(TestBase): @@ -14,13 +18,10 @@ class ERC20TransferAuthorizationQuorumTest(TestBase): 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]}) - self.eth_tester.mine_block() + w.functions.setThresholds(2, 0).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]}) + tx_hash = w.functions.createRequest(self.w3.eth.accounts[2], self.w3.eth.accounts[3], t.address, 10).transact({'from': self.w3.eth.accounts[9]}) r = self.w3.eth.getTransactionReceipt(tx_hash) topic_match = 'b609ae609609ee99268d05bc1371102cafe8d6b964bf082439ab16be2a01c87c' @@ -58,7 +59,6 @@ class ERC20TransferAuthorizationQuorumTest(TestBase): tx_hashh = w.functions.yay(serial).transact({'from': self.w3.eth.accounts[5]}) - 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) @@ -66,7 +66,7 @@ class ERC20TransferAuthorizationQuorumTest(TestBase): t.functions.approve(w.address, 10).transact({'from': self.w3.eth.accounts[2]}) self.eth_tester.mine_block() - tx_hash = w.functions.createRequest(self.w3.eth.accounts[3], t.address, 10).transact({'from': self.w3.eth.accounts[2]}) + tx_hash = w.functions.createRequest(self.w3.eth.accounts[2], self.w3.eth.accounts[3], t.address, 10).transact({'from': self.w3.eth.accounts[9]}) r = self.w3.eth.getTransactionReceipt(tx_hash) topic_match = 'b609ae609609ee99268d05bc1371102cafe8d6b964bf082439ab16be2a01c87c' @@ -85,7 +85,7 @@ 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' + topic_match = approved_log_signature log = r.logs[0] topic = log.topics[0] self.assertEqual(topic.hex()[2:], topic_match) @@ -113,7 +113,7 @@ class ERC20TransferAuthorizationQuorumTest(TestBase): w.functions.addSigner(self.w3.eth.accounts[6]).transact({'from': self.w3.eth.accounts[0]}) w.functions.setThresholds(2, 0).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]}) + tx_hash = w.functions.createRequest(self.w3.eth.accounts[2], self.w3.eth.accounts[3], t.address, 10).transact({'from': self.w3.eth.accounts[9]}) r = self.w3.eth.getTransactionReceipt(tx_hash) topic_match = 'b609ae609609ee99268d05bc1371102cafe8d6b964bf082439ab16be2a01c87c' @@ -152,7 +152,7 @@ class ERC20TransferAuthorizationQuorumTest(TestBase): 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]}) + tx_hash = w.functions.createRequest(self.w3.eth.accounts[2], self.w3.eth.accounts[3], t.address, 10).transact({'from': self.w3.eth.accounts[9]}) r = self.w3.eth.getTransactionReceipt(tx_hash) topic_match = 'b609ae609609ee99268d05bc1371102cafe8d6b964bf082439ab16be2a01c87c' @@ -164,7 +164,7 @@ class ERC20TransferAuthorizationQuorumTest(TestBase): tx_hashh = w.functions.nay(serial).transact({'from': self.w3.eth.accounts[0]}) r = self.w3.eth.getTransactionReceipt(tx_hashh) - topic_match = '94064f919a02d0565c6790e0615fb4ba6cf1be1dd679f0161be914613a1b9bb5' + topic_match = rejected_log_signature log = r.logs[0] topic = log.topics[0] self.assertEqual(topic.hex()[2:], topic_match) @@ -185,7 +185,7 @@ class ERC20TransferAuthorizationQuorumTest(TestBase): w.functions.addSigner(self.w3.eth.accounts[6]).transact({'from': self.w3.eth.accounts[0]}) w.functions.setThresholds(2, 0).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]}) + tx_hash = w.functions.createRequest(self.w3.eth.accounts[2], self.w3.eth.accounts[3], t.address, 10).transact({'from': self.w3.eth.accounts[9]}) r = self.w3.eth.getTransactionReceipt(tx_hash) topic_match = 'b609ae609609ee99268d05bc1371102cafe8d6b964bf082439ab16be2a01c87c' @@ -201,7 +201,7 @@ class ERC20TransferAuthorizationQuorumTest(TestBase): tx_hashh = w.functions.nay(serial).transact({'from': self.w3.eth.accounts[5]}) r = self.w3.eth.getTransactionReceipt(tx_hashh) - topic_match = '94064f919a02d0565c6790e0615fb4ba6cf1be1dd679f0161be914613a1b9bb5' + topic_match = rejected_log_signature log = r.logs[0] topic = log.topics[0] self.assertEqual(topic.hex()[2:], topic_match) @@ -229,7 +229,7 @@ class ERC20TransferAuthorizationQuorumTest(TestBase): 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]}) + tx_hash = w.functions.createRequest(self.w3.eth.accounts[2], self.w3.eth.accounts[3], t.address, 10).transact({'from': self.w3.eth.accounts[9]}) r = self.w3.eth.getTransactionReceipt(tx_hash) topic_match = 'b609ae609609ee99268d05bc1371102cafe8d6b964bf082439ab16be2a01c87c' @@ -242,7 +242,7 @@ class ERC20TransferAuthorizationQuorumTest(TestBase): tx_hashh = w.functions.nay(serial).transact({'from': self.w3.eth.accounts[5]}) r = self.w3.eth.getTransactionReceipt(tx_hashh) - topic_match = '2ae00ba9813199478b6f22f0c9b606daa70f8efc319c8d2fa6af63f66ea31763' + topic_match = vetoed_log_signature log = r.logs[0] topic = log.topics[0] self.assertEqual(topic.hex()[2:], topic_match) @@ -259,5 +259,34 @@ class ERC20TransferAuthorizationQuorumTest(TestBase): w.functions.nay(serial).transact({'from': self.w3.eth.accounts[6]}) + def test_inflight_change(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) + + 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, 0).transact({'from': self.w3.eth.accounts[0]}) + + tx_hash = w.functions.createRequest(self.w3.eth.accounts[2], self.w3.eth.accounts[3], t.address, 10).transact({'from': self.w3.eth.accounts[9]}) + 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.nay(serial).transact({'from': self.w3.eth.accounts[0]}) + w.functions.removeSigner(self.w3.eth.accounts[6]).transact({'from': self.w3.eth.accounts[0]}) + + tx_hashh = w.functions.checkResult(serial).transact({'from': self.w3.eth.accounts[6]}) + r = self.w3.eth.getTransactionReceipt(tx_hashh) + + topic_match = rejected_log_signature + log = r.logs[0] + topic = log.topics[0] + self.assertEqual(topic.hex()[2:], topic_match) + + if __name__ == '__main__': unittest.main() diff --git a/solidity/ERC20TransferAuthorization.sol b/solidity/ERC20TransferAuthorization.sol @@ -20,10 +20,10 @@ contract ERC20TransferAuthorization { mapping(uint256 => Transaction) public requests; uint256 hi; uint256 lo; - uint256 public count; + int256 public count; uint256 public quorum; uint256 public vetoThreshold; - uint256 signerCount; + uint256 public signerCount; mapping(address => bool) public signers; @@ -33,18 +33,16 @@ contract ERC20TransferAuthorization { event QuorumSet(uint256 _quorum, uint256 _vetoThreshold, uint256 _signerCount); event SignerAdded(address _signer); event SignerRemoved(address _signer); - event Vetoed(uint256 _serial); - event Approved(uint256 _serial); - event Rejected(uint256 _serial); + event Vetoed(uint256 indexed _serial, uint256 _yays, uint256 _nays); + event Approved(uint256 indexed _serial, uint256 _yays, uint256 _nays); + event Rejected(uint256 indexed _serial, uint256 _yays, uint256 _nays); constructor() public { owner = msg.sender; hi = 1; lo = 1; - quorum = 1; - signerCount = 1; - setThresholds(1, 0); addSigner(msg.sender); + setThresholds(1, 0); } function addSigner(address _signer) public returns (uint256) { @@ -79,12 +77,13 @@ contract ERC20TransferAuthorization { return true; } - function createRequest(address _recipient, address _token, uint256 _value) public returns (uint256) { + // create new request + function createRequest(address _sender, address _recipient, address _token, uint256 _value) public returns (uint256) { Transaction storage txx = requests[hi]; txx.serial = hi; txx.recipient = _recipient; - txx.sender = msg.sender; + txx.sender = _sender; txx.token = _token; txx.value = _value; txx.result = 1; @@ -97,11 +96,13 @@ contract ERC20TransferAuthorization { return txx.serial; } - function removeItem(uint256 serialToRemove) private { + // if request was oldest in index, move the pointer to oldest request to next oldest unfinished request. + // if no unfinished requests exits, it will point to newest request + function removeItem(uint256 _serialToRemove) private returns (uint256) { count--; if (count > 0) { - if (serialToRemove == lo) { + if (_serialToRemove == lo) { uint256 i; i = getSerialAt(0); if (i == 0) { @@ -113,12 +114,16 @@ contract ERC20TransferAuthorization { } else { lo = hi; } + + return lo; } + // index of newest vote function lastSerial() public view returns ( uint256 ) { return hi - 1; } + // index of oldest unfinished vote function nextSerial() public view returns ( uint256 ) { if (hi - lo == 0) { return 0; @@ -126,6 +131,7 @@ contract ERC20TransferAuthorization { return lo; } + // get the unfinished vote at the given index function getSerialAt(uint256 _idx) public view returns ( uint256 ) { uint256 i; for (uint256 j = lo; j < hi; j++) { @@ -140,9 +146,10 @@ contract ERC20TransferAuthorization { return 0; } + // vote yay, one per signer function yay(uint256 _serial) public returns (uint256) { - require(signers[msg.sender]); - require(vote[_serial][msg.sender] == 0); + require(signers[msg.sender], 'ERR_ACCESS'); + require(vote[_serial][msg.sender] == 0, 'ERR_ALREADYVOTED'); Transaction storage txx = requests[_serial]; require(txx.result == 1); @@ -156,9 +163,10 @@ contract ERC20TransferAuthorization { return txx.yay; } + // vote nay, one per signer function nay(uint256 _serial) public returns (uint256) { - require(signers[msg.sender]); - require(vote[_serial][msg.sender] == 0); + require(signers[msg.sender], 'ERR_ACCESS'); + require(vote[_serial][msg.sender] == 0, 'ERR_ALREADYVOTED'); Transaction storage txx = requests[_serial]; require(txx.result == 1); @@ -172,26 +180,36 @@ contract ERC20TransferAuthorization { return txx.nay; } + // locks the state of the vote if quorum or veto is reached + // returns true if state changes function checkResult(uint256 _serial) public returns (bool) { bool result; Transaction storage txx = requests[_serial]; - if (signerCount - txx.yay == quorum) { + if (txx.result < 1) { + return result; + } + + if (txx.yay >= quorum) { txx.result = 2; - emit Approved(_serial); + emit Approved(txx.serial, txx.yay, txx.nay); result = true; - } else if (signerCount - txx.nay == quorum) { + } else if (vetoThreshold > 0 && txx.nay >= vetoThreshold) { txx.result = -1; - removeItem(_serial); - emit Rejected(_serial); - } else if (vetoThreshold > 0 && txx.nay == vetoThreshold) { + removeItem(txx.serial); + emit Vetoed(txx.serial, txx.yay, txx.nay); + result = true; + } else if (signerCount - txx.nay < quorum) { txx.result = -1; - removeItem(_serial); - emit Vetoed(_serial); + removeItem(txx.serial); + emit Rejected(txx.serial, txx.yay, txx.nay); + result = true; } + return result; } + // execute transfer. needs positive vote result function executeRequest(uint256 _serial) public returns (bool) { Transaction storage txx = requests[_serial];