Cryo Explorer Ethereum Mainnet

Address Contract Partially Verified

Address 0x511485bBd96e7e3a056a8D1b84C5071071C52D6F
Balance 0 ETH
Nonce 1
Code Size 4736 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

4736 bytes
0x608060405234801561001057600080fd5b50600436106101425760003560e01c806365fae35e116100b8578063ac4c25b21161007c578063ac4c25b2146103a8578063b0b8579b146103b0578063be9a6555146103cf578063bf353dbb146103d7578063e38e2cfb146103fd578063f29c29c41461041e57610142565b806365fae35e1461031357806375f12b21146103395780639c52a7f114610341578063a4dff0a214610367578063a7a1ed721461038c57610142565b80632e7dc6af1161010a5780632e7dc6af1461021157806346d4577d146102355780634fce7a2a146102a557806357de26a4146102dd57806359e02dd7146102e557806365c4ce7a146102ed57610142565b806307da68f5146101475780630e5a6c701461015157806318178358146101735780631b25b65f1461017b5780631e77933e146101eb575b600080fd5b61014f610444565b005b6101596104d2565b604051918252151560208201526040908101905180910390f35b61014f610556565b61014f6004803603602081101561019157600080fd5b8101906020810181356401000000008111156101ac57600080fd5b8201836020820111156101be57600080fd5b803590602001918460208302840111640100000000831117156101e057600080fd5b5090925090506107b7565b61014f6004803603602081101561020157600080fd5b50356001600160a01b0316610907565b6102196109ad565b6040516001600160a01b03909116815260200160405180910390f35b61014f6004803603602081101561024b57600080fd5b81019060208101813564010000000081111561026657600080fd5b82018360208201111561027857600080fd5b8035906020019184602083028401116401000000008311171561029a57600080fd5b5090925090506109bc565b6102cb600480360360208110156102bb57600080fd5b50356001600160a01b0316610a63565b60405190815260200160405180910390f35b6102cb610a77565b610159610b47565b61014f6004803603602081101561030357600080fd5b50356001600160a01b0316610bcb565b61014f6004803603602081101561032957600080fd5b50356001600160a01b0316610c6f565b6102cb610d16565b61014f6004803603602081101561035757600080fd5b50356001600160a01b0316610d1c565b61036f610dc0565b60405167ffffffffffffffff909116815260200160405180910390f35b610394610dd7565b604051901515815260200160405180910390f35b61014f610e1c565b6103b8610f2d565b60405161ffff909116815260200160405180910390f35b61014f610f3e565b6102cb600480360360208110156103ed57600080fd5b50356001600160a01b0316610fcd565b61014f6004803603602081101561041357600080fd5b503561ffff16610fe1565b61014f6004803603602081101561043457600080fd5b50356001600160a01b031661109d565b336000908152602081905260409020546001146104955760405162461bcd60e51b8152602060048201526012602482015260008051602061122c833981519152604482015260640160405180910390fd5b600180555961012081016040526020815260e0602082015260e060006040830137602435600435336001600160e01b03196000351661012085a450565b33600090815260056020528060408120546001146105365760405162461bcd60e51b815260206004820152601c60248201527f4f534d2f636f6e74726163742d6e6f742d77686974656c697374656400000000604482015260640160405180910390fd5b50506004546001600160801b0380821691600160801b9004166001149091565b6001541561059b5760405162461bcd60e51b815260206004820152600e60248201526d13d4d34bda5ccb5cdd1bdc1c195960921b604482015260640160405180910390fd5b6105a3610dd7565b6105e45760405162461bcd60e51b815260206004820152600e60248201526d13d4d34bdb9bdd0b5c185cdcd95960921b604482015260640160405180910390fd5b60025460009081906001600160a01b03166359e02dd76040518163ffffffff1660e01b8152600401604080518083038186803b15801561062357600080fd5b505afa158015610637573d6000803e3d6000fd5b505050506040513d604081101561064d57600080fd5b8101908080519291906020018051939550929350508215915061077c90505760045460038054600160801b8084046001600160801b039081169091026001600160801b031990921693811693909317909216919091179055604051604080820190526001600160801b0383168152600160208201526004815181546001600160801b0319166001600160801b0391909116178155602082015181546001600160801b03918216600160801b0291161790555061070f61070a611192565b611196565b6002805467ffffffffffffffff92909216600160b01b0267ffffffffffffffff60b01b199092169190911790556003547f296ba4ca62c6c21c95e828080cb8aec7481b71390585605300a8a76f9e95b527906001600160801b031660405190815260200160405180910390a15b50505961012081016040526020815260e0602082015260e060006040830137602435600435336001600160e01b03196000351661012085a450565b336000908152602081905260409020546001146108085760405162461bcd60e51b8152602060048201526012602482015260008051602061122c833981519152604482015260640160405180910390fd5b60005b818110156108cb57600083838381811061082157fe5b905060200201356001600160a01b03166001600160a01b031614156108805760405162461bcd60e51b815260206004820152601160248201527004f534d2f6e6f2d636f6e74726163742d3607c1b604482015260640160405180910390fd5b60016005600085858581811061089257fe5b905060200201356001600160a01b03166001600160a01b03166001600160a01b031681526020019081526020016000205560010161080b565b505961012081016040526020815260e0602082015260e060006040830137602435600435336001600160e01b03196000351661012085a4505050565b336000908152602081905260409020546001146109585760405162461bcd60e51b8152602060048201526012602482015260008051602061122c833981519152604482015260640160405180910390fd5b600280546001600160a01b0319166001600160a01b0383161790555961012081016040526020815260e0602082015260e060006040830137602435600435336001600160e01b03196000351661012085a45050565b6002546001600160a01b031681565b33600090815260208190526040902054600114610a0d5760405162461bcd60e51b8152602060048201526012602482015260008051602061122c833981519152604482015260640160405180910390fd5b60005b818110156108cb57600060056000858585818110610a2a57fe5b905060200201356001600160a01b03166001600160a01b03166001600160a01b0316815260200190815260200160002055600101610a10565b600560205280600052604060002054905081565b33600090815260056020526040812054600114610ada5760405162461bcd60e51b815260206004820152601c60248201527f4f534d2f636f6e74726163742d6e6f742d77686974656c697374656400000000604482015260640160405180910390fd5b600354600160801b90046001600160801b0316600114610b375760405162461bcd60e51b81526020600482015260146024820152734f534d2f6e6f2d63757272656e742d76616c756560601b604482015260640160405180910390fd5b506003546001600160801b031690565b3360009081526005602052806040812054600114610bab5760405162461bcd60e51b815260206004820152601c60248201527f4f534d2f636f6e74726163742d6e6f742d77686974656c697374656400000000604482015260640160405180910390fd5b50506003546001600160801b0380821691600160801b9004166001149091565b33600090815260208190526040902054600114610c1c5760405162461bcd60e51b8152602060048201526012602482015260008051602061122c833981519152604482015260640160405180910390fd5b6001600160a01b0381166000908152600560205260408120555961012081016040526020815260e0602082015260e060006040830137602435600435336001600160e01b03196000351661012085a45050565b33600090815260208190526040902054600114610cc05760405162461bcd60e51b8152602060048201526012602482015260008051602061122c833981519152604482015260640160405180910390fd5b6001600160a01b0381166000908152602081905260019060409020555961012081016040526020815260e0602082015260e060006040830137602435600435336001600160e01b03196000351661012085a45050565b60015481565b33600090815260208190526040902054600114610d6d5760405162461bcd60e51b8152602060048201526012602482015260008051602061122c833981519152604482015260640160405180910390fd5b6001600160a01b0381166000908152602081905260408120555961012081016040526020815260e0602082015260e060006040830137602435600435336001600160e01b03196000351661012085a45050565b600254600160b01b900467ffffffffffffffff1681565b600254600090610e0390600160b01b810467ffffffffffffffff1690600160a01b900461ffff16611208565b67ffffffffffffffff16610e15611192565b1015905090565b33600090815260208190526040902054600114610e6d5760405162461bcd60e51b8152602060048201526012602482015260008051602061122c833981519152604482015260640160405180910390fd5b60405160408082019052600080825260208201526004815181546001600160801b0319166001600160801b0391909116178155602082015181546001600160801b03908116600160801b928216830217808455600380549183166001600160801b03199092169190911780825593549382169383900490911690910291909117905550600180555961012081016040526020815260e0602082015260e060006040830137602435600435336001600160e01b03196000351661012085a450565b600254600160a01b900461ffff1681565b33600090815260208190526040902054600114610f8f5760405162461bcd60e51b8152602060048201526012602482015260008051602061122c833981519152604482015260640160405180910390fd5b60006001555961012081016040526020815260e0602082015260e060006040830137602435600435336001600160e01b03196000351661012085a450565b600060205280600052604060002054905081565b336000908152602081905260409020546001146110325760405162461bcd60e51b8152602060048201526012602482015260008051602061122c833981519152604482015260640160405180910390fd5b60008161ffff161161107b5760405162461bcd60e51b815260206004820152600e60248201526d4f534d2f74732d69732d7a65726f60901b604482015260640160405180910390fd5b6002805461ffff909216600160a01b0261ffff60a01b19909216919091179055565b336000908152602081905260409020546001146110ee5760405162461bcd60e51b8152602060048201526012602482015260008051602061122c833981519152604482015260640160405180910390fd5b6001600160a01b03811661113c5760405162461bcd60e51b815260206004820152601160248201527004f534d2f6e6f2d636f6e74726163742d3607c1b604482015260640160405180910390fd5b6001600160a01b0381166000908152600560205260019060409020555961012081016040526020815260e0602082015260e060006040830137602435600435336001600160e01b03196000351661012085a45050565b4290565b600254600090600160a01b900461ffff166111e95760405162461bcd60e51b815260206004820152600f60248201526e4f534d2f686f702d69732d7a65726f60881b604482015260640160405180910390fd5b600254600160a01b900461ffff1682816111ff57fe5b06909103919050565b81810167ffffffffffffffff808416908216101561122557600080fd5b9291505056fe4f534d2f6e6f742d617574686f72697a65640000000000000000000000000000a265627a7a72315820eacacb6d29568fd167522843265786e2015acaaee0fb5acba48631e91269b9bc64736f6c634300050c0032

