Cryo Explorer Ethereum Mainnet

Address Contract Partially Verified

Address 0x52Ae12ABe5D8BD778BD5397F99cA900624CfADD4
Balance 0 ETH
Nonce 1
Code Size 3012 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

3012 bytes
0x6080604052600436106101115763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630c87355e81146101165780631d000b611461013d57806321f8a7211461015257806325f9bfef146101865780632bbd95301461019b5780633ca6bb92146101b55780635a46f06c1461024257806362614ae614610257578063662de3791461026c5780636bfb0d01146102905780636d7bd3fc146102a557806379ba5097146102ba57806383315b6e146102cf5780638da5cb5b146102e45780639232494e146102f95780639249993a1461030e578063bb34534c14610323578063c4a8598e1461033b578063d4ee1d9014610350578063f2fde38b14610365575b600080fd5b34801561012257600080fd5b5061012b610386565b60408051918252519081900360200190f35b34801561014957600080fd5b5061012b6103aa565b34801561015e57600080fd5b5061016a6004356103ce565b60408051600160a060020a039092168252519081900360200190f35b34801561019257600080fd5b5061012b6103df565b3480156101a757600080fd5b506101b3600435610403565b005b3480156101c157600080fd5b506101cd6004356105cb565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102075781810151838201526020016101ef565b50505050905090810190601f1680156102345780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561024e57600080fd5b5061012b610672565b34801561026357600080fd5b5061012b610696565b34801561027857600080fd5b506101b3600435600160a060020a03602435166106ba565b34801561029c57600080fd5b5061012b6107dc565b3480156102b157600080fd5b5061012b6107e3565b3480156102c657600080fd5b506101b3610807565b3480156102db57600080fd5b5061012b61088f565b3480156102f057600080fd5b5061016a6108b3565b34801561030557600080fd5b5061012b6108c2565b34801561031a57600080fd5b5061012b6108e6565b34801561032f57600080fd5b5061016a60043561090a565b34801561034757600080fd5b5061012b610925565b34801561035c57600080fd5b5061016a610949565b34801561037157600080fd5b506101b3600160a060020a0360043516610958565b7f42616e636f72436f6e766572746572557067726164657200000000000000000081565b7f424e54546f6b656e00000000000000000000000000000000000000000000000081565b60006103d98261090a565b92915050565b7f436f6e747261637452656769737472790000000000000000000000000000000081565b600080546060919081908190600160a060020a0316331461042357600080fd5b6000858152600260205260409020805473ffffffffffffffffffffffffffffffffffffffff19169055600354600110156105685760038054600019810190811061046957fe5b600091825260209182902001805460408051601f60026000196101006001871615020190941693909304928301859004850281018501909152818152928301828280156104f75780601f106104cc576101008083540402835291602001916104f7565b820191906000526020600020905b8154815290600101906020018083116104da57829003601f168201915b505050600088815260026020526040902060010154600380549498509096508793909250869150811061052657fe5b906000526020600020019080519060200190610543929190610a6d565b5061054d846109b9565b60008181526002602052604090206001810185905590925090505b600380549061057b906000198301610aeb565b50600085815260026020908152604080832060010183905580519283525187927ffc08d1253c81bcd5444fc7056ef1f5a5df4c9220b6fd70d7449267f1f0f2991892908290030190a25050505050565b60038054829081106105d957fe5b600091825260209182902001805460408051601f600260001961010060018716150201909416939093049283018590048502810185019091528181529350909183018282801561066a5780601f1061063f5761010080835404028352916020019161066a565b820191906000526020600020905b81548152906001019060200180831161064d57829003601f168201915b505050505081565b7f42616e636f72436f6e766572746572466163746f72790000000000000000000081565b7f424e54436f6e766572746572000000000000000000000000000000000000000081565b60008054600160a060020a031633146106d257600080fd5b81600160a060020a03811615156106e857600080fd5b6000848152600260208190526040909120805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038616178155015460ff16151561079757600084815260026020819052604090912001805460ff191660011790556003610752856109c0565b81546001810180845560009384526020938490208351919461077a9491909301920190610a6d565b506000858152600260205260409020600019820160019091015591505b60408051600160a060020a0385168152905185917ffc08d1253c81bcd5444fc7056ef1f5a5df4c9220b6fd70d7449267f1f0f29918919081900360200190a250505050565b6003545b90565b7f42616e636f72466f726d756c610000000000000000000000000000000000000081565b600154600160a060020a0316331461081e57600080fd5b60015460008054604051600160a060020a0393841693909116917f343765429aea5a34b3ff6a3785a98a5abb2597aca87bfbb58632c173d585373a91a3600180546000805473ffffffffffffffffffffffffffffffffffffffff19908116600160a060020a03841617909155169055565b7f436f6e747261637446656174757265730000000000000000000000000000000081565b600054600160a060020a031681565b7f42616e636f724e6574776f726b0000000000000000000000000000000000000081565b7f42616e636f7247617350726963654c696d69740000000000000000000000000081565b600090815260026020526040902054600160a060020a031690565b7f42616e636f72580000000000000000000000000000000000000000000000000081565b600154600160a060020a031681565b600054600160a060020a0316331461096f57600080fd5b600054600160a060020a038281169116141561098a57600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6020015190565b6040805160208082528183019092526060918291600091808201610400803883390190505091505b6020811015610a66578381602081106109fd57fe5b1a7f0100000000000000000000000000000000000000000000000000000000000000028282815181101515610a2e57fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506001016109e8565b5092915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610aae57805160ff1916838001178555610adb565b82800160010185558215610adb579182015b82811115610adb578251825591602001919060010190610ac0565b50610ae7929150610b14565b5090565b815481835581811115610b0f57600083815260209020610b0f918101908301610b2e565b505050565b6107e091905b80821115610ae75760008155600101610b1a565b6107e091905b80821115610ae7576000610b488282610b51565b50600101610b34565b50805460018160011615610100020316600290046000825580601f10610b775750610b95565b601f016020900490600052602060002090810190610b959190610b14565b505600a165627a7a72305820cd3e000b182ad7232346065f3c16b88629e59a9c082589a00b58e7f1fca33cab0029

