Contract Overview
Balance: 0 Ether
Transactions: 530 txns
 Latest 25 transactions from a total of 530 transactions

TxHash Age From To Value [TxFee]
0xbb828cbcba3e333864162a4e4bb96d730b6054b3bbe8ffb76b1f8495f0c3ecaf19 days 9 hrs ago0xb6f3cb1b1a7dcb470ef0883612b1f7018742b8f8  IN   0xee419971e63734fed782cfe49110b1544ae8a7730.1 Ether0.008952749
0x1c4ac4a01a5b5ebad6a76f9a4f11db5e78b6adf393ea0dddbc1d7e891e4592f431 days 14 hrs ago0x7c843e6fa11ab6af140feebec0fecad32868818d  IN   0xee419971e63734fed782cfe49110b1544ae8a7730.01 Ether0.003418405
0x7d9f0e9863e653054403e17bf0cbc6b3937ea1d22ed997eadf5bbfa39fc9731933 days 21 hrs ago0xcf2fb7f1d70245cb73096e2f19fdda51d8070ec9  IN   0xee419971e63734fed782cfe49110b1544ae8a7730.01 Ether0.003443365
0xdce1283066f5c48511c768f3f76ff35724a4bbb697804672f2ff36f526fa4cb533 days 23 hrs ago0x75b379238868ebb577ce9888524d3cd71ee4b236  IN   0xee419971e63734fed782cfe49110b1544ae8a7730.1 Ether0.004715711
0x630a575eacf32e246fa3bf15998f91f65aabf2187c83807024b5049ee998e3ca34 days 7 hrs ago0x2e2336f1791588759cbffcbacc2256b9d5600c25  IN   0xee419971e63734fed782cfe49110b1544ae8a7730.001 Ether0.00410247
0xb6c8feed4fa2e4a1db43512710b95e9f4df580bda141e4dbe9b8d5c9a54ea15641 days 4 hrs ago0x498e6cf4d54f4a4aeb8b80e6731ed8db48935bb9  IN   0xee419971e63734fed782cfe49110b1544ae8a7732.9 Ether0.0028033545
0x7d432d9f210ca59b6ff9696a0e02edb8832ac83b0578ddb4aada3107b01b5fa141 days 5 hrs ago0x00de5ed009f7c59f559a7bd505a8b02b13c283c0  IN   0xee419971e63734fed782cfe49110b1544ae8a7733 Ether0.003418725
0x6eeb91940cd02af0182702c17b3b5fd7a6f13ffef7633e207036b7157c56547945 days 13 hrs ago0xee108a62dbb64a95111965d8b6ceff3e52e599ec  IN   0xee419971e63734fed782cfe49110b1544ae8a77310 Ether0.004012086
0x9c3105688cee6228718d710674caf185d40afd21252a17c23911685ddcf2f9c448 days 7 hrs ago0xed2f74e1fb73b775e6e35720869ae7a7f4d755ad  IN   0xee419971e63734fed782cfe49110b1544ae8a7730.1 Ether0.003418725
0x1c7c859d92cb4fc537cb80e50f0cbdac1702d2c29fd98d59954061f8b268be2752 days 23 hrs ago0xc3bc9aacab6b4de31db08db7e7453ca833cc9e6a  IN   0xee419971e63734fed782cfe49110b1544ae8a7730.1 Ether0.003828972
0x73f719f29a14f482dd82430512e3e1684aa0f6b1a3f4967fc367b7ca029dcfb459 days 19 hrs ago0xd4ea698dfcdf0addeaae77a2d6584f822738cf66  IN   0xee419971e63734fed782cfe49110b1544ae8a7731 Ether0.003477474
0x8538c5f1c59a491220f5ea06d85eacf394acba4e9a72bcf4721f5eb98dbf10e660 days 6 hrs ago0x47dc906d0b69ee3e409b4b4661ca3eff11489278  IN   0xee419971e63734fed782cfe49110b1544ae8a7731 Ether0.0058118325
0x747ff8ac2b3d56d240eff5f19b1d92add484803d72e3adaa97353c9e82b58d7961 days 10 hrs ago0x6e4843e90ecacd3a3bbced74a5235363762d5100  IN   0xee419971e63734fed782cfe49110b1544ae8a77330 Ether0.004786663
0x858cd6406284d098172874bda4e192d04c7abce71ea12875fc936e17bad5ade861 days 16 hrs ago0xd0d44c9e51244ebfd70187548255d8e844567a92  IN   0xee419971e63734fed782cfe49110b1544ae8a7730.05 Ether0.002040559543
0x9cb4c5a5915d4aded0604db77e22fe77efacaf9cb38a8448a19fb2ecfe3cdcc962 days 1 hr ago0xb086f565e48a2b97c12ca45b9b6ad7e90ebe9f68  IN   0xee419971e63734fed782cfe49110b1544ae8a7730 Ether0.000601446
0xcd8faebd0228e1055858ca0884d08f0870c42a6ce8bad3e65dd8435c1bac32e262 days 1 hr ago0xb086f565e48a2b97c12ca45b9b6ad7e90ebe9f68  IN   0xee419971e63734fed782cfe49110b1544ae8a7730 Ether0.000601446
0xab61298909f2c342dfc48170601ee2bfac13a117b3fa6efe4ab1ac3fe2fcabe762 days 1 hr ago0xb086f565e48a2b97c12ca45b9b6ad7e90ebe9f68  IN   0xee419971e63734fed782cfe49110b1544ae8a7730 Ether0.000030416
0x09a2803b709a9e2f21c1bcc3923e7faceb3f4769454a45852b54875aade1173462 days 1 hr ago0xb086f565e48a2b97c12ca45b9b6ad7e90ebe9f68  IN   0xee419971e63734fed782cfe49110b1544ae8a7730 Ether0.000030416
0x9d23b3708043a2b8b4898b4bab741fe93a840ab742744525da329617c8eea68b62 days 1 hr ago0xb086f565e48a2b97c12ca45b9b6ad7e90ebe9f68  IN   0xee419971e63734fed782cfe49110b1544ae8a7730 Ether0.000030416
0x4b4e7e021dd6b240608f1d35575171a891c1334aeb7b95d5af9dbf8c1051a49762 days 1 hr ago0xb086f565e48a2b97c12ca45b9b6ad7e90ebe9f68  IN   0xee419971e63734fed782cfe49110b1544ae8a7730 Ether0.000029776
0xbdf9d12f3faa26256e347fd1eb6574f7093aa1db33b8a7da11a3a2432b5d217362 days 3 hrs ago0x82d4fe212e2253cd804dfcc2d02337725c2179cd  IN   0xee419971e63734fed782cfe49110b1544ae8a7730.01 Ether0.0041708201
0x5db1a688a06c3f09e4a7ac3bad918ffac06b5f6441e6bdbb203861490dd6e96566 days 1 hr ago0x0067d9619328a8db708b941ad36d6565986d1c85  IN   0xee419971e63734fed782cfe49110b1544ae8a7731.5 Ether0.0037517526
0x146f7c6497913308f7e18671fd9041b1182ddb77dbf7c4fb86824e1239f8647767 days 2 hrs ago0xc5fef6cb5a152ef2c13e3726111baef1a950fdd2  IN   0xee419971e63734fed782cfe49110b1544ae8a7732.039999999999999 Ether0.0035525215
0x854857cb39e4c30f9e75f369bb84d1af4e49433e0e5a2c033469241f7346f9fb67 days 21 hrs ago0xf47875b2c2eee722e56d7e6bbb7826db502bc295  IN   0xee419971e63734fed782cfe49110b1544ae8a7730.9 Ether0.002779076
0xc67576a14ab6d1c27c943361b8d1a83bad04eaa05cdaaa872748dcc623907b2568 days 3 hrs ago0xc5fef6cb5a152ef2c13e3726111baef1a950fdd2  IN   0xee419971e63734fed782cfe49110b1544ae8a7730.001 Ether0.003938832
[ Download CSV Export  ] 
 Internal Transactions as a result of Contract Execution
 Latest 25 Internal Txns, Click here To View More View All