Verified Source Code Partial Match

Compiler: v0.5.12+commit.7709ece9 EVM: petersburg Optimization: Yes (200 runs)
osm.sol 178 lines
/// osm.sol

// Copyright (C) 2018-2020 Maker Ecosystem Growth Holdings, INC.

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <https://www.gnu.org/licenses/>.

pragma solidity >=0.5.10;

import "ds-value/value.sol";

contract LibNote {
    event LogNote(
        bytes4   indexed  sig,
        address  indexed  usr,
        bytes32  indexed  arg1,
        bytes32  indexed  arg2,
        bytes             data
    ) anonymous;

    modifier note {
        _;
        assembly {
            // log an 'anonymous' event with a constant 6 words of calldata
            // and four indexed topics: selector, caller, arg1 and arg2
            let mark := msize()                       // end of memory ensures zero
            mstore(0x40, add(mark, 288))              // update free memory pointer
            mstore(mark, 0x20)                        // bytes type data offset
            mstore(add(mark, 0x20), 224)              // bytes size (padded)
            calldatacopy(add(mark, 0x40), 0, 224)     // bytes payload
            log4(mark, 288,                           // calldata
                 shl(224, shr(224, calldataload(0))), // msg.sig
                 caller(),                            // msg.sender
                 calldataload(4),                     // arg1
                 calldataload(36)                     // arg2
                )
        }
    }
}

