Source Code
Latest 25 from a total of 33 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Free All | 7708363 | 2499 days ago | IN | 0 ETH | 0.00063773 | ||||
| Vote | 7689068 | 2502 days ago | IN | 0 ETH | 0.00022269 | ||||
| Vote | 7665970 | 2506 days ago | IN | 0 ETH | 0.00009273 | ||||
| Vote | 7644096 | 2509 days ago | IN | 0 ETH | 0.00044539 | ||||
| Vote | 7619077 | 2513 days ago | IN | 0 ETH | 0.00030364 | ||||
| Vote | 7599121 | 2516 days ago | IN | 0 ETH | 0.00029693 | ||||
| Vote | 7574224 | 2520 days ago | IN | 0 ETH | 0.00016413 | ||||
| Vote | 7554374 | 2523 days ago | IN | 0 ETH | 0.00037116 | ||||
| Vote | 7532110 | 2527 days ago | IN | 0 ETH | 0.000164 | ||||
| Vote | 7419765 | 2544 days ago | IN | 0 ETH | 0.00037084 | ||||
| Vote | 7395741 | 2548 days ago | IN | 0 ETH | 0.00041033 | ||||
| Vote | 7329712 | 2558 days ago | IN | 0 ETH | 0.00029693 | ||||
| Vote | 7304975 | 2562 days ago | IN | 0 ETH | 0.00065652 | ||||
| Vote | 7253907 | 2572 days ago | IN | 0 ETH | 0.00094365 | ||||
| Lock | 7246190 | 2574 days ago | IN | 0 ETH | 0.0006043 | ||||
| Free | 7212105 | 2582 days ago | IN | 0 ETH | 0.0006506 | ||||
| Vote | 7194135 | 2586 days ago | IN | 0 ETH | 0.00036345 | ||||
| Lock | 7194127 | 2586 days ago | IN | 0 ETH | 0.00035074 | ||||
| Lock | 7164434 | 2592 days ago | IN | 0 ETH | 0.00030947 | ||||
| Vote | 7164419 | 2592 days ago | IN | 0 ETH | 0.00034444 | ||||
| Free | 6945090 | 2632 days ago | IN | 0 ETH | 0.00063971 | ||||
| Free | 6941514 | 2633 days ago | IN | 0 ETH | 0.0005663 | ||||
| Vote | 6906149 | 2639 days ago | IN | 0 ETH | 0.00029505 | ||||
| Lock | 6906135 | 2639 days ago | IN | 0 ETH | 0.00067537 | ||||
| Free | 6453635 | 2713 days ago | IN | 0 ETH | 0.00053971 |
Latest 1 internal transaction
Advanced mode:
| Parent Transaction Hash | Method | Block |
From
|
|
To
|
||
|---|---|---|---|---|---|---|---|
| Transfer | 6319757 | 2735 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x4f8f21b6...147106f91 The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
VoteProxy
Compiler Version
v0.4.24+commit.e67f0147
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity)
/**
*Submitted for verification at Etherscan.io on 2018-09-15
*/
// hevm: flattened sources of src/VoteProxyFactory.sol
pragma solidity ^0.4.24;
////// lib/ds-token/lib/ds-stop/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.23; */
contract DSAuthority {
function canCall(
address src, address dst, bytes4 sig
) public view returns (bool);
}
contract DSAuthEvents {
event LogSetAuthority (address indexed authority);
event LogSetOwner (address indexed owner);
}
contract DSAuth is DSAuthEvents {
DSAuthority public authority;
address public owner;
constructor() public {
owner = msg.sender;
emit LogSetOwner(msg.sender);
}
function setOwner(address owner_)
public
auth
{
owner = owner_;
emit LogSetOwner(owner);
}
function setAuthority(DSAuthority authority_)
public
auth
{
authority = authority_;
emit LogSetAuthority(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-chief/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 {
bytes32 has_roles = getUserRoles(caller);
bytes32 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
{
bytes32 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
{
bytes32 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-token/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-token/lib/ds-stop/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.23; */
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)
}
emit LogNote(msg.sig, msg.sender, foo, bar, msg.value, msg.data);
_;
}
}
////// lib/ds-chief/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.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 s) internal pure returns (bytes4) {
return bytes4(keccak256(abi.encodePacked(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.23; */
/* 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.23; */
/* 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;
constructor(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);
emit Transfer(src, dst, wad);
return true;
}
function approve(address guy, uint wad) public returns (bool) {
_approvals[msg.sender][guy] = wad;
emit 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.23; */
/* 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
constructor(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);
emit 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);
emit 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);
emit Burn(guy, wad);
}
// Optional token name
bytes32 public name = "";
function setName(bytes32 name_) public auth {
name = name_;
}
}
////// lib/ds-chief/src/chief.sol
// chief.sol - select an authority by consensus
// 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-token/token.sol'; */
/* import 'ds-roles/roles.sol'; */
/* import 'ds-thing/thing.sol'; */
// The right way to use this contract is probably to mix it with some kind
// of `DSAuthority`, like with `ds-roles`.
// SEE DSChief
contract DSChiefApprovals is DSThing {
mapping(bytes32=>address[]) public slates;
mapping(address=>bytes32) public votes;
mapping(address=>uint256) public approvals;
mapping(address=>uint256) public deposits;
DSToken public GOV; // voting token that gets locked up
DSToken public IOU; // non-voting representation of a token, for e.g. secondary voting mechanisms
address public hat; // the chieftain's hat
uint256 public MAX_YAYS;
event Etch(bytes32 indexed slate);
// IOU constructed outside this contract reduces deployment costs significantly
// lock/free/vote are quite sensitive to token invariants. Caution is advised.
constructor(DSToken GOV_, DSToken IOU_, uint MAX_YAYS_) public
{
GOV = GOV_;
IOU = IOU_;
MAX_YAYS = MAX_YAYS_;
}
function lock(uint wad)
public
note
{
GOV.pull(msg.sender, wad);
IOU.mint(msg.sender, wad);
deposits[msg.sender] = add(deposits[msg.sender], wad);
addWeight(wad, votes[msg.sender]);
}
function free(uint wad)
public
note
{
deposits[msg.sender] = sub(deposits[msg.sender], wad);
subWeight(wad, votes[msg.sender]);
IOU.burn(msg.sender, wad);
GOV.push(msg.sender, wad);
}
function etch(address[] yays)
public
note
returns (bytes32 slate)
{
require( yays.length <= MAX_YAYS );
requireByteOrderedSet(yays);
bytes32 hash = keccak256(abi.encodePacked(yays));
slates[hash] = yays;
emit Etch(hash);
return hash;
}
function vote(address[] yays) public returns (bytes32)
// note both sub-calls note
{
bytes32 slate = etch(yays);
vote(slate);
return slate;
}
function vote(bytes32 slate)
public
note
{
uint weight = deposits[msg.sender];
subWeight(weight, votes[msg.sender]);
votes[msg.sender] = slate;
addWeight(weight, votes[msg.sender]);
}
// like `drop`/`swap` except simply "elect this address if it is higher than current hat"
function lift(address whom)
public
note
{
require(approvals[whom] > approvals[hat]);
hat = whom;
}
function addWeight(uint weight, bytes32 slate)
internal
{
address[] storage yays = slates[slate];
for( uint i = 0; i < yays.length; i++) {
approvals[yays[i]] = add(approvals[yays[i]], weight);
}
}
function subWeight(uint weight, bytes32 slate)
internal
{
address[] storage yays = slates[slate];
for( uint i = 0; i < yays.length; i++) {
approvals[yays[i]] = sub(approvals[yays[i]], weight);
}
}
// Throws unless the array of addresses is a ordered set.
function requireByteOrderedSet(address[] yays)
internal
pure
{
if( yays.length == 0 || yays.length == 1 ) {
return;
}
for( uint i = 0; i < yays.length - 1; i++ ) {
// strict inequality ensures both ordering and uniqueness
require(uint(bytes32(yays[i])) < uint256(bytes32(yays[i+1])));
}
}
}
// `hat` address is unique root user (has every role) and the
// unique owner of role 0 (typically 'sys' or 'internal')
contract DSChief is DSRoles, DSChiefApprovals {
constructor(DSToken GOV, DSToken IOU, uint MAX_YAYS)
DSChiefApprovals (GOV, IOU, MAX_YAYS)
public
{
authority = this;
owner = 0;
}
function setOwner(address owner_) public {
owner_;
revert();
}
function setAuthority(DSAuthority authority_) public {
authority_;
revert();
}
function isUserRoot(address who)
public
constant
returns (bool)
{
return (who == hat);
}
function setRootUser(address who, bool enabled) public {
who; enabled;
revert();
}
}
contract DSChiefFab {
function newChief(DSToken gov, uint MAX_YAYS) public returns (DSChief chief) {
DSToken iou = new DSToken('IOU');
chief = new DSChief(gov, iou, MAX_YAYS);
iou.setOwner(chief);
}
}
////// src/VoteProxy.sol
// VoteProxy - vote w/ a hot or cold wallet using a proxy identity
/* pragma solidity ^0.4.24; */
/* import "ds-token/token.sol"; */
/* import "ds-chief/chief.sol"; */
contract VoteProxy {
address public cold;
address public hot;
DSToken public gov;
DSToken public iou;
DSChief public chief;
constructor(DSChief _chief, address _cold, address _hot) public {
chief = _chief;
cold = _cold;
hot = _hot;
gov = chief.GOV();
iou = chief.IOU();
gov.approve(chief, uint256(-1));
iou.approve(chief, uint256(-1));
}
modifier auth() {
require(msg.sender == hot || msg.sender == cold, "Sender must be a Cold or Hot Wallet");
_;
}
function lock(uint256 wad) public auth {
gov.pull(cold, wad); // mkr from cold
chief.lock(wad); // mkr out, ious in
}
function free(uint256 wad) public auth {
chief.free(wad); // ious out, mkr in
gov.push(cold, wad); // mkr to cold
}
function freeAll() public auth {
chief.free(chief.deposits(this));
gov.push(cold, gov.balanceOf(this));
}
function vote(address[] yays) public auth returns (bytes32) {
return chief.vote(yays);
}
function vote(bytes32 slate) public auth {
chief.vote(slate);
}
}
////// src/VoteProxyFactory.sol
// VoteProxyFactory - create and keep record of proxy identities
/* pragma solidity ^0.4.24; */
/* import "./VoteProxy.sol"; */
contract VoteProxyFactory {
DSChief public chief;
mapping(address => VoteProxy) public hotMap;
mapping(address => VoteProxy) public coldMap;
mapping(address => address) public linkRequests;
event LinkRequested(address indexed cold, address indexed hot);
event LinkConfirmed(address indexed cold, address indexed hot, address indexed voteProxy);
constructor(DSChief chief_) public { chief = chief_; }
function hasProxy(address guy) public view returns (bool) {
return (coldMap[guy] != address(0) || hotMap[guy] != address(0));
}
function initiateLink(address hot) public {
require(!hasProxy(msg.sender), "Cold wallet is already linked to another Vote Proxy");
require(!hasProxy(hot), "Hot wallet is already linked to another Vote Proxy");
linkRequests[msg.sender] = hot;
emit LinkRequested(msg.sender, hot);
}
function approveLink(address cold) public returns (VoteProxy voteProxy) {
require(linkRequests[cold] == msg.sender, "Cold wallet must initiate a link first");
require(!hasProxy(msg.sender), "Hot wallet is already linked to another Vote Proxy");
voteProxy = new VoteProxy(chief, cold, msg.sender);
hotMap[msg.sender] = voteProxy;
coldMap[cold] = voteProxy;
delete linkRequests[cold];
emit LinkConfirmed(cold, msg.sender, voteProxy);
}
function breakLink() public {
require(hasProxy(msg.sender), "No VoteProxy found for this sender");
VoteProxy voteProxy = coldMap[msg.sender] != address(0)
? coldMap[msg.sender] : hotMap[msg.sender];
address cold = voteProxy.cold();
address hot = voteProxy.hot();
require(chief.deposits(voteProxy) == 0, "VoteProxy still has funds attached to it");
delete coldMap[cold];
delete hotMap[hot];
}
function linkSelf() public returns (VoteProxy voteProxy) {
initiateLink(msg.sender);
return approveLink(msg.sender);
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"constant":true,"inputs":[],"name":"gov","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"cold","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"freeAll","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"iou","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"slate","type":"bytes32"}],"name":"vote","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"wad","type":"uint256"}],"name":"free","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"wad","type":"uint256"}],"name":"lock","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"hot","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"yays","type":"address[]"}],"name":"vote","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"chief","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_chief","type":"address"},{"name":"_cold","type":"address"},{"name":"_hot","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"}]Contract Creation Code
0x608060405234801561001057600080fd5b50604051606080610cd083398101604081815282516020808501519483015160048054600160a060020a03808616600160a060020a03199283161780845560008054838c16908516178155600180548488169516949094179093557f180cb47f00000000000000000000000000000000000000000000000000000000895296519598979396169463180cb47f9483850194909391929083900390910190829087803b1580156100be57600080fd5b505af11580156100d2573d6000803e3d6000fd5b505050506040513d60208110156100e857600080fd5b505160028054600160a060020a031916600160a060020a0392831617905560048054604080517f046c472f0000000000000000000000000000000000000000000000000000000081529051919093169263046c472f92818101926020929091908290030181600087803b15801561015e57600080fd5b505af1158015610172573d6000803e3d6000fd5b505050506040513d602081101561018857600080fd5b505160038054600160a060020a031916600160a060020a0392831617905560025460048054604080517f095ea7b30000000000000000000000000000000000000000000000000000000081529185169282019290925260001960248201529051919092169163095ea7b39160448083019260209291908290030181600087803b15801561021457600080fd5b505af1158015610228573d6000803e3d6000fd5b505050506040513d602081101561023e57600080fd5b505060035460048054604080517f095ea7b3000000000000000000000000000000000000000000000000000000008152600160a060020a039283169381019390935260001960248401525192169163095ea7b3916044808201926020929091908290030181600087803b1580156102b457600080fd5b505af11580156102c8573d6000803e3d6000fd5b505050506040513d60208110156102de57600080fd5b50505050506109de806102f26000396000f30060806040526004361061008a5763ffffffff60e060020a60003504166312d43a51811461008f578063578e9dc5146100c05780635c38f3d1146100d5578063a2fca6b3146100ec578063a69beaba14610101578063d8ccd0f314610119578063dd46706414610131578063dde9c29714610149578063ed0813291461015e578063ffd864d3146101c5575b600080fd5b34801561009b57600080fd5b506100a46101da565b60408051600160a060020a039092168252519081900360200190f35b3480156100cc57600080fd5b506100a46101e9565b3480156100e157600080fd5b506100ea6101f8565b005b3480156100f857600080fd5b506100a4610466565b34801561010d57600080fd5b506100ea600435610475565b34801561012557600080fd5b506100ea60043561056a565b34801561013d57600080fd5b506100ea6004356106c9565b34801561015557600080fd5b506100a461082a565b34801561016a57600080fd5b50604080516020600480358082013583810280860185019096528085526101b3953695939460249493850192918291850190849080828437509497506108399650505050505050565b60408051918252519081900360200190f35b3480156101d157600080fd5b506100a4610983565b600254600160a060020a031681565b600054600160a060020a031681565b600154600160a060020a031633148061021b5750600054600160a060020a031633145b151561026e576040805160e560020a62461bcd0281526020600482015260236024820152600080516020610993833981519152604482015260ea60020a621b195d02606482015290519081900360840190fd5b60048054604080517ffc7e286d000000000000000000000000000000000000000000000000000000008152309381019390935251600160a060020a039091169163d8ccd0f391839163fc7e286d9160248083019260209291908290030181600087803b1580156102dd57600080fd5b505af11580156102f1573d6000803e3d6000fd5b505050506040513d602081101561030757600080fd5b50516040805160e060020a63ffffffff8516028152600481019290925251602480830192600092919082900301818387803b15801561034557600080fd5b505af1158015610359573d6000803e3d6000fd5b505060025460008054604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600160a060020a03948516965063b753a98c9550919093169285926370a08231926024808401936020939083900390910190829087803b1580156103d457600080fd5b505af11580156103e8573d6000803e3d6000fd5b505050506040513d60208110156103fe57600080fd5b50516040805160e060020a63ffffffff8616028152600160a060020a039093166004840152602483019190915251604480830192600092919082900301818387803b15801561044c57600080fd5b505af1158015610460573d6000803e3d6000fd5b50505050565b600354600160a060020a031681565b600154600160a060020a03163314806104985750600054600160a060020a031633145b15156104eb576040805160e560020a62461bcd0281526020600482015260236024820152600080516020610993833981519152604482015260ea60020a621b195d02606482015290519081900360840190fd5b60048054604080517fa69beaba00000000000000000000000000000000000000000000000000000000815292830184905251600160a060020a039091169163a69beaba91602480830192600092919082900301818387803b15801561054f57600080fd5b505af1158015610563573d6000803e3d6000fd5b5050505050565b600154600160a060020a031633148061058d5750600054600160a060020a031633145b15156105e0576040805160e560020a62461bcd0281526020600482015260236024820152600080516020610993833981519152604482015260ea60020a621b195d02606482015290519081900360840190fd5b60048054604080517fd8ccd0f300000000000000000000000000000000000000000000000000000000815292830184905251600160a060020a039091169163d8ccd0f391602480830192600092919082900301818387803b15801561064457600080fd5b505af1158015610658573d6000803e3d6000fd5b505060025460008054604080517fb753a98c000000000000000000000000000000000000000000000000000000008152600160a060020a03928316600482015260248101889052905191909316945063b753a98c935060448084019382900301818387803b15801561054f57600080fd5b600154600160a060020a03163314806106ec5750600054600160a060020a031633145b151561073f576040805160e560020a62461bcd0281526020600482015260236024820152600080516020610993833981519152604482015260ea60020a621b195d02606482015290519081900360840190fd5b60025460008054604080517ff2d5d56b000000000000000000000000000000000000000000000000000000008152600160a060020a039283166004820152602481018690529051919093169263f2d5d56b92604480830193919282900301818387803b1580156107ae57600080fd5b505af11580156107c2573d6000803e3d6000fd5b505060048054604080517fdd46706400000000000000000000000000000000000000000000000000000000815292830186905251600160a060020a03909116935063dd4670649250602480830192600092919082900301818387803b15801561054f57600080fd5b600154600160a060020a031681565b600154600090600160a060020a031633148061085f5750600054600160a060020a031633145b15156108b2576040805160e560020a62461bcd0281526020600482015260236024820152600080516020610993833981519152604482015260ea60020a621b195d02606482015290519081900360840190fd5b600480546040517fed0813290000000000000000000000000000000000000000000000000000000081526020928101838152855160248301528551600160a060020a039093169363ed0813299387938392604490910191818601910280838360005b8381101561092c578181015183820152602001610914565b5050505090500192505050602060405180830381600087803b15801561095157600080fd5b505af1158015610965573d6000803e3d6000fd5b505050506040513d602081101561097b57600080fd5b505192915050565b600454600160a060020a031681560053656e646572206d757374206265206120436f6c64206f7220486f742057616ca165627a7a72305820bc9db7c0e2fcc3c4db9dc7c158a86f0200c00663b1a3f88ccbd4f056c9ae3de300290000000000000000000000008e2a84d6ade1e7fffee039a35ef5f19f130571520000000000000000000000008b272d1b710abbb5cc201979574a6a6ee4cdc62d0000000000000000000000003dc389e0a69d6364a66ab64ebd51234da9569284
Deployed Bytecode
0x60806040526004361061008a5763ffffffff60e060020a60003504166312d43a51811461008f578063578e9dc5146100c05780635c38f3d1146100d5578063a2fca6b3146100ec578063a69beaba14610101578063d8ccd0f314610119578063dd46706414610131578063dde9c29714610149578063ed0813291461015e578063ffd864d3146101c5575b600080fd5b34801561009b57600080fd5b506100a46101da565b60408051600160a060020a039092168252519081900360200190f35b3480156100cc57600080fd5b506100a46101e9565b3480156100e157600080fd5b506100ea6101f8565b005b3480156100f857600080fd5b506100a4610466565b34801561010d57600080fd5b506100ea600435610475565b34801561012557600080fd5b506100ea60043561056a565b34801561013d57600080fd5b506100ea6004356106c9565b34801561015557600080fd5b506100a461082a565b34801561016a57600080fd5b50604080516020600480358082013583810280860185019096528085526101b3953695939460249493850192918291850190849080828437509497506108399650505050505050565b60408051918252519081900360200190f35b3480156101d157600080fd5b506100a4610983565b600254600160a060020a031681565b600054600160a060020a031681565b600154600160a060020a031633148061021b5750600054600160a060020a031633145b151561026e576040805160e560020a62461bcd0281526020600482015260236024820152600080516020610993833981519152604482015260ea60020a621b195d02606482015290519081900360840190fd5b60048054604080517ffc7e286d000000000000000000000000000000000000000000000000000000008152309381019390935251600160a060020a039091169163d8ccd0f391839163fc7e286d9160248083019260209291908290030181600087803b1580156102dd57600080fd5b505af11580156102f1573d6000803e3d6000fd5b505050506040513d602081101561030757600080fd5b50516040805160e060020a63ffffffff8516028152600481019290925251602480830192600092919082900301818387803b15801561034557600080fd5b505af1158015610359573d6000803e3d6000fd5b505060025460008054604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600160a060020a03948516965063b753a98c9550919093169285926370a08231926024808401936020939083900390910190829087803b1580156103d457600080fd5b505af11580156103e8573d6000803e3d6000fd5b505050506040513d60208110156103fe57600080fd5b50516040805160e060020a63ffffffff8616028152600160a060020a039093166004840152602483019190915251604480830192600092919082900301818387803b15801561044c57600080fd5b505af1158015610460573d6000803e3d6000fd5b50505050565b600354600160a060020a031681565b600154600160a060020a03163314806104985750600054600160a060020a031633145b15156104eb576040805160e560020a62461bcd0281526020600482015260236024820152600080516020610993833981519152604482015260ea60020a621b195d02606482015290519081900360840190fd5b60048054604080517fa69beaba00000000000000000000000000000000000000000000000000000000815292830184905251600160a060020a039091169163a69beaba91602480830192600092919082900301818387803b15801561054f57600080fd5b505af1158015610563573d6000803e3d6000fd5b5050505050565b600154600160a060020a031633148061058d5750600054600160a060020a031633145b15156105e0576040805160e560020a62461bcd0281526020600482015260236024820152600080516020610993833981519152604482015260ea60020a621b195d02606482015290519081900360840190fd5b60048054604080517fd8ccd0f300000000000000000000000000000000000000000000000000000000815292830184905251600160a060020a039091169163d8ccd0f391602480830192600092919082900301818387803b15801561064457600080fd5b505af1158015610658573d6000803e3d6000fd5b505060025460008054604080517fb753a98c000000000000000000000000000000000000000000000000000000008152600160a060020a03928316600482015260248101889052905191909316945063b753a98c935060448084019382900301818387803b15801561054f57600080fd5b600154600160a060020a03163314806106ec5750600054600160a060020a031633145b151561073f576040805160e560020a62461bcd0281526020600482015260236024820152600080516020610993833981519152604482015260ea60020a621b195d02606482015290519081900360840190fd5b60025460008054604080517ff2d5d56b000000000000000000000000000000000000000000000000000000008152600160a060020a039283166004820152602481018690529051919093169263f2d5d56b92604480830193919282900301818387803b1580156107ae57600080fd5b505af11580156107c2573d6000803e3d6000fd5b505060048054604080517fdd46706400000000000000000000000000000000000000000000000000000000815292830186905251600160a060020a03909116935063dd4670649250602480830192600092919082900301818387803b15801561054f57600080fd5b600154600160a060020a031681565b600154600090600160a060020a031633148061085f5750600054600160a060020a031633145b15156108b2576040805160e560020a62461bcd0281526020600482015260236024820152600080516020610993833981519152604482015260ea60020a621b195d02606482015290519081900360840190fd5b600480546040517fed0813290000000000000000000000000000000000000000000000000000000081526020928101838152855160248301528551600160a060020a039093169363ed0813299387938392604490910191818601910280838360005b8381101561092c578181015183820152602001610914565b5050505090500192505050602060405180830381600087803b15801561095157600080fd5b505af1158015610965573d6000803e3d6000fd5b505050506040513d602081101561097b57600080fd5b505192915050565b600454600160a060020a031681560053656e646572206d757374206265206120436f6c64206f7220486f742057616ca165627a7a72305820bc9db7c0e2fcc3c4db9dc7c158a86f0200c00663b1a3f88ccbd4f056c9ae3de30029
Swarm Source
bzzr://bc9db7c0e2fcc3c4db9dc7c158a86f0200c00663b1a3f88ccbd4f056c9ae3de3
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.