ParentTxHash Block Age From To Value
0xbb828cbcba3e333864162a4e4bb96d730b6054b3bbe8ffb76b1f8495f0c3ecaf1021993019 days 9 hrs ago0xee419971e63734fed782cfe49110b1544ae8a7730xc4375b7de8af5a38a93548eb8453a498222c4ff20 Ether
0xbb828cbcba3e333864162a4e4bb96d730b6054b3bbe8ffb76b1f8495f0c3ecaf1021993019 days 9 hrs ago0xee419971e63734fed782cfe49110b1544ae8a7730xdb3b642ebc6ff85a3ab335cff9af2954f92159940 Ether
0xbb828cbcba3e333864162a4e4bb96d730b6054b3bbe8ffb76b1f8495f0c3ecaf1021993019 days 9 hrs ago0xee419971e63734fed782cfe49110b1544ae8a7730xd0a1e359811322d97991e03f863a0c30c2cf029c0 Ether
0xbb828cbcba3e333864162a4e4bb96d730b6054b3bbe8ffb76b1f8495f0c3ecaf1021993019 days 9 hrs ago0xee419971e63734fed782cfe49110b1544ae8a7730xd0a1e359811322d97991e03f863a0c30c2cf029c0.1 Ether
0xbb828cbcba3e333864162a4e4bb96d730b6054b3bbe8ffb76b1f8495f0c3ecaf1021993019 days 9 hrs ago0xee419971e63734fed782cfe49110b1544ae8a7730x64a436ae831c1672ae81f674cab8b6775df3475c0 Ether
0x1c4ac4a01a5b5ebad6a76f9a4f11db5e78b6adf393ea0dddbc1d7e891e4592f41009731031 days 14 hrs ago0xee419971e63734fed782cfe49110b1544ae8a7730xc4375b7de8af5a38a93548eb8453a498222c4ff20 Ether
0x1c4ac4a01a5b5ebad6a76f9a4f11db5e78b6adf393ea0dddbc1d7e891e4592f41009731031 days 14 hrs ago0xee419971e63734fed782cfe49110b1544ae8a7730xdb3b642ebc6ff85a3ab335cff9af2954f92159940 Ether
0x1c4ac4a01a5b5ebad6a76f9a4f11db5e78b6adf393ea0dddbc1d7e891e4592f41009731031 days 14 hrs ago0xee419971e63734fed782cfe49110b1544ae8a7730xd0a1e359811322d97991e03f863a0c30c2cf029c0 Ether
0x1c4ac4a01a5b5ebad6a76f9a4f11db5e78b6adf393ea0dddbc1d7e891e4592f41009731031 days 14 hrs ago0xee419971e63734fed782cfe49110b1544ae8a7730xd0a1e359811322d97991e03f863a0c30c2cf029c0.01 Ether
0x1c4ac4a01a5b5ebad6a76f9a4f11db5e78b6adf393ea0dddbc1d7e891e4592f41009731031 days 14 hrs ago0xee419971e63734fed782cfe49110b1544ae8a7730x64a436ae831c1672ae81f674cab8b6775df3475c0 Ether
0x7d9f0e9863e653054403e17bf0cbc6b3937ea1d22ed997eadf5bbfa39fc973191006939833 days 21 hrs ago0xee419971e63734fed782cfe49110b1544ae8a7730xc4375b7de8af5a38a93548eb8453a498222c4ff20 Ether
0x7d9f0e9863e653054403e17bf0cbc6b3937ea1d22ed997eadf5bbfa39fc973191006939833 days 21 hrs ago0xee419971e63734fed782cfe49110b1544ae8a7730xdb3b642ebc6ff85a3ab335cff9af2954f92159940 Ether
0x7d9f0e9863e653054403e17bf0cbc6b3937ea1d22ed997eadf5bbfa39fc973191006939833 days 21 hrs ago0xee419971e63734fed782cfe49110b1544ae8a7730xd0a1e359811322d97991e03f863a0c30c2cf029c0 Ether
0x7d9f0e9863e653054403e17bf0cbc6b3937ea1d22ed997eadf5bbfa39fc973191006939833 days 21 hrs ago0xee419971e63734fed782cfe49110b1544ae8a7730xd0a1e359811322d97991e03f863a0c30c2cf029c0.01 Ether
0x7d9f0e9863e653054403e17bf0cbc6b3937ea1d22ed997eadf5bbfa39fc973191006939833 days 21 hrs ago0xee419971e63734fed782cfe49110b1544ae8a7730x64a436ae831c1672ae81f674cab8b6775df3475c0 Ether
0xdce1283066f5c48511c768f3f76ff35724a4bbb697804672f2ff36f526fa4cb51006866633 days 23 hrs ago0xee419971e63734fed782cfe49110b1544ae8a7730xc4375b7de8af5a38a93548eb8453a498222c4ff20 Ether
0xdce1283066f5c48511c768f3f76ff35724a4bbb697804672f2ff36f526fa4cb51006866633 days 23 hrs ago0xee419971e63734fed782cfe49110b1544ae8a7730xdb3b642ebc6ff85a3ab335cff9af2954f92159940 Ether
0xdce1283066f5c48511c768f3f76ff35724a4bbb697804672f2ff36f526fa4cb51006866633 days 23 hrs ago0xee419971e63734fed782cfe49110b1544ae8a7730xd0a1e359811322d97991e03f863a0c30c2cf029c0 Ether
0xdce1283066f5c48511c768f3f76ff35724a4bbb697804672f2ff36f526fa4cb51006866633 days 23 hrs ago0xee419971e63734fed782cfe49110b1544ae8a7730xd0a1e359811322d97991e03f863a0c30c2cf029c0.1 Ether
0xdce1283066f5c48511c768f3f76ff35724a4bbb697804672f2ff36f526fa4cb51006866633 days 23 hrs ago0xee419971e63734fed782cfe49110b1544ae8a7730x64a436ae831c1672ae81f674cab8b6775df3475c0 Ether
0x630a575eacf32e246fa3bf15998f91f65aabf2187c83807024b5049ee998e3ca1006450634 days 7 hrs ago0xee419971e63734fed782cfe49110b1544ae8a7730xc4375b7de8af5a38a93548eb8453a498222c4ff20 Ether
0x630a575eacf32e246fa3bf15998f91f65aabf2187c83807024b5049ee998e3ca1006450634 days 7 hrs ago0xee419971e63734fed782cfe49110b1544ae8a7730xdb3b642ebc6ff85a3ab335cff9af2954f92159940 Ether
0x630a575eacf32e246fa3bf15998f91f65aabf2187c83807024b5049ee998e3ca1006450634 days 7 hrs ago0xee419971e63734fed782cfe49110b1544ae8a7730xd0a1e359811322d97991e03f863a0c30c2cf029c0 Ether
0x630a575eacf32e246fa3bf15998f91f65aabf2187c83807024b5049ee998e3ca1006450634 days 7 hrs ago0xee419971e63734fed782cfe49110b1544ae8a7730xd0a1e359811322d97991e03f863a0c30c2cf029c0.001 Ether
0x630a575eacf32e246fa3bf15998f91f65aabf2187c83807024b5049ee998e3ca1006450634 days 7 hrs ago0xee419971e63734fed782cfe49110b1544ae8a7730x64a436ae831c1672ae81f674cab8b6775df3475c0 Ether
[ Download CSV Export  ] 
Warning: The Compiled Contract might be susceptible to ExpExponentCleanup (medium/high-severity), EventStructWrongData (very low-severity), NestedArrayFunctionCallDecoder (medium-severity) SolidityCompiler Bugs.

