mirror of
git://holbrook.no/eth-contract-registry
synced 2024-12-22 20:27:32 +01:00
Correct interface abbreviations
This commit is contained in:
parent
29494b4366
commit
eadcdf1434
File diff suppressed because one or more lines are too long
@ -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"}]
|
||||||
|
@ -7,13 +7,17 @@ pragma solidity >0.6.11;
|
|||||||
|
|
||||||
|
|
||||||
contract CICRegistry {
|
contract CICRegistry {
|
||||||
// Implements EIP 173
|
// Implements ERC173
|
||||||
address public owner;
|
address public owner;
|
||||||
|
|
||||||
|
// Implements RegistryClient
|
||||||
bytes32[] public identifiers;
|
bytes32[] public identifiers;
|
||||||
mapping (bytes32 => address) entries; // contractidentifier -> address
|
mapping (bytes32 => address) entries; // contractidentifier -> address
|
||||||
mapping (bytes32 => bytes32[]) entryBindings; // contractidentifier -> chainidentifier
|
mapping (bytes32 => bytes32[]) entryBindings; // contractidentifier -> chainidentifier
|
||||||
|
|
||||||
|
// Implements ERC173
|
||||||
|
event OwnershipTransferred(address indexed _previousOwner, address indexed _newOwner);
|
||||||
|
|
||||||
constructor(bytes32[] memory _identifiers) {
|
constructor(bytes32[] memory _identifiers) {
|
||||||
owner = msg.sender;
|
owner = msg.sender;
|
||||||
for (uint i = 0; i < _identifiers.length; i++) {
|
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) {
|
function set(bytes32 _identifier, address _address) public returns (bool) {
|
||||||
require(msg.sender == owner);
|
require(msg.sender == owner);
|
||||||
require(entries[_identifier] == address(0));
|
require(entries[_identifier] == address(0));
|
||||||
@ -38,6 +43,7 @@ contract CICRegistry {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Implements Registry
|
||||||
function bind(bytes32 _identifier, bytes32 _reference) public returns (bool) {
|
function bind(bytes32 _identifier, bytes32 _reference) public returns (bool) {
|
||||||
require(msg.sender == owner);
|
require(msg.sender == owner);
|
||||||
require(entries[_identifier] != address(0));
|
require(entries[_identifier] != address(0));
|
||||||
@ -48,27 +54,32 @@ contract CICRegistry {
|
|||||||
|
|
||||||
// Implements EIP 173
|
// Implements EIP 173
|
||||||
function transferOwnership(address _newOwner) public returns (bool) {
|
function transferOwnership(address _newOwner) public returns (bool) {
|
||||||
|
address _oldOwner;
|
||||||
|
|
||||||
require(msg.sender == owner);
|
require(msg.sender == owner);
|
||||||
|
_oldOwner = owner;
|
||||||
owner = _newOwner;
|
owner = _newOwner;
|
||||||
|
emit OwnershipTransferred(_oldOwner, _newOwner);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implements Registry
|
// Implements RegistryClient
|
||||||
function addressOf(bytes32 _identifier) public view returns (address) {
|
function addressOf(bytes32 _identifier) public view returns (address) {
|
||||||
return entries[_identifier];
|
return entries[_identifier];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Implements ERC165
|
||||||
function supportsInterface(bytes4 _sum) public pure returns (bool) {
|
function supportsInterface(bytes4 _sum) public pure returns (bool) {
|
||||||
if (_sum == 0xffeb6416) { // Registry
|
if (_sum == 0xd719b0cc) { // Registry
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (_sum == 0xbb34534c) { // RegistryClient
|
if (_sum == 0x93c68796) { // RegistryClient
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (_sum == 0x01ffc9a7) { // EIP165
|
if (_sum == 0x01ffc9a7) { // ERC165
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (_sum == 0x9493f8b2) { // EIP173
|
if (_sum == 0x9493f8b2) { // ERC173
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user