erc20-pool

Permissioned ERC20 swap pool for EVM
Log | Files | Refs | README

commit 89b92ef7def79caffd3e569880628a11878509d2
parent 5219ca0385b94a80189fa46b9f50dd6f63b525df
Author: lash <dev@holbrook.no>
Date:   Fri, 28 Jul 2023 13:46:15 +0100

Add limiter token registry

Diffstat:
Mpython/erc20_pool/data/SwapPool.bin | 4++--
Mpython/erc20_pool/data/SwapPool.json | 2+-
Mpython/erc20_pool/data/SwapPool.metadata.json | 2+-
Mpython/erc20_pool/pool.py | 18+++++++++---------
Mpython/erc20_pool/unittest/base.py | 35+++++++++++++++++++++++++++++------
Mpython/test_requirements.txt | 2+-
Mpython/tests/test_base.py | 4----
Apython/tests/test_token.py | 86+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Msolidity/SwapPool.sol | 15++++++++-------
9 files changed, 137 insertions(+), 31 deletions(-)

diff --git a/python/erc20_pool/data/SwapPool.bin b/python/erc20_pool/data/SwapPool.bin @@ -1 +1 @@ -60a06040523480156200001157600080fd5b5060405162002f6438038062002f648339818101604052810190620000379190620003ac565b8560079081620000489190620006d7565b5084600890816200005a9190620006d7565b508360ff166080818152505081600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600681905550336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050505050620007be565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b620001a48262000159565b810181811067ffffffffffffffff82111715620001c657620001c56200016a565b5b80604052505050565b6000620001db6200013b565b9050620001e9828262000199565b919050565b600067ffffffffffffffff8211156200020c576200020b6200016a565b5b620002178262000159565b9050602081019050919050565b60005b838110156200024457808201518184015260208101905062000227565b60008484015250505050565b6000620002676200026184620001ee565b620001cf565b90508281526020810184848401111562000286576200028562000154565b5b6200029384828562000224565b509392505050565b600082601f830112620002b357620002b26200014f565b5b8151620002c584826020860162000250565b91505092915050565b600060ff82169050919050565b620002e681620002ce565b8114620002f257600080fd5b50565b6000815190506200030681620002db565b92915050565b6000819050919050565b62000321816200030c565b81146200032d57600080fd5b50565b600081519050620003418162000316565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620003748262000347565b9050919050565b620003868162000367565b81146200039257600080fd5b50565b600081519050620003a6816200037b565b92915050565b60008060008060008060c08789031215620003cc57620003cb62000145565b5b600087015167ffffffffffffffff811115620003ed57620003ec6200014a565b5b620003fb89828a016200029b565b965050602087015167ffffffffffffffff8111156200041f576200041e6200014a565b5b6200042d89828a016200029b565b95505060406200044089828a01620002f5565b94505060606200045389828a0162000330565b93505060806200046689828a0162000395565b92505060a06200047989828a0162000395565b9150509295509295509295565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680620004d957607f821691505b602082108103620004ef57620004ee62000491565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b60008160020a8302905092915050565b6000600883026200055c7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826200051a565b6200056886836200051a565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b6000620005b5620005af620005a98462000580565b6200058a565b62000580565b9050919050565b6000819050919050565b620005d18362000594565b620005e9620005e082620005bc565b8484546200052a565b825550505050565b600090565b62000600620005f1565b6200060d818484620005c6565b505050565b5b81811015620006355762000629600082620005f6565b60018101905062000613565b5050565b601f82111562000684576200064e81620004f5565b62000659846200050a565b8101602085101562000669578190505b6200068162000678856200050a565b83018262000612565b50505b505050565b60008160020a8304905092915050565b6000620006ac6000198460080262000689565b1980831691505092915050565b6000620006c7838362000699565b9150826002028217905092915050565b620006e28262000486565b67ffffffffffffffff811115620006fe57620006fd6200016a565b5b6200070a8254620004c0565b6200071782828562000639565b600060209050601f8311600181146200074f57600084156200073a578287015190505b620007468582620006b9565b865550620007b6565b601f1984166200075f86620004f5565b60005b82811015620007895784890151825560018201915060208501945060208101905062000762565b86831015620007a95784890151620007a5601f89168262000699565b8355505b6001600288020188555050505b505050505050565b60805161278a620007da600039600061055f015261278a6000f3fe608060405234801561001057600080fd5b5060043610610128576000357c01000000000000000000000000000000000000000000000000000000009004806351cff8d9116100bf5780638da5cb5b1161008e5780638da5cb5b146102d757806395d89b41146102f5578063d9caed1214610313578063f2fde38b1461032f578063f3fef3a31461035f57610128565b806351cff8d91461023f57806369fe0e2d1461026f57806386fe212d1461028b5780638705fcd4146102bb57610128565b80632c1758c1116100fb5780632c1758c1146101b7578063313ce567146101e757806331a5995d1461020557806347e7ef241461022357610128565b806301ffc9a71461012d57806306fdde031461015d57806318160ddd1461017b57806318cbbcfc14610199575b600080fd5b61014760048036038101906101429190611b8e565b61038f565b6040516101549190611bd6565b60405180910390f35b610165610491565b6040516101729190611c81565b60405180910390f35b61018361051f565b6040516101909190611cbc565b60405180910390f35b6101a1610525565b6040516101ae9190611cbc565b60405180910390f35b6101d160048036038101906101cc9190611d03565b61052a565b6040516101de9190611bd6565b60405180910390f35b6101ef61055d565b6040516101fc9190611cbc565b60405180910390f35b61020d610581565b60405161021a9190611cbc565b60405180910390f35b61023d60048036038101906102389190611d8e565b610587565b005b61025960048036038101906102549190611dce565b610777565b6040516102669190611cbc565b60405180910390f35b61028960048036038101906102849190611d03565b610813565b005b6102a560048036038101906102a09190611d03565b61093d565b6040516102b29190611cbc565b60405180910390f35b6102d560048036038101906102d09190611dce565b610a25565b005b6102df610b44565b6040516102ec9190611e0a565b60405180910390f35b6102fd610b68565b60405161030a9190611c81565b60405180910390f35b61032d60048036038101906103289190611e25565b610bf6565b005b61034960048036038101906103449190611dce565b61101c565b6040516103569190611bd6565b60405180910390f35b61037960048036038101906103749190611d8e565b61115e565b6040516103869190611cbc565b60405180910390f35b60006301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036103e3576001905061048c565b639493f8b27c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191603610435576001905061048c565b630d7491f87c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191603610487576001905061048c565b600090505b919050565b6007805461049e90611ea7565b80601f01602080910402602001604051908101604052809291908181526020018280546104ca90611ea7565b80156105175780601f106104ec57610100808354040283529160200191610517565b820191906000526020600020905b8154815290600101906020018083116104fa57829003601f168201915b505050505081565b60095481565b600381565b60006003821061053957600080fd5b6000820361054e576003600b54149050610558565b81600b5483161490505b919050565b7f000000000000000000000000000000000000000000000000000000000000000081565b600b5481565b600060606105b784600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166113b6565b6105c1848461158f565b8373ffffffffffffffffffffffffffffffffffffffff163330856040516024016105ed93929190611f37565b6040516020818303038152906040527f23b872dd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516106779190611fb5565b6000604051808303816000865af19150503d80600081146106b4576040519150601f19603f3d011682016040523d82523d6000602084013e6106b9565b606091505b50809250819350505081610702576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106f990612018565b60405180910390fd5b808060200190518101906107169190612064565b915081610758576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074f906120dd565b60405180910390fd5b826009600082825461076a919061212c565b9250508190555050505050565b600080600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061080b838261115e565b915050919050565b610820600160ff1661052a565b15610860576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610857906121ac565b60405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108e590612218565b60405180910390fd5b620f42408110610933576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161092a90612284565b60405180910390fd5b8060048190555050565b60006003821115610983576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097a906122f0565b60405180910390fd5b6000600b548316146109ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109c19061235c565b60405180910390fd5b81600b600082825417925050819055506003600b541415157f6b7e2e653f93b645d4ed7292d6429f96637084363e477c8aaea1a43ed13c284e600b54604051610a139190611cbc565b60405180910390a2600b549050919050565b610a32600260ff1661052a565b15610a72576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a69906121ac565b60405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b00576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610af790612218565b60405180910390fd5b80600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60088054610b7590611ea7565b80601f0160208091040260200160405190810160405280929190818152602001828054610ba190611ea7565b8015610bee5780601f10610bc357610100808354040283529160200191610bee565b820191906000526020600020905b815481529060010190602001808311610bd157829003601f168201915b505050505081565b600060606000806000610c0886611916565b90508086610c16919061237c565b9250610c23888885611943565b92508773ffffffffffffffffffffffffffffffffffffffff1630604051602401610c4d91906123b0565b6040516020818303038152906040527f70a08231000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610cd79190611fb5565b6000604051808303816000865af19150503d8060008114610d14576040519150601f19603f3d011682016040523d82523d6000602084013e610d19565b606091505b50809550819650505084610d62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5990612018565b60405180910390fd5b83806020019051810190610d7691906123e0565b91508083610d84919061212c565b821015610dc6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dbd90612459565b60405180910390fd5b610dd08787610587565b8773ffffffffffffffffffffffffffffffffffffffff163384604051602401610dfa929190612479565b6040516020818303038152906040527fa9059cbb000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610e849190611fb5565b6000604051808303816000865af19150503d8060008114610ec1576040519150601f19603f3d011682016040523d82523d6000602084013e610ec6565b606091505b50809550819650505084610f0f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0690612018565b60405180910390fd5b83806020019051810190610f239190612064565b945084610f65576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f5c906120dd565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110125780600a60008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461100a919061212c565b925050819055505b5050505050505050565b60008060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461107757600080fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050826000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36001915050919050565b6000806060600073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16036111f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111eb90612218565b60405180910390fd5b8473ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685604051602401611240929190612479565b6040516020818303038152906040527fa9059cbb000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516112ca9190611fb5565b6000604051808303816000865af19150503d8060008114611307576040519150601f19603f3d011682016040523d82523d6000602084013e61130c565b606091505b50809250819350505081611355576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161134c90612018565b60405180910390fd5b808060200190518101906113699190612064565b9150816113ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113a2906120dd565b60405180910390fd5b839250505092915050565b60006060600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036113f557505061158b565b8273ffffffffffffffffffffffffffffffffffffffff168460405160240161141d9190611e0a565b6040516020818303038152906040527f3ef25013000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516114a79190611fb5565b6000604051808303816000865af19150503d80600081146114e4576040519150601f19603f3d011682016040523d82523d6000602084013e6114e9565b606091505b50809250819350505081611532576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611529906124ee565b60405180910390fd5b808060200190518101906115469190612064565b915081611588576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157f9061255a565b60405180910390fd5b50505b5050565b60006060600080600073ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16036115f55750505050611912565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16863060405160240161164192919061257a565b6040516020818303038152906040527fc9301033000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516116cb9190611fb5565b6000604051808303816000865af19150503d8060008114611708576040519150601f19603f3d011682016040523d82523d6000602084013e61170d565b606091505b50809450819550505083611756576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161174d90612018565b60405180910390fd5b8280602001905181019061176a91906123e0565b91508573ffffffffffffffffffffffffffffffffffffffff163060405160240161179491906123b0565b6040516020818303038152906040527f70a08231000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405161181e9190611fb5565b6000604051808303816000865af19150503d806000811461185b576040519150601f19603f3d011682016040523d82523d6000602084013e611860565b606091505b508094508195505050836118a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118a090612018565b60405180910390fd5b828060200190518101906118bd91906123e0565b90508185826118cc919061212c565b111561190d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611904906125ef565b60405180910390fd5b505050505b5050565b60008060045483611927919061260f565b9050620f4240816119389190612680565b905080915050919050565b600080606060008073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16036119aa57849350505050611b2a565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168787876040516024016119f8939291906126b1565b6040516020818303038152906040527fdbb21d40000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051611a829190611fb5565b6000604051808303816000865af19150503d8060008114611abf576040519150601f19603f3d011682016040523d82523d6000602084013e611ac4565b606091505b50809350819450505082611b0d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b0490612734565b60405180910390fd5b81806020019051810190611b2191906123e0565b90508093505050505b9392505050565b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b611b6b81611b36565b8114611b7657600080fd5b50565b600081359050611b8881611b62565b92915050565b600060208284031215611ba457611ba3611b31565b5b6000611bb284828501611b79565b91505092915050565b60008115159050919050565b611bd081611bbb565b82525050565b6000602082019050611beb6000830184611bc7565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611c2b578082015181840152602081019050611c10565b60008484015250505050565b6000601f19601f8301169050919050565b6000611c5382611bf1565b611c5d8185611bfc565b9350611c6d818560208601611c0d565b611c7681611c37565b840191505092915050565b60006020820190508181036000830152611c9b8184611c48565b905092915050565b6000819050919050565b611cb681611ca3565b82525050565b6000602082019050611cd16000830184611cad565b92915050565b611ce081611ca3565b8114611ceb57600080fd5b50565b600081359050611cfd81611cd7565b92915050565b600060208284031215611d1957611d18611b31565b5b6000611d2784828501611cee565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611d5b82611d30565b9050919050565b611d6b81611d50565b8114611d7657600080fd5b50565b600081359050611d8881611d62565b92915050565b60008060408385031215611da557611da4611b31565b5b6000611db385828601611d79565b9250506020611dc485828601611cee565b9150509250929050565b600060208284031215611de457611de3611b31565b5b6000611df284828501611d79565b91505092915050565b611e0481611d50565b82525050565b6000602082019050611e1f6000830184611dfb565b92915050565b600080600060608486031215611e3e57611e3d611b31565b5b6000611e4c86828701611d79565b9350506020611e5d86828701611d79565b9250506040611e6e86828701611cee565b9150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680611ebf57607f821691505b602082108103611ed257611ed1611e78565b5b50919050565b6000819050919050565b6000611efd611ef8611ef384611d30565b611ed8565b611d30565b9050919050565b6000611f0f82611ee2565b9050919050565b6000611f2182611f04565b9050919050565b611f3181611f16565b82525050565b6000606082019050611f4c6000830186611dfb565b611f596020830185611f28565b611f666040830184611cad565b949350505050565b600081519050919050565b600081905092915050565b6000611f8f82611f6e565b611f998185611f79565b9350611fa9818560208601611c0d565b80840191505092915050565b6000611fc18284611f84565b915081905092915050565b7f4552525f544f4b454e0000000000000000000000000000000000000000000000600082015250565b6000612002600983611bfc565b915061200d82611fcc565b602082019050919050565b6000602082019050818103600083015261203181611ff5565b9050919050565b61204181611bbb565b811461204c57600080fd5b50565b60008151905061205e81612038565b92915050565b60006020828403121561207a57612079611b31565b5b60006120888482850161204f565b91505092915050565b7f4552525f5452414e534645520000000000000000000000000000000000000000600082015250565b60006120c7600c83611bfc565b91506120d282612091565b602082019050919050565b600060208201905081810360008301526120f6816120ba565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061213782611ca3565b915061214283611ca3565b925082820190508082111561215a576121596120fd565b5b92915050565b7f4552525f5345414c000000000000000000000000000000000000000000000000600082015250565b6000612196600883611bfc565b91506121a182612160565b602082019050919050565b600060208201905081810360008301526121c581612189565b9050919050565b7f4552525f41585800000000000000000000000000000000000000000000000000600082015250565b6000612202600783611bfc565b915061220d826121cc565b602082019050919050565b60006020820190508181036000830152612231816121f5565b9050919050565b7f4552525f4645455f544f4f5f4849474800000000000000000000000000000000600082015250565b600061226e601083611bfc565b915061227982612238565b602082019050919050565b6000602082019050818103600083015261229d81612261565b9050919050565b7f4552525f494e56414c49445f5354415445000000000000000000000000000000600082015250565b60006122da601183611bfc565b91506122e5826122a4565b602082019050919050565b60006020820190508181036000830152612309816122cd565b9050919050565b7f4552525f414c52454144595f4c4f434b45440000000000000000000000000000600082015250565b6000612346601283611bfc565b915061235182612310565b602082019050919050565b6000602082019050818103600083015261237581612339565b9050919050565b600061238782611ca3565b915061239283611ca3565b92508282039050818111156123aa576123a96120fd565b5b92915050565b60006020820190506123c56000830184611f28565b92915050565b6000815190506123da81611cd7565b92915050565b6000602082840312156123f6576123f5611b31565b5b6000612404848285016123cb565b91505092915050565b7f4552525f42414c414e4345000000000000000000000000000000000000000000600082015250565b6000612443600b83611bfc565b915061244e8261240d565b602082019050919050565b6000602082019050818103600083015261247281612436565b9050919050565b600060408201905061248e6000830185611dfb565b61249b6020830184611cad565b9392505050565b7f4552525f52454749535452590000000000000000000000000000000000000000600082015250565b60006124d8600c83611bfc565b91506124e3826124a2565b602082019050919050565b60006020820190508181036000830152612507816124cb565b9050919050565b7f4552525f554e415554485f544f4b454e00000000000000000000000000000000600082015250565b6000612544601083611bfc565b915061254f8261250e565b602082019050919050565b6000602082019050818103600083015261257381612537565b9050919050565b600060408201905061258f6000830185611dfb565b61259c6020830184611f28565b9392505050565b7f4552525f4c494d49540000000000000000000000000000000000000000000000600082015250565b60006125d9600983611bfc565b91506125e4826125a3565b602082019050919050565b60006020820190508181036000830152612608816125cc565b9050919050565b600061261a82611ca3565b915061262583611ca3565b925082820261263381611ca3565b9150828204841483151761264a576126496120fd565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061268b82611ca3565b915061269683611ca3565b9250826126a6576126a5612651565b5b828204905092915050565b60006060820190506126c66000830186611dfb565b6126d36020830185611dfb565b6126e06040830184611cad565b949350505050565b7f4552525f51554f54455200000000000000000000000000000000000000000000600082015250565b600061271e600a83611bfc565b9150612729826126e8565b602082019050919050565b6000602082019050818103600083015261274d81612711565b905091905056fea2646970667358221220b310b219755e3f7a8f6740bcd2ec909423718f1b622eee5be725b8429ee2db7164736f6c63430008130033 -\ No newline at end of file +60a06040523480156200001157600080fd5b5060405162002fd038038062002fd08339818101604052810190620000379190620003ac565b8560079081620000489190620006d7565b5084600890816200005a9190620006d7565b508360ff166080818152505081600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600681905550336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050505050620007be565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b620001a48262000159565b810181811067ffffffffffffffff82111715620001c657620001c56200016a565b5b80604052505050565b6000620001db6200013b565b9050620001e9828262000199565b919050565b600067ffffffffffffffff8211156200020c576200020b6200016a565b5b620002178262000159565b9050602081019050919050565b60005b838110156200024457808201518184015260208101905062000227565b60008484015250505050565b6000620002676200026184620001ee565b620001cf565b90508281526020810184848401111562000286576200028562000154565b5b6200029384828562000224565b509392505050565b600082601f830112620002b357620002b26200014f565b5b8151620002c584826020860162000250565b91505092915050565b600060ff82169050919050565b620002e681620002ce565b8114620002f257600080fd5b50565b6000815190506200030681620002db565b92915050565b6000819050919050565b62000321816200030c565b81146200032d57600080fd5b50565b600081519050620003418162000316565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620003748262000347565b9050919050565b620003868162000367565b81146200039257600080fd5b50565b600081519050620003a6816200037b565b92915050565b60008060008060008060c08789031215620003cc57620003cb62000145565b5b600087015167ffffffffffffffff811115620003ed57620003ec6200014a565b5b620003fb89828a016200029b565b965050602087015167ffffffffffffffff8111156200041f576200041e6200014a565b5b6200042d89828a016200029b565b95505060406200044089828a01620002f5565b94505060606200045389828a0162000330565b93505060806200046689828a0162000395565b92505060a06200047989828a0162000395565b9150509295509295509295565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680620004d957607f821691505b602082108103620004ef57620004ee62000491565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b60008160020a8302905092915050565b6000600883026200055c7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826200051a565b6200056886836200051a565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b6000620005b5620005af620005a98462000580565b6200058a565b62000580565b9050919050565b6000819050919050565b620005d18362000594565b620005e9620005e082620005bc565b8484546200052a565b825550505050565b600090565b62000600620005f1565b6200060d818484620005c6565b505050565b5b81811015620006355762000629600082620005f6565b60018101905062000613565b5050565b601f82111562000684576200064e81620004f5565b62000659846200050a565b8101602085101562000669578190505b6200068162000678856200050a565b83018262000612565b50505b505050565b60008160020a8304905092915050565b6000620006ac6000198460080262000689565b1980831691505092915050565b6000620006c7838362000699565b9150826002028217905092915050565b620006e28262000486565b67ffffffffffffffff811115620006fe57620006fd6200016a565b5b6200070a8254620004c0565b6200071782828562000639565b600060209050601f8311600181146200074f57600084156200073a578287015190505b620007468582620006b9565b865550620007b6565b601f1984166200075f86620004f5565b60005b82811015620007895784890151825560018201915060208501945060208101905062000762565b86831015620007a95784890151620007a5601f89168262000699565b8355505b6001600288020188555050505b505050505050565b6080516127f6620007da600039600061055f01526127f66000f3fe608060405234801561001057600080fd5b5060043610610128576000357c01000000000000000000000000000000000000000000000000000000009004806351cff8d9116100bf5780638da5cb5b1161008e5780638da5cb5b146102d757806395d89b41146102f5578063d9caed1214610313578063f2fde38b1461032f578063f3fef3a31461035f57610128565b806351cff8d91461023f57806369fe0e2d1461026f57806386fe212d1461028b5780638705fcd4146102bb57610128565b80632c1758c1116100fb5780632c1758c1146101b7578063313ce567146101e757806331a5995d1461020557806347e7ef241461022357610128565b806301ffc9a71461012d57806306fdde031461015d57806318160ddd1461017b57806318cbbcfc14610199575b600080fd5b61014760048036038101906101429190611b8e565b61038f565b6040516101549190611bd6565b60405180910390f35b610165610491565b6040516101729190611c81565b60405180910390f35b61018361051f565b6040516101909190611cbc565b60405180910390f35b6101a1610525565b6040516101ae9190611cbc565b60405180910390f35b6101d160048036038101906101cc9190611d03565b61052a565b6040516101de9190611bd6565b60405180910390f35b6101ef61055d565b6040516101fc9190611cbc565b60405180910390f35b61020d610581565b60405161021a9190611cbc565b60405180910390f35b61023d60048036038101906102389190611d8e565b610587565b005b61025960048036038101906102549190611dce565b610777565b6040516102669190611cbc565b60405180910390f35b61028960048036038101906102849190611d03565b610813565b005b6102a560048036038101906102a09190611d03565b61093d565b6040516102b29190611cbc565b60405180910390f35b6102d560048036038101906102d09190611dce565b610a25565b005b6102df610b44565b6040516102ec9190611e0a565b60405180910390f35b6102fd610b68565b60405161030a9190611c81565b60405180910390f35b61032d60048036038101906103289190611e25565b610bf6565b005b61034960048036038101906103449190611dce565b61101c565b6040516103569190611bd6565b60405180910390f35b61037960048036038101906103749190611d8e565b61115e565b6040516103869190611cbc565b60405180910390f35b60006301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036103e3576001905061048c565b639493f8b27c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191603610435576001905061048c565b630d7491f87c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191603610487576001905061048c565b600090505b919050565b6007805461049e90611ea7565b80601f01602080910402602001604051908101604052809291908181526020018280546104ca90611ea7565b80156105175780601f106104ec57610100808354040283529160200191610517565b820191906000526020600020905b8154815290600101906020018083116104fa57829003601f168201915b505050505081565b60095481565b600381565b60006003821061053957600080fd5b6000820361054e576003600b54149050610558565b81600b5483161490505b919050565b7f000000000000000000000000000000000000000000000000000000000000000081565b600b5481565b600060606105b784600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166113b6565b6105c1848461158f565b8373ffffffffffffffffffffffffffffffffffffffff163330856040516024016105ed93929190611f37565b6040516020818303038152906040527f23b872dd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516106779190611fb5565b6000604051808303816000865af19150503d80600081146106b4576040519150601f19603f3d011682016040523d82523d6000602084013e6106b9565b606091505b50809250819350505081610702576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106f990612018565b60405180910390fd5b808060200190518101906107169190612064565b915081610758576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074f906120dd565b60405180910390fd5b826009600082825461076a919061212c565b9250508190555050505050565b600080600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061080b838261115e565b915050919050565b610820600160ff1661052a565b15610860576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610857906121ac565b60405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108e590612218565b60405180910390fd5b620f42408110610933576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161092a90612284565b60405180910390fd5b8060048190555050565b60006003821115610983576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097a906122f0565b60405180910390fd5b6000600b548316146109ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109c19061235c565b60405180910390fd5b81600b600082825417925050819055506003600b541415157f6b7e2e653f93b645d4ed7292d6429f96637084363e477c8aaea1a43ed13c284e600b54604051610a139190611cbc565b60405180910390a2600b549050919050565b610a32600260ff1661052a565b15610a72576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a69906121ac565b60405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b00576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610af790612218565b60405180910390fd5b80600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60088054610b7590611ea7565b80601f0160208091040260200160405190810160405280929190818152602001828054610ba190611ea7565b8015610bee5780601f10610bc357610100808354040283529160200191610bee565b820191906000526020600020905b815481529060010190602001808311610bd157829003601f168201915b505050505081565b600060606000806000610c0886611916565b90508086610c16919061237c565b9250610c23888885611943565b92508773ffffffffffffffffffffffffffffffffffffffff1630604051602401610c4d91906123b0565b6040516020818303038152906040527f70a08231000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610cd79190611fb5565b6000604051808303816000865af19150503d8060008114610d14576040519150601f19603f3d011682016040523d82523d6000602084013e610d19565b606091505b50809550819650505084610d62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5990612018565b60405180910390fd5b83806020019051810190610d7691906123e0565b91508083610d84919061212c565b821015610dc6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dbd90612459565b60405180910390fd5b610dd08787610587565b8773ffffffffffffffffffffffffffffffffffffffff163384604051602401610dfa929190612479565b6040516020818303038152906040527fa9059cbb000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610e849190611fb5565b6000604051808303816000865af19150503d8060008114610ec1576040519150601f19603f3d011682016040523d82523d6000602084013e610ec6565b606091505b50809550819650505084610f0f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0690612018565b60405180910390fd5b83806020019051810190610f239190612064565b945084610f65576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f5c906120dd565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110125780600a60008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461100a919061212c565b925050819055505b5050505050505050565b60008060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461107757600080fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050826000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36001915050919050565b6000806060600073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16036111f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111eb90612218565b60405180910390fd5b8473ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685604051602401611240929190612479565b6040516020818303038152906040527fa9059cbb000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516112ca9190611fb5565b6000604051808303816000865af19150503d8060008114611307576040519150601f19603f3d011682016040523d82523d6000602084013e61130c565b606091505b50809250819350505081611355576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161134c90612018565b60405180910390fd5b808060200190518101906113699190612064565b9150816113ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113a2906120dd565b60405180910390fd5b839250505092915050565b60006060600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036113f557505061158b565b8273ffffffffffffffffffffffffffffffffffffffff168460405160240161141d9190611e0a565b6040516020818303038152906040527f3ef25013000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516114a79190611fb5565b6000604051808303816000865af19150503d80600081146114e4576040519150601f19603f3d011682016040523d82523d6000602084013e6114e9565b606091505b50809250819350505081611532576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611529906124ee565b60405180910390fd5b808060200190518101906115469190612064565b915081611588576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157f9061255a565b60405180910390fd5b50505b5050565b60006060600080600073ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16036115f55750505050611912565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16863060405160240161164192919061257a565b6040516020818303038152906040527f23778613000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516116cb9190611fb5565b6000604051808303816000865af19150503d8060008114611708576040519150601f19603f3d011682016040523d82523d6000602084013e61170d565b606091505b50809450819550505083611756576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161174d906125ef565b60405180910390fd5b8280602001905181019061176a91906123e0565b91508573ffffffffffffffffffffffffffffffffffffffff163060405160240161179491906123b0565b6040516020818303038152906040527f70a08231000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405161181e9190611fb5565b6000604051808303816000865af19150503d806000811461185b576040519150601f19603f3d011682016040523d82523d6000602084013e611860565b606091505b508094508195505050836118a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118a090612018565b60405180910390fd5b828060200190518101906118bd91906123e0565b90508185826118cc919061212c565b111561190d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119049061265b565b60405180910390fd5b505050505b5050565b60008060045483611927919061267b565b9050620f42408161193891906126ec565b905080915050919050565b600080606060008073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16036119aa57849350505050611b2a565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168787876040516024016119f89392919061271d565b6040516020818303038152906040527fdbb21d40000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051611a829190611fb5565b6000604051808303816000865af19150503d8060008114611abf576040519150601f19603f3d011682016040523d82523d6000602084013e611ac4565b606091505b50809350819450505082611b0d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b04906127a0565b60405180910390fd5b81806020019051810190611b2191906123e0565b90508093505050505b9392505050565b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b611b6b81611b36565b8114611b7657600080fd5b50565b600081359050611b8881611b62565b92915050565b600060208284031215611ba457611ba3611b31565b5b6000611bb284828501611b79565b91505092915050565b60008115159050919050565b611bd081611bbb565b82525050565b6000602082019050611beb6000830184611bc7565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611c2b578082015181840152602081019050611c10565b60008484015250505050565b6000601f19601f8301169050919050565b6000611c5382611bf1565b611c5d8185611bfc565b9350611c6d818560208601611c0d565b611c7681611c37565b840191505092915050565b60006020820190508181036000830152611c9b8184611c48565b905092915050565b6000819050919050565b611cb681611ca3565b82525050565b6000602082019050611cd16000830184611cad565b92915050565b611ce081611ca3565b8114611ceb57600080fd5b50565b600081359050611cfd81611cd7565b92915050565b600060208284031215611d1957611d18611b31565b5b6000611d2784828501611cee565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611d5b82611d30565b9050919050565b611d6b81611d50565b8114611d7657600080fd5b50565b600081359050611d8881611d62565b92915050565b60008060408385031215611da557611da4611b31565b5b6000611db385828601611d79565b9250506020611dc485828601611cee565b9150509250929050565b600060208284031215611de457611de3611b31565b5b6000611df284828501611d79565b91505092915050565b611e0481611d50565b82525050565b6000602082019050611e1f6000830184611dfb565b92915050565b600080600060608486031215611e3e57611e3d611b31565b5b6000611e4c86828701611d79565b9350506020611e5d86828701611d79565b9250506040611e6e86828701611cee565b9150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680611ebf57607f821691505b602082108103611ed257611ed1611e78565b5b50919050565b6000819050919050565b6000611efd611ef8611ef384611d30565b611ed8565b611d30565b9050919050565b6000611f0f82611ee2565b9050919050565b6000611f2182611f04565b9050919050565b611f3181611f16565b82525050565b6000606082019050611f4c6000830186611dfb565b611f596020830185611f28565b611f666040830184611cad565b949350505050565b600081519050919050565b600081905092915050565b6000611f8f82611f6e565b611f998185611f79565b9350611fa9818560208601611c0d565b80840191505092915050565b6000611fc18284611f84565b915081905092915050565b7f4552525f544f4b454e0000000000000000000000000000000000000000000000600082015250565b6000612002600983611bfc565b915061200d82611fcc565b602082019050919050565b6000602082019050818103600083015261203181611ff5565b9050919050565b61204181611bbb565b811461204c57600080fd5b50565b60008151905061205e81612038565b92915050565b60006020828403121561207a57612079611b31565b5b60006120888482850161204f565b91505092915050565b7f4552525f5452414e534645520000000000000000000000000000000000000000600082015250565b60006120c7600c83611bfc565b91506120d282612091565b602082019050919050565b600060208201905081810360008301526120f6816120ba565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061213782611ca3565b915061214283611ca3565b925082820190508082111561215a576121596120fd565b5b92915050565b7f4552525f5345414c000000000000000000000000000000000000000000000000600082015250565b6000612196600883611bfc565b91506121a182612160565b602082019050919050565b600060208201905081810360008301526121c581612189565b9050919050565b7f4552525f41585800000000000000000000000000000000000000000000000000600082015250565b6000612202600783611bfc565b915061220d826121cc565b602082019050919050565b60006020820190508181036000830152612231816121f5565b9050919050565b7f4552525f4645455f544f4f5f4849474800000000000000000000000000000000600082015250565b600061226e601083611bfc565b915061227982612238565b602082019050919050565b6000602082019050818103600083015261229d81612261565b9050919050565b7f4552525f494e56414c49445f5354415445000000000000000000000000000000600082015250565b60006122da601183611bfc565b91506122e5826122a4565b602082019050919050565b60006020820190508181036000830152612309816122cd565b9050919050565b7f4552525f414c52454144595f4c4f434b45440000000000000000000000000000600082015250565b6000612346601283611bfc565b915061235182612310565b602082019050919050565b6000602082019050818103600083015261237581612339565b9050919050565b600061238782611ca3565b915061239283611ca3565b92508282039050818111156123aa576123a96120fd565b5b92915050565b60006020820190506123c56000830184611f28565b92915050565b6000815190506123da81611cd7565b92915050565b6000602082840312156123f6576123f5611b31565b5b6000612404848285016123cb565b91505092915050565b7f4552525f42414c414e4345000000000000000000000000000000000000000000600082015250565b6000612443600b83611bfc565b915061244e8261240d565b602082019050919050565b6000602082019050818103600083015261247281612436565b9050919050565b600060408201905061248e6000830185611dfb565b61249b6020830184611cad565b9392505050565b7f4552525f52454749535452590000000000000000000000000000000000000000600082015250565b60006124d8600c83611bfc565b91506124e3826124a2565b602082019050919050565b60006020820190508181036000830152612507816124cb565b9050919050565b7f4552525f554e415554485f544f4b454e00000000000000000000000000000000600082015250565b6000612544601083611bfc565b915061254f8261250e565b602082019050919050565b6000602082019050818103600083015261257381612537565b9050919050565b600060408201905061258f6000830185611dfb565b61259c6020830184611f28565b9392505050565b7f4552525f4c494d49544552000000000000000000000000000000000000000000600082015250565b60006125d9600b83611bfc565b91506125e4826125a3565b602082019050919050565b60006020820190508181036000830152612608816125cc565b9050919050565b7f4552525f4c494d49540000000000000000000000000000000000000000000000600082015250565b6000612645600983611bfc565b91506126508261260f565b602082019050919050565b6000602082019050818103600083015261267481612638565b9050919050565b600061268682611ca3565b915061269183611ca3565b925082820261269f81611ca3565b915082820484148315176126b6576126b56120fd565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006126f782611ca3565b915061270283611ca3565b925082612712576127116126bd565b5b828204905092915050565b60006060820190506127326000830186611dfb565b61273f6020830185611dfb565b61274c6040830184611cad565b949350505050565b7f4552525f51554f54455200000000000000000000000000000000000000000000600082015250565b600061278a600a83611bfc565b915061279582612754565b602082019050919050565b600060208201905081810360008301526127b98161277d565b905091905056fea2646970667358221220ad942c2e5f9ec53985ec9292b7b3a6f38a6ae035db5c5a1a9d32df888e2b310664736f6c63430008130033 +\ No newline at end of file diff --git a/python/erc20_pool/data/SwapPool.json b/python/erc20_pool/data/SwapPool.json @@ -1 +1 @@ -[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"uint8","name":"_decimals","type":"uint8"},{"internalType":"bytes32","name":"_declaration","type":"bytes32"},{"internalType":"address","name":"_tokenRegistry","type":"address"},{"internalType":"address","name":"_limitRegistry","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bool","name":"_final","type":"bool"},{"indexed":false,"internalType":"uint256","name":"_sealState","type":"uint256"}],"name":"SealStateChange","type":"event"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_state","type":"uint256"}],"name":"isSealed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSealState","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_state","type":"uint256"}],"name":"seal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sealState","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_feeAddress","type":"address"}],"name":"setFeeAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_sum","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_outToken","type":"address"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_outToken","type":"address"},{"internalType":"address","name":"_inToken","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_outToken","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}] +[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"uint8","name":"_decimals","type":"uint8"},{"internalType":"bytes32","name":"_declaration","type":"bytes32"},{"internalType":"address","name":"_tokenRegistry","type":"address"},{"internalType":"address","name":"_tokenLimiter","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bool","name":"_final","type":"bool"},{"indexed":false,"internalType":"uint256","name":"_sealState","type":"uint256"}],"name":"SealStateChange","type":"event"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_state","type":"uint256"}],"name":"isSealed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSealState","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_state","type":"uint256"}],"name":"seal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sealState","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_feeAddress","type":"address"}],"name":"setFeeAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_sum","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_outToken","type":"address"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_outToken","type":"address"},{"internalType":"address","name":"_inToken","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_outToken","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}] diff --git a/python/erc20_pool/data/SwapPool.metadata.json b/python/erc20_pool/data/SwapPool.metadata.json @@ -1 +1 @@ -{"compiler":{"version":"0.8.19+commit.7dd6d404"},"language":"Solidity","output":{"abi":[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"uint8","name":"_decimals","type":"uint8"},{"internalType":"bytes32","name":"_declaration","type":"bytes32"},{"internalType":"address","name":"_tokenRegistry","type":"address"},{"internalType":"address","name":"_limitRegistry","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bool","name":"_final","type":"bool"},{"indexed":false,"internalType":"uint256","name":"_sealState","type":"uint256"}],"name":"SealStateChange","type":"event"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_state","type":"uint256"}],"name":"isSealed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSealState","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_state","type":"uint256"}],"name":"seal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sealState","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_feeAddress","type":"address"}],"name":"setFeeAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_sum","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_outToken","type":"address"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_outToken","type":"address"},{"internalType":"address","name":"_inToken","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_outToken","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"compilationTarget":{"SwapPool.sol":"SwapPool"},"evmVersion":"byzantium","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":false,"runs":200},"remappings":[]},"sources":{"SwapPool.sol":{"keccak256":"0x3c82726f2bc94fd37c90dd161143155eb73ea0d4ede9c414554641d02db38c05","license":"AGPL-3.0-or-later","urls":["bzz-raw://53756d11bf73951a4165e907429c5b5365cf7da530193cd75cace975e4dd1e2a","dweb:/ipfs/QmR7gMvYpfaWVQPT8ZhyPMCxqa1dhvrhRCTzbrCb7WpMBv"]}},"version":1} +{"compiler":{"version":"0.8.19+commit.7dd6d404"},"language":"Solidity","output":{"abi":[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"uint8","name":"_decimals","type":"uint8"},{"internalType":"bytes32","name":"_declaration","type":"bytes32"},{"internalType":"address","name":"_tokenRegistry","type":"address"},{"internalType":"address","name":"_tokenLimiter","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bool","name":"_final","type":"bool"},{"indexed":false,"internalType":"uint256","name":"_sealState","type":"uint256"}],"name":"SealStateChange","type":"event"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_state","type":"uint256"}],"name":"isSealed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSealState","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_state","type":"uint256"}],"name":"seal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sealState","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_feeAddress","type":"address"}],"name":"setFeeAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_sum","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_outToken","type":"address"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_outToken","type":"address"},{"internalType":"address","name":"_inToken","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_outToken","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"compilationTarget":{"SwapPool.sol":"SwapPool"},"evmVersion":"byzantium","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":false,"runs":200},"remappings":[]},"sources":{"SwapPool.sol":{"keccak256":"0x436bcba6d38310e5caa8a4a2a83f309f95016521e052a88139f4241f7fc1cab6","license":"AGPL-3.0-or-later","urls":["bzz-raw://056d060f236df6c0f325ff74a9299f767dd42236494e9e14065a7d5626de952e","dweb:/ipfs/QmTRDCaMKu84ZrJqrKk3mwfDBK6Cnt9G5zLgABGyNyY23F"]}},"version":1} diff --git a/python/erc20_pool/pool.py b/python/erc20_pool/pool.py @@ -37,29 +37,29 @@ class Pool(TxFactory): __abi = None __bytecode = None - def constructor(self, sender_address, name, symbol, decimals, declaration=None, accounts_registry=None, limit_registry=None, tx_format=TxFormat.JSONRPC, version=None): - code = self.cargs(name, symbol, decimals, declaration=declaration, accounts_registry=accounts_registry, limit_registry=limit_registry, version=version) + def constructor(self, sender_address, name, symbol, decimals, declaration=None, token_registry=None, token_limiter=None, tx_format=TxFormat.JSONRPC, version=None): + code = self.cargs(name, symbol, decimals, declaration=declaration, token_registry=token_registry, token_limiter=token_limiter, version=version) tx = self.template(sender_address, None, use_nonce=True) tx = self.set_code(tx, code) return self.finalize(tx, tx_format) @staticmethod - def cargs(name, symbol, decimals, declaration=None, accounts_registry=None, limit_registry=None, version=None): + def cargs(name, symbol, decimals, declaration=None, token_registry=None, token_limiter=None, version=None): if declaration == None: declaration = ZERO_CONTENT - if accounts_registry == None: - accounts_registry = ZERO_ADDRESS - if limit_registry == None: - limit_registry = ZERO_ADDRESS + if token_registry == None: + token_registry = ZERO_ADDRESS + if token_limiter == None: + token_limiter = ZERO_ADDRESS code = Pool.bytecode(version=version) enc = ABIContractEncoder() enc.string(name) enc.string(symbol) enc.uint256(decimals) enc.bytes32(declaration) - enc.address(accounts_registry) - enc.address(limit_registry) + enc.address(token_registry) + enc.address(token_limiter) args = enc.get() code += args logg.debug('constructor code: ' + args) diff --git a/python/erc20_pool/unittest/base.py b/python/erc20_pool/unittest/base.py @@ -14,6 +14,7 @@ from chainlib.eth.block import block_latest from eth_accounts_index.unittest import TestAccountsIndex from eth_accounts_index.registry import AccountRegistry from giftable_erc20_token import GiftableToken +from erc20_limiter.unittest import TestLimiter # local imports from erc20_pool import Pool @@ -21,18 +22,21 @@ from erc20_pool import Pool logg = logging.getLogger(__name__) hash_of_foo = '2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae' -hash_of_bar = 'fcde2b2edba56bf408601fb721fe9b5c338d10ee429ea04fae5511b68fbf8fb9' -hash_of_baz = 'baa5a0964d3320fbc0c6a922140453c8513ea24ab8fd0577034804a967248096' +#hash_of_bar = 'fcde2b2edba56bf408601fb721fe9b5c338d10ee429ea04fae5511b68fbf8fb9' +#hash_of_baz = 'baa5a0964d3320fbc0c6a922140453c8513ea24ab8fd0577034804a967248096' -class TestERC20Pool(TestGiftableToken): +class TestERC20PoolBase(TestGiftableToken): expire = 0 def setUp(self): - super(TestERC20Pool, self).setUp() - + super(TestERC20PoolBase, self).setUp() self.foo_address = self.address + self.publish_tokens() + + + def publish_tokens(self): self.bar_address = self.publish_giftable_token('Bar Token', 'BAR', 16) self.baz_address = self.publish_giftable_token('Baz Token', 'BAZ', 16) self.initial_supply_bar = 1 << 20 @@ -52,8 +56,11 @@ class TestERC20Pool(TestGiftableToken): r = self.conn.do(o) self.assertEqual(r['status'], 1) + + def publish_pool(self, declaration=hash_of_foo, token_registry=None, token_limiter=None): + nonce_oracle = RPCNonceOracle(self.accounts[0], conn=self.conn) c = Pool(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) - (tx_hash, o) = c.constructor(self.accounts[0], "Big Pool", "BIG", 16) + (tx_hash, o) = c.constructor(self.accounts[0], "Big Pool", "BIG", 16, declaration=declaration, token_registry=token_registry, token_limiter=token_limiter) self.rpc.do(o) o = receipt(tx_hash) r = self.rpc.do(o) @@ -62,3 +69,19 @@ class TestERC20Pool(TestGiftableToken): self.address = self.pool_address logg.debug('published bar token {}, baz token {}'.format(self.bar_address, self.baz_address)) logg.debug('published pool on address {} with hash {}'.format(self.pool_address, tx_hash)) + + +class TestERC20Pool(TestERC20PoolBase): + + + def setUp(self): + super(TestERC20Pool, self).setUp() + self.publish_pool() + + +class TestERC20PoolLimiter(TestERC20PoolBase, TestLimiter): + + def setUp(self): + super(TestERC20PoolLimiter, self).setUp() + self.limiter_address = self.publish_limiter() + self.publish_pool(token_limiter=self.limiter_address) diff --git a/python/test_requirements.txt b/python/test_requirements.txt @@ -1,4 +1,4 @@ eth_tester==0.5.0b3 py-evm==0.3.0a20 eth-interface==0.1.1 -eth-accounts-index~=0.5.3 +erc20-limiter==0.0.2 diff --git a/python/tests/test_base.py b/python/tests/test_base.py @@ -12,10 +12,6 @@ from giftable_erc20_token import GiftableToken # local imports from erc20_pool.unittest import TestERC20Pool from erc20_pool import Pool -#from evm_tokenvote.unittest.base import hash_of_foo -#from evm_tokenvote import Voter -#from evm_tokenvote import ProposalState - logging.basicConfig(level=logging.DEBUG) logg = logging.getLogger() diff --git a/python/tests/test_token.py b/python/tests/test_token.py @@ -0,0 +1,86 @@ +# standard imports +import unittest +import logging +import os +from chainlib.eth.nonce import RPCNonceOracle +from chainlib.eth.tx import receipt +from chainlib.eth.block import block_latest +from hexathon import same as same_hex +from eth_erc20 import ERC20 +from giftable_erc20_token import GiftableToken +from erc20_limiter import Limiter + +# local imports +from erc20_pool.unittest import TestERC20PoolLimiter +from erc20_pool import Pool + +logging.basicConfig(level=logging.DEBUG) +logg = logging.getLogger() + +class TestPoolLimit(TestERC20PoolLimiter): + + def test_deposit_limit(self): + nonce_oracle = RPCNonceOracle(self.accounts[0], conn=self.conn) + c = ERC20(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) + (tx_hash, o) = c.approve(self.foo_address, self.accounts[0], self.pool_address, 1024) + self.rpc.do(o) + o = receipt(tx_hash) + r = self.rpc.do(o) + self.assertEqual(r['status'], 1) + + c = Pool(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) + (tx_hash, o) = c.deposit(self.pool_address, self.accounts[0], self.foo_address, 513) + self.rpc.do(o) + o = receipt(tx_hash) + r = self.rpc.do(o) + self.assertEqual(r['status'], 0) + + c = Limiter(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) + (tx_hash, o) = c.set_limit(self.limiter_address, self.accounts[0], self.foo_address, 512, holder_address=self.pool_address) + self.rpc.do(o) + o = receipt(tx_hash) + r = self.rpc.do(o) + self.assertEqual(r['status'], 1) + + o = c.limit_of(self.limiter_address, self.foo_address, self.pool_address, sender_address=self.accounts[0]) + r = self.rpc.do(o) + self.assertEqual(int(r, 16), 512) + + c = Pool(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) + (tx_hash, o) = c.deposit(self.pool_address, self.accounts[0], self.foo_address, 513) + self.rpc.do(o) + o = receipt(tx_hash) + r = self.rpc.do(o) + self.assertEqual(r['status'], 0) + + c = Pool(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) + (tx_hash, o) = c.deposit(self.pool_address, self.accounts[0], self.foo_address, 512) + self.rpc.do(o) + o = receipt(tx_hash) + r = self.rpc.do(o) + self.assertEqual(r['status'], 1) + + c = Pool(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) + (tx_hash, o) = c.deposit(self.pool_address, self.accounts[0], self.foo_address, 1) + self.rpc.do(o) + o = receipt(tx_hash) + r = self.rpc.do(o) + self.assertEqual(r['status'], 0) + + c = Limiter(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) + (tx_hash, o) = c.set_limit(self.limiter_address, self.accounts[0], self.foo_address, 513, holder_address=self.pool_address) + self.rpc.do(o) + o = receipt(tx_hash) + r = self.rpc.do(o) + self.assertEqual(r['status'], 1) + + c = Pool(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) + (tx_hash, o) = c.deposit(self.pool_address, self.accounts[0], self.foo_address, 1) + self.rpc.do(o) + o = receipt(tx_hash) + r = self.rpc.do(o) + self.assertEqual(r['status'], 1) + + +if __name__ == '__main__': + unittest.main() diff --git a/solidity/SwapPool.sol b/solidity/SwapPool.sol @@ -3,14 +3,14 @@ pragma solidity ^0.8.0; // Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746 // SPDX-License-Identifier: AGPL-3.0-or-later // File-Version: 1 -// Description: Voting contract using ERC20 tokens as shares +// Description: ACL-enabled ERC20 token swap for tokens with compatible properties. contract SwapPool { // Implements EIP173 address public owner; address tokenRegistry; - address limitRegistry; + address tokenLimiter; address quoter; uint256 feePpm; address feeAddress; @@ -36,12 +36,12 @@ contract SwapPool { // EIP173 event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); // EIP173 - constructor(string memory _name, string memory _symbol, uint8 _decimals, bytes32 _declaration, address _tokenRegistry, address _limitRegistry) { + constructor(string memory _name, string memory _symbol, uint8 _decimals, bytes32 _declaration, address _tokenRegistry, address _tokenLimiter) { name = _name; symbol = _symbol; decimals = _decimals; tokenRegistry = _tokenRegistry; - limitRegistry = _limitRegistry; + tokenLimiter = _tokenLimiter; declaration = _declaration; owner = msg.sender; } @@ -200,12 +200,13 @@ contract SwapPool { uint256 limit; uint256 balance; - if (limitRegistry == address(0)) { + if (tokenLimiter == address(0)) { return; } - (r, v) = limitRegistry.call(abi.encodeWithSignature("limitOf(address, address)", _token, this)); - require(r, "ERR_TOKEN"); + + (r, v) = tokenLimiter.call(abi.encodeWithSignature("limitOf(address,address)", _token, this)); + require(r, "ERR_LIMITER"); limit = abi.decode(v, (uint256)); (r, v) = _token.call(abi.encodeWithSignature("balanceOf(address)", this));