contract OSM is LibNote {

    // --- Auth ---
    mapping (address => uint) public wards;
    function rely(address usr) external note auth { wards[usr] = 1; }
    function deny(address usr) external note auth { wards[usr] = 0; }
    modifier auth {
        require(wards[msg.sender] == 1, "OSM/not-authorized");
        _;
    }

    // --- Stop ---
    uint256 public stopped;
    modifier stoppable { require(stopped == 0, "OSM/is-stopped"); _; }

    // --- Math ---
    function add(uint64 x, uint64 y) internal pure returns (uint64 z) {
        z = x + y;
        require(z >= x);
    }

    address public src;
    uint16  constant ONE_HOUR = uint16(3600);
    uint16  public hop = ONE_HOUR;
    uint64  public zzz;

    struct Feed {
        uint128 val;
        uint128 has;
    }

    Feed cur;
    Feed nxt;

    // Whitelisted contracts, set by an auth
    mapping (address => uint256) public bud;

    modifier toll { require(bud[msg.sender] == 1, "OSM/contract-not-whitelisted"); _; }

    event LogValue(bytes32 val);

    constructor (address src_) public {
        wards[msg.sender] = 1;
        src = src_;
    }

    function stop() external note auth {
        stopped = 1;
    }
    function start() external note auth {
        stopped = 0;
    }

    function change(address src_) external note auth {
        src = src_;
    }

    function era() internal view returns (uint) {
        return block.timestamp;
    }

    function prev(uint ts) internal view returns (uint64) {
        require(hop != 0, "OSM/hop-is-zero");
        return uint64(ts - (ts % hop));
    }

    function step(uint16 ts) external auth {
        require(ts > 0, "OSM/ts-is-zero");
        hop = ts;
    }

    function void() external note auth {
        cur = nxt = Feed(0, 0);
        stopped = 1;
    }

    function pass() public view returns (bool ok) {
        return era() >= add(zzz, hop);
    }

    function poke() external note stoppable {
        require(pass(), "OSM/not-passed");
        (bytes32 wut, bool ok) = DSValue(src).peek();
        if (ok) {
            cur = nxt;
            nxt = Feed(uint128(uint(wut)), 1);
            zzz = prev(era());
            emit LogValue(bytes32(uint(cur.val)));
        }
    }

    function peek() external view toll returns (bytes32,bool) {
        return (bytes32(uint(cur.val)), cur.has == 1);
    }

    function peep() external view toll returns (bytes32,bool) {
        return (bytes32(uint(nxt.val)), nxt.has == 1);
    }

    function read() external view toll returns (bytes32) {
        require(cur.has == 1, "OSM/no-current-value");
        return (bytes32(uint(cur.val)));
    }



    function kiss(address a) external note auth {
        require(a != address(0), "OSM/no-contract-0");
        bud[a] = 1;
    }

    function diss(address a) external note auth {
        bud[a] = 0;
    }

    function kiss(address[] calldata a) external note auth {
        for(uint i = 0; i < a.length; i++) {
            require(a[i] != address(0), "OSM/no-contract-0");
            bud[a[i]] = 1;
        }
    }

    function diss(address[] calldata a) external note auth {
        for(uint i = 0; i < a.length; i++) {
            bud[a[i]] = 0;
        }
    }
}
value.sol 41 lines
/// value.sol - a value is a simple thing, it can be get and set