Verified Source Code Partial Match

Compiler: v0.4.24+commit.e67f0147 EVM: byzantium Optimization: Yes (200 runs)
ContractRegistry.sol 318 lines
pragma solidity ^0.4.24;

// File: contracts/utility/interfaces/IOwned.sol

/*
    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;
}

// File: contracts/utility/Owned.sol

/*
    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
    */
    constructor() public {
        owner = msg.sender;
    }

    // allows execution by the owner only
    modifier ownerOnly {
        require(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);
    }
}

// File: contracts/utility/Utils.sol

/*
    Utilities & Common Modifiers
*/
contract Utils {
    /**
        constructor
    */
    constructor() public {
    }

    // verifies that an amount is greater than zero
    modifier greaterThanZero(uint256 _amount) {
        require(_amount > 0);
        _;
    }

    // validates an address - currently only checks that it isn't null
    modifier validAddress(address _address) {
        require(_address != address(0));
        _;
    }

    // verifies that the address is different than this contract address
    modifier notThis(address _address) {
        require(_address != address(this));
        _;
    }

    // Overflow protected math functions

    /**
        @dev returns the sum of _x and _y, asserts if the calculation overflows

        @param _x   value 1
        @param _y   value 2

        @return sum
    */
    function safeAdd(uint256 _x, uint256 _y) internal pure returns (uint256) {
        uint256 z = _x + _y;
        assert(z >= _x);
        return z;
    }

    /**
        @dev returns the difference of _x minus _y, asserts if the subtraction results in a negative number

        @param _x   minuend
        @param _y   subtrahend

        @return difference
    */
    function safeSub(uint256 _x, uint256 _y) internal pure returns (uint256) {
        assert(_x >= _y);
        return _x - _y;
    }

    /**
        @dev returns the product of multiplying _x by _y, asserts if the calculation overflows

        @param _x   factor 1
        @param _y   factor 2

        @return product
    */
    function safeMul(uint256 _x, uint256 _y) internal pure returns (uint256) {
        uint256 z = _x * _y;
        assert(_x == 0 || z / _x == _y);
        return z;
    }
}

// File: contracts/utility/interfaces/IContractRegistry.sol

/*
    Contract Registry interface
*/
contract IContractRegistry {
    function addressOf(bytes32 _contractName) public view returns (address);

    // deprecated, backward compatibility
    function getAddress(bytes32 _contractName) public view returns (address);
}

// File: contracts/ContractIds.sol

/**
    Id definitions for bancor contracts

    Can be used in conjunction with the contract registry to get contract addresses
*/
contract ContractIds {
    // generic
    bytes32 public constant CONTRACT_FEATURES = "ContractFeatures";
    bytes32 public constant CONTRACT_REGISTRY = "ContractRegistry";

    // bancor logic
    bytes32 public constant BANCOR_NETWORK = "BancorNetwork";
    bytes32 public constant BANCOR_FORMULA = "BancorFormula";
    bytes32 public constant BANCOR_GAS_PRICE_LIMIT = "BancorGasPriceLimit";
    bytes32 public constant BANCOR_CONVERTER_UPGRADER = "BancorConverterUpgrader";
    bytes32 public constant BANCOR_CONVERTER_FACTORY = "BancorConverterFactory";

    // Ids of BNT converter and BNT token
    bytes32 public constant BNT_TOKEN = "BNTToken";
    bytes32 public constant BNT_CONVERTER = "BNTConverter";

    // Id of BancorX contract
    bytes32 public constant BANCOR_X = "BancorX";
}

// File: contracts/utility/ContractRegistry.sol

