Source Code
Latest 9 internal transactions
Advanced mode:
| Parent Transaction Hash | Method | Block |
From
|
|
To
|
||
|---|---|---|---|---|---|---|---|
| - | 7728792 | 2488 days ago | Contract Creation | 0 ETH | |||
| - | 7713644 | 2490 days ago | Contract Creation | 0 ETH | |||
| - | 7681436 | 2495 days ago | Contract Creation | 0 ETH | |||
| Transfer | 4752008 | 2995 days ago | Contract Creation | 0 ETH | |||
| Transfer | 4752008 | 2995 days ago | Contract Creation | 0 ETH | |||
| Transfer | 4752008 | 2995 days ago | Contract Creation | 0 ETH | |||
| Transfer | 4750108 | 2996 days ago | Contract Creation | 0 ETH | |||
| Transfer | 4750108 | 2996 days ago | Contract Creation | 0 ETH | |||
| Transfer | 4750108 | 2996 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
GemFab
Compiler Version
v0.4.19+commit.c4cbbb05
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity)
/**
*Submitted for verification at Etherscan.io on 2017-12-17
*/
// hevm: flattened sources of src/fab.sol
pragma solidity ^0.4.18;
////// lib/ds-guard/lib/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.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);
}
}
}
////// lib/ds-guard/src/guard.sol
// guard.sol -- simple whitelist implementation of DSAuthority
// 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; */
/* import "ds-auth/auth.sol"; */
contract DSGuardEvents {
event LogPermit(
bytes32 indexed src,
bytes32 indexed dst,
bytes32 indexed sig
);
event LogForbid(
bytes32 indexed src,
bytes32 indexed dst,
bytes32 indexed sig
);
}
contract DSGuard is DSAuth, DSAuthority, DSGuardEvents {
bytes32 constant public ANY = bytes32(uint(-1));
mapping (bytes32 => mapping (bytes32 => mapping (bytes32 => bool))) acl;
function canCall(
address src_, address dst_, bytes4 sig
) public view returns (bool) {
var src = bytes32(src_);
var dst = bytes32(dst_);
return acl[src][dst][sig]
|| acl[src][dst][ANY]
|| acl[src][ANY][sig]
|| acl[src][ANY][ANY]
|| acl[ANY][dst][sig]
|| acl[ANY][dst][ANY]
|| acl[ANY][ANY][sig]
|| acl[ANY][ANY][ANY];
}
function permit(bytes32 src, bytes32 dst, bytes32 sig) public auth {
acl[src][dst][sig] = true;
LogPermit(src, dst, sig);
}
function forbid(bytes32 src, bytes32 dst, bytes32 sig) public auth {
acl[src][dst][sig] = false;
LogForbid(src, dst, sig);
}
function permit(address src, address dst, bytes32 sig) public {
permit(bytes32(src), bytes32(dst), sig);
}
function forbid(address src, address dst, bytes32 sig) public {
forbid(bytes32(src), bytes32(dst), sig);
}
}
contract DSGuardFactory {
mapping (address => bool) public isGuard;
function newGuard() public returns (DSGuard guard) {
guard = new DSGuard();
guard.setOwner(msg.sender);
isGuard[guard] = true;
}
}
////// lib/ds-roles/src/roles.sol
// roles.sol - roled based authentication
// 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; */
/* import 'ds-auth/auth.sol'; */
contract DSRoles is DSAuth, DSAuthority
{
mapping(address=>bool) _root_users;
mapping(address=>bytes32) _user_roles;
mapping(address=>mapping(bytes4=>bytes32)) _capability_roles;
mapping(address=>mapping(bytes4=>bool)) _public_capabilities;
function getUserRoles(address who)
public
view
returns (bytes32)
{
return _user_roles[who];
}
function getCapabilityRoles(address code, bytes4 sig)
public
view
returns (bytes32)
{
return _capability_roles[code][sig];
}
function isUserRoot(address who)
public
view
returns (bool)
{
return _root_users[who];
}
function isCapabilityPublic(address code, bytes4 sig)
public
view
returns (bool)
{
return _public_capabilities[code][sig];
}
function hasUserRole(address who, uint8 role)
public
view
returns (bool)
{
bytes32 roles = getUserRoles(who);
bytes32 shifted = bytes32(uint256(uint256(2) ** uint256(role)));
return bytes32(0) != roles & shifted;
}
function canCall(address caller, address code, bytes4 sig)
public
view
returns (bool)
{
if( isUserRoot(caller) || isCapabilityPublic(code, sig) ) {
return true;
} else {
var has_roles = getUserRoles(caller);
var needs_one_of = getCapabilityRoles(code, sig);
return bytes32(0) != has_roles & needs_one_of;
}
}
function BITNOT(bytes32 input) internal pure returns (bytes32 output) {
return (input ^ bytes32(uint(-1)));
}
function setRootUser(address who, bool enabled)
public
auth
{
_root_users[who] = enabled;
}
function setUserRole(address who, uint8 role, bool enabled)
public
auth
{
var last_roles = _user_roles[who];
bytes32 shifted = bytes32(uint256(uint256(2) ** uint256(role)));
if( enabled ) {
_user_roles[who] = last_roles | shifted;
} else {
_user_roles[who] = last_roles & BITNOT(shifted);
}
}
function setPublicCapability(address code, bytes4 sig, bool enabled)
public
auth
{
_public_capabilities[code][sig] = enabled;
}
function setRoleCapability(uint8 role, address code, bytes4 sig, bool enabled)
public
auth
{
var last_roles = _capability_roles[code][sig];
bytes32 shifted = bytes32(uint256(uint256(2) ** uint256(role)));
if( enabled ) {
_capability_roles[code][sig] = last_roles | shifted;
} else {
_capability_roles[code][sig] = last_roles & BITNOT(shifted);
}
}
}
////// lib/ds-spell/lib/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.13; */
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);
_;
}
}
////// lib/ds-thing/lib/ds-math/src/math.sol
/// 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);
}
function sub(uint x, uint y) internal pure returns (uint z) {
require((z = x - y) <= x);
}
function mul(uint x, uint y) internal pure returns (uint z) {
require(y == 0 || (z = x * y) / y == x);
}
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;
function wmul(uint x, uint y) internal pure returns (uint z) {
z = add(mul(x, y), WAD / 2) / WAD;
}
function rmul(uint x, uint y) internal pure returns (uint z) {
z = add(mul(x, y), RAY / 2) / RAY;
}
function wdiv(uint x, uint y) internal pure returns (uint z) {
z = add(mul(x, WAD), y / 2) / y;
}
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);
}
}
}
}
////// lib/ds-thing/src/thing.sol
// 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.13; */
/* import 'ds-auth/auth.sol'; */
/* import 'ds-note/note.sol'; */
/* import 'ds-math/math.sol'; */
contract DSThing is DSAuth, DSNote, DSMath {
function S(string s) internal pure returns (bytes4) {
return bytes4(keccak256(s));
}
}
////// lib/ds-token/lib/ds-stop/src/stop.sol
/// stop.sol -- mixin for enable/disable functionality
// 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; */
/* import "ds-auth/auth.sol"; */
/* import "ds-note/note.sol"; */
contract DSStop is DSNote, DSAuth {
bool public stopped;
modifier stoppable {
require(!stopped);
_;
}
function stop() public auth note {
stopped = true;
}
function start() public auth note {
stopped = false;
}
}
////// lib/ds-token/lib/erc20/src/erc20.sol
/// erc20.sol -- API for the ERC20 token standard
// See <https://github.com/ethereum/EIPs/issues/20>.
// This file likely does not meet the threshold of originality
// required for copyright to apply. As a result, this is free and
// unencumbered software belonging to the public domain.
/* pragma solidity ^0.4.8; */
contract ERC20Events {
event Approval(address indexed src, address indexed guy, uint wad);
event Transfer(address indexed src, address indexed dst, uint wad);
}
contract ERC20 is ERC20Events {
function totalSupply() public view returns (uint);
function balanceOf(address guy) public view returns (uint);
function allowance(address src, address guy) public view returns (uint);
function approve(address guy, uint wad) public returns (bool);
function transfer(address dst, uint wad) public returns (bool);
function transferFrom(
address src, address dst, uint wad
) public returns (bool);
}
////// lib/ds-token/src/base.sol
/// base.sol -- basic ERC20 implementation
// Copyright (C) 2015, 2016, 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; */
/* import "erc20/erc20.sol"; */
/* import "ds-math/math.sol"; */
contract DSTokenBase is ERC20, DSMath {
uint256 _supply;
mapping (address => uint256) _balances;
mapping (address => mapping (address => uint256)) _approvals;
function DSTokenBase(uint supply) public {
_balances[msg.sender] = supply;
_supply = supply;
}
function totalSupply() public view returns (uint) {
return _supply;
}
function balanceOf(address src) public view returns (uint) {
return _balances[src];
}
function allowance(address src, address guy) public view returns (uint) {
return _approvals[src][guy];
}
function transfer(address dst, uint wad) public returns (bool) {
return transferFrom(msg.sender, dst, wad);
}
function transferFrom(address src, address dst, uint wad)
public
returns (bool)
{
if (src != msg.sender) {
_approvals[src][msg.sender] = sub(_approvals[src][msg.sender], wad);
}
_balances[src] = sub(_balances[src], wad);
_balances[dst] = add(_balances[dst], wad);
Transfer(src, dst, wad);
return true;
}
function approve(address guy, uint wad) public returns (bool) {
_approvals[msg.sender][guy] = wad;
Approval(msg.sender, guy, wad);
return true;
}
}
////// lib/ds-token/src/token.sol
/// token.sol -- ERC20 implementation with minting and burning
// Copyright (C) 2015, 2016, 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; */
/* import "ds-stop/stop.sol"; */
/* import "./base.sol"; */
contract DSToken is DSTokenBase(0), DSStop {
bytes32 public symbol;
uint256 public decimals = 18; // standard token precision. override to customize
function DSToken(bytes32 symbol_) public {
symbol = symbol_;
}
event Mint(address indexed guy, uint wad);
event Burn(address indexed guy, uint wad);
function approve(address guy) public stoppable returns (bool) {
return super.approve(guy, uint(-1));
}
function approve(address guy, uint wad) public stoppable returns (bool) {
return super.approve(guy, wad);
}
function transferFrom(address src, address dst, uint wad)
public
stoppable
returns (bool)
{
if (src != msg.sender && _approvals[src][msg.sender] != uint(-1)) {
_approvals[src][msg.sender] = sub(_approvals[src][msg.sender], wad);
}
_balances[src] = sub(_balances[src], wad);
_balances[dst] = add(_balances[dst], wad);
Transfer(src, dst, wad);
return true;
}
function push(address dst, uint wad) public {
transferFrom(msg.sender, dst, wad);
}
function pull(address src, uint wad) public {
transferFrom(src, msg.sender, wad);
}
function move(address src, address dst, uint wad) public {
transferFrom(src, dst, wad);
}
function mint(uint wad) public {
mint(msg.sender, wad);
}
function burn(uint wad) public {
burn(msg.sender, wad);
}
function mint(address guy, uint wad) public auth stoppable {
_balances[guy] = add(_balances[guy], wad);
_supply = add(_supply, wad);
Mint(guy, wad);
}
function burn(address guy, uint wad) public auth stoppable {
if (guy != msg.sender && _approvals[guy][msg.sender] != uint(-1)) {
_approvals[guy][msg.sender] = sub(_approvals[guy][msg.sender], wad);
}
_balances[guy] = sub(_balances[guy], wad);
_supply = sub(_supply, wad);
Burn(guy, wad);
}
// Optional token name
bytes32 public name = "";
function setName(bytes32 name_) public auth {
name = name_;
}
}
////// lib/ds-value/src/value.sol
/// 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.13; */
/* 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) {
var (wut, haz) = peek();
assert(haz);
return wut;
}
function poke(bytes32 wut) public note auth {
val = wut;
has = true;
}
function void() public note auth { // unset the value
has = false;
}
}
////// src/vox.sol
/// vox.sol -- target price feed
// Copyright (C) 2016, 2017 Nikolai Mushegian <[email protected]>
// Copyright (C) 2016, 2017 Daniel Brockman <[email protected]>
// Copyright (C) 2017 Rain Break <[email protected]>
// 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.18; */
/* import "ds-thing/thing.sol"; */
contract SaiVox is DSThing {
uint256 _par;
uint256 _way;
uint256 public fix;
uint256 public how;
uint256 public tau;
function SaiVox(uint par_) public {
_par = fix = par_;
_way = RAY;
tau = era();
}
function era() public view returns (uint) {
return block.timestamp;
}
function mold(bytes32 param, uint val) public note auth {
if (param == 'way') _way = val;
}
// Dai Target Price (ref per dai)
function par() public returns (uint) {
prod();
return _par;
}
function way() public returns (uint) {
prod();
return _way;
}
function tell(uint256 ray) public note auth {
fix = ray;
}
function tune(uint256 ray) public note auth {
how = ray;
}
function prod() public note {
var age = era() - tau;
if (age == 0) return; // optimised
tau = era();
if (_way != RAY) _par = rmul(_par, rpow(_way, age)); // optimised
if (how == 0) return; // optimised
var wag = int128(how * age);
_way = inj(prj(_way) + (fix < _par ? wag : -wag));
}
function inj(int128 x) internal pure returns (uint256) {
return x >= 0 ? uint256(x) + RAY
: rdiv(RAY, RAY + uint256(-x));
}
function prj(uint256 x) internal pure returns (int128) {
return x >= RAY ? int128(x - RAY)
: int128(RAY) - int128(rdiv(RAY, x));
}
}
////// src/tub.sol
/// tub.sol -- simplified CDP engine (baby brother of `vat')
// Copyright (C) 2017 Nikolai Mushegian <[email protected]>
// Copyright (C) 2017 Daniel Brockman <[email protected]>
// Copyright (C) 2017 Rain Break <[email protected]>
// 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.18; */
/* import "ds-thing/thing.sol"; */
/* import "ds-token/token.sol"; */
/* import "ds-value/value.sol"; */
/* import "./vox.sol"; */
contract SaiTubEvents {
event LogNewCup(address indexed lad, bytes32 cup);
}
contract SaiTub is DSThing, SaiTubEvents {
DSToken public sai; // Stablecoin
DSToken public sin; // Debt (negative sai)
DSToken public skr; // Abstracted collateral
ERC20 public gem; // Underlying collateral
DSToken public gov; // Governance token
SaiVox public vox; // Target price feed
DSValue public pip; // Reference price feed
DSValue public pep; // Governance price feed
address public tap; // Liquidator
address public pit; // Governance Vault
uint256 public axe; // Liquidation penalty
uint256 public cap; // Debt ceiling
uint256 public mat; // Liquidation ratio
uint256 public tax; // Stability fee
uint256 public fee; // Governance fee
uint256 public gap; // Join-Exit Spread
bool public off; // Cage flag
bool public out; // Post cage exit
uint256 public fit; // REF per SKR (just before settlement)
uint256 public rho; // Time of last drip
uint256 _chi; // Accumulated Tax Rates
uint256 _rhi; // Accumulated Tax + Fee Rates
uint256 public rum; // Total normalised debt
uint256 public cupi;
mapping (bytes32 => Cup) public cups;
struct Cup {
address lad; // CDP owner
uint256 ink; // Locked collateral (in SKR)
uint256 art; // Outstanding normalised debt (tax only)
uint256 ire; // Outstanding normalised debt
}
function lad(bytes32 cup) public view returns (address) {
return cups[cup].lad;
}
function ink(bytes32 cup) public view returns (uint) {
return cups[cup].ink;
}
function tab(bytes32 cup) public returns (uint) {
return rmul(cups[cup].art, chi());
}
function rap(bytes32 cup) public returns (uint) {
return sub(rmul(cups[cup].ire, rhi()), tab(cup));
}
// Total CDP Debt
function din() public returns (uint) {
return rmul(rum, chi());
}
// Backing collateral
function air() public view returns (uint) {
return skr.balanceOf(this);
}
// Raw collateral
function pie() public view returns (uint) {
return gem.balanceOf(this);
}
//------------------------------------------------------------------
function SaiTub(
DSToken sai_,
DSToken sin_,
DSToken skr_,
ERC20 gem_,
DSToken gov_,
DSValue pip_,
DSValue pep_,
SaiVox vox_,
address pit_
) public {
gem = gem_;
skr = skr_;
sai = sai_;
sin = sin_;
gov = gov_;
pit = pit_;
pip = pip_;
pep = pep_;
vox = vox_;
axe = RAY;
mat = RAY;
tax = RAY;
fee = RAY;
gap = WAD;
_chi = RAY;
_rhi = RAY;
rho = era();
}
function era() public constant returns (uint) {
return block.timestamp;
}
//--Risk-parameter-config-------------------------------------------
function mold(bytes32 param, uint val) public note auth {
if (param == 'cap') cap = val;
else if (param == 'mat') { require(val >= RAY); mat = val; }
else if (param == 'tax') { require(val >= RAY); drip(); tax = val; }
else if (param == 'fee') { require(val >= RAY); drip(); fee = val; }
else if (param == 'axe') { require(val >= RAY); axe = val; }
else if (param == 'gap') { require(val >= WAD); gap = val; }
else return;
}
//--Price-feed-setters----------------------------------------------
function setPip(DSValue pip_) public note auth {
pip = pip_;
}
function setPep(DSValue pep_) public note auth {
pep = pep_;
}
function setVox(SaiVox vox_) public note auth {
vox = vox_;
}
//--Tap-setter------------------------------------------------------
function turn(address tap_) public note {
require(tap == 0);
require(tap_ != 0);
tap = tap_;
}
//--Collateral-wrapper----------------------------------------------
// Wrapper ratio (gem per skr)
function per() public view returns (uint ray) {
return skr.totalSupply() == 0 ? RAY : rdiv(pie(), skr.totalSupply());
}
// Join price (gem per skr)
function ask(uint wad) public view returns (uint) {
return rmul(wad, wmul(per(), gap));
}
// Exit price (gem per skr)
function bid(uint wad) public view returns (uint) {
return rmul(wad, wmul(per(), sub(2 * WAD, gap)));
}
function join(uint wad) public note {
require(!off);
require(ask(wad) > 0);
require(gem.transferFrom(msg.sender, this, ask(wad)));
skr.mint(msg.sender, wad);
}
function exit(uint wad) public note {
require(!off || out);
require(gem.transfer(msg.sender, bid(wad)));
skr.burn(msg.sender, wad);
}
//--Stability-fee-accumulation--------------------------------------
// Accumulated Rates
function chi() public returns (uint) {
drip();
return _chi;
}
function rhi() public returns (uint) {
drip();
return _rhi;
}
function drip() public note {
if (off) return;
var rho_ = era();
var age = rho_ - rho;
if (age == 0) return; // optimised
rho = rho_;
var inc = RAY;
if (tax != RAY) { // optimised
var _chi_ = _chi;
inc = rpow(tax, age);
_chi = rmul(_chi, inc);
sai.mint(tap, rmul(sub(_chi, _chi_), rum));
}
// optimised
if (fee != RAY) inc = rmul(inc, rpow(fee, age));
if (inc != RAY) _rhi = rmul(_rhi, inc);
}
//--CDP-risk-indicator----------------------------------------------
// Abstracted collateral price (ref per skr)
function tag() public view returns (uint wad) {
return off ? fit : wmul(per(), uint(pip.read()));
}
// Returns true if cup is well-collateralized
function safe(bytes32 cup) public returns (bool) {
var pro = rmul(tag(), ink(cup));
var con = rmul(vox.par(), tab(cup));
var min = rmul(con, mat);
return pro >= min;
}
//--CDP-operations--------------------------------------------------
function open() public note returns (bytes32 cup) {
require(!off);
cupi = add(cupi, 1);
cup = bytes32(cupi);
cups[cup].lad = msg.sender;
LogNewCup(msg.sender, cup);
}
function give(bytes32 cup, address guy) public note {
require(msg.sender == cups[cup].lad);
require(guy != 0);
cups[cup].lad = guy;
}
function lock(bytes32 cup, uint wad) public note {
require(!off);
cups[cup].ink = add(cups[cup].ink, wad);
skr.pull(msg.sender, wad);
require(cups[cup].ink == 0 || cups[cup].ink > 0.005 ether);
}
function free(bytes32 cup, uint wad) public note {
require(msg.sender == cups[cup].lad);
cups[cup].ink = sub(cups[cup].ink, wad);
skr.push(msg.sender, wad);
require(safe(cup));
require(cups[cup].ink == 0 || cups[cup].ink > 0.005 ether);
}
function draw(bytes32 cup, uint wad) public note {
require(!off);
require(msg.sender == cups[cup].lad);
require(rdiv(wad, chi()) > 0);
cups[cup].art = add(cups[cup].art, rdiv(wad, chi()));
rum = add(rum, rdiv(wad, chi()));
cups[cup].ire = add(cups[cup].ire, rdiv(wad, rhi()));
sai.mint(cups[cup].lad, wad);
require(safe(cup));
require(sai.totalSupply() <= cap);
}
function wipe(bytes32 cup, uint wad) public note {
require(!off);
var owe = rmul(wad, rdiv(rap(cup), tab(cup)));
cups[cup].art = sub(cups[cup].art, rdiv(wad, chi()));
rum = sub(rum, rdiv(wad, chi()));
cups[cup].ire = sub(cups[cup].ire, rdiv(add(wad, owe), rhi()));
sai.burn(msg.sender, wad);
var (val, ok) = pep.peek();
if (ok && val != 0) gov.move(msg.sender, pit, wdiv(owe, uint(val)));
}
function shut(bytes32 cup) public note {
require(!off);
require(msg.sender == cups[cup].lad);
if (tab(cup) != 0) wipe(cup, tab(cup));
if (ink(cup) != 0) free(cup, ink(cup));
delete cups[cup];
}
function bite(bytes32 cup) public note {
require(!safe(cup) || off);
// Take on all of the debt, except unpaid fees
var rue = tab(cup);
sin.mint(tap, rue);
rum = sub(rum, cups[cup].art);
cups[cup].art = 0;
cups[cup].ire = 0;
// Amount owed in SKR, including liquidation penalty
var owe = rdiv(rmul(rmul(rue, axe), vox.par()), tag());
if (owe > cups[cup].ink) {
owe = cups[cup].ink;
}
skr.push(tap, owe);
cups[cup].ink = sub(cups[cup].ink, owe);
}
//------------------------------------------------------------------
function cage(uint fit_, uint jam) public note auth {
require(!off && fit_ != 0);
off = true;
axe = RAY;
gap = WAD;
fit = fit_; // ref per skr
require(gem.transfer(tap, jam));
}
function flow() public note auth {
require(off);
out = true;
}
}
////// src/tap.sol
/// tap.sol -- liquidation engine (see also `vow`)
// Copyright (C) 2017 Nikolai Mushegian <[email protected]>
// Copyright (C) 2017 Daniel Brockman <[email protected]>
// Copyright (C) 2017 Rain Break <[email protected]>
// 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.18; */
/* import "./tub.sol"; */
contract SaiTap is DSThing {
DSToken public sai;
DSToken public sin;
DSToken public skr;
SaiVox public vox;
SaiTub public tub;
uint256 public gap; // Boom-Bust Spread
bool public off; // Cage flag
uint256 public fix; // Cage price
// Surplus
function joy() public view returns (uint) {
return sai.balanceOf(this);
}
// Bad debt
function woe() public view returns (uint) {
return sin.balanceOf(this);
}
// Collateral pending liquidation
function fog() public view returns (uint) {
return skr.balanceOf(this);
}
function SaiTap(SaiTub tub_) public {
tub = tub_;
sai = tub.sai();
sin = tub.sin();
skr = tub.skr();
vox = tub.vox();
gap = WAD;
}
function mold(bytes32 param, uint val) public note auth {
if (param == 'gap') gap = val;
}
// Cancel debt
function heal() public note {
if (joy() == 0 || woe() == 0) return; // optimised
var wad = min(joy(), woe());
sai.burn(wad);
sin.burn(wad);
}
// Feed price (sai per skr)
function s2s() public returns (uint) {
var tag = tub.tag(); // ref per skr
var par = vox.par(); // ref per sai
return rdiv(tag, par); // sai per skr
}
// Boom price (sai per skr)
function bid(uint wad) public returns (uint) {
return rmul(wad, wmul(s2s(), sub(2 * WAD, gap)));
}
// Bust price (sai per skr)
function ask(uint wad) public returns (uint) {
return rmul(wad, wmul(s2s(), gap));
}
function flip(uint wad) internal {
require(ask(wad) > 0);
skr.push(msg.sender, wad);
sai.pull(msg.sender, ask(wad));
heal();
}
function flop(uint wad) internal {
skr.mint(sub(wad, fog()));
flip(wad);
require(joy() == 0); // can't flop into surplus
}
function flap(uint wad) internal {
heal();
sai.push(msg.sender, bid(wad));
skr.burn(msg.sender, wad);
}
function bust(uint wad) public note {
require(!off);
if (wad > fog()) flop(wad);
else flip(wad);
}
function boom(uint wad) public note {
require(!off);
flap(wad);
}
//------------------------------------------------------------------
function cage(uint fix_) public note auth {
require(!off);
off = true;
fix = fix_;
}
function cash(uint wad) public note {
require(off);
sai.burn(msg.sender, wad);
require(tub.gem().transfer(msg.sender, rmul(wad, fix)));
}
function mock(uint wad) public note {
require(off);
sai.mint(msg.sender, wad);
require(tub.gem().transferFrom(msg.sender, this, rmul(wad, fix)));
}
function vent() public note {
require(off);
skr.burn(fog());
}
}
////// src/top.sol
/// top.sol -- global settlement manager
// Copyright (C) 2017 Nikolai Mushegian <[email protected]>
// Copyright (C) 2017 Daniel Brockman <[email protected]>
// Copyright (C) 2017 Rain Break <[email protected]>
// 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.18; */
/* import "./tub.sol"; */
/* import "./tap.sol"; */
contract SaiTop is DSThing {
SaiVox public vox;
SaiTub public tub;
SaiTap public tap;
DSToken public sai;
DSToken public sin;
DSToken public skr;
ERC20 public gem;
uint256 public fix; // sai cage price (gem per sai)
uint256 public fit; // skr cage price (ref per skr)
uint256 public caged;
uint256 public cooldown = 6 hours;
function SaiTop(SaiTub tub_, SaiTap tap_) public {
tub = tub_;
tap = tap_;
vox = tub.vox();
sai = tub.sai();
sin = tub.sin();
skr = tub.skr();
gem = tub.gem();
}
function era() public view returns (uint) {
return block.timestamp;
}
// force settlement of the system at a given price (sai per gem).
// This is nearly the equivalent of biting all cups at once.
// Important consideration: the gems associated with free skr can
// be tapped to make sai whole.
function cage(uint price) internal {
require(!tub.off() && price != 0);
caged = era();
tub.drip(); // collect remaining fees
tap.heal(); // absorb any pending fees
fit = rmul(wmul(price, vox.par()), tub.per());
// Most gems we can get per sai is the full balance of the tub.
// If there is no sai issued, we should still be able to cage.
if (sai.totalSupply() == 0) {
fix = rdiv(WAD, price);
} else {
fix = min(rdiv(WAD, price), rdiv(tub.pie(), sai.totalSupply()));
}
tub.cage(fit, rmul(fix, sai.totalSupply()));
tap.cage(fix);
tap.vent(); // burn pending sale skr
}
// cage by reading the last value from the feed for the price
function cage() public note auth {
cage(rdiv(uint(tub.pip().read()), vox.par()));
}
function flow() public note {
require(tub.off());
var empty = tub.din() == 0 && tap.fog() == 0;
var ended = era() > caged + cooldown;
require(empty || ended);
tub.flow();
}
function setCooldown(uint cooldown_) public auth {
cooldown = cooldown_;
}
}
////// src/mom.sol
/// mom.sol -- admin manager
// Copyright (C) 2017 Nikolai Mushegian <[email protected]>
// Copyright (C) 2017 Daniel Brockman <[email protected]>
// Copyright (C) 2017 Rain <[email protected]>
// 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.18; */
/* import 'ds-thing/thing.sol'; */
/* import './tub.sol'; */
/* import './top.sol'; */
/* import './tap.sol'; */
contract SaiMom is DSThing {
SaiTub public tub;
SaiTap public tap;
SaiVox public vox;
function SaiMom(SaiTub tub_, SaiTap tap_, SaiVox vox_) public {
tub = tub_;
tap = tap_;
vox = vox_;
}
// Debt ceiling
function setCap(uint wad) public note auth {
tub.mold("cap", wad);
}
// Liquidation ratio
function setMat(uint ray) public note auth {
tub.mold("mat", ray);
var axe = tub.axe();
var mat = tub.mat();
require(axe >= RAY && axe <= mat);
}
// Stability fee
function setTax(uint ray) public note auth {
tub.mold("tax", ray);
var tax = tub.tax();
require(RAY <= tax);
require(tax < 10002 * 10 ** 23); // ~200% per hour
}
// Governance fee
function setFee(uint ray) public note auth {
tub.mold("fee", ray);
var fee = tub.fee();
require(RAY <= fee);
require(fee < 10002 * 10 ** 23); // ~200% per hour
}
// Liquidation fee
function setAxe(uint ray) public note auth {
tub.mold("axe", ray);
var axe = tub.axe();
var mat = tub.mat();
require(axe >= RAY && axe <= mat);
}
// Join/Exit Spread
function setTubGap(uint wad) public note auth {
tub.mold("gap", wad);
}
// ETH/USD Feed
function setPip(DSValue pip_) public note auth {
tub.setPip(pip_);
}
// MKR/USD Feed
function setPep(DSValue pep_) public note auth {
tub.setPep(pep_);
}
// TRFM
function setVox(SaiVox vox_) public note auth {
tub.setVox(vox_);
}
// Boom/Bust Spread
function setTapGap(uint wad) public note auth {
tap.mold("gap", wad);
var gap = tap.gap();
require(gap <= 1.05 ether);
require(gap >= 0.95 ether);
}
// Rate of change of target price (per second)
function setWay(uint ray) public note auth {
require(ray < 10002 * 10 ** 23); // ~200% per hour
require(ray > 9998 * 10 ** 23);
vox.mold("way", ray);
}
function setHow(uint ray) public note auth {
vox.tune(ray);
}
}
////// src/fab.sol
/* pragma solidity ^0.4.18; */
/* import "ds-auth/auth.sol"; */
/* import 'ds-token/token.sol'; */
/* import 'ds-guard/guard.sol'; */
/* import 'ds-roles/roles.sol'; */
/* import 'ds-value/value.sol'; */
/* import './mom.sol'; */
contract GemFab {
function newTok(bytes32 name) public returns (DSToken token) {
token = new DSToken(name);
token.setOwner(msg.sender);
}
}
contract VoxFab {
function newVox() public returns (SaiVox vox) {
vox = new SaiVox(10 ** 27);
vox.setOwner(msg.sender);
}
}
contract TubFab {
function newTub(DSToken sai, DSToken sin, DSToken skr, ERC20 gem, DSToken gov, DSValue pip, DSValue pep, SaiVox vox, address pit) public returns (SaiTub tub) {
tub = new SaiTub(sai, sin, skr, gem, gov, pip, pep, vox, pit);
tub.setOwner(msg.sender);
}
}
contract TapFab {
function newTap(SaiTub tub) public returns (SaiTap tap) {
tap = new SaiTap(tub);
tap.setOwner(msg.sender);
}
}
contract TopFab {
function newTop(SaiTub tub, SaiTap tap) public returns (SaiTop top) {
top = new SaiTop(tub, tap);
top.setOwner(msg.sender);
}
}
contract MomFab {
function newMom(SaiTub tub, SaiTap tap, SaiVox vox) public returns (SaiMom mom) {
mom = new SaiMom(tub, tap, vox);
mom.setOwner(msg.sender);
}
}
contract DadFab {
function newDad() public returns (DSGuard dad) {
dad = new DSGuard();
dad.setOwner(msg.sender);
}
}
contract DaiFab is DSAuth {
GemFab public gemFab;
VoxFab public voxFab;
TapFab public tapFab;
TubFab public tubFab;
TopFab public topFab;
MomFab public momFab;
DadFab public dadFab;
DSToken public sai;
DSToken public sin;
DSToken public skr;
SaiVox public vox;
SaiTub public tub;
SaiTap public tap;
SaiTop public top;
SaiMom public mom;
DSGuard public dad;
uint8 public step = 0;
function DaiFab(GemFab gemFab_, VoxFab voxFab_, TubFab tubFab_, TapFab tapFab_, TopFab topFab_, MomFab momFab_, DadFab dadFab_) public {
gemFab = gemFab_;
voxFab = voxFab_;
tubFab = tubFab_;
tapFab = tapFab_;
topFab = topFab_;
momFab = momFab_;
dadFab = dadFab_;
}
function makeTokens() public auth {
require(step == 0);
sai = gemFab.newTok('sai');
sin = gemFab.newTok('sin');
skr = gemFab.newTok('skr');
step += 1;
}
function makeVoxTub(ERC20 gem, DSToken gov, DSValue pip, DSValue pep, address pit) public auth {
require(step == 1);
require(address(gem) != 0x0);
require(address(gov) != 0x0);
require(address(pip) != 0x0);
require(address(pep) != 0x0);
require(pit != 0x0);
vox = voxFab.newVox();
tub = tubFab.newTub(sai, sin, skr, gem, gov, pip, pep, vox, pit);
step += 1;
}
function makeTapTop() public auth {
require(step == 2);
tap = tapFab.newTap(tub);
tub.turn(tap);
top = topFab.newTop(tub, tap);
step += 1;
}
function S(string s) internal pure returns (bytes4) {
return bytes4(keccak256(s));
}
function ray(uint256 wad) internal pure returns (uint256) {
return wad * 10 ** 9;
}
// Liquidation Ratio 150%
// Liquidation Penalty 13%
// Stability Fee 0.05%
// PETH Fee 0%
// Boom/Bust Spread -3%
// Join/Exit Spread 0%
// Debt Ceiling 0
function configParams() public auth {
require(step == 3);
tub.mold("cap", 0);
tub.mold("mat", ray(1.5 ether));
tub.mold("axe", ray(1.13 ether));
tub.mold("fee", 1000000000158153903837946257); // 0.5% / year
tub.mold("tax", ray(1 ether));
tub.mold("gap", 1 ether);
tap.mold("gap", 0.97 ether);
step += 1;
}
function verifyParams() public auth {
require(step == 4);
require(tub.cap() == 0);
require(tub.mat() == 1500000000000000000000000000);
require(tub.axe() == 1130000000000000000000000000);
require(tub.fee() == 1000000000158153903837946257);
require(tub.tax() == 1000000000000000000000000000);
require(tub.gap() == 1000000000000000000);
require(tap.gap() == 970000000000000000);
require(vox.par() == 1000000000000000000000000000);
require(vox.how() == 0);
step += 1;
}
function configAuth(DSAuthority authority) public auth {
require(step == 5);
require(address(authority) != 0x0);
mom = momFab.newMom(tub, tap, vox);
dad = dadFab.newDad();
vox.setAuthority(dad);
vox.setOwner(0);
tub.setAuthority(dad);
tub.setOwner(0);
tap.setAuthority(dad);
tap.setOwner(0);
sai.setAuthority(dad);
sai.setOwner(0);
sin.setAuthority(dad);
sin.setOwner(0);
skr.setAuthority(dad);
skr.setOwner(0);
top.setAuthority(authority);
top.setOwner(0);
mom.setAuthority(authority);
mom.setOwner(0);
dad.permit(top, tub, S("cage(uint256,uint256)"));
dad.permit(top, tub, S("flow()"));
dad.permit(top, tap, S("cage(uint256)"));
dad.permit(tub, skr, S('mint(address,uint256)'));
dad.permit(tub, skr, S('burn(address,uint256)'));
dad.permit(tub, sai, S('mint(address,uint256)'));
dad.permit(tub, sai, S('burn(address,uint256)'));
dad.permit(tub, sin, S('mint(address,uint256)'));
dad.permit(tap, sai, S('mint(address,uint256)'));
dad.permit(tap, sai, S('burn(address,uint256)'));
dad.permit(tap, sai, S('burn(uint256)'));
dad.permit(tap, sin, S('burn(uint256)'));
dad.permit(tap, skr, S('mint(uint256)'));
dad.permit(tap, skr, S('burn(uint256)'));
dad.permit(tap, skr, S('burn(address,uint256)'));
dad.permit(mom, vox, S("mold(bytes32,uint256)"));
dad.permit(mom, vox, S("tune(uint256)"));
dad.permit(mom, tub, S("mold(bytes32,uint256)"));
dad.permit(mom, tap, S("mold(bytes32,uint256)"));
dad.permit(mom, tub, S("setPip(address)"));
dad.permit(mom, tub, S("setPep(address)"));
dad.permit(mom, tub, S("setVox(address)"));
dad.setOwner(0);
step += 1;
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"constant":false,"inputs":[{"name":"name","type":"bytes32"}],"name":"newTok","outputs":[{"name":"token","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
6060604052341561000f57600080fd5b610f558061001e6000396000f3006060604052600436106100405763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663b476ae3e8114610045575b600080fd5b341561005057600080fd5b61005b600435610084565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b60008161008f610147565b908152602001604051809103906000f08015156100ab57600080fd5b90508073ffffffffffffffffffffffffffffffffffffffff166313af4035336040517c010000000000000000000000000000000000000000000000000000000063ffffffff841602815273ffffffffffffffffffffffffffffffffffffffff9091166004820152602401600060405180830381600087803b151561012e57600080fd5b6102c65a03f1151561013f57600080fd5b505050919050565b604051610dd280610158833901905600606060405260126006556000600755341561001957600080fd5b604051602080610dd283398101604052808051600160a060020a03331660008181526001602052604080822082905590805560048054600160a060020a0319168317905591935091507fce241d7ca1f669fee44b6fc00b8eba2df3bb514eed0f6f668f8f89096e81ed94905160405180910390a2600555610d338061009f6000396000f3006060604052600436106101485763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde03811461014d57806307da68f514610172578063095ea7b31461018757806313af4035146101bd57806318160ddd146101dc57806323b872dd146101ef578063313ce5671461021757806340c10f191461022a57806342966c681461024c5780635ac801fe1461026257806370a082311461027857806375f12b21146102975780637a9e5e4b146102aa5780638da5cb5b146102c957806395d89b41146102f85780639dc29fac1461030b578063a0712d681461032d578063a9059cbb14610343578063b753a98c14610365578063bb35783b14610387578063be9a6555146103af578063bf7e214f146103c2578063daea85c5146103d5578063dd62ed3e146103f4578063f2d5d56b14610419575b600080fd5b341561015857600080fd5b61016061043b565b60405190815260200160405180910390f35b341561017d57600080fd5b610185610441565b005b341561019257600080fd5b6101a9600160a060020a03600435166024356104e0565b604051901515815260200160405180910390f35b34156101c857600080fd5b610185600160a060020a036004351661050d565b34156101e757600080fd5b61016061058c565b34156101fa57600080fd5b6101a9600160a060020a0360043581169060243516604435610592565b341561022257600080fd5b610160610707565b341561023557600080fd5b610185600160a060020a036004351660243561070d565b341561025757600080fd5b6101856004356107d3565b341561026d57600080fd5b6101856004356107e0565b341561028357600080fd5b610160600160a060020a0360043516610806565b34156102a257600080fd5b6101a9610821565b34156102b557600080fd5b610185600160a060020a0360043516610831565b34156102d457600080fd5b6102dc6108b0565b604051600160a060020a03909116815260200160405180910390f35b341561030357600080fd5b6101606108bf565b341561031657600080fd5b610185600160a060020a03600435166024356108c5565b341561033857600080fd5b610185600435610a33565b341561034e57600080fd5b6101a9600160a060020a0360043516602435610a3d565b341561037057600080fd5b610185600160a060020a0360043516602435610a4a565b341561039257600080fd5b610185600160a060020a0360043581169060243516604435610a5a565b34156103ba57600080fd5b610185610a6b565b34156103cd57600080fd5b6102dc610b04565b34156103e057600080fd5b6101a9600160a060020a0360043516610b13565b34156103ff57600080fd5b610160600160a060020a0360043581169060243516610b39565b341561042457600080fd5b610185600160a060020a0360043516602435610b64565b60075481565b61045733600035600160e060020a031916610b6f565b151561046257600080fd5b600435602435808233600160a060020a031660008035600160e060020a0319169034903660405183815260406020820181815290820183905260608201848480828437820191505094505050505060405180910390a450506004805474ff0000000000000000000000000000000000000000191660a060020a179055565b60045460009060a060020a900460ff16156104fa57600080fd5b6105048383610c7b565b90505b92915050565b61052333600035600160e060020a031916610b6f565b151561052e57600080fd5b6004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038381169190911791829055167fce241d7ca1f669fee44b6fc00b8eba2df3bb514eed0f6f668f8f89096e81ed9460405160405180910390a250565b60005490565b60045460009060a060020a900460ff16156105ac57600080fd5b33600160a060020a031684600160a060020a0316141580156105f65750600160a060020a038085166000908152600260209081526040808320339094168352929052205460001914155b1561065457600160a060020a038085166000908152600260209081526040808320339094168352929052205461062c9083610ce7565b600160a060020a03808616600090815260026020908152604080832033909416835292905220555b600160a060020a0384166000908152600160205260409020546106779083610ce7565b600160a060020a0380861660009081526001602052604080822093909355908516815220546106a69083610cf7565b600160a060020a03808516600081815260016020526040908190209390935591908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060019392505050565b60065481565b61072333600035600160e060020a031916610b6f565b151561072e57600080fd5b60045460a060020a900460ff161561074557600080fd5b600160a060020a0382166000908152600160205260409020546107689082610cf7565b600160a060020a0383166000908152600160205260408120919091555461078f9082610cf7565b600055600160a060020a0382167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968858260405190815260200160405180910390a25050565b6107dd33826108c5565b50565b6107f633600035600160e060020a031916610b6f565b151561080157600080fd5b600755565b600160a060020a031660009081526001602052604090205490565b60045460a060020a900460ff1681565b61084733600035600160e060020a031916610b6f565b151561085257600080fd5b6003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038381169190911791829055167f1abebea81bfa2637f28358c371278fb15ede7ea8dd28d2e03b112ff6d936ada460405160405180910390a250565b600454600160a060020a031681565b60055481565b6108db33600035600160e060020a031916610b6f565b15156108e657600080fd5b60045460a060020a900460ff16156108fd57600080fd5b33600160a060020a031682600160a060020a0316141580156109475750600160a060020a038083166000908152600260209081526040808320339094168352929052205460001914155b156109a557600160a060020a038083166000908152600260209081526040808320339094168352929052205461097d9082610ce7565b600160a060020a03808416600090815260026020908152604080832033909416835292905220555b600160a060020a0382166000908152600160205260409020546109c89082610ce7565b600160a060020a038316600090815260016020526040812091909155546109ef9082610ce7565b600055600160a060020a0382167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58260405190815260200160405180910390a25050565b6107dd338261070d565b6000610504338484610592565b610a55338383610592565b505050565b610a65838383610592565b50505050565b610a8133600035600160e060020a031916610b6f565b1515610a8c57600080fd5b600435602435808233600160a060020a031660008035600160e060020a0319169034903660405183815260406020820181815290820183905260608201848480828437820191505094505050505060405180910390a450506004805474ff000000000000000000000000000000000000000019169055565b600354600160a060020a031681565b60045460009060a060020a900460ff1615610b2d57600080fd5b61050782600019610c7b565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b610a55823383610592565b600030600160a060020a031683600160a060020a03161415610b9357506001610507565b600454600160a060020a0384811691161415610bb157506001610507565b600354600160a060020a03161515610bcb57506000610507565b600354600160a060020a031663b70096138430856000604051602001526040517c010000000000000000000000000000000000000000000000000000000063ffffffff8616028152600160a060020a039384166004820152919092166024820152600160e060020a03199091166044820152606401602060405180830381600087803b1515610c5957600080fd5b6102c65a03f11515610c6a57600080fd5b505050604051805190509050610507565b600160a060020a03338116600081815260026020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b8082038281111561050757600080fd5b8082018281101561050757600080fd00a165627a7a723058200877df264aa5d498c61a45dfe4fc04c68d11820448cf0cc7a275283a271173b40029a165627a7a723058207c9191226a86d78a13e166f79571f27eb09e019fe6108f7da957e98f66fec89c0029
Deployed Bytecode
0x6060604052600436106100405763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663b476ae3e8114610045575b600080fd5b341561005057600080fd5b61005b600435610084565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b60008161008f610147565b908152602001604051809103906000f08015156100ab57600080fd5b90508073ffffffffffffffffffffffffffffffffffffffff166313af4035336040517c010000000000000000000000000000000000000000000000000000000063ffffffff841602815273ffffffffffffffffffffffffffffffffffffffff9091166004820152602401600060405180830381600087803b151561012e57600080fd5b6102c65a03f1151561013f57600080fd5b505050919050565b604051610dd280610158833901905600606060405260126006556000600755341561001957600080fd5b604051602080610dd283398101604052808051600160a060020a03331660008181526001602052604080822082905590805560048054600160a060020a0319168317905591935091507fce241d7ca1f669fee44b6fc00b8eba2df3bb514eed0f6f668f8f89096e81ed94905160405180910390a2600555610d338061009f6000396000f3006060604052600436106101485763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde03811461014d57806307da68f514610172578063095ea7b31461018757806313af4035146101bd57806318160ddd146101dc57806323b872dd146101ef578063313ce5671461021757806340c10f191461022a57806342966c681461024c5780635ac801fe1461026257806370a082311461027857806375f12b21146102975780637a9e5e4b146102aa5780638da5cb5b146102c957806395d89b41146102f85780639dc29fac1461030b578063a0712d681461032d578063a9059cbb14610343578063b753a98c14610365578063bb35783b14610387578063be9a6555146103af578063bf7e214f146103c2578063daea85c5146103d5578063dd62ed3e146103f4578063f2d5d56b14610419575b600080fd5b341561015857600080fd5b61016061043b565b60405190815260200160405180910390f35b341561017d57600080fd5b610185610441565b005b341561019257600080fd5b6101a9600160a060020a03600435166024356104e0565b604051901515815260200160405180910390f35b34156101c857600080fd5b610185600160a060020a036004351661050d565b34156101e757600080fd5b61016061058c565b34156101fa57600080fd5b6101a9600160a060020a0360043581169060243516604435610592565b341561022257600080fd5b610160610707565b341561023557600080fd5b610185600160a060020a036004351660243561070d565b341561025757600080fd5b6101856004356107d3565b341561026d57600080fd5b6101856004356107e0565b341561028357600080fd5b610160600160a060020a0360043516610806565b34156102a257600080fd5b6101a9610821565b34156102b557600080fd5b610185600160a060020a0360043516610831565b34156102d457600080fd5b6102dc6108b0565b604051600160a060020a03909116815260200160405180910390f35b341561030357600080fd5b6101606108bf565b341561031657600080fd5b610185600160a060020a03600435166024356108c5565b341561033857600080fd5b610185600435610a33565b341561034e57600080fd5b6101a9600160a060020a0360043516602435610a3d565b341561037057600080fd5b610185600160a060020a0360043516602435610a4a565b341561039257600080fd5b610185600160a060020a0360043581169060243516604435610a5a565b34156103ba57600080fd5b610185610a6b565b34156103cd57600080fd5b6102dc610b04565b34156103e057600080fd5b6101a9600160a060020a0360043516610b13565b34156103ff57600080fd5b610160600160a060020a0360043581169060243516610b39565b341561042457600080fd5b610185600160a060020a0360043516602435610b64565b60075481565b61045733600035600160e060020a031916610b6f565b151561046257600080fd5b600435602435808233600160a060020a031660008035600160e060020a0319169034903660405183815260406020820181815290820183905260608201848480828437820191505094505050505060405180910390a450506004805474ff0000000000000000000000000000000000000000191660a060020a179055565b60045460009060a060020a900460ff16156104fa57600080fd5b6105048383610c7b565b90505b92915050565b61052333600035600160e060020a031916610b6f565b151561052e57600080fd5b6004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038381169190911791829055167fce241d7ca1f669fee44b6fc00b8eba2df3bb514eed0f6f668f8f89096e81ed9460405160405180910390a250565b60005490565b60045460009060a060020a900460ff16156105ac57600080fd5b33600160a060020a031684600160a060020a0316141580156105f65750600160a060020a038085166000908152600260209081526040808320339094168352929052205460001914155b1561065457600160a060020a038085166000908152600260209081526040808320339094168352929052205461062c9083610ce7565b600160a060020a03808616600090815260026020908152604080832033909416835292905220555b600160a060020a0384166000908152600160205260409020546106779083610ce7565b600160a060020a0380861660009081526001602052604080822093909355908516815220546106a69083610cf7565b600160a060020a03808516600081815260016020526040908190209390935591908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060019392505050565b60065481565b61072333600035600160e060020a031916610b6f565b151561072e57600080fd5b60045460a060020a900460ff161561074557600080fd5b600160a060020a0382166000908152600160205260409020546107689082610cf7565b600160a060020a0383166000908152600160205260408120919091555461078f9082610cf7565b600055600160a060020a0382167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968858260405190815260200160405180910390a25050565b6107dd33826108c5565b50565b6107f633600035600160e060020a031916610b6f565b151561080157600080fd5b600755565b600160a060020a031660009081526001602052604090205490565b60045460a060020a900460ff1681565b61084733600035600160e060020a031916610b6f565b151561085257600080fd5b6003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038381169190911791829055167f1abebea81bfa2637f28358c371278fb15ede7ea8dd28d2e03b112ff6d936ada460405160405180910390a250565b600454600160a060020a031681565b60055481565b6108db33600035600160e060020a031916610b6f565b15156108e657600080fd5b60045460a060020a900460ff16156108fd57600080fd5b33600160a060020a031682600160a060020a0316141580156109475750600160a060020a038083166000908152600260209081526040808320339094168352929052205460001914155b156109a557600160a060020a038083166000908152600260209081526040808320339094168352929052205461097d9082610ce7565b600160a060020a03808416600090815260026020908152604080832033909416835292905220555b600160a060020a0382166000908152600160205260409020546109c89082610ce7565b600160a060020a038316600090815260016020526040812091909155546109ef9082610ce7565b600055600160a060020a0382167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58260405190815260200160405180910390a25050565b6107dd338261070d565b6000610504338484610592565b610a55338383610592565b505050565b610a65838383610592565b50505050565b610a8133600035600160e060020a031916610b6f565b1515610a8c57600080fd5b600435602435808233600160a060020a031660008035600160e060020a0319169034903660405183815260406020820181815290820183905260608201848480828437820191505094505050505060405180910390a450506004805474ff000000000000000000000000000000000000000019169055565b600354600160a060020a031681565b60045460009060a060020a900460ff1615610b2d57600080fd5b61050782600019610c7b565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b610a55823383610592565b600030600160a060020a031683600160a060020a03161415610b9357506001610507565b600454600160a060020a0384811691161415610bb157506001610507565b600354600160a060020a03161515610bcb57506000610507565b600354600160a060020a031663b70096138430856000604051602001526040517c010000000000000000000000000000000000000000000000000000000063ffffffff8616028152600160a060020a039384166004820152919092166024820152600160e060020a03199091166044820152606401602060405180830381600087803b1515610c5957600080fd5b6102c65a03f11515610c6a57600080fd5b505050604051805190509050610507565b600160a060020a03338116600081815260026020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b8082038281111561050757600080fd5b8082018281101561050757600080fd00a165627a7a723058200877df264aa5d498c61a45dfe4fc04c68d11820448cf0cc7a275283a271173b40029a165627a7a723058207c9191226a86d78a13e166f79571f27eb09e019fe6108f7da957e98f66fec89c0029
Swarm Source
bzzr://7c9191226a86d78a13e166f79571f27eb09e019fe6108f7da957e98f66fec89c
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 33 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.