// Copyright (C) 2017  DappHub, LLC

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

pragma solidity >=0.4.23;

import 'ds-thing/thing.sol';

contract DSValue is DSThing {
    bool    has;
    bytes32 val;
    function peek() public view returns (bytes32, bool) {
        return (val,has);
    }
    function read() public view returns (bytes32) {
        bytes32 wut; bool haz;
        (wut, haz) = peek();
        require(haz, "haz-not");
        return wut;
    }
    function poke(bytes32 wut) public note auth {
        val = wut;
        has = true;
    }
    function void() public note auth {  // unset the value
        has = false;
    }
}
thing.sol 29 lines
// thing.sol - `auth` with handy mixins. your things should be DSThings

// Copyright (C) 2017  DappHub, LLC

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

pragma solidity >=0.4.23;

import 'ds-auth/auth.sol';
import 'ds-note/note.sol';
import 'ds-math/math.sol';

contract DSThing is DSAuth, DSNote, DSMath {
    function S(string memory s) internal pure returns (bytes4) {
        return bytes4(keccak256(abi.encodePacked(s)));
    }

}
auth.sol 69 lines
// SPDX-License-Identifier: GNU-3
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

pragma solidity >=0.4.23;

interface DSAuthority {
    function canCall(
        address src, address dst, bytes4 sig
    ) external view returns (bool);
}

contract DSAuthEvents {
    event LogSetAuthority (address indexed authority);
    event LogSetOwner     (address indexed owner);
}

contract DSAuth is DSAuthEvents {
    DSAuthority  public  authority;
    address      public  owner;

    constructor() public {
        owner = msg.sender;
        emit LogSetOwner(msg.sender);
    }

    function setOwner(address owner_)
        public
        auth
    {
        owner = owner_;
        emit LogSetOwner(owner);
    }

    function setAuthority(DSAuthority authority_)
        public
        auth
    {
        authority = authority_;
        emit LogSetAuthority(address(authority));
    }

    modifier auth {
        require(isAuthorized(msg.sender, msg.sig), "ds-auth-unauthorized");
        _;
    }

    function isAuthorized(address src, bytes4 sig) internal view returns (bool) {
        if (src == address(this)) {
            return true;
        } else if (src == owner) {
            return true;
        } else if (authority == DSAuthority(address(0))) {
            return false;
        } else {
            return authority.canCall(src, address(this), sig);
        }
    }
}
note.sol 43 lines
/// note.sol -- the `note' modifier, for logging calls as events

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