/**
    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 encoded ASCII strings to optimize gas costs
*/
contract ContractRegistry is IContractRegistry, Owned, Utils, ContractIds {
    struct RegistryItem {
        address contractAddress;    // contract address
        uint256 nameIndex;          // index of the item in the list of contract names
        bool isSet;                 // used to tell if the mapping element is defined
    }

    mapping (bytes32 => RegistryItem) private items;    // name -> RegistryItem mapping
    string[] public contractNames;                      // list of all registered contract names

    // triggered when an address pointed to by a contract name is modified
    event AddressUpdate(bytes32 indexed _contractName, address _contractAddress);

    /**
        @dev constructor
    */
    constructor() public {
        registerAddress(ContractIds.CONTRACT_REGISTRY, address(this));
    }

    /**
        @dev returns the number of items in the registry

        @return number of items
    */
    function itemCount() public view returns (uint256) {
        return contractNames.length;
    }

    /**
        @dev returns the address associated with the given contract name

        @param _contractName    contract name

        @return contract address
    */
    function addressOf(bytes32 _contractName) public view returns (address) {
        return items[_contractName].contractAddress;
    }

    /**
        @dev registers a new address for the contract name in the registry

        @param _contractName     contract name
        @param _contractAddress  contract address
    */
    function registerAddress(bytes32 _contractName, address _contractAddress)
        public
        ownerOnly
        validAddress(_contractAddress)
    {
        require(_contractName.length > 0); // validate input

        // update the address in the registry
        items[_contractName].contractAddress = _contractAddress;

        if (!items[_contractName].isSet) {
            // mark the item as set
            items[_contractName].isSet = true;
            // add the contract name to the name list
            uint256 i = contractNames.push(bytes32ToString(_contractName));
            // update the item's index in the list
            items[_contractName].nameIndex = i - 1;
        }

        // dispatch the address update event
        emit AddressUpdate(_contractName, _contractAddress);
    }

    /**
        @dev removes an existing contract address from the registry

        @param _contractName contract name
    */
    function unregisterAddress(bytes32 _contractName) public ownerOnly {
        require(_contractName.length > 0); // validate input

        // remove the address from the registry
        items[_contractName].contractAddress = address(0);

        // if there are multiple items in the registry, move the last element to the deleted element's position
        // and modify last element's registryItem.nameIndex in the items collection to point to the right position in contractNames
        if (contractNames.length > 1) {
            string memory lastContractNameString = contractNames[contractNames.length - 1];
            uint256 unregisterIndex = items[_contractName].nameIndex;

            contractNames[unregisterIndex] = lastContractNameString;
            bytes32 lastContractName = stringToBytes32(lastContractNameString);
            RegistryItem storage registryItem = items[lastContractName];
            registryItem.nameIndex = unregisterIndex;
        }

        // remove the last element from the name list
        contractNames.length--;
        // zero the deleted element's index
        items[_contractName].nameIndex = 0;

        // dispatch the address update event
        emit AddressUpdate(_contractName, address(0));
    }

    /**
        @dev utility, converts bytes32 to a string
        note that the bytes32 argument is assumed to be UTF8 encoded ASCII string

        @return string representation of the given bytes32 argument
    */
    function bytes32ToString(bytes32 _bytes) private pure returns (string) {
        bytes memory byteArray = new bytes(32);
        for (uint256 i; i < 32; i++) {
            byteArray[i] = _bytes[i];
        }

        return string(byteArray);
    }

    // @dev utility, converts string to bytes32
    function stringToBytes32(string memory _string) private pure returns (bytes32) {
        bytes32 result;
        assembly {
            result := mload(add(_string,32))
        }
        return result;
    }

    // deprecated, backward compatibility
    function getAddress(bytes32 _contractName) public view returns (address) {
        return addressOf(_contractName);
    }
}

Read Contract

BANCOR_CONVERTER_FACTORY 0x5a46f06c → bytes32
BANCOR_CONVERTER_UPGRADER 0x0c87355e → bytes32
BANCOR_FORMULA 0x6d7bd3fc → bytes32
BANCOR_GAS_PRICE_LIMIT 0x9249993a → bytes32
BANCOR_NETWORK 0x9232494e → bytes32
BANCOR_X 0xc4a8598e → bytes32
BNT_CONVERTER 0x62614ae6 → bytes32
BNT_TOKEN 0x1d000b61 → bytes32
CONTRACT_FEATURES 0x83315b6e → bytes32
CONTRACT_REGISTRY 0x25f9bfef → bytes32
addressOf 0xbb34534c → address
contractNames 0x3ca6bb92 → string
getAddress 0x21f8a721 → address
itemCount 0x6bfb0d01 → uint256
newOwner 0xd4ee1d90 → address
owner 0x8da5cb5b → address

Write Contract 4 functions

These functions modify contract state and require a wallet transaction to execute.

acceptOwnership 0x79ba5097
No parameters
registerAddress 0x662de379
bytes32 _contractName
address _contractAddress
transferOwnership 0xf2fde38b
address _newOwner
unregisterAddress 0x2bbd9530
bytes32 _contractName

Recent Transactions

No transactions found for this address