Contract Source Code Verified (Exact Match)
Contract Name: ProxyCreationAndExecute
Compiler Version: v0.4.21+commit.dfe3193c
Optimization Enabled: Yes
Runs (Optimiser):  200



  Contract Source Code   Find Similiar Contracts

pragma solidity ^0.4.16;

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);
            }
        }
    }
}

contract OtcInterface {
    function sellAllAmount(address, uint, address, uint) public returns (uint);
    function buyAllAmount(address, uint, address, uint) public returns (uint);
    function getPayAmount(address, address, uint) public constant returns (uint);
}

contract TokenInterface {
    function balanceOf(address) public returns (uint);
    function allowance(address, address) public returns (uint);
    function approve(address, uint) public;
    function transfer(address,uint) public returns (bool);
    function transferFrom(address, address, uint) public returns (bool);
    function deposit() public payable;
    function withdraw(uint) public;
}

contract OasisDirectProxy is DSMath {
    function withdrawAndSend(TokenInterface wethToken, uint wethAmt) internal {
        wethToken.withdraw(wethAmt);
        require(msg.sender.call.value(wethAmt)());
    }

    function sellAllAmount(OtcInterface otc, TokenInterface payToken, uint payAmt, TokenInterface buyToken, uint minBuyAmt) public returns (uint buyAmt) {
        require(payToken.transferFrom(msg.sender, this, payAmt));
        if (payToken.allowance(this, otc) < payAmt) {
            payToken.approve(otc, uint(-1));
        }
        buyAmt = otc.sellAllAmount(payToken, payAmt, buyToken, minBuyAmt);
        require(buyToken.transfer(msg.sender, buyAmt));
    }

    function sellAllAmountPayEth(OtcInterface otc, TokenInterface wethToken, TokenInterface buyToken, uint minBuyAmt) public payable returns (uint buyAmt) {
        wethToken.deposit.value(msg.value)();
        if (wethToken.allowance(this, otc) < msg.value) {
            wethToken.approve(otc, uint(-1));
        }
        buyAmt = otc.sellAllAmount(wethToken, msg.value, buyToken, minBuyAmt);
        require(buyToken.transfer(msg.sender, buyAmt));
    }

    function sellAllAmountBuyEth(OtcInterface otc, TokenInterface payToken, uint payAmt, TokenInterface wethToken, uint minBuyAmt) public returns (uint wethAmt) {
        require(payToken.transferFrom(msg.sender, this, payAmt));
        if (payToken.allowance(this, otc) < payAmt) {
            payToken.approve(otc, uint(-1));
        }
        wethAmt = otc.sellAllAmount(payToken, payAmt, wethToken, minBuyAmt);
        withdrawAndSend(wethToken, wethAmt);
    }

    function buyAllAmount(OtcInterface otc, TokenInterface buyToken, uint buyAmt, TokenInterface payToken, uint maxPayAmt) public returns (uint payAmt) {
        uint payAmtNow = otc.getPayAmount(payToken, buyToken, buyAmt);
        require(payAmtNow <= maxPayAmt);
        require(payToken.transferFrom(msg.sender, this, payAmtNow));
        if (payToken.allowance(this, otc) < payAmtNow) {
            payToken.approve(otc, uint(-1));
        }
        payAmt = otc.buyAllAmount(buyToken, buyAmt, payToken, payAmtNow);
        require(buyToken.transfer(msg.sender, min(buyAmt, buyToken.balanceOf(this)))); // To avoid rounding issues we check the minimum value
    }

    function buyAllAmountPayEth(OtcInterface otc, TokenInterface buyToken, uint buyAmt, TokenInterface wethToken) public payable returns (uint wethAmt) {
        // In this case user needs to send more ETH than a estimated value, then contract will send back the rest
        wethToken.deposit.value(msg.value)();
        if (wethToken.allowance(this, otc) < msg.value) {
            wethToken.approve(otc, uint(-1));
        }
        wethAmt = otc.buyAllAmount(buyToken, buyAmt, wethToken, msg.value);
        require(buyToken.transfer(msg.sender, min(buyAmt, buyToken.balanceOf(this)))); // To avoid rounding issues we check the minimum value
        withdrawAndSend(wethToken, sub(msg.value, wethAmt));
    }

    function buyAllAmountBuyEth(OtcInterface otc, TokenInterface wethToken, uint wethAmt, TokenInterface payToken, uint maxPayAmt) public returns (uint payAmt) {
        uint payAmtNow = otc.getPayAmount(payToken, wethToken, wethAmt);
        require(payAmtNow <= maxPayAmt);
        require(payToken.transferFrom(msg.sender, this, payAmtNow));
        if (payToken.allowance(this, otc) < payAmtNow) {
            payToken.approve(otc, uint(-1));
        }
        payAmt = otc.buyAllAmount(wethToken, wethAmt, payToken, payAmtNow);
        withdrawAndSend(wethToken, wethAmt);
    }

    function() public payable {}
}

