diff --git a/python/eth_contract_registry/data/Registry.bin b/python/eth_contract_registry/data/Registry.bin index 626b8d3..efb0547 100644 --- a/python/eth_contract_registry/data/Registry.bin +++ b/python/eth_contract_registry/data/Registry.bin @@ -1 +1 @@ -60806040523480156200001157600080fd5b5060405162000e9e38038062000e9e8339818101604052810190620000379190620002ac565b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060005b8151811015620000e05760018282815181106200009c576200009b620002fd565b5b602002602001015190806001815401808255809150506001900390600052602060002001600090919091909150558080620000d79062000365565b9150506200007a565b5050620003b2565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6200014c8262000101565b810181811067ffffffffffffffff821117156200016e576200016d62000112565b5b80604052505050565b600062000183620000e8565b905062000191828262000141565b919050565b600067ffffffffffffffff821115620001b457620001b362000112565b5b602082029050602081019050919050565b600080fd5b6000819050919050565b620001df81620001ca565b8114620001eb57600080fd5b50565b600081519050620001ff81620001d4565b92915050565b60006200021c620002168462000196565b62000177565b90508083825260208201905060208402830185811115620002425762000241620001c5565b5b835b818110156200026f57806200025a8882620001ee565b84526020840193505060208101905062000244565b5050509392505050565b600082601f830112620002915762000290620000fc565b5b8151620002a384826020860162000205565b91505092915050565b600060208284031215620002c557620002c4620000f2565b5b600082015167ffffffffffffffff811115620002e657620002e5620000f7565b5b620002f48482850162000279565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000819050919050565b600062000372826200035b565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203620003a757620003a66200032c565b5b600182019050919050565b610adc80620003c26000396000f3fe608060405234801561001057600080fd5b506004361061009a576000357c0100000000000000000000000000000000000000000000000000000000900480638da5cb5b116100785780638da5cb5b1461012f578063ba44593c1461014d578063bb34534c1461017d578063f2fde38b146101ad5761009a565b806301ffc9a71461009f57806328f2d4da146100cf5780636d5de9f0146100ff575b600080fd5b6100b960048036038101906100b49190610778565b6101dd565b6040516100c691906107c0565b60405180910390f35b6100e960048036038101906100e49190610811565b610331565b6040516100f69190610857565b60405180910390f35b6101196004803603810190610114919061089e565b610355565b60405161012691906107c0565b60405180910390f35b610137610460565b604051610144919061091f565b60405180910390f35b61016760048036038101906101629190610966565b610484565b60405161017491906107c0565b60405180910390f35b610197600480360381019061019291906109a6565b61063a565b6040516101a4919061091f565b60405180910390f35b6101c760048036038101906101c291906109d3565b610677565b6040516101d491906107c0565b60405180910390f35b600063ffeb64167c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191603610231576001905061032c565b63bb34534c7c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191603610283576001905061032c565b6301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036102d5576001905061032c565b639493f8b27c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191603610327576001905061032c565b600090505b919050565b6001818154811061034157600080fd5b906000526020600020016000915090505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146103b057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff166002600085815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff160361041c57600080fd5b600360008481526020019081526020016000208290806001815401808255809150506001900390600052602060002001600090919091909150556001905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146104df57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff166002600085815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461054b57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361058457600080fd5b6000805b6001805490508110156105d25784600182815481106105aa576105a9610a00565b5b9060005260206000200154036105bf57600191505b80806105ca90610a5e565b915050610588565b50806105dd57600080fd5b826002600086815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600191505092915050565b60006002600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146106d257600080fd5b816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b61075581610720565b811461076057600080fd5b50565b6000813590506107728161074c565b92915050565b60006020828403121561078e5761078d61071b565b5b600061079c84828501610763565b91505092915050565b60008115159050919050565b6107ba816107a5565b82525050565b60006020820190506107d560008301846107b1565b92915050565b6000819050919050565b6107ee816107db565b81146107f957600080fd5b50565b60008135905061080b816107e5565b92915050565b6000602082840312156108275761082661071b565b5b6000610835848285016107fc565b91505092915050565b6000819050919050565b6108518161083e565b82525050565b600060208201905061086c6000830184610848565b92915050565b61087b8161083e565b811461088657600080fd5b50565b60008135905061089881610872565b92915050565b600080604083850312156108b5576108b461071b565b5b60006108c385828601610889565b92505060206108d485828601610889565b9150509250929050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610909826108de565b9050919050565b610919816108fe565b82525050565b60006020820190506109346000830184610910565b92915050565b610943816108fe565b811461094e57600080fd5b50565b6000813590506109608161093a565b92915050565b6000806040838503121561097d5761097c61071b565b5b600061098b85828601610889565b925050602061099c85828601610951565b9150509250929050565b6000602082840312156109bc576109bb61071b565b5b60006109ca84828501610889565b91505092915050565b6000602082840312156109e9576109e861071b565b5b60006109f784828501610951565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610a69826107db565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610a9b57610a9a610a2f565b5b60018201905091905056fea26469706673582212204c6e355c046dc11d1a24752df06c164b0ea2ab3ce11233f422b81a383a26462664736f6c63430008120033 \ No newline at end of file +60806040523480156200001157600080fd5b5060405162000f1c38038062000f1c8339818101604052810190620000379190620002ac565b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060005b8151811015620000e05760018282815181106200009c576200009b620002fd565b5b602002602001015190806001815401808255809150506001900390600052602060002001600090919091909150558080620000d79062000365565b9150506200007a565b5050620003b2565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6200014c8262000101565b810181811067ffffffffffffffff821117156200016e576200016d62000112565b5b80604052505050565b600062000183620000e8565b905062000191828262000141565b919050565b600067ffffffffffffffff821115620001b457620001b362000112565b5b602082029050602081019050919050565b600080fd5b6000819050919050565b620001df81620001ca565b8114620001eb57600080fd5b50565b600081519050620001ff81620001d4565b92915050565b60006200021c620002168462000196565b62000177565b90508083825260208201905060208402830185811115620002425762000241620001c5565b5b835b818110156200026f57806200025a8882620001ee565b84526020840193505060208101905062000244565b5050509392505050565b600082601f830112620002915762000290620000fc565b5b8151620002a384826020860162000205565b91505092915050565b600060208284031215620002c557620002c4620000f2565b5b600082015167ffffffffffffffff811115620002e657620002e5620000f7565b5b620002f48482850162000279565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000819050919050565b600062000372826200035b565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203620003a757620003a66200032c565b5b600182019050919050565b610b5a80620003c26000396000f3fe608060405234801561001057600080fd5b506004361061009a576000357c0100000000000000000000000000000000000000000000000000000000900480638da5cb5b116100785780638da5cb5b1461012f578063ba44593c1461014d578063bb34534c1461017d578063f2fde38b146101ad5761009a565b806301ffc9a71461009f57806328f2d4da146100cf5780636d5de9f0146100ff575b600080fd5b6100b960048036038101906100b491906107f6565b6101dd565b6040516100c6919061083e565b60405180910390f35b6100e960048036038101906100e4919061088f565b610331565b6040516100f691906108d5565b60405180910390f35b6101196004803603810190610114919061091c565b610355565b604051610126919061083e565b60405180910390f35b610137610460565b604051610144919061099d565b60405180910390f35b610167600480360381019061016291906109e4565b610484565b604051610174919061083e565b60405180910390f35b61019760048036038101906101929190610a24565b61063a565b6040516101a4919061099d565b60405180910390f35b6101c760048036038101906101c29190610a51565b610677565b6040516101d4919061083e565b60405180910390f35b600063d719b0cc7c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191603610231576001905061032c565b6393c687967c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191603610283576001905061032c565b6301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036102d5576001905061032c565b639493f8b27c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191603610327576001905061032c565b600090505b919050565b6001818154811061034157600080fd5b906000526020600020016000915090505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146103b057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff166002600085815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff160361041c57600080fd5b600360008481526020019081526020016000208290806001815401808255809150506001900390600052602060002001600090919091909150556001905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146104df57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff166002600085815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461054b57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361058457600080fd5b6000805b6001805490508110156105d25784600182815481106105aa576105a9610a7e565b5b9060005260206000200154036105bf57600191505b80806105ca90610adc565b915050610588565b50806105dd57600080fd5b826002600086815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600191505092915050565b60006002600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b60008060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146106d257600080fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050826000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508273ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36001915050919050565b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6107d38161079e565b81146107de57600080fd5b50565b6000813590506107f0816107ca565b92915050565b60006020828403121561080c5761080b610799565b5b600061081a848285016107e1565b91505092915050565b60008115159050919050565b61083881610823565b82525050565b6000602082019050610853600083018461082f565b92915050565b6000819050919050565b61086c81610859565b811461087757600080fd5b50565b60008135905061088981610863565b92915050565b6000602082840312156108a5576108a4610799565b5b60006108b38482850161087a565b91505092915050565b6000819050919050565b6108cf816108bc565b82525050565b60006020820190506108ea60008301846108c6565b92915050565b6108f9816108bc565b811461090457600080fd5b50565b600081359050610916816108f0565b92915050565b6000806040838503121561093357610932610799565b5b600061094185828601610907565b925050602061095285828601610907565b9150509250929050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006109878261095c565b9050919050565b6109978161097c565b82525050565b60006020820190506109b2600083018461098e565b92915050565b6109c18161097c565b81146109cc57600080fd5b50565b6000813590506109de816109b8565b92915050565b600080604083850312156109fb576109fa610799565b5b6000610a0985828601610907565b9250506020610a1a858286016109cf565b9150509250929050565b600060208284031215610a3a57610a39610799565b5b6000610a4884828501610907565b91505092915050565b600060208284031215610a6757610a66610799565b5b6000610a75848285016109cf565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610ae782610859565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610b1957610b18610aad565b5b60018201905091905056fea2646970667358221220ec3f6c5948f12d149cbdd2760ca8c25e64e9eed2e9c1ba6a5942bffb9db55b4364736f6c63430008120033 \ No newline at end of file diff --git a/python/eth_contract_registry/data/Registry.json b/python/eth_contract_registry/data/Registry.json index 54d1a9e..14a98df 100644 --- a/python/eth_contract_registry/data/Registry.json +++ b/python/eth_contract_registry/data/Registry.json @@ -1 +1 @@ -[{"inputs":[{"internalType":"bytes32[]","name":"_identifiers","type":"bytes32[]"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"bytes32","name":"_identifier","type":"bytes32"}],"name":"addressOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_identifier","type":"bytes32"},{"internalType":"bytes32","name":"_reference","type":"bytes32"}],"name":"bind","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"identifiers","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_identifier","type":"bytes32"},{"internalType":"address","name":"_address","type":"address"}],"name":"set","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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"}] +[{"inputs":[{"internalType":"bytes32[]","name":"_identifiers","type":"bytes32[]"}],"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":"bytes32","name":"_identifier","type":"bytes32"}],"name":"addressOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_identifier","type":"bytes32"},{"internalType":"bytes32","name":"_reference","type":"bytes32"}],"name":"bind","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"identifiers","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_identifier","type":"bytes32"},{"internalType":"address","name":"_address","type":"address"}],"name":"set","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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"}] diff --git a/solidity/Registry.sol b/solidity/Registry.sol index 4263bdf..d7ff83e 100644 --- a/solidity/Registry.sol +++ b/solidity/Registry.sol @@ -7,13 +7,17 @@ pragma solidity >0.6.11; contract CICRegistry { - // Implements EIP 173 + // Implements ERC173 address public owner; + // Implements RegistryClient bytes32[] public identifiers; mapping (bytes32 => address) entries; // contractidentifier -> address mapping (bytes32 => bytes32[]) entryBindings; // contractidentifier -> chainidentifier + // Implements ERC173 + event OwnershipTransferred(address indexed _previousOwner, address indexed _newOwner); + constructor(bytes32[] memory _identifiers) { owner = msg.sender; for (uint i = 0; i < _identifiers.length; i++) { @@ -21,6 +25,7 @@ contract CICRegistry { } } + // Implements Registry function set(bytes32 _identifier, address _address) public returns (bool) { require(msg.sender == owner); require(entries[_identifier] == address(0)); @@ -38,6 +43,7 @@ contract CICRegistry { return true; } + // Implements Registry function bind(bytes32 _identifier, bytes32 _reference) public returns (bool) { require(msg.sender == owner); require(entries[_identifier] != address(0)); @@ -48,27 +54,32 @@ contract CICRegistry { // Implements EIP 173 function transferOwnership(address _newOwner) public returns (bool) { + address _oldOwner; + require(msg.sender == owner); + _oldOwner = owner; owner = _newOwner; + emit OwnershipTransferred(_oldOwner, _newOwner); return true; } - // Implements Registry + // Implements RegistryClient function addressOf(bytes32 _identifier) public view returns (address) { return entries[_identifier]; } + // Implements ERC165 function supportsInterface(bytes4 _sum) public pure returns (bool) { - if (_sum == 0xffeb6416) { // Registry + if (_sum == 0xd719b0cc) { // Registry return true; } - if (_sum == 0xbb34534c) { // RegistryClient + if (_sum == 0x93c68796) { // RegistryClient return true; } - if (_sum == 0x01ffc9a7) { // EIP165 + if (_sum == 0x01ffc9a7) { // ERC165 return true; } - if (_sum == 0x9493f8b2) { // EIP173 + if (_sum == 0x9493f8b2) { // ERC173 return true; } return false;