Перейти к содержимому
Проверенный контрактТочноеAGPL-3.0-or-later

DSValue

Адрес0x0318078b990c73a5b1f9482eaec009d2bedd1387
Баланс

0 ETH

 

Транзакций

0

 

Компилятор

solc 0.6.12

 

Тот же код

ещё 1 контракт

 

Подробности

Компилятор
solc 0.6.12+commit.27d51765
Язык
solidity
Оптимизация
Да, 200 прогонов
Версия EVM
istanbul
Лицензия
AGPL-3.0-or-later
Совпадение
Точноекод создания: да, код в сети: да
Проверен на Sourcify
Создан в блоке
23 967 019
Транзакция создания
0x41167d98d1…f940212436

2 файла

src/value/value.sol

// SPDX-License-Identifier: AGPL-3.0-or-later

/// 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.6.12;

import {DSAuth} from "../auth/auth.sol";

contract DSValue is DSAuth {
    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 auth {
        val = wut;
        has = true;
    }
    function void() public auth {  // unset the value
        has = false;
    }
}

src/auth/auth.sol

// 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.6.12;

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
        virtual
        auth
    {
        owner = owner_;
        emit LogSetOwner(owner);
    }

    function setAuthority(DSAuthority authority_)
        public
        virtual
        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);
        }
    }
}
Настройки компилятораПоказать
{
  "metadata": {
    "bytecodeHash": "ipfs",
    "useLiteralContent": false
  },
  "optimizer": {
    "runs": 200,
    "enabled": true
  },
  "evmVersion": "istanbul",
  "remappings": [
    "forge-std/=lib/forge-std/src/",
    "usdd/=lib/usddv2-contracts/src/",
    "ds-math/=lib/ds-math/src/",
    "ds-token/=lib/ds-token/src/",
    "ds-value/=lib/ds-value/src/",
    "psm/=lib/psm/src/",
    "forward-proxy/=lib/forward-proxy/src/",
    "ds-auth/=lib/usddv2-contracts/lib/ds-auth/src/",
    "ds-note/=lib/ds-value/lib/ds-thing/lib/ds-note/src/",
    "ds-test/=lib/psm/lib/ds-test/src/",
    "ds-thing/=lib/ds-value/lib/ds-thing/src/",
    "dss-interfaces/=lib/psm/lib/dss-interfaces/src/",
    "erc4626-tests/=lib/usddv2-contracts/lib/erc4626-tests/",
    "usddv2-contracts/=lib/usddv2-contracts/",
    "usddv2/=lib/psm/lib/usddv2/"
  ]
}

Исходный код и метаданные: Sourcify.

Исходный код принадлежит авторам контракта.