Transactions
Token Transfers
Tokens
Internal Transactions
Coin Balance History
Code
Read Contract
Write Contract
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- DSPauseProxy
- Optimization enabled
- false
- Compiler version
- v0.5.12+commit.7709ece9
- EVM Version
- default
- Verified at
- 2025-01-13T18:45:38.599376Z
Contract source code
/**
*Submitted for verification at Etherscan.io on 2019-11-14
*/
// hevm: flattened sources of /nix/store/b2bvh9ljr3yljrdz6lm764hdyj7nk4iy-ds-pause-f43edc1/src/pause.sol
pragma solidity >=0.4.23 >=0.5.0 <0.6.0;
////// /nix/store/6qq1ps6wrikrl6ha3q33739dbs2wg2hb-ds-note/dapp/ds-note/src/note.sol
/// 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);
_;
}
}
////// /nix/store/r1w3fgb8wh0c2qn0i8jg95sv99l5nh7j-ds-auth/dapp/ds-auth/src/auth.sol
// 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 DSAuthority {
function canCall(
address src, address dst, bytes4 sig
) public 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(0)) {
return false;
} else {
return authority.canCall(src, address(this), sig);
}
}
}
////// /nix/store/b2bvh9ljr3yljrdz6lm764hdyj7nk4iy-ds-pause-f43edc1/src/pause.sol
// Copyright (C) 2019 David Terry <me@xwvvvvwx.com>
//
// 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.0 <0.6.0; */
/* import {DSNote} from "ds-note/note.sol"; */
/* import {DSAuth, DSAuthority} from "ds-auth/auth.sol"; */
contract DSPause is DSAuth, DSNote {
// --- admin ---
modifier wait { require(msg.sender == address(proxy), "ds-pause-undelayed-call"); _; }
function setOwner(address owner_) public wait {
owner = owner_;
emit LogSetOwner(owner);
}
function setAuthority(DSAuthority authority_) public wait {
authority = authority_;
emit LogSetAuthority(address(authority));
}
function setDelay(uint delay_) public note wait {
delay = delay_;
}
// --- math ---
function add(uint x, uint y) internal pure returns (uint z) {
z = x + y;
require(z >= x, "ds-pause-addition-overflow");
}
// --- data ---
mapping (bytes32 => bool) public plans;
DSPauseProxy public proxy;
uint public delay;
// --- init ---
constructor(uint delay_, address owner_, DSAuthority authority_) public {
delay = delay_;
owner = owner_;
authority = authority_;
proxy = new DSPauseProxy();
}
// --- util ---
function hash(address usr, bytes32 tag, bytes memory fax, uint eta)
internal pure
returns (bytes32)
{
return keccak256(abi.encode(usr, tag, fax, eta));
}
function soul(address usr)
internal view
returns (bytes32 tag)
{
assembly { tag := extcodehash(usr) }
}
// --- operations ---
function plot(address usr, bytes32 tag, bytes memory fax, uint eta)
public note auth
{
require(eta >= add(now, delay), "ds-pause-delay-not-respected");
plans[hash(usr, tag, fax, eta)] = true;
}
function drop(address usr, bytes32 tag, bytes memory fax, uint eta)
public note auth
{
plans[hash(usr, tag, fax, eta)] = false;
}
function exec(address usr, bytes32 tag, bytes memory fax, uint eta)
public note
returns (bytes memory out)
{
require(plans[hash(usr, tag, fax, eta)], "ds-pause-unplotted-plan");
require(soul(usr) == tag, "ds-pause-wrong-codehash");
require(now >= eta, "ds-pause-premature-exec");
plans[hash(usr, tag, fax, eta)] = false;
out = proxy.exec(usr, fax);
require(proxy.owner() == address(this), "ds-pause-illegal-storage-change");
}
}
// plans are executed in an isolated storage context to protect the pause from
// malicious storage modification during plan execution
contract DSPauseProxy {
address public owner;
modifier auth { require(msg.sender == owner, "ds-pause-proxy-unauthorized"); _; }
constructor() public { owner = msg.sender; }
function exec(address usr, bytes memory fax)
public auth
returns (bytes memory out)
{
bool ok;
(ok, out) = usr.delegatecall(fax);
require(ok, "ds-pause-delegatecall-error");
}
}
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","payable":false,"inputs":[]},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bytes","name":"out","internalType":"bytes"}],"name":"exec","inputs":[{"type":"address","name":"usr","internalType":"address"},{"type":"bytes","name":"fax","internalType":"bytes"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[],"constant":true}]
Contract Creation Code
0x608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061042c806100606000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80638da5cb5b1461003b578063be6002c214610085575b600080fd5b6100436101d9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61015e6004803603604081101561009b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001906401000000008111156100d857600080fd5b8201836020820111156100ea57600080fd5b8035906020019184600183028401116401000000008311171561010c57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192905050506101fe565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561019e578082015181840152602081019050610183565b50505050905090810190601f1680156101cb5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60606000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146102c2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f64732d70617573652d70726f78792d756e617574686f72697a6564000000000081525060200191505060405180910390fd5b60008373ffffffffffffffffffffffffffffffffffffffff16836040518082805190602001908083835b6020831061030f57805182526020820191506020810190506020830392506102ec565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d806000811461036f576040519150601f19603f3d011682016040523d82523d6000602084013e610374565b606091505b508093508192505050806103f0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f64732d70617573652d64656c656761746563616c6c2d6572726f72000000000081525060200191505060405180910390fd5b509291505056fea265627a7a723158201aaf44b09961e5d78dcb89db50ece2cf99b6310af3657880f30921c1a292db5364736f6c634300050c0032
Deployed ByteCode
0x608060405234801561001057600080fd5b50600436106100365760003560e01c80638da5cb5b1461003b578063be6002c214610085575b600080fd5b6100436101d9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61015e6004803603604081101561009b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001906401000000008111156100d857600080fd5b8201836020820111156100ea57600080fd5b8035906020019184600183028401116401000000008311171561010c57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192905050506101fe565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561019e578082015181840152602081019050610183565b50505050905090810190601f1680156101cb5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60606000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146102c2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f64732d70617573652d70726f78792d756e617574686f72697a6564000000000081525060200191505060405180910390fd5b60008373ffffffffffffffffffffffffffffffffffffffff16836040518082805190602001908083835b6020831061030f57805182526020820191506020810190506020830392506102ec565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d806000811461036f576040519150601f19603f3d011682016040523d82523d6000602084013e610374565b606091505b508093508192505050806103f0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f64732d70617573652d64656c656761746563616c6c2d6572726f72000000000081525060200191505060405180910390fd5b509291505056fea265627a7a723158201aaf44b09961e5d78dcb89db50ece2cf99b6310af3657880f30921c1a292db5364736f6c634300050c0032