contract DSAuthority {
    function canCall(
        address src, address dst, bytes4 sig
    ) public view returns (bool);
}

contract DSAuthEvents {
    event LogSetAuthority (address indexed authority);
    event LogSetOwner     (address indexed owner);
}

contract DSAuth is DSAuthEvents {
    DSAuthority  public  authority;
    address      public  owner;

    function DSAuth() public {
        owner = msg.sender;
        LogSetOwner(msg.sender);
    }

    function setOwner(address owner_)
        public
        auth
    {
        owner = owner_;
        LogSetOwner(owner);
    }

    function setAuthority(DSAuthority authority_)
        public
        auth
    {
        authority = authority_;
        LogSetAuthority(authority);
    }

    modifier auth {
        require(isAuthorized(msg.sender, msg.sig));
        _;
    }

    function isAuthorized(address src, bytes4 sig) internal view returns (bool) {
        if (src == address(this)) {
            return true;
        } else if (src == owner) {
            return true;
        } else if (authority == DSAuthority(0)) {
            return false;
        } else {
            return authority.canCall(src, this, sig);
        }
    }
}

contract DSNote {
    event LogNote(
        bytes4   indexed  sig,
        address  indexed  guy,
        bytes32  indexed  foo,
        bytes32  indexed  bar,
        uint              wad,
        bytes             fax
    ) anonymous;

    modifier note {
        bytes32 foo;
        bytes32 bar;

        assembly {
            foo := calldataload(4)
            bar := calldataload(36)
        }

        LogNote(msg.sig, msg.sender, foo, bar, msg.value, msg.data);

        _;
    }
}

