Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0x386b98e757847F4bF6D83AbF034b218f38B6eF27
Balance 0 ETH
Nonce 1
Code Size 2520 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

2520 bytes
0x608060405234801561000f575f5ffd5b506004361061007b575f3560e01c80633c6bb436116100595780633c6bb436146100b157806387e9e77f146100cf5780639ae5a2be146100ed578063fa290fad1461010b5761007b565b806328d36a831461007f5780632ae3594a14610089578063371303c014610093575b5f5ffd5b610087610129565b005b6100916101c4565b005b61009b61025f565b6040516100a891906106a2565b60405180910390f35b6100b96103d0565b6040516100c69190610735565b60405180910390f35b6100d76103f4565b6040516100e4919061076e565b60405180910390f35b6100f5610418565b6040516101029190610796565b60405180910390f35b6101136104ab565b6040516101209190610735565b60405180910390f35b7f00000000000000000000000061e10fe86390b481da477f280cea831aab4bdf4c73ffffffffffffffffffffffffffffffffffffffff166328d36a836040518163ffffffff1660e01b81526004015f604051808303815f87803b15801561018e575f5ffd5b505af11580156101a0573d5f5f3e3d5ffd5b505050506101c233670de0b6b3a7640000600a6101bd91906107dc565b6104cf565b565b7f00000000000000000000000061e10fe86390b481da477f280cea831aab4bdf4c73ffffffffffffffffffffffffffffffffffffffff16632ae3594a6040518163ffffffff1660e01b81526004015f604051808303815f87803b158015610229575f5ffd5b505af115801561023b573d5f5f3e3d5ffd5b5050505061025d33670de0b6b3a7640000600a61025891906107dc565b6104cf565b565b6102676105fa565b5f7f000000000000000000000000ce78254bcd05040953d28fcb640c465f086bec9b73ffffffffffffffffffffffffffffffffffffffff1663853255cc6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102d1573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102f5919061085c565b90505f5f5f5f5f8573ffffffffffffffffffffffffffffffffffffffff16637bc1152d7f00000000000000000000000061e10fe86390b481da477f280cea831aab4bdf4c6040518263ffffffff1660e01b81526004016103559190610896565b60a060405180830381865afa158015610370573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061039491906108d9565b945094509450945094506040518060a0016040528086815260200185815260200184815260200183815260200182815250965050505050505090565b7f00000000000000000000000061e10fe86390b481da477f280cea831aab4bdf4c81565b7f000000000000000000000000a86c903cabab19f193a6252dd99bdfd747cd40ee81565b5f7f00000000000000000000000061e10fe86390b481da477f280cea831aab4bdf4c73ffffffffffffffffffffffffffffffffffffffff16639ae5a2be6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610482573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104a69190610950565b905090565b7f000000000000000000000000ce78254bcd05040953d28fcb640c465f086bec9b81565b807f000000000000000000000000a86c903cabab19f193a6252dd99bdfd747cd40ee73ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016105299190610896565b602060405180830381865afa158015610544573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105689190610950565b106105f6577f000000000000000000000000a86c903cabab19f193a6252dd99bdfd747cd40ee73ffffffffffffffffffffffffffffffffffffffff1663b753a98c83836040518363ffffffff1660e01b81526004016105c892919061097b565b5f604051808303815f87803b1580156105df575f5ffd5b505af11580156105f1573d5f5f3e3d5ffd5b505050505b5050565b6040518060a001604052805f81526020015f81526020015f81526020015f81526020015f81525090565b5f819050919050565b61063681610624565b82525050565b60a082015f8201516106505f85018261062d565b506020820151610663602085018261062d565b506040820151610676604085018261062d565b506060820151610689606085018261062d565b50608082015161069c608085018261062d565b50505050565b5f60a0820190506106b55f83018461063c565b92915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f819050919050565b5f6106fd6106f86106f3846106bb565b6106da565b6106bb565b9050919050565b5f61070e826106e3565b9050919050565b5f61071f82610704565b9050919050565b61072f81610715565b82525050565b5f6020820190506107485f830184610726565b92915050565b5f61075882610704565b9050919050565b6107688161074e565b82525050565b5f6020820190506107815f83018461075f565b92915050565b61079081610624565b82525050565b5f6020820190506107a95f830184610787565b92915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6107e682610624565b91506107f183610624565b92508282026107ff81610624565b91508282048414831517610816576108156107af565b5b5092915050565b5f5ffd5b5f61082b826106bb565b9050919050565b61083b81610821565b8114610845575f5ffd5b50565b5f8151905061085681610832565b92915050565b5f602082840312156108715761087061081d565b5b5f61087e84828501610848565b91505092915050565b61089081610821565b82525050565b5f6020820190506108a95f830184610887565b92915050565b6108b881610624565b81146108c2575f5ffd5b50565b5f815190506108d3816108af565b92915050565b5f5f5f5f5f60a086880312156108f2576108f161081d565b5b5f6108ff888289016108c5565b9550506020610910888289016108c5565b9450506040610921888289016108c5565b9350506060610932888289016108c5565b9250506080610943888289016108c5565b9150509295509295909350565b5f602082840312156109655761096461081d565b5b5f610972848285016108c5565b91505092915050565b5f60408201905061098e5f830185610887565b61099b6020830184610787565b939250505056fea2646970667358221220d527edb973494f99860147b10b5a72a847729060993906393438342d7108013764736f6c634300081d0033

