Address Contract Partially Verified
Address
0xFe7a2aC0B945f12089aEEB6eCebf4F384D9f043F
Balance
0 ETH
Nonce
1
Code Size
8117 bytes
Creator
0x1f42e41A...9745 at tx 0x70f57c83...ace8fa
Indexed Transactions
0 (1 on-chain, 1.4% indexed)
Contract Bytecode
8117 bytes
0x608060405234801561001057600080fd5b50600436106101425760003560e01c806365fae35e116100b8578063ac4c25b21161007c578063ac4c25b2146104e1578063b0b8579b146104eb578063be9a655514610511578063bf353dbb1461051b578063e38e2cfb14610573578063f29c29c4146105a557610142565b806365fae35e146103e757806375f12b211461042b5780639c52a7f114610449578063a4dff0a21461048d578063a7a1ed72146104bf57610142565b80632e7dc6af1161010a5780632e7dc6af1461024157806346d4577d1461028b5780634fce7a2a1461030457806357de26a41461035c57806359e02dd71461037a57806365c4ce7a146103a357610142565b806307da68f5146101475780630e5a6c7014610151578063181783581461017a5780631b25b65f146101845780631e77933e146101fd575b600080fd5b61014f6105e9565b005b6101596106d9565b60405180838152602001821515151581526020019250505060405180910390f35b610182610807565b005b6101fb6004803603602081101561019a57600080fd5b81019080803590602001906401000000008111156101b757600080fd5b8201836020820111156101c957600080fd5b803590602001918460208302840111640100000000831117156101eb57600080fd5b9091929391929390505050610c0c565b005b61023f6004803603602081101561021357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e4e565b005b610249610f79565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610302600480360360208110156102a157600080fd5b81019080803590602001906401000000008111156102be57600080fd5b8201836020820111156102d057600080fd5b803590602001918460208302840111640100000000831117156102f257600080fd5b9091929391929390505050610f9f565b005b6103466004803603602081101561031a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611116565b6040518082815260200191505060405180910390f35b61036461112e565b6040518082815260200191505060405180910390f35b6103826112ca565b60405180838152602001821515151581526020019250505060405180910390f35b6103e5600480360360208110156103b957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506113f8565b005b610429600480360360208110156103fd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611527565b005b610433611655565b6040518082815260200191505060405180910390f35b61048b6004803603602081101561045f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061165b565b005b610495611789565b604051808267ffffffffffffffff1667ffffffffffffffff16815260200191505060405180910390f35b6104c76117a3565b604051808215151515815260200191505060405180910390f35b6104e96117f2565b005b6104f3611a5a565b604051808261ffff1661ffff16815260200191505060405180910390f35b610519611a6e565b005b61055d6004803603602081101561053157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b5f565b6040518082815260200191505060405180910390f35b6105a36004803603602081101561058957600080fd5b81019080803561ffff169060200190929190505050611b77565b005b6105e7600480360360208110156105bb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611cc5565b005b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541461069d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f4f534d2f6e6f742d617574686f72697a6564000000000000000000000000000081525060200191505060405180910390fd5b600180819055505961012081016040526020815260e0602082015260e0600060408301376024356004353360003560e01c60e01b61012085a450565b6000806001600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414610791576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f4f534d2f636f6e74726163742d6e6f742d77686974656c69737465640000000081525060200191505060405180910390fd5b600460000160009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1660001b6001600460000160109054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1614915091509091565b60006001541461087f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f4f534d2f69732d73746f7070656400000000000000000000000000000000000081525060200191505060405180910390fd5b6108876117a3565b6108f9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f4f534d2f6e6f742d70617373656400000000000000000000000000000000000081525060200191505060405180910390fd5b600080600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166359e02dd76040518163ffffffff1660e01b8152600401604080518083038186803b15801561096357600080fd5b505afa158015610977573d6000803e3d6000fd5b505050506040513d604081101561098d57600080fd5b810190808051906020019092919080519060200190929190505050915091508015610bd557600460036000820160009054906101000a90046fffffffffffffffffffffffffffffffff168160000160006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055506000820160109054906101000a90046fffffffffffffffffffffffffffffffff168160000160106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555090505060405180604001604052808360001c6fffffffffffffffffffffffffffffffff16815260200160016fffffffffffffffffffffffffffffffff16815250600460008201518160000160006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555060208201518160000160106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550905050610b3f610b3a611e97565b611e9f565b600260166101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055507f296ba4ca62c6c21c95e828080cb8aec7481b71390585605300a8a76f9e95b527600360000160009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1660001b6040518082815260200191505060405180910390a15b50505961012081016040526020815260e0602082015260e0600060408301376024356004353360003560e01c60e01b61012085a450565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414610cc0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f4f534d2f6e6f742d617574686f72697a6564000000000000000000000000000081525060200191505060405180910390fd5b60008090505b82829050811015610e1657600073ffffffffffffffffffffffffffffffffffffffff16838383818110610cf557fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610d9c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4f534d2f6e6f2d636f6e74726163742d3000000000000000000000000000000081525060200191505060405180910390fd5b600160056000858585818110610dae57fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508080600101915050610cc6565b505961012081016040526020815260e0602082015260e0600060408301376024356004353360003560e01c60e01b61012085a4505050565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414610f02576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f4f534d2f6e6f742d617574686f72697a6564000000000000000000000000000081525060200191505060405180910390fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505961012081016040526020815260e0602082015260e0600060408301376024356004353360003560e01c60e01b61012085a45050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414611053576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f4f534d2f6e6f742d617574686f72697a6564000000000000000000000000000081525060200191505060405180910390fd5b60008090505b828290508110156110de5760006005600085858581811061107657fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508080600101915050611059565b505961012081016040526020815260e0602082015260e0600060408301376024356004353360003560e01c60e01b61012085a4505050565b60056020528060005260406000206000915090505481565b60006001600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054146111e5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f4f534d2f636f6e74726163742d6e6f742d77686974656c69737465640000000081525060200191505060405180910390fd5b6001600360000160109054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff161461128e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f4f534d2f6e6f2d63757272656e742d76616c756500000000000000000000000081525060200191505060405180910390fd5b600360000160009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1660001b905090565b6000806001600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414611382576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f4f534d2f636f6e74726163742d6e6f742d77686974656c69737465640000000081525060200191505060405180910390fd5b600360000160009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1660001b6001600360000160109054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1614915091509091565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054146114ac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f4f534d2f6e6f742d617574686f72697a6564000000000000000000000000000081525060200191505060405180910390fd5b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505961012081016040526020815260e0602082015260e0600060408301376024356004353360003560e01c60e01b61012085a45050565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054146115db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f4f534d2f6e6f742d617574686f72697a6564000000000000000000000000000081525060200191505060405180910390fd5b60016000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505961012081016040526020815260e0602082015260e0600060408301376024356004353360003560e01c60e01b61012085a45050565b60015481565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541461170f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f4f534d2f6e6f742d617574686f72697a6564000000000000000000000000000081525060200191505060405180910390fd5b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505961012081016040526020815260e0602082015260e0600060408301376024356004353360003560e01c60e01b61012085a45050565b600260169054906101000a900467ffffffffffffffff1681565b60006117d9600260169054906101000a900467ffffffffffffffff16600260149054906101000a900461ffff1661ffff16611f52565b67ffffffffffffffff166117eb611e97565b1015905090565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054146118a6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f4f534d2f6e6f742d617574686f72697a6564000000000000000000000000000081525060200191505060405180910390fd5b604051806040016040528060006fffffffffffffffffffffffffffffffff16815260200160006fffffffffffffffffffffffffffffffff16815250600460008201518160000160006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555060208201518160000160106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550905060036000820160009054906101000a90046fffffffffffffffffffffffffffffffff168160000160006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055506000820160109054906101000a90046fffffffffffffffffffffffffffffffff168160000160106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550905050600180819055505961012081016040526020815260e0602082015260e0600060408301376024356004353360003560e01c60e01b61012085a450565b600260149054906101000a900461ffff1681565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414611b22576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f4f534d2f6e6f742d617574686f72697a6564000000000000000000000000000081525060200191505060405180910390fd5b60006001819055505961012081016040526020815260e0602082015260e0600060408301376024356004353360003560e01c60e01b61012085a450565b60006020528060005260406000206000915090505481565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414611c2b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f4f534d2f6e6f742d617574686f72697a6564000000000000000000000000000081525060200191505060405180910390fd5b60008161ffff1611611ca5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f4f534d2f74732d69732d7a65726f00000000000000000000000000000000000081525060200191505060405180910390fd5b80600260146101000a81548161ffff021916908361ffff16021790555050565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414611d79576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f4f534d2f6e6f742d617574686f72697a6564000000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611e1c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4f534d2f6e6f2d636f6e74726163742d3000000000000000000000000000000081525060200191505060405180910390fd5b6001600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505961012081016040526020815260e0602082015260e0600060408301376024356004353360003560e01c60e01b61012085a45050565b600042905090565b600080600260149054906101000a900461ffff1661ffff161415611f2b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f4f534d2f686f702d69732d7a65726f000000000000000000000000000000000081525060200191505060405180910390fd5b600260149054906101000a900461ffff1661ffff168281611f4857fe5b0682039050919050565b600081830190508267ffffffffffffffff168167ffffffffffffffff161015611f7a57600080fd5b9291505056fea265627a7a72315820889d954dc1f6c43b567fbd2797c91c5a07ebfb1433c4039dba0942ce6123f55964736f6c634300050c0032
Verified Source Code Partial Match
Compiler: v0.5.12+commit.7709ece9
EVM: petersburg
Optimization: No
OSM_STETHUSD.sol 448 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 -- 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 -- 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);
}
}
}
}
// 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)));
}
}
/// 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;
}
}
/// 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_STETHUSD 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;
}
}
}
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
This address has 1 on-chain transactions, but only 1.4% of the chain is indexed. Transactions will appear as indexing progresses. View on Etherscan →