// DSProxy
// Allows code execution using a persistant identity This can be very
// useful to execute a sequence of atomic actions. Since the owner of
// the proxy can be changed, this allows for dynamic ownership models
// i.e. a multisig
contract DSProxy is DSAuth, DSNote {
    DSProxyCache public cache;  // global cache for contracts

    function DSProxy(address _cacheAddr) public {
        require(setCache(_cacheAddr));
    }

    function() public payable {
    }

    // use the proxy to execute calldata _data on contract _code
    function execute(bytes _code, bytes _data)
        public
        payable
        returns (address target, bytes32 response)
    {
        target = cache.read(_code);
        if (target == 0x0) {
            // deploy contract & store its address in cache
            target = cache.write(_code);
        }

        response = execute(target, _data);
    }

    function execute(address _target, bytes _data)
        public
        auth
        note
        payable
        returns (bytes32 response)
    {
        require(_target != 0x0);

        // call contract in current context
        assembly {
            let succeeded := delegatecall(sub(gas, 5000), _target, add(_data, 0x20), mload(_data), 0, 32)
            response := mload(0)      // load delegatecall output
            switch iszero(succeeded)
            case 1 {
                // throw if delegatecall failed
                revert(0, 0)
            }
        }
    }

    //set new cache
    function setCache(address _cacheAddr)
        public
        auth
        note
        returns (bool)
    {
        require(_cacheAddr != 0x0);        // invalid cache address
        cache = DSProxyCache(_cacheAddr);  // overwrite cache
        return true;
    }
}

// DSProxyFactory
// This factory deploys new proxy instances through build()
// Deployed proxy addresses are logged
contract DSProxyFactory {
    event Created(address indexed sender, address proxy, address cache);
    mapping(address=>bool) public isProxy;
    DSProxyCache public cache = new DSProxyCache();

    // deploys a new proxy instance
    // sets owner of proxy to caller
    function build() public returns (DSProxy proxy) {
        proxy = build(msg.sender);
    }

    // deploys a new proxy instance
    // sets custom owner of proxy
    function build(address owner) public returns (DSProxy proxy) {
        proxy = new DSProxy(cache);
        Created(owner, address(proxy), address(cache));
        proxy.setOwner(owner);
        isProxy[proxy] = true;
    }
}

// DSProxyCache
// This global cache stores addresses of contracts previously deployed
// by a proxy. This saves gas from repeat deployment of the same
// contracts and eliminates blockchain bloat.

// By default, all proxies deployed from the same factory store
// contracts in the same cache. The cache a proxy instance uses can be
// changed.  The cache uses the sha3 hash of a contract's bytecode to
// lookup the address
contract DSProxyCache {
    mapping(bytes32 => address) cache;

    function read(bytes _code) public view returns (address) {
        bytes32 hash = keccak256(_code);
        return cache[hash];
    }

    function write(bytes _code) public returns (address target) {
        assembly {
            target := create(0, add(_code, 0x20), mload(_code))
            switch iszero(extcodesize(target))
            case 1 {
                // throw if contract failed to deploy
                revert(0, 0)
            }
        }
        bytes32 hash = keccak256(_code);
        cache[hash] = target;
    }
}