Verified Source Code Full Match

Compiler: v0.8.29+commit.ab55807c EVM: cancun Optimization: No
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);
    }
}
dss.sol 147 lines
// SPDX-License-Identifier: AGPL-3.0-or-later

/// dss.sol -- Decentralized Summation System

// Copyright (C) 2022 Horsefacts <[email protected]>
//
// 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.8.15;

import {DSSProxy} from "./proxy/proxy.sol";

interface DSSLike {
    function sum() external view returns(address);
    function use() external;
    function see() external view returns (uint256);
    function hit() external;
    function dip() external;
    function nil() external;
    function hope(address) external;
    function nope(address) external;
    function bless() external;
    function build(bytes32 wit, address god) external returns (address);
    function scry(address guy, bytes32 wit, address god) external view returns (address);
}

interface SumLike {
    function hope(address) external;
    function nope(address) external;
}

interface UseLike {
    function use() external;
}

interface SpyLike {
    function see() external view returns (uint256);
}

interface HitterLike {
    function hit() external;
}

interface DipperLike {
    function dip() external;
}

interface NilLike {
    function nil() external;
}

contract DSS {
    // --- Data ---
    address immutable public sum;
    address immutable public _use;
    address immutable public _spy;
    address immutable public _hitter;
    address immutable public _dipper;
    address immutable public _nil;

    // --- Init ---
    constructor(
        address sum_,
        address use_,
        address spy_,
        address hitter_,
        address dipper_,
        address nil_)
    {
        sum     = sum_;     // Core ICV engine
        _use    = use_;     // Creation module
        _spy    = spy_;     // Read module
        _hitter = hitter_;  // Increment module
        _dipper = dipper_;  // Decrement module
        _nil    = nil_;     // Reset module
    }

    // --- DSS Operations ---
    function use() external {
        UseLike(_use).use();
    }

    function see() external view returns (uint256) {
        return SpyLike(_spy).see();
    }

    function hit() external {
        HitterLike(_hitter).hit();
    }

    function dip() external {
        DipperLike(_dipper).dip();
    }

    function nil() external {
        NilLike(_nil).nil();
    }

    function hope(address usr) external {
        SumLike(sum).hope(usr);
    }

    function nope(address usr) external {
        SumLike(sum).nope(usr);
    }

    function bless() external {
        SumLike(sum).hope(_use);
        SumLike(sum).hope(_hitter);
        SumLike(sum).hope(_dipper);
        SumLike(sum).hope(_nil);
    }

    function build(bytes32 wit, address god) external returns (address proxy) {
        proxy = address(new DSSProxy{ salt: wit }(address(this), msg.sender, god));
    }

    function scry(address guy, bytes32 wit, address god) external view returns (address) {
        address me = address(this);
        return address(uint160(uint256(keccak256(
            abi.encodePacked(
                bytes1(0xff),
                me,
                wit,
                keccak256(
                    abi.encodePacked(
                        type(DSSProxy).creationCode,
                        abi.encode(me),
                        abi.encode(guy),
                        abi.encode(god)
                    )
                )
            )
        ))));
    }
}
proxy.sol 67 lines
// SPDX-License-Identifier: AGPL-3.0-or-later

