Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
This contract has been partially verified via Sourcify.
View contract in Sourcify repository
- Contract name:
- DSProxyCache
- Optimization enabled
- true
- Compiler version
- v0.4.20+commit.3155dd80
- Optimization runs
- 200
- Verified at
- 2026-05-12T06:04:47.572308Z
DSProxyCache.sol
// proxy.sol - execute actions atomically through the proxy's identity
// 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.13;
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;
function DSAuth() public {
owner = msg.sender;
LogSetOwner(msg.sender);
}
function setOwner(address owner_)
public
auth
{
owner = owner_;
LogSetOwner(owner);
}
function setAuthority(DSAuthority authority_)
public
auth
{
authority = authority_;
LogSetAuthority(authority);
}
modifier auth {
require(isAuthorized(msg.sender, msg.sig));
_;
}
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, this, sig);
}
}
}
contract DSNote {
event LogNote(
bytes4 indexed sig,
address indexed guy,
bytes32 indexed foo,
bytes32 indexed bar,
uint wad,
bytes fax
) anonymous;
modifier note {
bytes32 foo;
bytes32 bar;
assembly {
foo := calldataload(4)
bar := calldataload(36)
}
LogNote(msg.sig, msg.sender, foo, bar, msg.value, msg.data);
_;
}
}
// DSProxyCache
// This global cache stores addresses of contracts previously deployed
// by a proxy. This saves gas from repeat deployment of the same
// contracts and eliminates blockchain bloat.
// By default, all proxies deployed from the same factory store
// contracts in the same cache. The cache a proxy instance uses can be
// changed. The cache uses the sha3 hash of a contract's bytecode to
// lookup the address
contract DSProxyCache {
mapping(bytes32 => address) cache;
function read(bytes _code) public view returns (address) {
bytes32 hash = keccak256(_code);
return cache[hash];
}
function write(bytes _code) public returns (address target) {
assembly {
target := create(0, add(_code, 0x20), mload(_code))
switch iszero(extcodesize(target))
case 1 {
// throw if contract failed to deploy
revert(0, 0)
}
}
bytes32 hash = keccak256(_code);
cache[hash] = target;
}
}
Compiler Settings
{"remappings":[],"optimizer":{"runs":200,"enabled":true},"libraries":{},"compilationTarget":{"DSProxyCache.sol":"DSProxyCache"}}
Contract ABI
[{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"address","name":"target"}],"name":"write","inputs":[{"type":"bytes","name":"_code"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":""}],"name":"read","inputs":[{"type":"bytes","name":"_code"}],"constant":true}]
Contract Creation Code
0x6060604052341561000f57600080fd5b6102918061001e6000396000f30060606040526004361061004b5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416637ed0c3b281146100505780638bf4515c146100ca575b600080fd5b341561005b57600080fd5b6100a160046024813581810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061011b95505050505050565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b34156100d557600080fd5b6100a160046024813581810190830135806020601f820181900481020160405190810160405281815292919060208401838380828437509496506101d995505050505050565b6000808251602084016000f09150813b156001811461004b5750826040518082805190602001908083835b602083106101655780518252601f199092019160209182019101610146565b6001836020036101000a03801982511681845116179092525050509190910192506040915050519081900390206000908152602081905260409020805473ffffffffffffffffffffffffffffffffffffffff191673ffffffffffffffffffffffffffffffffffffffff841617905550919050565b600080826040518082805190602001908083835b6020831061020c5780518252601f1990920191602091820191016101ed565b6001836020036101000a038019825116818451161790925250505091909101925060409150505190819003902060009081526020819052604090205473ffffffffffffffffffffffffffffffffffffffff1693925050505600a165627a7a723058200cb76cd69cdf96e9ca0035bccd7a8a06a0747c12f9cdbc2fe0570098e197d8580029
Deployed ByteCode
0x60606040526004361061004b5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416637ed0c3b281146100505780638bf4515c146100ca575b600080fd5b341561005b57600080fd5b6100a160046024813581810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061011b95505050505050565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b34156100d557600080fd5b6100a160046024813581810190830135806020601f820181900481020160405190810160405281815292919060208401838380828437509496506101d995505050505050565b6000808251602084016000f09150813b156001811461004b5750826040518082805190602001908083835b602083106101655780518252601f199092019160209182019101610146565b6001836020036101000a03801982511681845116179092525050509190910192506040915050519081900390206000908152602081905260409020805473ffffffffffffffffffffffffffffffffffffffff191673ffffffffffffffffffffffffffffffffffffffff841617905550919050565b600080826040518082805190602001908083835b6020831061020c5780518252601f1990920191602091820191016101ed565b6001836020036101000a038019825116818451161790925250505091909101925060409150505190819003902060009081526020819052604090205473ffffffffffffffffffffffffffffffffffffffff1693925050505600a165627a7a723058200cb76cd69cdf96e9ca0035bccd7a8a06a0747c12f9cdbc2fe0570098e197d8580029