contract ProxyCreationAndExecute is OasisDirectProxy {
    TokenInterface wethToken;

    function ProxyCreationAndExecute(address wethToken_) {
        wethToken = TokenInterface(wethToken_);
    }

    function createAndSellAllAmount(DSProxyFactory factory, OtcInterface otc, TokenInterface payToken, uint payAmt, TokenInterface buyToken, uint minBuyAmt) public returns (DSProxy proxy, uint buyAmt) {
        proxy = factory.build(msg.sender);
        buyAmt = sellAllAmount(otc, payToken, payAmt, buyToken, minBuyAmt);
    }

    function createAndSellAllAmountPayEth(DSProxyFactory factory, OtcInterface otc, TokenInterface buyToken, uint minBuyAmt) public payable returns (DSProxy proxy, uint buyAmt) {
        proxy = factory.build(msg.sender);
        buyAmt = sellAllAmountPayEth(otc, wethToken, buyToken, minBuyAmt);
    }

    function createAndSellAllAmountBuyEth(DSProxyFactory factory, OtcInterface otc, TokenInterface payToken, uint payAmt, uint minBuyAmt) public returns (DSProxy proxy, uint wethAmt) {
        proxy = factory.build(msg.sender);
        wethAmt = sellAllAmountBuyEth(otc, payToken, payAmt, wethToken, minBuyAmt);
    }

    function createAndBuyAllAmount(DSProxyFactory factory, OtcInterface otc, TokenInterface buyToken, uint buyAmt, TokenInterface payToken, uint maxPayAmt) public returns (DSProxy proxy, uint payAmt) {
        proxy = factory.build(msg.sender);
        payAmt = buyAllAmount(otc, buyToken, buyAmt, payToken, maxPayAmt);
    }

    function createAndBuyAllAmountPayEth(DSProxyFactory factory, OtcInterface otc, TokenInterface buyToken, uint buyAmt) public payable returns (DSProxy proxy, uint wethAmt) {
        proxy = factory.build(msg.sender);
        wethAmt = buyAllAmountPayEth(otc, buyToken, buyAmt, wethToken);
    }

    function createAndBuyAllAmountBuyEth(DSProxyFactory factory, OtcInterface otc, uint wethAmt, TokenInterface payToken, uint maxPayAmt) public returns (DSProxy proxy, uint payAmt) {
        proxy = factory.build(msg.sender);
        payAmt = buyAllAmountBuyEth(otc, wethToken, wethAmt, payToken, maxPayAmt);
    }

    function() public payable {
        require(msg.sender == address(wethToken));
    }
}

    Contract ABI  