/// proxy.sol -- Execute DSS actions through the proxy's identity

// Copyright (C) 2022 Horsefacts <[email protected]>
//
// 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.8.15;

import {DSAuth} from "ds-auth/auth.sol";
import {DSNote} from "ds-note/note.sol";

contract DSSProxy is DSAuth, DSNote {
    // --- Data ---
    address public dss;

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

    // --- Init ---
    constructor(address dss_, address usr, address god) {
        dss = dss_;
        wards[usr] = 1;
        setOwner(god);
    }

    // --- Upgrade ---
    function upgrade(address dss_) external auth note {
        dss = dss_;
    }

    // --- Proxy ---
    fallback() external ward note {
        address _dss = dss;
        assembly {
            calldatacopy(0, 0, calldatasize())
            let result := delegatecall(gas(), _dss, 0, calldatasize(), 0, 0)
            returndatacopy(0, 0, returndatasize())
            switch result
            case 0 {
                revert(0, returndatasize())
            }
            default {
                return(0, returndatasize())
            }
        }
    }
}
counter.sol 80 lines
// SPDX-License-Identifier: AGPL-3.0-or-later

// counter.sol -- frob an inc, get CTR

// Copyright (C) 2025 Horsefacts <[email protected]>
//
// 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.8.29;

import {DSSLike} from "dss/src/dss.sol";

interface SumLike {
    function incs(address) external view returns (uint256, uint256, uint256, uint256, uint256);
}

interface CTRLike {
    function balanceOf(address) external view returns (uint256);
    function push(address, uint256) external;
}

struct Inc {
    uint256 net;
    uint256 tab;
    uint256 tax;
    uint256 num;
    uint256 hop;
}

contract DSSDemo {
    uint256 constant WAD = 1 ether;

    DSSLike public immutable dss; // DSS module
    CTRLike public immutable ctr; // CTR token
    DSSLike public immutable val; // Counter

    constructor(address _dss, address _ctr) {
        dss = DSSLike(_dss);
        ctr = CTRLike(_ctr);

        val = DSSLike(dss.build("val", address(0)));
        val.bless();
        val.use();
    }

    function see() public view returns (uint256) {
        return val.see();
    }

    function hit() external {
        val.hit();
        _give(msg.sender, 10 * WAD);
    }

    function dip() external {
        val.dip();
        _give(msg.sender, 10 * WAD);
    }

    function inc() public view returns (Inc memory) {
        SumLike sum = SumLike(dss.sum());
        (uint256 net, uint256 tab, uint256 tax, uint256 num, uint256 hop) = sum.incs(address(val));
        return Inc(net, tab, tax, num, hop);
    }

    function _give(address dst, uint256 wad) internal {
        if (ctr.balanceOf(address(this)) >= wad) ctr.push(dst, wad);
    }
}

Read Contract

ctr 0x87e9e77f → address
dss 0xfa290fad → address
inc 0x371303c0 → tuple
see 0x9ae5a2be → uint256
val 0x3c6bb436 → address

Write Contract 2 functions

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

dip 0x28d36a83
No parameters
hit 0x2ae3594a
No parameters

Recent Transactions

No transactions found for this address