pragma solidity >=0.4.23;

contract DSNote {
    event LogNote(
        bytes4   indexed  sig,
        address  indexed  guy,
        bytes32  indexed  foo,
        bytes32  indexed  bar,
        uint256           wad,
        bytes             fax
    ) anonymous;

    modifier note {
        bytes32 foo;
        bytes32 bar;
        uint256 wad;

        assembly {
            foo := calldataload(4)
            bar := calldataload(36)
            wad := callvalue()
        }

        _;

        emit LogNote(msg.sig, msg.sender, foo, bar, wad, msg.data);
    }
}
math.sol 88 lines
/// math.sol -- mixin for inline numerical wizardry

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

pragma solidity >0.4.13;

contract DSMath {
    function add(uint x, uint y) internal pure returns (uint z) {
        require((z = x + y) >= x, "ds-math-add-overflow");
    }
    function sub(uint x, uint y) internal pure returns (uint z) {
        require((z = x - y) <= x, "ds-math-sub-underflow");
    }
    function mul(uint x, uint y) internal pure returns (uint z) {
        require(y == 0 || (z = x * y) / y == x, "ds-math-mul-overflow");
    }

    function min(uint x, uint y) internal pure returns (uint z) {
        return x <= y ? x : y;
    }
    function max(uint x, uint y) internal pure returns (uint z) {
        return x >= y ? x : y;
    }
    function imin(int x, int y) internal pure returns (int z) {
        return x <= y ? x : y;
    }
    function imax(int x, int y) internal pure returns (int z) {
        return x >= y ? x : y;
    }

    uint constant WAD = 10 ** 18;
    uint constant RAY = 10 ** 27;

    //rounds to zero if x*y < WAD / 2
    function wmul(uint x, uint y) internal pure returns (uint z) {
        z = add(mul(x, y), WAD / 2) / WAD;
    }
    //rounds to zero if x*y < WAD / 2
    function rmul(uint x, uint y) internal pure returns (uint z) {
        z = add(mul(x, y), RAY / 2) / RAY;
    }
    //rounds to zero if x*y < WAD / 2
    function wdiv(uint x, uint y) internal pure returns (uint z) {
        z = add(mul(x, WAD), y / 2) / y;
    }
    //rounds to zero if x*y < RAY / 2
    function rdiv(uint x, uint y) internal pure returns (uint z) {
        z = add(mul(x, RAY), y / 2) / y;
    }

    // This famous algorithm is called "exponentiation by squaring"
    // and calculates x^n with x as fixed-point and n as regular unsigned.
    //
    // It's O(log n), instead of O(n) for naive repeated multiplication.
    //
    // These facts are why it works:
    //
    //  If n is even, then x^n = (x^2)^(n/2).
    //  If n is odd,  then x^n = x * x^(n-1),
    //   and applying the equation for even x gives
    //    x^n = x * (x^2)^((n-1) / 2).
    //
    //  Also, EVM division is flooring and
    //    floor[(n-1) / 2] = floor[n / 2].
    //
    function rpow(uint x, uint n) internal pure returns (uint z) {
        z = n % 2 != 0 ? x : RAY;

        for (n /= 2; n != 0; n /= 2) {
            x = rmul(x, x);

            if (n % 2 != 0) {
                z = rmul(z, x);
            }
        }
    }
}

Read Contract

bud 0x4fce7a2a → uint256
hop 0xb0b8579b → uint16
pass 0xa7a1ed72 → bool
peek 0x59e02dd7 → bytes32, bool
peep 0x0e5a6c70 → bytes32, bool
read 0x57de26a4 → bytes32
src 0x2e7dc6af → address
stopped 0x75f12b21 → uint256
wards 0xbf353dbb → uint256
zzz 0xa4dff0a2 → uint64

Write Contract 12 functions

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

change 0x1e77933e
address src_
deny 0x9c52a7f1
address usr
diss 0x46d4577d
address[] a
diss 0x65c4ce7a
address a
kiss 0x1b25b65f
address[] a
kiss 0xf29c29c4
address a
poke 0x18178358
No parameters
rely 0x65fae35e
address usr
start 0xbe9a6555
No parameters
step 0xe38e2cfb
uint16 ts
stop 0x07da68f5
No parameters
void 0xac4c25b2
No parameters

Recent Transactions

No transactions found for this address