[{"constant":false,"inputs":[{"name":"otc","type":"address"},{"name":"payToken","type":"address"},{"name":"payAmt","type":"uint256"},{"name":"wethToken","type":"address"},{"name":"minBuyAmt","type":"uint256"}],"name":"sellAllAmountBuyEth","outputs":[{"name":"wethAmt","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"otc","type":"address"},{"name":"payToken","type":"address"},{"name":"payAmt","type":"uint256"},{"name":"buyToken","type":"address"},{"name":"minBuyAmt","type":"uint256"}],"name":"sellAllAmount","outputs":[{"name":"buyAmt","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"otc","type":"address"},{"name":"buyToken","type":"address"},{"name":"buyAmt","type":"uint256"},{"name":"payToken","type":"address"},{"name":"maxPayAmt","type":"uint256"}],"name":"buyAllAmount","outputs":[{"name":"payAmt","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"factory","type":"address"},{"name":"otc","type":"address"},{"name":"wethAmt","type":"uint256"},{"name":"payToken","type":"address"},{"name":"maxPayAmt","type":"uint256"}],"name":"createAndBuyAllAmountBuyEth","outputs":[{"name":"proxy","type":"address"},{"name":"payAmt","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"factory","type":"address"},{"name":"otc","type":"address"},{"name":"payToken","type":"address"},{"name":"payAmt","type":"uint256"},{"name":"minBuyAmt","type":"uint256"}],"name":"createAndSellAllAmountBuyEth","outputs":[{"name":"proxy","type":"address"},{"name":"wethAmt","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"factory","type":"address"},{"name":"otc","type":"address"},{"name":"buyToken","type":"address"},{"name":"buyAmt","type":"uint256"}],"name":"createAndBuyAllAmountPayEth","outputs":[{"name":"proxy","type":"address"},{"name":"wethAmt","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"factory","type":"address"},{"name":"otc","type":"address"},{"name":"buyToken","type":"address"},{"name":"minBuyAmt","type":"uint256"}],"name":"createAndSellAllAmountPayEth","outputs":[{"name":"proxy","type":"address"},{"name":"buyAmt","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"factory","type":"address"},{"name":"otc","type":"address"},{"name":"buyToken","type":"address"},{"name":"buyAmt","type":"uint256"},{"name":"payToken","type":"address"},{"name":"maxPayAmt","type":"uint256"}],"name":"createAndBuyAllAmount","outputs":[{"name":"proxy","type":"address"},{"name":"payAmt","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"otc","type":"address"},{"name":"buyToken","type":"address"},{"name":"buyAmt","type":"uint256"},{"name":"wethToken","type":"address"}],"name":"buyAllAmountPayEth","outputs":[{"name":"wethAmt","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"factory","type":"address"},{"name":"otc","type":"address"},{"name":"payToken","type":"address"},{"name":"payAmt","type":"uint256"},{"name":"buyToken","type":"address"},{"name":"minBuyAmt","type":"uint256"}],"name":"createAndSellAllAmount","outputs":[{"name":"proxy","type":"address"},{"name":"buyAmt","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"otc","type":"address"},{"name":"wethToken","type":"address"},{"name":"buyToken","type":"address"},{"name":"minBuyAmt","type":"uint256"}],"name":"sellAllAmountPayEth","outputs":[{"name":"buyAmt","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"otc","type":"address"},{"name":"wethToken","type":"address"},{"name":"wethAmt","type":"uint256"},{"name":"payToken","type":"address"},{"name":"maxPayAmt","type":"uint256"}],"name":"buyAllAmountBuyEth","outputs":[{"name":"payAmt","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"wethToken_","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"}]

  Contract Creation Code Switch To Opcodes View
6060604052341561000f57600080fd5b6040516020806116148339810160405280805160008054600160a060020a03909216600160a060020a031990921691909117905550506115c0806100546000396000f3006060604052600436106100a05763ffffffff60e060020a60003504166303e1b3c681146100bd5780631ebf0d11146101015780633c0ab650146101335780633fa9baf1146101655780636c1210e8146101b95780636fc4a4a2146101ea578063793e39cd1461020d57806392eeee63146102305780639a22dec514610268578063b126d0e51461028c578063e50278a6146102c4578063f9a87d4f146102e7575b60005433600160a060020a039081169116146100bb57600080fd5b005b34156100c857600080fd5b6100ef600160a060020a036004358116906024358116906044359060643516608435610319565b60405190815260200160405180910390f35b341561010c57600080fd5b6100ef600160a060020a03600435811690602435811690604435906064351660843561050d565b341561013e57600080fd5b6100ef600160a060020a036004358116906024358116906044359060643516608435610763565b341561017057600080fd5b610197600160a060020a036004358116906024358116906044359060643516608435610aae565b604051600160a060020a03909216825260208201526040908101905180910390f35b34156101c457600080fd5b610197600160a060020a0360043581169060243581169060443516606435608435610b3e565b610197600160a060020a0360043581169060243581169060443516606435610bc4565b610197600160a060020a0360043581169060243581169060443516606435610c54565b341561023b57600080fd5b610197600160a060020a03600435811690602435811690604435811690606435906084351660a435610cd7565b6100ef600160a060020a036004358116906024358116906044359060643516610d5b565b341561029757600080fd5b610197600160a060020a03600435811690602435811690604435811690606435906084351660a435610fdf565b6100ef600160a060020a0360043581169060243581169060443516606435611056565b34156102f257600080fd5b6100ef600160a060020a036004358116906024358116906044359060643516608435611277565b600084600160a060020a03166323b872dd33308760405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401602060405180830381600087803b151561037c57600080fd5b5af1151561038957600080fd5b50505060405180519050151561039e57600080fd5b8385600160a060020a031663dd62ed3e308960405160e060020a63ffffffff8516028152600160a060020a03928316600482015291166024820152604401602060405180830381600087803b15156103f557600080fd5b5af1151561040257600080fd5b5050506040518051905010156104795784600160a060020a031663095ea7b38760001960405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b151561046857600080fd5b5af1151561047557600080fd5b5050505b85600160a060020a0316630621b4f68686868660405160e060020a63ffffffff8716028152600160a060020a0394851660048201526024810193909352921660448201526064810191909152608401602060405180830381600087803b15156104e157600080fd5b5af115156104ee57600080fd5b50505060405180519050905061050483826114e5565b95945050505050565b600084600160a060020a03166323b872dd33308760405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401602060405180830381600087803b151561057057600080fd5b5af1151561057d57600080fd5b50505060405180519050151561059257600080fd5b8385600160a060020a031663dd62ed3e308960405160e060020a63ffffffff8516028152600160a060020a03928316600482015291166024820152604401602060405180830381600087803b15156105e957600080fd5b5af115156105f657600080fd5b50505060405180519050101561066d5784600160a060020a031663095ea7b38760001960405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b151561065c57600080fd5b5af1151561066957600080fd5b5050505b85600160a060020a0316630621b4f68686868660405160e060020a63ffffffff8716028152600160a060020a0394851660048201526024810193909352921660448201526064810191909152608401602060405180830381600087803b15156106d557600080fd5b5af115156106e257600080fd5b5050506040518051915050600160a060020a03831663a9059cbb338360405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561074157600080fd5b5af1151561074e57600080fd5b50505060405180519050151561050457600080fd5b60008086600160a060020a031663ff1fd97485888860405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401602060405180830381600087803b15156107c757600080fd5b5af115156107d457600080fd5b5050506040518051915050828111156107ec57600080fd5b83600160a060020a03166323b872dd33308460405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401602060405180830381600087803b151561084d57600080fd5b5af1151561085a57600080fd5b50505060405180519050151561086f57600080fd5b8084600160a060020a031663dd62ed3e308a60405160e060020a63ffffffff8516028152600160a060020a03928316600482015291166024820152604401602060405180830381600087803b15156108c657600080fd5b5af115156108d357600080fd5b50505060405180519050101561094a5783600160a060020a031663095ea7b38860001960405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b151561093957600080fd5b5af1151561094657600080fd5b5050505b86600160a060020a0316638185402b8787878560405160e060020a63ffffffff8716028152600160a060020a0394851660048201526024810193909352921660448201526064810191909152608401602060405180830381600087803b15156109b257600080fd5b5af115156109bf57600080fd5b5050506040518051925050600160a060020a03861663a9059cbb33610a3f88846370a082313060405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515610a2357600080fd5b5af11515610a3057600080fd5b50505060405180519050611569565b60405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610a8257600080fd5b5af11515610a8f57600080fd5b505050604051805190501515610aa457600080fd5b5095945050505050565b60008086600160a060020a031663f3701da23360405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515610aff57600080fd5b5af11515610b0c57600080fd5b5050506040518051600054909350610b3291508790600160a060020a0316878787611277565b90509550959350505050565b60008086600160a060020a031663f3701da23360405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515610b8f57600080fd5b5af11515610b9c57600080fd5b5050506040518051600054909350610b329150879087908790600160a060020a031687610319565b60008085600160a060020a031663f3701da23360405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515610c1557600080fd5b5af11515610c2257600080fd5b5050506040518051600054909350610c499150869086908690600160a060020a0316610d5b565b905094509492505050565b60008085600160a060020a031663f3701da23360405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515610ca557600080fd5b5af11515610cb257600080fd5b5050506040518051600054909350610c4991508690600160a060020a03168686611056565b60008087600160a060020a031663f3701da23360405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515610d2857600080fd5b5af11515610d3557600080fd5b505050604051805190509150610d4e8787878787610763565b9050965096945050505050565b600081600160a060020a031663d0e30db0346040518263ffffffff1660e060020a0281526004016000604051808303818588803b1515610d9a57600080fd5b5af11515610da757600080fd5b505050503482600160a060020a031663dd62ed3e308860405160e060020a63ffffffff8516028152600160a060020a03928316600482015291166024820152604401602060405180830381600087803b1515610e0257600080fd5b5af11515610e0f57600080fd5b505050604051805190501015610e865781600160a060020a031663095ea7b38660001960405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b1515610e7557600080fd5b5af11515610e8257600080fd5b5050505b84600160a060020a0316638185402b8585853460405160e060020a63ffffffff8716028152600160a060020a0394851660048201526024810193909352921660448201526064810191909152608401602060405180830381600087803b1515610eee57600080fd5b5af11515610efb57600080fd5b5050506040518051915050600160a060020a03841663a9059cbb33610f5f86846370a082313060405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515610a2357600080fd5b60405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610fa257600080fd5b5af11515610faf57600080fd5b505050604051805190501515610fc457600080fd5b610fd782610fd23484611584565b6114e5565b949350505050565b60008087600160a060020a031663f3701da23360405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561103057600080fd5b5af1151561103d57600080fd5b505050604051805190509150610d4e878787878761050d565b600083600160a060020a031663d0e30db0346040518263ffffffff1660e060020a0281526004016000604051808303818588803b151561109557600080fd5b5af115156110a257600080fd5b505050503484600160a060020a031663dd62ed3e308860405160e060020a63ffffffff8516028152600160a060020a03928316600482015291166024820152604401602060405180830381600087803b15156110fd57600080fd5b5af1151561110a57600080fd5b5050506040518051905010156111815783600160a060020a031663095ea7b38660001960405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b151561117057600080fd5b5af1151561117d57600080fd5b5050505b84600160a060020a0316630621b4f68534868660405160e060020a63ffffffff8716028152600160a060020a0394851660048201526024810193909352921660448201526064810191909152608401602060405180830381600087803b15156111e957600080fd5b5af115156111f657600080fd5b5050506040518051915050600160a060020a03831663a9059cbb338360405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561125557600080fd5b5af1151561126257600080fd5b505050604051805190501515610fd757600080fd5b60008086600160a060020a031663ff1fd97485888860405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401602060405180830381600087803b15156112db57600080fd5b5af115156112e857600080fd5b50505060405180519150508281111561130057600080fd5b83600160a060020a03166323b872dd33308460405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401602060405180830381600087803b151561136157600080fd5b5af1151561136e57600080fd5b50505060405180519050151561138357600080fd5b8084600160a060020a031663dd62ed3e308a60405160e060020a63ffffffff8516028152600160a060020a03928316600482015291166024820152604401602060405180830381600087803b15156113da57600080fd5b5af115156113e757600080fd5b50505060405180519050101561145e5783600160a060020a031663095ea7b38860001960405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b151561144d57600080fd5b5af1151561145a57600080fd5b5050505b86600160a060020a0316638185402b8787878560405160e060020a63ffffffff8716028152600160a060020a0394851660048201526024810193909352921660448201526064810191909152608401602060405180830381600087803b15156114c657600080fd5b5af115156114d357600080fd5b505050604051805190509150610aa486865b81600160a060020a0316632e1a7d4d8260405160e060020a63ffffffff84160281526004810191909152602401600060405180830381600087803b151561152b57600080fd5b5af1151561153857600080fd5b50505033600160a060020a03168160405160006040518083038185875af192505050151561156557600080fd5b5050565b600081831115611579578161157b565b825b90505b92915050565b8082038281111561157e57600080fd00a165627a7a723058205e0896a71f48b6c42df9d3843ca60c3e5fad0463472b43c0236bfc26b30336990029000000000000000000000000d0a1e359811322d97991e03f863a0c30c2cf029c

    Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000d0a1e359811322d97991e03f863a0c30c2cf029c

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000d0a1e359811322d97991e03f863a0c30c2cf029c


   Swarm Source:
bzzr://5e0896a71f48b6c42df9d3843ca60c3e5fad0463472b43c0236bfc26b3033699

 

View All
Block Age transaction Difficulty GasUsed Reward
View All
Block Age UncleNumber Difficulty GasUsed Reward