Contract 0x641b470Ab5Fe8BD2De95c2Ec9EF6c6CEf1f75b0F

 

TxHash Block Age From To Value [TxFee]
0x791bd0e2d6943b0393e6e2668fa9a4487209338d0a612bf5074aa5f5f5c1ec4372246588 hrs 42 mins ago0x1231d83026c6d8fd810501801288668590ab1ce4  IN   0x641b470ab5fe8bd2de95c2ec9ef6c6cef1f75b0f0 Ether0.00207597
0x686dd138587a32878a7bdc333683cefde5fa61ee2e9e375b2e0d3be6caa8535b722413611 hrs 43 mins ago0xf603092c0552ba3b38108333de879ba8eec3e764  IN   0x641b470ab5fe8bd2de95c2ec9ef6c6cef1f75b0f0 Ether0.005777772
0x5fafc1959a05b84cd9daa8262a81ab27656390b73f3c24d2b42e836ea241274c722246821 hrs 14 mins ago0xb3005003a2cd106007a886783dad0346958e9603  IN   0x641b470ab5fe8bd2de95c2ec9ef6c6cef1f75b0f0 Ether0.0030945776
0xeb5361377f3725253f117cbef3c07dde8dc28db78865cb1383c3f0f7201956b1722245521 hrs 19 mins ago0xb3005003a2cd106007a886783dad0346958e9603  IN   0x641b470ab5fe8bd2de95c2ec9ef6c6cef1f75b0f0 Ether0.0029278909
0xa6e36bd6081166398f0df4a981e382def100fd857f0049cff4c673cd3bed93fe722242521 hrs 29 mins ago0xb3005003a2cd106007a886783dad0346958e9603  IN   0x641b470ab5fe8bd2de95c2ec9ef6c6cef1f75b0f0 Ether0.003202072
0xf36849fc773c692b076b9d70588bb18bd006e0c5c4ffbe2d70c16abcba7c3446722232621 hrs 59 mins ago0xb3005003a2cd106007a886783dad0346958e9603  IN   0x641b470ab5fe8bd2de95c2ec9ef6c6cef1f75b0f0 Ether0.000546264375
0x1d14cde3c6aaa7594f7b1ff7bf0f56e71e26b409ce0ae1b75147f35c7ddfe15f72219291 day 15 mins ago0xebebc6b04e844ab5498f29b1083b11d06249ae83  IN   0x641b470ab5fe8bd2de95c2ec9ef6c6cef1f75b0f0 Ether0.001451538
0xe59bfa04b3bb5f062bb5606661292b6b4c47e92bef3f53239158b1282968bc8972219191 day 18 mins ago0xebebc6b04e844ab5498f29b1083b11d06249ae83  IN   0x641b470ab5fe8bd2de95c2ec9ef6c6cef1f75b0f0 Ether0.000811422
0x5591986d99c19ddf4e1f3a0608e803ce224ffb7de2bae2d8ce085a503d49a8e472204811 day 8 hrs ago0xb3005003a2cd106007a886783dad0346958e9603  IN   0x641b470ab5fe8bd2de95c2ec9ef6c6cef1f75b0f0 Ether0.0021185025
0x7f378d350a6e98a543189a1f87907b918ef01ae55e9915999ed1ff85746145c272204161 day 9 hrs ago0xb3005003a2cd106007a886783dad0346958e9603  IN   0x641b470ab5fe8bd2de95c2ec9ef6c6cef1f75b0f0 Ether0.000945987
0x3e45757e9278656893057f1e9c9f22ea79e45f1356d94d82279c84cbd22c82c472195411 day 14 hrs ago0x90d7d698c85b5524a748a251446e2acd487004be  IN   0x641b470ab5fe8bd2de95c2ec9ef6c6cef1f75b0f0 Ether0.000676185
0xebb590ab491645497a7162b4aeeb6f341449a2c3666e6a1e97aecf1be4cae77172163872 days 8 hrs ago0xa90a55af4f5c76c9e6c3d22a8dec7d6de0fb1388  IN   0x641b470ab5fe8bd2de95c2ec9ef6c6cef1f75b0f0 Ether0.00110646
0x4dcfe975e2fa1aacb10316f7da427a7cf96870ddf397fab35fe465364affb8d372160992 days 10 hrs ago0x2e5fc1cb068ca097414a8d703e61a4f8d034b962  IN   0x641b470ab5fe8bd2de95c2ec9ef6c6cef1f75b0f0 Ether0.000405711
0x5e25e4420842fe856c99779b2739de21c66d68f3558e30e93e7ea84b5b57b5ad72160892 days 10 hrs ago0x404c439cae3208255cb98cabfcef4c4aac03f37e  IN   0x641b470ab5fe8bd2de95c2ec9ef6c6cef1f75b0f0 Ether0.000811422
0x7ff8334f547ef7a3bf7282d2248c1707b17b045a71861cd3c0ba234dc1213cb172155482 days 13 hrs ago0x18a8053f6f50f57fe72c44f504faae2e572059d0  IN   0x641b470ab5fe8bd2de95c2ec9ef6c6cef1f75b0f0 Ether0.0041211975
0x4d1e4a922d4ea21d218e27488f5904dd3d9ab4a59480103f509f10df30e7074872155312 days 13 hrs ago0x18a8053f6f50f57fe72c44f504faae2e572059d0  IN   0x641b470ab5fe8bd2de95c2ec9ef6c6cef1f75b0f0 Ether0.000946659
0x9cb8a3a42faa6cc16be30c2dd1e4797f1e0f97acac8aa9f5c8d8c8f0f5f8930f72127803 days 5 hrs ago0xa90a55af4f5c76c9e6c3d22a8dec7d6de0fb1388  IN   0x641b470ab5fe8bd2de95c2ec9ef6c6cef1f75b0f0 Ether0.00238161
0xc9ab7139c376b79b11360fada5270d3c84568149fe6fcc591ced562a7dde317072127393 days 5 hrs ago0xa90a55af4f5c76c9e6c3d22a8dec7d6de0fb1388  IN   0x641b470ab5fe8bd2de95c2ec9ef6c6cef1f75b0f0 Ether0.000782707695
0xf4f805a482aab4fa17a8c1b1b4401319eac6bdf67a4aea343ec99078b165f5d472127323 days 5 hrs ago0xa90a55af4f5c76c9e6c3d22a8dec7d6de0fb1388  IN   0x641b470ab5fe8bd2de95c2ec9ef6c6cef1f75b0f0 Ether0.0019747575
0xa462e2ae748662a76e6f09f4e33374c469268c3ff17c84aa2cb24f2a44d210ab72123553 days 7 hrs ago0xa90a55af4f5c76c9e6c3d22a8dec7d6de0fb1388  IN   0x641b470ab5fe8bd2de95c2ec9ef6c6cef1f75b0f0 Ether0.0023834025
0xf68dd036111bf3b21dcf3992057d619c9245105f675620330b06521ed11f141e72116143 days 11 hrs ago0xa90a55af4f5c76c9e6c3d22a8dec7d6de0fb1388  IN   0x641b470ab5fe8bd2de95c2ec9ef6c6cef1f75b0f0 Ether0.001798569
0x482e0d3c063325e1597cfef172310bd8a4590b95b77f1b09c83882cef380ec8772116063 days 11 hrs ago0xa90a55af4f5c76c9e6c3d22a8dec7d6de0fb1388  IN   0x641b470ab5fe8bd2de95c2ec9ef6c6cef1f75b0f0 Ether0.000405711
0x3709697d59e93430f9126ef280fce2904617ff9b22926f5a257d2d33e5e6317e72114473 days 12 hrs ago0x2c67eb139eb0b1416c3e743a106eb68d8442d627  IN   0x641b470ab5fe8bd2de95c2ec9ef6c6cef1f75b0f0 Ether0.006016635
0x530c5da8fa08b8e8c10a3ffb9ad7f7501c6b7bca4f78b6d77f72ae8c3462643b72114143 days 12 hrs ago0x2c67eb139eb0b1416c3e743a106eb68d8442d627  IN   0x641b470ab5fe8bd2de95c2ec9ef6c6cef1f75b0f0 Ether0.004510207155
0x6da7366581f87699b444fa85c07c0c3a0164809994baeae12eacd82335a4305272113983 days 12 hrs ago0x2c67eb139eb0b1416c3e743a106eb68d8442d627  IN   0x641b470ab5fe8bd2de95c2ec9ef6c6cef1f75b0f0 Ether0.00422985
[ Download CSV Export 

Latest 17 Internal Transactions Internal Transactions as a result of Contract Execution

Parent TxHash Block Age From To Value
0xf68dd036111bf3b21dcf3992057d619c9245105f675620330b06521ed11f141e72116143 days 11 hrs ago0x641b470ab5fe8bd2de95c2ec9ef6c6cef1f75b0f0xa90a55af4f5c76c9e6c3d22a8dec7d6de0fb13880.006307000027257447 Ether
0xf68dd036111bf3b21dcf3992057d619c9245105f675620330b06521ed11f141e72116143 days 11 hrs ago0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc20x641b470ab5fe8bd2de95c2ec9ef6c6cef1f75b0f0.006307000027257447 Ether
0x3709697d59e93430f9126ef280fce2904617ff9b22926f5a257d2d33e5e6317e72114473 days 12 hrs ago0x641b470ab5fe8bd2de95c2ec9ef6c6cef1f75b0f0x2c67eb139eb0b1416c3e743a106eb68d8442d62710.184182101086363302 Ether
0x3709697d59e93430f9126ef280fce2904617ff9b22926f5a257d2d33e5e6317e72114473 days 12 hrs ago0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc20x641b470ab5fe8bd2de95c2ec9ef6c6cef1f75b0f10.184182101086363302 Ether
0x530c5da8fa08b8e8c10a3ffb9ad7f7501c6b7bca4f78b6d77f72ae8c3462643b72114143 days 12 hrs ago0x641b470ab5fe8bd2de95c2ec9ef6c6cef1f75b0f0x2c67eb139eb0b1416c3e743a106eb68d8442d62713.205818 Ether
0x530c5da8fa08b8e8c10a3ffb9ad7f7501c6b7bca4f78b6d77f72ae8c3462643b72114143 days 12 hrs ago0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc20x641b470ab5fe8bd2de95c2ec9ef6c6cef1f75b0f13.205818 Ether
0x98ef83bb57a3cb6334da8253268f3c485348ad6c84a8f34455f1bcec342d49f672103033 days 19 hrs ago0x641b470ab5fe8bd2de95c2ec9ef6c6cef1f75b0f0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc26.166134769750844 Ether
0x0a549a70b12c6137684c11677d25d874b412a653c9747f59726d84c1dffbfd9772098763 days 21 hrs ago0x641b470ab5fe8bd2de95c2ec9ef6c6cef1f75b0f0x7c873433a1bd0cde667a08f8bec66965a4c37c920.156718 Ether
0x0a549a70b12c6137684c11677d25d874b412a653c9747f59726d84c1dffbfd9772098763 days 21 hrs ago0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc20x641b470ab5fe8bd2de95c2ec9ef6c6cef1f75b0f0.156718 Ether
0x9206cfc3f10d44f18c65882197e297ea3cee0a3756076e8643136c365018d69672098383 days 21 hrs ago0x641b470ab5fe8bd2de95c2ec9ef6c6cef1f75b0f0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc20.156718 Ether
0x412beb4755d548edffcda3fe2a8fc49170cc834a860f0385480295a8fd6f4afd71996596 days 6 hrs ago0x641b470ab5fe8bd2de95c2ec9ef6c6cef1f75b0f0x82b13de76ee899d15a78bf618c1dfc90e00439371.2 Ether
0x412beb4755d548edffcda3fe2a8fc49170cc834a860f0385480295a8fd6f4afd71996596 days 6 hrs ago0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc20x641b470ab5fe8bd2de95c2ec9ef6c6cef1f75b0f1.2 Ether
0xa433cced7f6a4c613daeae3117be5a1ff2a2af703b8db642d6662233eb9200e971989846 days 10 hrs ago0x641b470ab5fe8bd2de95c2ec9ef6c6cef1f75b0f0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc21.2 Ether
0x1a17a408501bc26d07db77bea09a53923e9ac531160eb410bfebc547c124224471947127 days 6 hrs ago0x641b470ab5fe8bd2de95c2ec9ef6c6cef1f75b0f0xc18926cb21791bfbc2c8b5b80fdfe68a6757d8190.033717 Ether
0x1a17a408501bc26d07db77bea09a53923e9ac531160eb410bfebc547c124224471947127 days 6 hrs ago0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc20x641b470ab5fe8bd2de95c2ec9ef6c6cef1f75b0f0.033717 Ether
0x72a342759e4015152c6ef47c33a9bbd8de41d71b9b474278666fd9830c95dde671946797 days 7 hrs ago0x641b470ab5fe8bd2de95c2ec9ef6c6cef1f75b0f0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc20.033717 Ether
0x6a967246bf75368b6376efe8f249b23d7a6c23530777238be890f25601a5c8a371943197 days 8 hrs ago0x641b470ab5fe8bd2de95c2ec9ef6c6cef1f75b0f0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc20.016925 Ether
[ Download CSV Export 
Contract Source Code Verified (Similar Match)
Note: This contract matches the deployed ByteCode of the Verified Source Code for Contract 0xfAdDcfa9cb1CB19BA865A5FD7134B2824b73453c
Contract Name: MakerDaoGateway
Compiler Version: v0.5.0+commit.1d4f565a
Optimization Enabled: Yes
Runs (Optimizer):  200


Contract Source Code
pragma solidity 0.5.0;

// File: openzeppelin-solidity/contracts/access/Roles.sol

/**
 * @title Roles
 * @dev Library for managing addresses assigned to a Role.
 */
library Roles {
    struct Role {
        mapping (address => bool) bearer;
    }

    /**
     * @dev give an account access to this role
     */
    function add(Role storage role, address account) internal {
        require(account != address(0));
        require(!has(role, account));

        role.bearer[account] = true;
    }

    /**
     * @dev remove an account's access to this role
     */
    function remove(Role storage role, address account) internal {
        require(account != address(0));
        require(has(role, account));

        role.bearer[account] = false;
    }

    /**
     * @dev check if an account has this role
     * @return bool
     */
    function has(Role storage role, address account) internal view returns (bool) {
        require(account != address(0));
        return role.bearer[account];
    }
}

// File: openzeppelin-solidity/contracts/access/roles/PauserRole.sol

contract PauserRole {
    using Roles for Roles.Role;

    event PauserAdded(address indexed account);
    event PauserRemoved(address indexed account);

    Roles.Role private _pausers;

    constructor () internal {
        _addPauser(msg.sender);
    }

    modifier onlyPauser() {
        require(isPauser(msg.sender));
        _;
    }

    function isPauser(address account) public view returns (bool) {
        return _pausers.has(account);
    }

    function addPauser(address account) public onlyPauser {
        _addPauser(account);
    }

    function renouncePauser() public {
        _removePauser(msg.sender);
    }

    function _addPauser(address account) internal {
        _pausers.add(account);
        emit PauserAdded(account);
    }

    function _removePauser(address account) internal {
        _pausers.remove(account);
        emit PauserRemoved(account);
    }
}

// File: openzeppelin-solidity/contracts/lifecycle/Pausable.sol

/**
 * @title Pausable
 * @dev Base contract which allows children to implement an emergency stop mechanism.
 */
contract Pausable is PauserRole {
    event Paused(address account);
    event Unpaused(address account);

    bool private _paused;

    constructor () internal {
        _paused = false;
    }

    /**
     * @return true if the contract is paused, false otherwise.
     */
    function paused() public view returns (bool) {
        return _paused;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     */
    modifier whenNotPaused() {
        require(!_paused);
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     */
    modifier whenPaused() {
        require(_paused);
        _;
    }

    /**
     * @dev called by the owner to pause, triggers stopped state
     */
    function pause() public onlyPauser whenNotPaused {
        _paused = true;
        emit Paused(msg.sender);
    }

    /**
     * @dev called by the owner to unpause, returns to normal state
     */
    function unpause() public onlyPauser whenPaused {
        _paused = false;
        emit Unpaused(msg.sender);
    }
}

// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol

/**
 * @title ERC20 interface
 * @dev see https://github.com/ethereum/EIPs/issues/20
 */
interface IERC20 {
    function transfer(address to, uint256 value) external returns (bool);

    function approve(address spender, uint256 value) external returns (bool);

    function transferFrom(address from, address to, uint256 value) external returns (bool);

    function totalSupply() external view returns (uint256);

    function balanceOf(address who) external view returns (uint256);

    function allowance(address owner, address spender) external view returns (uint256);

    event Transfer(address indexed from, address indexed to, uint256 value);

    event Approval(address indexed owner, address indexed spender, uint256 value);
}

// File: 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, "ds-math-add-overflow");
    }
    function sub(uint x, uint y) internal pure returns (uint z) {
        require((z = x - y) <= x, "ds-math-sub-underflow");
    }
    function mul(uint x, uint y) internal pure returns (uint z) {
        require(y == 0 || (z = x * y) / y == x, "ds-math-mul-overflow");
    }

    function min(uint x, uint y) internal pure returns (uint z) {
        return x <= y ? x : y;
    }
    function max(uint x, uint y) internal pure returns (uint z) {
        return x >= y ? x : y;
    }
    function imin(int x, int y) internal pure returns (int z) {
        return x <= y ? x : y;
    }
    function imax(int x, int y) internal pure returns (int z) {
        return x >= y ? x : y;
    }

    uint constant WAD = 10 ** 18;
    uint constant RAY = 10 ** 27;

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

// File: contracts/interfaces/IWrappedEther.sol

contract IWrappedEther is IERC20 {
    function deposit() external payable;
    function withdraw(uint amount) external;
}

// File: contracts/interfaces/ISaiTub.sol

interface DSValue {
    function peek() external view returns (bytes32, bool);
}

interface ISaiTub {
    function sai() external view returns (IERC20);  // Stablecoin
    function sin() external view returns (IERC20);  // Debt (negative sai)
    function skr() external view returns (IERC20);  // Abstracted collateral
    function gem() external view returns (IWrappedEther);  // Underlying collateral
    function gov() external view returns (IERC20);  // Governance token

    function open() external returns (bytes32 cup);
    function join(uint wad) external;
    function exit(uint wad) external;
    function give(bytes32 cup, address guy) external;
    function lock(bytes32 cup, uint wad) external;
    function free(bytes32 cup, uint wad) external;
    function draw(bytes32 cup, uint wad) external;
    function wipe(bytes32 cup, uint wad) external;
    function shut(bytes32 cup) external;
    function per() external view returns (uint ray);
    function lad(bytes32 cup) external view returns (address);
    
    function tab(bytes32 cup) external returns (uint);
    function rap(bytes32 cup) external returns (uint);
    function ink(bytes32 cup) external view returns (uint);
    function mat() external view returns (uint);    // Liquidation ratio
    function fee() external view returns (uint);    // Governance fee
    function pep() external view returns (DSValue); // Governance price feed
    function cap() external view returns (uint); // Debt ceiling
    

    function cups(bytes32) external view returns (address, uint, uint, uint);
}

// File: contracts/interfaces/IDex.sol

interface IDex {
    function getPayAmount(IERC20 pay_gem, IERC20 buy_gem, uint buy_amt) external view returns (uint);
    function buyAllAmount(IERC20 buy_gem, uint buy_amt, IERC20 pay_gem, uint max_fill_amount) external returns (uint);
    function offer(
        uint pay_amt,    //maker (ask) sell how much
        IERC20 pay_gem,   //maker (ask) sell which token
        uint buy_amt,    //maker (ask) buy how much
        IERC20 buy_gem,   //maker (ask) buy which token
        uint pos         //position to insert offer, 0 should be used if unknown
    )
    external
    returns (uint);
}

// File: contracts/ArrayUtils.sol

library ArrayUtils {
    function removeElement(bytes32[] storage array, uint index) internal {
        if (index >= array.length) return;

        for (uint i = index; i < array.length - 1; i++) {
            array[i] = array[i + 1];
        }
        delete array[array.length - 1];
        array.length--;
    }

    function findElement(bytes32[] storage array, bytes32 element) internal view returns (uint index, bool ok) {
        for (uint i = 0; i < array.length; i++) {
            if (array[i] == element) {
                return (i, true);
            }
        }

        return (0, false);
    }
}

// File: contracts/MakerDaoGateway.sol

contract MakerDaoGateway is Pausable, DSMath {
    using ArrayUtils for bytes32[];

    ISaiTub public saiTub;
    IDex public dex;
    IWrappedEther public weth;
    IERC20 public peth;
    IERC20 public dai;
    IERC20 public mkr;

    mapping(bytes32 => address) public cdpOwner;
    mapping(address => bytes32[]) public cdpsByOwner;

    event CdpOpened(address indexed owner, bytes32 cdpId);
    event CdpClosed(address indexed owner, bytes32 cdpId);
    event CollateralSupplied(address indexed owner, bytes32 cdpId, uint wethAmount, uint pethAmount);
    event DaiBorrowed(address indexed owner, bytes32 cdpId, uint amount);
    event DaiRepaid(address indexed owner, bytes32 cdpId, uint amount);
    event CollateralReturned(address indexed owner, bytes32 cdpId, uint wethAmount, uint pethAmount);
    event CdpTransferred(address indexed oldOwner, address indexed newOwner, bytes32 cdpId);
    event CdpEjected(address indexed newOwner, bytes32 cdpId);
    event CdpRegistered(address indexed newOwner, bytes32 cdpId);

    modifier isCdpOwner(bytes32 cdpId) {
        require(cdpOwner[cdpId] == msg.sender || cdpId == 0, "CDP belongs to a different address");
        _;
    }

    constructor(ISaiTub _saiTub, IDex _dex) public {
        saiTub = _saiTub;
        dex = _dex;
        weth = saiTub.gem();
        peth = saiTub.skr();
        dai = saiTub.sai();
        mkr = saiTub.gov();
    }

    function cdpsByOwnerLength(address _owner) external view returns (uint) {
        return cdpsByOwner[_owner].length;
    }

    function systemParameters() external view returns (uint liquidationRatio, uint annualStabilityFee, uint daiAvailable) {
        liquidationRatio = saiTub.mat();
        annualStabilityFee = rpow(saiTub.fee(), 365 days);
        daiAvailable = sub(saiTub.cap(), dai.totalSupply());
    }
    
    function cdpInfo(bytes32 cdpId) external returns (uint borrowedDai, uint outstandingDai, uint suppliedPeth) {
        (, uint ink, uint art, ) = saiTub.cups(cdpId);
        borrowedDai = art;
        suppliedPeth = ink;
        outstandingDai = add(saiTub.rap(cdpId), saiTub.tab(cdpId));
    }
    
    function pethForWeth(uint wethAmount) public view returns (uint) {
        return rdiv(wethAmount, saiTub.per());
    }

    function wethForPeth(uint pethAmount) public view returns (uint) {
        return rmul(pethAmount, saiTub.per());
    }

    function() external payable {
        // For unwrapping WETH
    }

    // SUPPLY AND BORROW
    
    // specify cdpId if you want to use existing CDP, or pass 0 if you need to create a new one
    // for new and active CDPs collateral amount should be > 0.005 PETH
    function supplyEthAndBorrowDai(bytes32 cdpId, uint daiAmount) whenNotPaused isCdpOwner(cdpId) external payable {
        bytes32 id = supplyEth(cdpId);
        borrowDai(id, daiAmount);
    }

    // specify cdpId if you want to use existing CDP, or pass 0 if you need to create a new one 
    function supplyWethAndBorrowDai(bytes32 cdpId, uint wethAmount, uint daiAmount) whenNotPaused isCdpOwner(cdpId) external {
        bytes32 id = supplyWeth(cdpId, wethAmount);
        borrowDai(id, daiAmount);
    }

    // returns id of actual CDP (existing or a new one)
    // for new and active CDPs collateral amount should be > 0.005 PETH
    function supplyEth(bytes32 cdpId) whenNotPaused isCdpOwner(cdpId) public payable returns (bytes32 _cdpId) {
        if (msg.value > 0) {
            weth.deposit.value(msg.value)();
            return _supply(cdpId, msg.value);
        }

        return cdpId;
    }

    // for new and active CDPs collateral amount should be > 0.005 PETH
    // don't forget to approve WETH before supplying
    // returns id of actual CDP (existing or a new one)
    function supplyWeth(bytes32 cdpId, uint wethAmount) whenNotPaused isCdpOwner(cdpId) public returns (bytes32 _cdpId) {
        if (wethAmount > 0) {
            require(weth.transferFrom(msg.sender, address(this), wethAmount));
            return _supply(cdpId, wethAmount);
        }

        return cdpId;
    }

    function borrowDai(bytes32 cdpId, uint daiAmount) whenNotPaused isCdpOwner(cdpId) public {
        if (daiAmount > 0) {
            saiTub.draw(cdpId, daiAmount);

            require(dai.transfer(msg.sender, daiAmount));

            emit DaiBorrowed(msg.sender, cdpId, daiAmount);
        }
    }

    // REPAY AND RETURN

    // don't forget to approve DAI before repaying
    function repayDaiAndReturnEth(bytes32 cdpId, uint daiAmount, uint ethAmount, bool payFeeInDai) whenNotPaused isCdpOwner(cdpId) external {
        repayDai(cdpId, daiAmount, payFeeInDai);
        returnEth(cdpId, ethAmount);
    }

    // don't forget to approve DAI before repaying
    // pass -1 to daiAmount to repay all outstanding debt
    // pass -1 to wethAmount to return all collateral
    function repayDaiAndReturnWeth(bytes32 cdpId, uint daiAmount, uint wethAmount, bool payFeeInDai) whenNotPaused isCdpOwner(cdpId) public {
        repayDai(cdpId, daiAmount, payFeeInDai);
        returnWeth(cdpId, wethAmount);
    }

    // don't forget to approve DAI before repaying
    // pass -1 to daiAmount to repay all outstanding debt
    function repayDai(bytes32 cdpId, uint daiAmount, bool payFeeInDai) whenNotPaused isCdpOwner(cdpId) public {
        if (daiAmount > 0) {
            uint _daiAmount = daiAmount;
            if (_daiAmount == uint(- 1)) {
                // repay all outstanding debt
                _daiAmount = saiTub.tab(cdpId);
            }

            _ensureApproval(dai, address(saiTub));
            _ensureApproval(mkr, address(saiTub));

            uint govFeeAmount = _calcGovernanceFee(cdpId, _daiAmount);
            _handleGovFee(govFeeAmount, payFeeInDai);

            require(dai.transferFrom(msg.sender, address(this), _daiAmount));

            saiTub.wipe(cdpId, _daiAmount);

            emit DaiRepaid(msg.sender, cdpId, _daiAmount);
        }
    }

    function returnEth(bytes32 cdpId, uint ethAmount) whenNotPaused isCdpOwner(cdpId) public {
        if (ethAmount > 0) {
            uint effectiveWethAmount = _return(cdpId, ethAmount);
            weth.withdraw(effectiveWethAmount);
            msg.sender.transfer(effectiveWethAmount);
        }
    }

    function returnWeth(bytes32 cdpId, uint wethAmount) whenNotPaused isCdpOwner(cdpId) public {
        if (wethAmount > 0) {
            uint effectiveWethAmount = _return(cdpId, wethAmount);
            require(weth.transfer(msg.sender, effectiveWethAmount));
        }
    }

    function closeCdp(bytes32 cdpId, bool payFeeInDai) whenNotPaused isCdpOwner(cdpId) external {
        repayDaiAndReturnWeth(cdpId, uint(-1), uint(-1), payFeeInDai);
        _removeCdp(cdpId, msg.sender);
        saiTub.shut(cdpId);
        
        emit CdpClosed(msg.sender, cdpId);
    }

    // TRANSFER AND ADOPT

    // You can migrate your CDP from MakerDaoGateway contract to another owner
    function transferCdp(bytes32 cdpId, address nextOwner) isCdpOwner(cdpId) external {
        address _owner = nextOwner;
        if (_owner == address(0x0)) {
            _owner = msg.sender;
        }
        
        saiTub.give(cdpId, _owner);

        _removeCdp(cdpId, msg.sender);

        emit CdpTransferred(msg.sender, _owner, cdpId);
    }
    
    function ejectCdp(bytes32 cdpId) onlyPauser external {
        address owner = cdpOwner[cdpId];
        saiTub.give(cdpId, owner);

        _removeCdp(cdpId, owner);

        emit CdpEjected(owner, cdpId);
    }

    // If you want to migrate existing CDP to MakerDaoGateway contract,
    // you need to register your cdp first with this function, and then execute `give` operation,
    // transferring CDP to the MakerDaoGateway contract
    function registerCdp(bytes32 cdpId, address owner) whenNotPaused external {
        require(saiTub.lad(cdpId) == msg.sender, "Can't register other's CDP");
        require(cdpOwner[cdpId] == address(0x0), "Can't register CDP twice");

        address _owner = owner;
        if (_owner == address(0x0)) {
            _owner = msg.sender;
        }

        cdpOwner[cdpId] = _owner;
        cdpsByOwner[_owner].push(cdpId);

        emit CdpRegistered(_owner, cdpId);
    }

    // INTERNAL FUNCTIONS

    function _supply(bytes32 cdpId, uint wethAmount) internal returns (bytes32 _cdpId) {
        _cdpId = cdpId;
        if (_cdpId == 0) {
            _cdpId = _createCdp();
        }

        _ensureApproval(weth, address(saiTub));

        uint pethAmount = pethForWeth(wethAmount);

        saiTub.join(pethAmount);

        _ensureApproval(peth, address(saiTub));

        saiTub.lock(_cdpId, pethAmount);
        emit CollateralSupplied(msg.sender, _cdpId, wethAmount, pethAmount);
    }

    function _return(bytes32 cdpId, uint wethAmount) internal returns (uint _wethAmount) {
        uint pethAmount;

        if (wethAmount == uint(- 1)) {
            // return all collateral
            pethAmount = saiTub.ink(cdpId);
        } else {
            pethAmount = pethForWeth(wethAmount);
        }

        saiTub.free(cdpId, pethAmount);

        _ensureApproval(peth, address(saiTub));

        saiTub.exit(pethAmount);

        _wethAmount = wethForPeth(pethAmount);

        emit CollateralReturned(msg.sender, cdpId, _wethAmount, pethAmount);
    }

    function _calcGovernanceFee(bytes32 cdpId, uint daiAmount) internal returns (uint mkrFeeAmount) {
        uint daiFeeAmount = rmul(daiAmount, rdiv(saiTub.rap(cdpId), saiTub.tab(cdpId)));
        (bytes32 val, bool ok) = saiTub.pep().peek();
        require(ok && val != 0, 'Unable to get mkr rate');

        return wdiv(daiFeeAmount, uint(val));
    }

    function _handleGovFee(uint mkrGovAmount, bool payWithDai) internal {
        if (mkrGovAmount > 0) {
            if (payWithDai) {
                uint daiAmount = dex.getPayAmount(dai, mkr, mkrGovAmount);

                _ensureApproval(dai, address(dex));

                require(dai.transferFrom(msg.sender, address(this), daiAmount));
                dex.buyAllAmount(mkr, mkrGovAmount, dai, daiAmount);
            } else {
                require(mkr.transferFrom(msg.sender, address(this), mkrGovAmount));
            }
        }
    }

    function _ensureApproval(IERC20 token, address spender) internal {
        if (token.allowance(address(this), spender) != uint(- 1)) {
            require(token.approve(spender, uint(- 1)));
        }
    }

    function _createCdp() internal returns (bytes32 cdpId) {
        cdpId = saiTub.open();

        cdpOwner[cdpId] = msg.sender;
        cdpsByOwner[msg.sender].push(cdpId);

        emit CdpOpened(msg.sender, cdpId);
    }
    
    function _removeCdp(bytes32 cdpId, address owner) internal {
        (uint i, bool ok) = cdpsByOwner[owner].findElement(cdpId);
        require(ok, "Can't find cdp in owner's list");
        
        cdpsByOwner[owner].removeElement(i);
        delete cdpOwner[cdpId];
    }
}

Contract ABI
[{"constant":false,"inputs":[{"name":"cdpId","type":"bytes32"}],"name":"cdpInfo","outputs":[{"name":"borrowedDai","type":"uint256"},{"name":"outstandingDai","type":"uint256"},{"name":"suppliedPeth","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"pethAmount","type":"uint256"}],"name":"wethForPeth","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"uint256"}],"name":"cdpsByOwner","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"cdpId","type":"bytes32"},{"name":"daiAmount","type":"uint256"},{"name":"ethAmount","type":"uint256"},{"name":"payFeeInDai","type":"bool"}],"name":"repayDaiAndReturnEth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"cdpId","type":"bytes32"},{"name":"nextOwner","type":"address"}],"name":"transferCdp","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"cdpId","type":"bytes32"},{"name":"wethAmount","type":"uint256"},{"name":"daiAmount","type":"uint256"}],"name":"supplyWethAndBorrowDai","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"weth","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"cdpId","type":"bytes32"}],"name":"supplyEth","outputs":[{"name":"_cdpId","type":"bytes32"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"}],"name":"isPauser","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"cdpsByOwnerLength","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"cdpId","type":"bytes32"},{"name":"ethAmount","type":"uint256"}],"name":"returnEth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"cdpId","type":"bytes32"},{"name":"owner","type":"address"}],"name":"registerCdp","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"cdpId","type":"bytes32"},{"name":"daiAmount","type":"uint256"}],"name":"supplyEthAndBorrowDai","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"dex","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renouncePauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"cdpId","type":"bytes32"},{"name":"daiAmount","type":"uint256"}],"name":"borrowDai","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"peth","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"systemParameters","outputs":[{"name":"liquidationRatio","type":"uint256"},{"name":"annualStabilityFee","type":"uint256"},{"name":"daiAvailable","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"mkr","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"account","type":"address"}],"name":"addPauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"cdpId","type":"bytes32"},{"name":"daiAmount","type":"uint256"},{"name":"payFeeInDai","type":"bool"}],"name":"repayDai","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"saiTub","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"cdpOwner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"cdpId","type":"bytes32"},{"name":"wethAmount","type":"uint256"}],"name":"supplyWeth","outputs":[{"name":"_cdpId","type":"bytes32"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"cdpId","type":"bytes32"},{"name":"wethAmount","type":"uint256"}],"name":"returnWeth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"cdpId","type":"bytes32"},{"name":"daiAmount","type":"uint256"},{"name":"wethAmount","type":"uint256"},{"name":"payFeeInDai","type":"bool"}],"name":"repayDaiAndReturnWeth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"cdpId","type":"bytes32"},{"name":"payFeeInDai","type":"bool"}],"name":"closeCdp","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"wethAmount","type":"uint256"}],"name":"pethForWeth","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"cdpId","type":"bytes32"}],"name":"ejectCdp","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"dai","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_saiTub","type":"address"},{"name":"_dex","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"cdpId","type":"bytes32"}],"name":"CdpOpened","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"cdpId","type":"bytes32"}],"name":"CdpClosed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"cdpId","type":"bytes32"},{"indexed":false,"name":"wethAmount","type":"uint256"},{"indexed":false,"name":"pethAmount","type":"uint256"}],"name":"CollateralSupplied","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"cdpId","type":"bytes32"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"DaiBorrowed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"cdpId","type":"bytes32"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"DaiRepaid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"cdpId","type":"bytes32"},{"indexed":false,"name":"wethAmount","type":"uint256"},{"indexed":false,"name":"pethAmount","type":"uint256"}],"name":"CollateralReturned","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"oldOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"},{"indexed":false,"name":"cdpId","type":"bytes32"}],"name":"CdpTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"newOwner","type":"address"},{"indexed":false,"name":"cdpId","type":"bytes32"}],"name":"CdpEjected","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"newOwner","type":"address"},{"indexed":false,"name":"cdpId","type":"bytes32"}],"name":"CdpRegistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"PauserAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"PauserRemoved","type":"event"}]

