Code for 0xd199…38b3 (ContractRegistry)
Since block 5742824
Verified contract
- /**
- *Submitted for verification at Etherscan.io on 2018-06-06
- */
-
- pragma solidity ^0.4.21;
-
- /*
- Owned contract interface
- */
- contract IOwned {
- // this function isn't abstract since the compiler emits automatically generated getter functions as external
- function owner() public view returns (address) {}
-
- function transferOwnership(address _newOwner) public;
- function acceptOwnership() public;
- }
-
- /*
- Provides support and utilities for contract ownership
- */
- contract Owned is IOwned {
- address public owner;
- address public newOwner;
-
- event OwnerUpdate(address indexed _prevOwner, address indexed _newOwner);
-
- /**
- @dev constructor
- */
- function Owned() public {
- owner = msg.sender;
- }
-
- // allows execution by the owner only
- modifier ownerOnly {
- assert(msg.sender == owner);
- _;
- }
-
- /**
- @dev allows transferring the contract ownership
- the new owner still needs to accept the transfer
- can only be called by the contract owner
-
- @param _newOwner new contract owner
- */
- function transferOwnership(address _newOwner) public ownerOnly {
- require(_newOwner != owner);
- newOwner = _newOwner;
- }
-
- /**
- @dev used by a new owner to accept an ownership transfer
- */
- function acceptOwnership() public {
- require(msg.sender == newOwner);
- emit OwnerUpdate(owner, newOwner);
- owner = newOwner;
- newOwner = address(0);
- }
- }
-
- /*
- Contract Registry interface
- */
- contract IContractRegistry {
- function getAddress(bytes32 _contractName) public view returns (address);
- }
-
- /**
- Contract Registry
-
- The contract registry keeps contract addresses by name.
- The owner can update contract addresses so that a contract name always points to the latest version
- of the given contract.
- Other contracts can query the registry to get updated addresses instead of depending on specific
- addresses.
-
- Note that contract names are limited to 32 bytes, UTF8 strings to optimize gas costs
- */
- contract ContractRegistry is IContractRegistry, Owned {
- mapping (bytes32 => address) addresses;
-
- event AddressUpdate(bytes32 indexed _contractName, address _contractAddress);
-
- /**
- @dev constructor
- */
- function ContractRegistry() public {
- }
-
- /**
- @dev returns the address associated with the given contract name
-
- @param _contractName contract name
-
- @return contract address
- */
- function getAddress(bytes32 _contractName) public view returns (address) {
- return addresses[_contractName];
- }
-
- /**
- @dev registers a new address for the contract name
-
- @param _contractName contract name
- @param _contractAddress contract address
- */
- function registerAddress(bytes32 _contractName, address _contractAddress) public ownerOnly {
- require(_contractName.length > 0); // validating input
-
- addresses[_contractName] = _contractAddress;
- emit AddressUpdate(_contractName, _contractAddress);
- }
- }
Contract sourced from Etherscan. Solidity version v0.4.21+commit.dfe3193c
.
Panoramix decompilation
# Palkeoramix decompiler. def storage: owner is address at storage 0 newOwner is address at storage 1 address is mapping of address at storage 2 def getAddress(bytes32 id): # not payable return address[id] def owner(): # not payable return owner def newOwner(): # not payable return newOwner # # Regular functions # def _fallback(?) payable: # default function revert def transferOwnership(address newOwner): # not payable require owner == caller require owner != newOwner newOwner = newOwner def acceptOwnership(): # not payable require newOwner == caller log OwnerUpdate( address _prevOwner=owner, address _newOwner=newOwner) owner = newOwner newOwner = 0 def registerAddress(bytes32 _contractName, address _contractAddress): # not payable require owner == caller address[_contractName] = _contractAddress log AddressUpdate( bytes32 _contractName=_contractAddress, address _contractAddress=_contractName)
Decompilation generated by Panoramix.
Raw bytecode
0x6060604052600436106100775763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166321f8a721811461007c578063662de379146100bb57806379ba5097146100ec5780638da5cb5b146100ff578063d4ee1d9014610112578063f2fde38b14610125575b600080fd5b341561008757600080fd5b610092600435610151565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b34156100c657600080fd5b6100ea60043573ffffffffffffffffffffffffffffffffffffffff60243516610179565b005b34156100f757600080fd5b6100ea610231565b341561010a57600080fd5b6100926102e6565b341561011d57600080fd5b610092610302565b341561013057600080fd5b6100ea73ffffffffffffffffffffffffffffffffffffffff6004351661031e565b60009081526002602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b6000543373ffffffffffffffffffffffffffffffffffffffff90811691161461019e57fe5b60008281526002602052604090819020805473ffffffffffffffffffffffffffffffffffffffff191673ffffffffffffffffffffffffffffffffffffffff841617905582907ffc08d1253c81bcd5444fc7056ef1f5a5df4c9220b6fd70d7449267f1f0f299189083905173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a25050565b6001543373ffffffffffffffffffffffffffffffffffffffff90811691161461025957600080fd5b60015460005473ffffffffffffffffffffffffffffffffffffffff91821691167f343765429aea5a34b3ff6a3785a98a5abb2597aca87bfbb58632c173d585373a60405160405180910390a3600180546000805473ffffffffffffffffffffffffffffffffffffffff1990811673ffffffffffffffffffffffffffffffffffffffff841617909155169055565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b6000543373ffffffffffffffffffffffffffffffffffffffff90811691161461034357fe5b60005473ffffffffffffffffffffffffffffffffffffffff8281169116141561036b57600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff191673ffffffffffffffffffffffffffffffffffffffff929092169190911790555600a165627a7a723058203f31c817cb2ad76ddb76aa2d6bbb4b3326362386c8cc6144c2d1c80680a861a80029