commit 8c033e056ed3862c4085d24fe97ca1cee1df1a8d
parent 8d84dbb4871179d2669c4a6247113e93c8c84563
Author: lash <dev@holbrook.no>
Date: Thu, 3 Aug 2023 15:45:46 +0100
Add access guard to setLimitFor in index contract version
Diffstat:
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/python/erc20_limiter/data/LimiterIndex.bin b/python/erc20_limiter/data/LimiterIndex.bin
@@ -1 +1 @@
-60806040523480156200001157600080fd5b5060405162000c6238038062000c628339818101604052810190620000379190620001b0565b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050620001f7565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620001338262000106565b9050919050565b620001458162000126565b81146200015157600080fd5b50565b60008151905062000165816200013a565b92915050565b6000620001788262000126565b9050919050565b6200018a816200016b565b81146200019657600080fd5b50565b600081519050620001aa816200017f565b92915050565b60008060408385031215620001ca57620001c962000101565b5b6000620001da8582860162000154565b9250506020620001ed8582860162000199565b9150509250929050565b610a5b80620002076000396000f3fe608060405234801561001057600080fd5b506004361061009a576000357c0100000000000000000000000000000000000000000000000000000000900480633ef25013116100785780633ef250131461011b5780638da5cb5b1461014b578063bdd5544014610169578063f2fde38b146101855761009a565b806301ffc9a71461009f57806323778613146100cf57806336db43b5146100ff575b600080fd5b6100b960048036038101906100b49190610738565b6101b5565b6040516100c69190610780565b60405180910390f35b6100e960048036038101906100e491906107f9565b610309565b6040516100f69190610852565b60405180910390f35b61011960048036038101906101149190610899565b6103cd565b005b610135600480360381019061013091906108d9565b6103dc565b6040516101429190610780565b60405180910390f35b6101536104c3565b6040516101609190610915565b60405180910390f35b610183600480360381019061017e9190610930565b6104e7565b005b61019f600480360381019061019a91906108d9565b610599565b6040516101ac9190610780565b60405180910390f35b60006301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036102095760019050610304565b633ef250137c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19160361025b5760019050610304565b63237786137c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036102ad5760019050610304565b639493f8b27c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036102ff5760019050610304565b600090505b919050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632377861384846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401610384929190610983565b602060405180830381865afa1580156103a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103c591906109c1565b905092915050565b6103d88233836104e7565b5050565b600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632377861384600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518363ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040161047a929190610983565b602060405180830381865afa158015610497573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104bb91906109c1565b119050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bdd554408484846040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401610562939291906109ee565b600060405180830381600087803b15801561057c57600080fd5b505af1158015610590573d6000803e3d6000fd5b50505050505050565b60008060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146105f457600080fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050826000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36001915050919050565b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b610715816106e0565b811461072057600080fd5b50565b6000813590506107328161070c565b92915050565b60006020828403121561074e5761074d6106db565b5b600061075c84828501610723565b91505092915050565b60008115159050919050565b61077a81610765565b82525050565b60006020820190506107956000830184610771565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006107c68261079b565b9050919050565b6107d6816107bb565b81146107e157600080fd5b50565b6000813590506107f3816107cd565b92915050565b600080604083850312156108105761080f6106db565b5b600061081e858286016107e4565b925050602061082f858286016107e4565b9150509250929050565b6000819050919050565b61084c81610839565b82525050565b60006020820190506108676000830184610843565b92915050565b61087681610839565b811461088157600080fd5b50565b6000813590506108938161086d565b92915050565b600080604083850312156108b0576108af6106db565b5b60006108be858286016107e4565b92505060206108cf85828601610884565b9150509250929050565b6000602082840312156108ef576108ee6106db565b5b60006108fd848285016107e4565b91505092915050565b61090f816107bb565b82525050565b600060208201905061092a6000830184610906565b92915050565b600080600060608486031215610949576109486106db565b5b6000610957868287016107e4565b9350506020610968868287016107e4565b925050604061097986828701610884565b9150509250925092565b60006040820190506109986000830185610906565b6109a56020830184610906565b9392505050565b6000815190506109bb8161086d565b92915050565b6000602082840312156109d7576109d66106db565b5b60006109e5848285016109ac565b91505092915050565b6000606082019050610a036000830186610906565b610a106020830185610906565b610a1d6040830184610843565b94935050505056fea2646970667358221220dc667a5b0e9e0a550b8a205f4d150d6658abf72dfea71a87a8b2f7042c9ad81264736f6c63430008130033
-\ No newline at end of file
+60806040523480156200001157600080fd5b5060405162000da338038062000da38339818101604052810190620000379190620001b0565b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050620001f7565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620001338262000106565b9050919050565b620001458162000126565b81146200015157600080fd5b50565b60008151905062000165816200013a565b92915050565b6000620001788262000126565b9050919050565b6200018a816200016b565b81146200019657600080fd5b50565b600081519050620001aa816200017f565b92915050565b60008060408385031215620001ca57620001c962000101565b5b6000620001da8582860162000154565b9250506020620001ed8582860162000199565b9150509250929050565b610b9c80620002076000396000f3fe608060405234801561001057600080fd5b506004361061009a576000357c0100000000000000000000000000000000000000000000000000000000900480633ef25013116100785780633ef250131461011b5780638da5cb5b1461014b578063bdd5544014610169578063f2fde38b146101855761009a565b806301ffc9a71461009f57806323778613146100cf57806336db43b5146100ff575b600080fd5b6100b960048036038101906100b491906107fc565b6101b5565b6040516100c69190610844565b60405180910390f35b6100e960048036038101906100e491906108bd565b610309565b6040516100f69190610916565b60405180910390f35b6101196004803603810190610114919061095d565b6103cd565b005b6101356004803603810190610130919061099d565b6103dc565b6040516101429190610844565b60405180910390f35b6101536104c3565b60405161016091906109d9565b60405180910390f35b610183600480360381019061017e91906109f4565b6104e7565b005b61019f600480360381019061019a919061099d565b61065d565b6040516101ac9190610844565b60405180910390f35b60006301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036102095760019050610304565b633ef250137c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19160361025b5760019050610304565b63237786137c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036102ad5760019050610304565b639493f8b27c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036102ff5760019050610304565b600090505b919050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632377861384846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401610384929190610a47565b602060405180830381865afa1580156103a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103c59190610a85565b905092915050565b6103d88233836104e7565b5050565b600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632377861384600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518363ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040161047a929190610a47565b602060405180830381865afa158015610497573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104bb9190610a85565b119050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061056c57508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6105ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a290610b0f565b60405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bdd554408484846040518463ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040161062693929190610b2f565b600060405180830381600087803b15801561064057600080fd5b505af1158015610654573d6000803e3d6000fd5b50505050505050565b60008060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146106b857600080fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050826000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36001915050919050565b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6107d9816107a4565b81146107e457600080fd5b50565b6000813590506107f6816107d0565b92915050565b6000602082840312156108125761081161079f565b5b6000610820848285016107e7565b91505092915050565b60008115159050919050565b61083e81610829565b82525050565b60006020820190506108596000830184610835565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061088a8261085f565b9050919050565b61089a8161087f565b81146108a557600080fd5b50565b6000813590506108b781610891565b92915050565b600080604083850312156108d4576108d361079f565b5b60006108e2858286016108a8565b92505060206108f3858286016108a8565b9150509250929050565b6000819050919050565b610910816108fd565b82525050565b600060208201905061092b6000830184610907565b92915050565b61093a816108fd565b811461094557600080fd5b50565b60008135905061095781610931565b92915050565b600080604083850312156109745761097361079f565b5b6000610982858286016108a8565b925050602061099385828601610948565b9150509250929050565b6000602082840312156109b3576109b261079f565b5b60006109c1848285016108a8565b91505092915050565b6109d38161087f565b82525050565b60006020820190506109ee60008301846109ca565b92915050565b600080600060608486031215610a0d57610a0c61079f565b5b6000610a1b868287016108a8565b9350506020610a2c868287016108a8565b9250506040610a3d86828701610948565b9150509250925092565b6000604082019050610a5c60008301856109ca565b610a6960208301846109ca565b9392505050565b600081519050610a7f81610931565b92915050565b600060208284031215610a9b57610a9a61079f565b5b6000610aa984828501610a70565b91505092915050565b600082825260208201905092915050565b7f4552525f41585800000000000000000000000000000000000000000000000000600082015250565b6000610af9600783610ab2565b9150610b0482610ac3565b602082019050919050565b60006020820190508181036000830152610b2881610aec565b9050919050565b6000606082019050610b4460008301866109ca565b610b5160208301856109ca565b610b5e6040830184610907565b94935050505056fea264697066735822122016fb852dceb2839c2b2f07f6501f25abb0abe053c45719851c3cf41248c044d164736f6c63430008130033
+\ No newline at end of file
diff --git a/python/erc20_limiter/data/LimiterIndex.metadata.json b/python/erc20_limiter/data/LimiterIndex.metadata.json
@@ -1 +1 @@
-{"compiler":{"version":"0.8.19+commit.7dd6d404"},"language":"Solidity","output":{"abi":[{"inputs":[{"internalType":"address","name":"_holder","type":"address"},{"internalType":"contract Limiter","name":"_limiter","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"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"have","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_holder","type":"address"}],"name":"limitOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"setLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_holder","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"setLimitFor","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":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"compilationTarget":{"LimiterIndex.sol":"LimiterTokenRegistry"},"evmVersion":"byzantium","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":false,"runs":200},"remappings":[]},"sources":{"LimiterIndex.sol":{"keccak256":"0x9fd0c38e85af9b5c270c9fd05289279487a4d23b7df0a69d58d04cce7cc96b12","license":"AGPL-3.0-or-later","urls":["bzz-raw://b1e085fc05ff9b23e74cbda4cee4f8c69153d9737601ae1735c443735e2bc1d4","dweb:/ipfs/QmbqZmpnped8P1NgiMcTX8tCH9foN1rNDBKSdWL2o9r8Hd"]}},"version":1}
+{"compiler":{"version":"0.8.19+commit.7dd6d404"},"language":"Solidity","output":{"abi":[{"inputs":[{"internalType":"address","name":"_holder","type":"address"},{"internalType":"contract Limiter","name":"_limiter","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"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"have","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_holder","type":"address"}],"name":"limitOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"setLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_holder","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"setLimitFor","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":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"compilationTarget":{"LimiterIndex.sol":"LimiterTokenRegistry"},"evmVersion":"byzantium","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":false,"runs":200},"remappings":[]},"sources":{"LimiterIndex.sol":{"keccak256":"0xf75e17753d0aa896c0a2c134e4a8c3e4b14aaa86482323bb6add99f455f72a92","license":"AGPL-3.0-or-later","urls":["bzz-raw://6ff6dfefb6c0e6c99e57eaebf43668fc861292765299d8ee01d55ea6e49843c7","dweb:/ipfs/QmTXMTnMuieiZwE1CPDD1MLHwY3JVyCwPwJ4xuuBVcUC5G"]}},"version":1}
diff --git a/solidity/LimiterIndex.sol b/solidity/LimiterIndex.sol
@@ -35,6 +35,7 @@ contract LimiterTokenRegistry {
}
function setLimitFor(address _token, address _holder, uint256 _value) public {
+ require(msg.sender == owner || msg.sender == _holder, 'ERR_AXX');
limiter.setLimitFor(_token, _holder, _value);
}