Contract Creation Code
60806040523480156200001157600080fd5b50604051604080620034d6833981018060405260408110156200003357600080fd5b508051602090910151620000503364010000000062000328810204565b60018054600160a860020a031916610100600160a060020a038581168202929092179283905560028054600160a060020a031916858416179055604080517f7bd2bea700000000000000000000000000000000000000000000000000000000815290519190930490911691637bd2bea7916004808301926020929190829003018186803b158015620000e157600080fd5b505afa158015620000f6573d6000803e3d6000fd5b505050506040513d60208110156200010d57600080fd5b505160038054600160a060020a031916600160a060020a03928316179055600154604080517f0f8a771e000000000000000000000000000000000000000000000000000000008152905161010090920490921691630f8a771e916004808301926020929190829003018186803b1580156200018757600080fd5b505afa1580156200019c573d6000803e3d6000fd5b505050506040513d6020811015620001b357600080fd5b505160048054600160a060020a031916600160a060020a03928316178155600154604080517f9166cba4000000000000000000000000000000000000000000000000000000008152905161010090920490931692639166cba49281810192602092909190829003018186803b1580156200022c57600080fd5b505afa15801562000241573d6000803e3d6000fd5b505050506040513d60208110156200025857600080fd5b505160058054600160a060020a031916600160a060020a03928316179055600154604080517f12d43a510000000000000000000000000000000000000000000000000000000081529051610100909204909216916312d43a51916004808301926020929190829003018186803b158015620002d257600080fd5b505afa158015620002e7573d6000803e3d6000fd5b505050506040513d6020811015620002fe57600080fd5b505160068054600160a060020a031916600160a060020a03909216919091179055506200040d9050565b6200034360008264010000000062002fca6200037a82021704565b604051600160a060020a038216907f6719d08c1888103bea251a4ed56406bd0c3e69723c8a1686e017e7bbe159b6f890600090a250565b600160a060020a03811615156200039057600080fd5b620003a58282640100000000620003d5810204565b15620003b057600080fd5b600160a060020a0316600090815260209190915260409020805460ff19166001179055565b6000600160a060020a0382161515620003ed57600080fd5b50600160a060020a03166000908152602091909152604090205460ff1690565b6130b9806200041d6000396000f3fe6080604052600436106101875763ffffffff60e060020a6000350416630f6afc4381146101895780631023e8f2146101d157806311fdb0471461020d5780631459659e1461024657806318b2b7a01461028457806332d41d4f146102bd5780633f4ba83a146102f35780633fc8cef3146103085780634176df321461033957806346fbf68e146103565780634a84ae331461039d578063531adc1d146103d05780635620742c146104005780635a7063e1146104395780635c975abb1461045c578063692058c2146104715780636ef8d66d146104865780637507df241461049b5780637d211c75146104cb5780637dcbf024146104e05780637e992cb8146104f557806382dc1ec41461050a578063836715551461053d5780638456cb591461057557806389dcd64f1461058a5780638cdf9f661461059f578063936c2fff146105c9578063b9690380146105f9578063bd62c42514610629578063bfbda3fc14610667578063c5f1375114610699578063cba68918146106c3578063f4b9fa75146106ed575b005b34801561019557600080fd5b506101b3600480360360208110156101ac57600080fd5b5035610702565b60408051938452602084019290925282820152519081900360600190f35b3480156101dd57600080fd5b506101fb600480360360208110156101f457600080fd5b50356108e3565b60408051918252519081900360200190f35b34801561021957600080fd5b506101fb6004803603604081101561023057600080fd5b50600160a060020a038135169060200135610970565b34801561025257600080fd5b506101876004803603608081101561026957600080fd5b508035906020810135906040810135906060013515156109a0565b34801561029057600080fd5b50610187600480360360408110156102a757600080fd5b5080359060200135600160a060020a0316610a43565b3480156102c957600080fd5b50610187600480360360608110156102e057600080fd5b5080359060208101359060400135610baa565b3480156102ff57600080fd5b50610187610c49565b34801561031457600080fd5b5061031d610cad565b60408051600160a060020a039092168252519081900360200190f35b6101fb6004803603602081101561034f57600080fd5b5035610cbc565b34801561036257600080fd5b506103896004803603602081101561037957600080fd5b5035600160a060020a0316610dd6565b604080519115158252519081900360200190f35b3480156103a957600080fd5b506101fb600480360360208110156103c057600080fd5b5035600160a060020a0316610de8565b3480156103dc57600080fd5b50610187600480360360408110156103f357600080fd5b5080359060200135610e03565b34801561040c57600080fd5b506101876004803603604081101561042357600080fd5b5080359060200135600160a060020a0316610f52565b6101876004803603604081101561044f57600080fd5b5080359060200135611166565b34801561046857600080fd5b5061038961120a565b34801561047d57600080fd5b5061031d611214565b34801561049257600080fd5b50610187611223565b3480156104a757600080fd5b50610187600480360360408110156104be57600080fd5b508035906020013561122e565b3480156104d757600080fd5b5061031d61141e565b3480156104ec57600080fd5b506101b361142d565b34801561050157600080fd5b5061031d611664565b34801561051657600080fd5b506101876004803603602081101561052d57600080fd5b5035600160a060020a0316611673565b34801561054957600080fd5b506101876004803603606081101561056057600080fd5b50803590602081013590604001351515611693565b34801561058157600080fd5b5061018761196a565b34801561059657600080fd5b5061031d6119cf565b3480156105ab57600080fd5b5061031d600480360360208110156105c257600080fd5b50356119e3565b3480156105d557600080fd5b506101fb600480360360408110156105ec57600080fd5b50803590602001356119fe565b34801561060557600080fd5b506101876004803603604081101561061c57600080fd5b5080359060200135611b41565b34801561063557600080fd5b506101876004803603608081101561064c57600080fd5b50803590602081013590604081013590606001351515611c84565b34801561067357600080fd5b506101876004803603604081101561068a57600080fd5b50803590602001351515611d20565b3480156106a557600080fd5b506101fb600480360360208110156106bc57600080fd5b5035611e6f565b3480156106cf57600080fd5b50610187600480360360208110156106e657600080fd5b5035611ef6565b3480156106f957600080fd5b5061031d611ff1565b60008060008060006001809054906101000a9004600160a060020a0316600160a060020a031663fdac0025876040518263ffffffff1660e060020a0281526004018082815260200191505060806040518083038186803b15801561076557600080fd5b505afa158015610779573d6000803e3d6000fd5b505050506040513d608081101561078f57600080fd5b5060208181015160409283015160015484517f6f78ee0d000000000000000000000000000000000000000000000000000000008152600481018c905294519199509196508695508894506108d893610100909204600160a060020a031692636f78ee0d92602480820193918290030181600087803b15801561081057600080fd5b505af1158015610824573d6000803e3d6000fd5b505050506040513d602081101561083a57600080fd5b5051600154604080517ff7c8d634000000000000000000000000000000000000000000000000000000008152600481018b90529051610100909204600160a060020a03169163f7c8d634916024808201926020929091908290030181600087803b1580156108a757600080fd5b505af11580156108bb573d6000803e3d6000fd5b505050506040513d60208110156108d157600080fd5b5051612000565b935050509193909250565b600061096a826001809054906101000a9004600160a060020a0316600160a060020a0316637ec9c3b86040518163ffffffff1660e060020a02815260040160206040518083038186803b15801561093957600080fd5b505afa15801561094d573d6000803e3d6000fd5b505050506040513d602081101561096357600080fd5b505161205b565b92915050565b60086020528160005260406000208181548110151561098b57fe5b90600052602060002001600091509150505481565b60015460ff16156109b057600080fd5b6000848152600760205260409020548490600160a060020a03163314806109d5575080155b1515610a27576040805160e560020a62461bcd028152602060048201526022602482015260008051602061306e833981519152604482015260f060020a61737302606482015290519081900360840190fd5b610a32858584611693565b610a3c8584610e03565b5050505050565b6000828152600760205260409020548290600160a060020a0316331480610a68575080155b1515610aba576040805160e560020a62461bcd028152602060048201526022602482015260008051602061306e833981519152604482015260f060020a61737302606482015290519081900360840190fd5b81600160a060020a0381161515610ace5750335b600154604080517fbaa8529c00000000000000000000000000000000000000000000000000000000815260048101879052600160a060020a03848116602483015291516101009093049091169163baa8529c9160448082019260009290919082900301818387803b158015610b4257600080fd5b505af1158015610b56573d6000803e3d6000fd5b50505050610b64843361209e565b604080518581529051600160a060020a0383169133917fae4f954cb5f51f7740e11994224de6aa60f423d54cb7b30ea41bae077a2776e59181900360200190a350505050565b60015460ff1615610bba57600080fd5b6000838152600760205260409020548390600160a060020a0316331480610bdf575080155b1515610c31576040805160e560020a62461bcd028152602060048201526022602482015260008051602061306e833981519152604482015260f060020a61737302606482015290519081900360840190fd5b6000610c3d85856119fe565b9050610a3c818461122e565b610c5233610dd6565b1515610c5d57600080fd5b60015460ff161515610c6e57600080fd5b6001805460ff191690556040805133815290517f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa9181900360200190a1565b600354600160a060020a031681565b60015460009060ff1615610ccf57600080fd5b6000828152600760205260409020548290600160a060020a0316331480610cf4575080155b1515610d46576040805160e560020a62461bcd028152602060048201526022602482015260008051602061306e833981519152604482015260f060020a61737302606482015290519081900360840190fd5b6000341115610dcc57600360009054906101000a9004600160a060020a0316600160a060020a031663d0e30db0346040518263ffffffff1660e060020a0281526004016000604051808303818588803b158015610da257600080fd5b505af1158015610db6573d6000803e3d6000fd5b5050505050610dc58334612179565b9150610dd0565b8291505b50919050565b600061096a818363ffffffff61231716565b600160a060020a031660009081526008602052604090205490565b60015460ff1615610e1357600080fd5b6000828152600760205260409020548290600160a060020a0316331480610e38575080155b1515610e8a576040805160e560020a62461bcd028152602060048201526022602482015260008051602061306e833981519152604482015260f060020a61737302606482015290519081900360840190fd5b6000821115610f4d576000610e9f848461234e565b600354604080517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018490529051929350600160a060020a0390911691632e1a7d4d9160248082019260009290919082900301818387803b158015610f0857600080fd5b505af1158015610f1c573d6000803e3d6000fd5b505060405133925083156108fc02915083906000818181858888f19350505050158015610a3c573d6000803e3d6000fd5b505050565b60015460ff1615610f6257600080fd5b600154604080517fde5f551700000000000000000000000000000000000000000000000000000000815260048101859052905133926101009004600160a060020a03169163de5f5517916024808301926020929190829003018186803b158015610fcb57600080fd5b505afa158015610fdf573d6000803e3d6000fd5b505050506040513d6020811015610ff557600080fd5b5051600160a060020a031614611055576040805160e560020a62461bcd02815260206004820152601a60248201527f43616e2774207265676973746572206f74686572277320434450000000000000604482015290519081900360640190fd5b600082815260076020526040902054600160a060020a0316156110c2576040805160e560020a62461bcd02815260206004820152601860248201527f43616e2774207265676973746572204344502074776963650000000000000000604482015290519081900360640190fd5b80600160a060020a03811615156110d65750335b6000838152600760209081526040808320805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03861690811790915580845260088352818420805460018101825590855293839020909301869055805186815290517fb06e86a0c79c2fd37762dfe403753d23892f32dcfa5437d9225705e0c49bab69929181900390910190a2505050565b60015460ff161561117657600080fd5b6000828152600760205260409020548290600160a060020a031633148061119b575080155b15156111ed576040805160e560020a62461bcd028152602060048201526022602482015260008051602061306e833981519152604482015260f060020a61737302606482015290519081900360840190fd5b60006111f884610cbc565b9050611204818461122e565b50505050565b60015460ff165b90565b600254600160a060020a031681565b61122c3361255d565b565b60015460ff161561123e57600080fd5b6000828152600760205260409020548290600160a060020a0316331480611263575080155b15156112b5576040805160e560020a62461bcd028152602060048201526022602482015260008051602061306e833981519152604482015260f060020a61737302606482015290519081900360840190fd5b6000821115610f4d576001809054906101000a9004600160a060020a0316600160a060020a031663440f19ba84846040518363ffffffff1660e060020a0281526004018083815260200182815260200192505050600060405180830381600087803b15801561132357600080fd5b505af1158015611337573d6000803e3d6000fd5b5050600554604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152336004820152602481018790529051600160a060020a03909216935063a9059cbb92506044808201926020929091908290030181600087803b1580156113a857600080fd5b505af11580156113bc573d6000803e3d6000fd5b505050506040513d60208110156113d257600080fd5b505115156113df57600080fd5b6040805184815260208101849052815133927f3412d0645ecdd0b97bd45dce6ca0514a592225911eefbb485b777a2c143a56ef928290030190a2505050565b600454600160a060020a031681565b60008060006001809054906101000a9004600160a060020a0316600160a060020a031663ab0783da6040518163ffffffff1660e060020a02815260040160206040518083038186803b15801561148257600080fd5b505afa158015611496573d6000803e3d6000fd5b505050506040513d60208110156114ac57600080fd5b5051600154604080517fddca3f43000000000000000000000000000000000000000000000000000000008152905192955061154d92610100909204600160a060020a03169163ddca3f4391600480820192602092909190829003018186803b15801561151757600080fd5b505afa15801561152b573d6000803e3d6000fd5b505050506040513d602081101561154157600080fd5b50516301e133806125a5565b915061165d6001809054906101000a9004600160a060020a0316600160a060020a031663355274ea6040518163ffffffff1660e060020a02815260040160206040518083038186803b1580156115a257600080fd5b505afa1580156115b6573d6000803e3d6000fd5b505050506040513d60208110156115cc57600080fd5b5051600554604080517f18160ddd0000000000000000000000000000000000000000000000000000000081529051600160a060020a03909216916318160ddd91600480820192602092909190829003018186803b15801561162c57600080fd5b505afa158015611640573d6000803e3d6000fd5b505050506040513d602081101561165657600080fd5b5051612601565b9050909192565b600654600160a060020a031681565b61167c33610dd6565b151561168757600080fd5b6116908161265c565b50565b60015460ff16156116a357600080fd5b6000838152600760205260409020548390600160a060020a03163314806116c8575080155b151561171a576040805160e560020a62461bcd028152602060048201526022602482015260008051602061306e833981519152604482015260f060020a61737302606482015290519081900360840190fd5b600083111561120457826000198114156117ba576001809054906101000a9004600160a060020a0316600160a060020a031663f7c8d634866040518263ffffffff1660e060020a02815260040180828152602001915050602060405180830381600087803b15801561178b57600080fd5b505af115801561179f573d6000803e3d6000fd5b505050506040513d60208110156117b557600080fd5b505190505b6005546001546117db91600160a060020a03908116916101009004166126a4565b6006546001546117fc91600160a060020a03908116916101009004166126a4565b600061180886836127e8565b90506118148185612a86565b6005546040805160e060020a6323b872dd028152336004820152306024820152604481018590529051600160a060020a03909216916323b872dd916064808201926020929091908290030181600087803b15801561187157600080fd5b505af1158015611885573d6000803e3d6000fd5b505050506040513d602081101561189b57600080fd5b505115156118a857600080fd5b6001809054906101000a9004600160a060020a0316600160a060020a03166373b3810187846040518363ffffffff1660e060020a0281526004018083815260200182815260200192505050600060405180830381600087803b15801561190d57600080fd5b505af1158015611921573d6000803e3d6000fd5b5050604080518981526020810186905281513394507fbe5581faf5bc8d0ab1f9d5855e33c6b04cc396e9d87624bc2900e32b853dde9a93509081900390910190a2505050505050565b61197333610dd6565b151561197e57600080fd5b60015460ff161561198e57600080fd5b6001805460ff1916811790556040805133815290517f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2589181900360200190a1565b6001546101009004600160a060020a031681565b600760205260009081526040902054600160a060020a031681565b60015460009060ff1615611a1157600080fd5b6000838152600760205260409020548390600160a060020a0316331480611a36575080155b1515611a88576040805160e560020a62461bcd028152602060048201526022602482015260008051602061306e833981519152604482015260f060020a61737302606482015290519081900360840190fd5b6000831115611b36576003546040805160e060020a6323b872dd028152336004820152306024820152604481018690529051600160a060020a03909216916323b872dd916064808201926020929091908290030181600087803b158015611aee57600080fd5b505af1158015611b02573d6000803e3d6000fd5b505050506040513d6020811015611b1857600080fd5b50511515611b2557600080fd5b611b2f8484612179565b9150611b3a565b8391505b5092915050565b60015460ff1615611b5157600080fd5b6000828152600760205260409020548290600160a060020a0316331480611b76575080155b1515611bc8576040805160e560020a62461bcd028152602060048201526022602482015260008051602061306e833981519152604482015260f060020a61737302606482015290519081900360840190fd5b6000821115610f4d576000611bdd848461234e565b600354604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152336004820152602481018490529051929350600160a060020a039091169163a9059cbb916044808201926020929091908290030181600087803b158015611c4d57600080fd5b505af1158015611c61573d6000803e3d6000fd5b505050506040513d6020811015611c7757600080fd5b5051151561120457600080fd5b60015460ff1615611c9457600080fd5b6000848152600760205260409020548490600160a060020a0316331480611cb9575080155b1515611d0b576040805160e560020a62461bcd028152602060048201526022602482015260008051602061306e833981519152604482015260f060020a61737302606482015290519081900360840190fd5b611d16858584611693565b610a3c8584611b41565b60015460ff1615611d3057600080fd5b6000828152600760205260409020548290600160a060020a0316331480611d55575080155b1515611da7576040805160e560020a62461bcd028152602060048201526022602482015260008051602061306e833981519152604482015260f060020a61737302606482015290519081900360840190fd5b611db5836000198085611c84565b611dbf833361209e565b6001809054906101000a9004600160a060020a0316600160a060020a031663b84d2106846040518263ffffffff1660e060020a02815260040180828152602001915050600060405180830381600087803b158015611e1c57600080fd5b505af1158015611e30573d6000803e3d6000fd5b50506040805186815290513393507f7f701babb88447c2bd74b7ac66eabd86e9641dbcac3dd3072bd0a4b1659a3fd792509081900360200190a2505050565b600061096a826001809054906101000a9004600160a060020a0316600160a060020a0316637ec9c3b86040518163ffffffff1660e060020a02815260040160206040518083038186803b158015611ec557600080fd5b505afa158015611ed9573d6000803e3d6000fd5b505050506040513d6020811015611eef57600080fd5b5051612d05565b611eff33610dd6565b1515611f0a57600080fd5b6000818152600760205260408082205460015482517fbaa8529c00000000000000000000000000000000000000000000000000000000815260048101869052600160a060020a0392831660248201819052935193946101009092049092169263baa8529c92604480820193929182900301818387803b158015611f8c57600080fd5b505af1158015611fa0573d6000803e3d6000fd5b50505050611fae828261209e565b604080518381529051600160a060020a038316917f70bfb225c90eca83db93eea7329dca2abd406215b7c9ac0038d7d47644c5a950919081900360200190a25050565b600554600160a060020a031681565b8082018281101561096a576040805160e560020a62461bcd02815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b60006b033b2e3c9fd0803ce800000061208d6120778585612d29565b60026b033b2e3c9fd0803ce80000005b04612000565b81151561209657fe5b049392505050565b600160a060020a038116600090815260086020526040812081906120c8908563ffffffff612d9c16565b91509150801515612123576040805160e560020a62461bcd02815260206004820152601e60248201527f43616e27742066696e642063647020696e206f776e65722773206c6973740000604482015290519081900360640190fd5b600160a060020a038316600090815260086020526040902061214b908363ffffffff612ded16565b5050506000908152600760205260409020805473ffffffffffffffffffffffffffffffffffffffff19169055565b8180151561218c57612189612e75565b90505b6003546001546121ad91600160a060020a03908116916101009004166126a4565b60006121b883611e6f565b90506001809054906101000a9004600160a060020a0316600160a060020a031663049878f3826040518263ffffffff1660e060020a02815260040180828152602001915050600060405180830381600087803b15801561221757600080fd5b505af115801561222b573d6000803e3d6000fd5b50506004546001546122509350600160a060020a0391821692506101009004166126a4565b6001809054906101000a9004600160a060020a0316600160a060020a031663b3b77a5183836040518363ffffffff1660e060020a0281526004018083815260200182815260200192505050600060405180830381600087803b1580156122b557600080fd5b505af11580156122c9573d6000803e3d6000fd5b5050604080518581526020810187905280820185905290513393507fc3fc5150c1cb9274062f1f7a4836ce287eb592f32695e229820ef45dc904e0e492509081900360600190a25092915050565b6000600160a060020a038216151561232e57600080fd5b50600160a060020a03166000908152602091909152604090205460ff1690565b6000806000198314156123e9576001809054906101000a9004600160a060020a0316600160a060020a0316631f3634ed856040518263ffffffff1660e060020a0281526004018082815260200191505060206040518083038186803b1580156123b657600080fd5b505afa1580156123ca573d6000803e3d6000fd5b505050506040513d60208110156123e057600080fd5b505190506123f5565b6123f283611e6f565b90505b6001809054906101000a9004600160a060020a0316600160a060020a031663a5cd184e85836040518363ffffffff1660e060020a0281526004018083815260200182815260200192505050600060405180830381600087803b15801561245a57600080fd5b505af115801561246e573d6000803e3d6000fd5b50506004546001546124939350600160a060020a0391821692506101009004166126a4565b6001809054906101000a9004600160a060020a0316600160a060020a0316637f8661a1826040518263ffffffff1660e060020a02815260040180828152602001915050600060405180830381600087803b1580156124f057600080fd5b505af1158015612504573d6000803e3d6000fd5b50505050612511816108e3565b6040805186815260208101839052808201849052905191935033917f4a5290a74b6bc6c685525bc436bf2cba7d63ebce6343b2893b7fe5e67b4a16659181900360600190a25092915050565b61256e60008263ffffffff612f7e16565b604051600160a060020a038216907fcd265ebaf09df2871cc7bd4133404a235ba12eff2041bb89d9c714a2621c7c7e90600090a250565b60006002820615156125c3576b033b2e3c9fd0803ce80000006125c5565b825b90506002820491505b811561096a576125de838461205b565b925060028206156125f6576125f3818461205b565b90505b6002820491506125ce565b8082038281111561096a576040805160e560020a62461bcd02815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b61266d60008263ffffffff612fca16565b604051600160a060020a038216907f6719d08c1888103bea251a4ed56406bd0c3e69723c8a1686e017e7bbe159b6f890600090a250565b604080517fdd62ed3e000000000000000000000000000000000000000000000000000000008152306004820152600160a060020a03838116602483015291516000199285169163dd62ed3e916044808301926020929190829003018186803b15801561270f57600080fd5b505afa158015612723573d6000803e3d6000fd5b505050506040513d602081101561273957600080fd5b5051146127e457604080517f095ea7b3000000000000000000000000000000000000000000000000000000008152600160a060020a038381166004830152600019602483015291519184169163095ea7b3916044808201926020929091908290030181600087803b1580156127ad57600080fd5b505af11580156127c1573d6000803e3d6000fd5b505050506040513d60208110156127d757600080fd5b505115156127e457600080fd5b5050565b6000806128ff836128fa6001809054906101000a9004600160a060020a0316600160a060020a0316636f78ee0d886040518263ffffffff1660e060020a02815260040180828152602001915050602060405180830381600087803b15801561284f57600080fd5b505af1158015612863573d6000803e3d6000fd5b505050506040513d602081101561287957600080fd5b5051600154604080517ff7c8d634000000000000000000000000000000000000000000000000000000008152600481018b90529051610100909204600160a060020a03169163f7c8d634916024808201926020929091908290030181600087803b1580156128e657600080fd5b505af1158015611ed9573d6000803e3d6000fd5b61205b565b90506000806001809054906101000a9004600160a060020a0316600160a060020a031663ace237f56040518163ffffffff1660e060020a02815260040160206040518083038186803b15801561295457600080fd5b505afa158015612968573d6000803e3d6000fd5b505050506040513d602081101561297e57600080fd5b5051604080517f59e02dd70000000000000000000000000000000000000000000000000000000081528151600160a060020a03909316926359e02dd792600480840193919291829003018186803b1580156129d857600080fd5b505afa1580156129ec573d6000803e3d6000fd5b505050506040513d6040811015612a0257600080fd5b5080516020909101519092509050808015612a1c57508115155b1515612a72576040805160e560020a62461bcd02815260206004820152601660248201527f556e61626c6520746f20676574206d6b72207261746500000000000000000000604482015290519081900360640190fd5b612a7c8383613018565b9695505050505050565b60008211156127e4578015612ca857600254600554600654604080517fff1fd974000000000000000000000000000000000000000000000000000000008152600160a060020a03938416600482015291831660248301526044820186905251600093929092169163ff1fd97491606480820192602092909190829003018186803b158015612b1357600080fd5b505afa158015612b27573d6000803e3d6000fd5b505050506040513d6020811015612b3d57600080fd5b5051600554600254919250612b5e91600160a060020a0391821691166126a4565b6005546040805160e060020a6323b872dd028152336004820152306024820152604481018490529051600160a060020a03909216916323b872dd916064808201926020929091908290030181600087803b158015612bbb57600080fd5b505af1158015612bcf573d6000803e3d6000fd5b505050506040513d6020811015612be557600080fd5b50511515612bf257600080fd5b600254600654600554604080517f8185402b000000000000000000000000000000000000000000000000000000008152600160a060020a03938416600482015260248101889052918316604483015260648201859052519190921691638185402b9160848083019260209291908290030181600087803b158015612c7557600080fd5b505af1158015612c89573d6000803e3d6000fd5b505050506040513d6020811015612c9f57600080fd5b506127e4915050565b6006546040805160e060020a6323b872dd028152336004820152306024820152604481018590529051600160a060020a03909216916323b872dd916064808201926020929091908290030181600087803b1580156127ad57600080fd5b60008161208d612d21856b033b2e3c9fd0803ce8000000612d29565b600285612087565b6000811580612d46575050808202828282811515612d4357fe5b04145b151561096a576040805160e560020a62461bcd02815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b600080805b8454811015612ddd57838582815481101515612db957fe5b90600052602060002001541415612dd557915060019050612de6565b600101612da1565b50600091508190505b9250929050565b81548110612dfa576127e4565b805b825460001901811015612e47578281600101815481101515612e1a57fe5b90600052602060002001548382815481101515612e3357fe5b600091825260209091200155600101612dfc565b50815482906000198101908110612e5a57fe5b60009182526020822001558154610f4d836000198301613030565b60006001809054906101000a9004600160a060020a0316600160a060020a031663fcfff16f6040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015612ec957600080fd5b505af1158015612edd573d6000803e3d6000fd5b505050506040513d6020811015612ef357600080fd5b50516000818152600760209081526040808320805473ffffffffffffffffffffffffffffffffffffffff191633908117909155808452600883528184208054600181018255908552938390209093018490558051848152905193945091927f8adf09526ccd2c8e7615e9260445cad955b0942d9691aeb5318de0b94cf386789281900390910190a290565b600160a060020a0381161515612f9357600080fd5b612f9d8282612317565b1515612fa857600080fd5b600160a060020a0316600090815260209190915260409020805460ff19169055565b600160a060020a0381161515612fdf57600080fd5b612fe98282612317565b15612ff357600080fd5b600160a060020a0316600090815260209190915260409020805460ff19166001179055565b60008161208d612d2185670de0b6b3a7640000612d29565b815481835581811115610f4d57600083815260209020610f4d91810190830161121191905b808211156130695760008155600101613055565b509056fe4344502062656c6f6e677320746f206120646966666572656e74206164647265a165627a7a72305820d6689684f135480aa439e92377bb5050b848faefd97f2172684d17d3e93b938e0029000000000000000000000000448a5065aebb8e423f0896e6c5d525c040f59af3000000000000000000000000b7ac09c2c0217b07d7c103029b4918a2c401eecb


   Swarm Source:
bzzr://d6689684f135480aa439e92377bb5050b848faefd97f2172684d17d3e93b938e
Block Age transaction Difficulty GasUsed Reward
Block Age Uncle Number Difficulty GasUsed Reward
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.