Contract Overview
Balance: 0 Ether
Ether Value: $0
Transactions: 6 txns
Misc:
Address Watch: Add To Watch List
Contract Creator: 0x4cb3fd420555a09ba98845f0b816e45cfb230983at txn 0x5bef6a5428cd62a27eb46b8954169611dfcce58a26203bae3e7490ddd9c453aa
Token Balance:
 Latest 6 txns

TxHash Age From To Value [TxFee]
0xb17e416bb280e3ef57570115a07f07333cfc163bd3958007e03ba3b773745d827 days 1 hr ago0xb8dc24569eed78375c71808a865a8a013bd2cb7c  IN   0x3e7aaeec48fc9197ccf207f1852918c40925a0ff150 Ether0.002435598
0x0c321b720f4e64c4f495e0c3a6beb272c12da3f4059bef4087a2b867a7e211ba15 days 10 hrs ago0x137eec70e77acb387e2bbec996c6358986af6923  IN   0x3e7aaeec48fc9197ccf207f1852918c40925a0ff0.1 Ether0.00162288
0xba57ec271af7c0ae22673bcfeaa69eb321a8dedd0dcb8a13f6ad6ded8066c38716 days 16 mins ago0xddc1b51b67dabd408b224d0f7dfcc93ec4b06265  IN   0x3e7aaeec48fc9197ccf207f1852918c40925a0ff0.03 Ether0.0026712576
0x4922d763a16ecb611078eae442b5ebcbd91a12d21edec360b7a198ff2ae04c0016 days 51 mins ago0xb8dc24569eed78375c71808a865a8a013bd2cb7c  IN   0x3e7aaeec48fc9197ccf207f1852918c40925a0ff1 Ether0.00406625
0xe71f38aa860eefd367958ea04b5e4e61e97200f94e452e015766cc0571fcabef16 days 1 hr ago0x4cb3fd420555a09ba98845f0b816e45cfb230983  IN   0x3e7aaeec48fc9197ccf207f1852918c40925a0ff0.04 Ether0.00392283
0x5bef6a5428cd62a27eb46b8954169611dfcce58a26203bae3e7490ddd9c453aa16 days 1 hr ago0x4cb3fd420555a09ba98845f0b816e45cfb230983  IN    Contract Creation0 Ether0.007749657
[ Download CSV Export  ] 
 Internal Transactions as a result of Contract Execution
 Latest 9 Internal Transactions

ParentTxHash Block Age From To Value
0xb17e416bb280e3ef57570115a07f07333cfc163bd3958007e03ba3b773745d8268352697 days 1 hr ago0x3e7aaeec48fc9197ccf207f1852918c40925a0ff0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2150 Ether
0x0c321b720f4e64c4f495e0c3a6beb272c12da3f4059bef4087a2b867a7e211ba678457815 days 10 hrs ago0x3e7aaeec48fc9197ccf207f1852918c40925a0ff0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc20.1 Ether
0xb7bfbc84a7f7524cf42a8cba01e2c6be5de4b37c1d84162fe39993b408ab24fa678133915 days 23 hrs ago0x3e7aaeec48fc9197ccf207f1852918c40925a0ff0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc240,000 Ether
0xb7bfbc84a7f7524cf42a8cba01e2c6be5de4b37c1d84162fe39993b408ab24fa678133915 days 23 hrs ago0xcafe1a77e84698c83ca8931f54a755176ef75f2c0x3e7aaeec48fc9197ccf207f1852918c40925a0ff40,000 Ether
0xd1ddce20c3aebdaa5eff24e0ae42689fcfe843581089f5490c5ac3f60200c930678132115 days 23 hrs ago0x3e7aaeec48fc9197ccf207f1852918c40925a0ff0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc20.03 Ether
0xd1ddce20c3aebdaa5eff24e0ae42689fcfe843581089f5490c5ac3f60200c930678132115 days 23 hrs ago0xcafe1a77e84698c83ca8931f54a755176ef75f2c0x3e7aaeec48fc9197ccf207f1852918c40925a0ff0.03 Ether
0xba57ec271af7c0ae22673bcfeaa69eb321a8dedd0dcb8a13f6ad6ded8066c387678122816 days 16 mins ago0x3e7aaeec48fc9197ccf207f1852918c40925a0ff0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc20.03 Ether
0x4922d763a16ecb611078eae442b5ebcbd91a12d21edec360b7a198ff2ae04c00678109516 days 51 mins ago0x3e7aaeec48fc9197ccf207f1852918c40925a0ff0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc21 Ether
0xe71f38aa860eefd367958ea04b5e4e61e97200f94e452e015766cc0571fcabef678098016 days 1 hr ago0x3e7aaeec48fc9197ccf207f1852918c40925a0ff0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc20.04 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: DaiMaker
Compiler Text: v0.4.18+commit.9cf6e910
Optimization Enabled: Yes
Runs (Optimiser):  10000



  Contract Source Code   Find Similiar Contracts

// File: contracts/v-DaiMaker.sol
/*

Read code from https://github.com/onbjerg/dai.how

*/
interface IMaker {
    function sai() public view returns (ERC20);
    function skr() public view returns (ERC20);
    function gem() public view returns (ERC20);

    function open() public returns (bytes32 cup);
    function give(bytes32 cup, address guy) public;

    function gap() public view returns (uint);
    function per() public view returns (uint);

    function ask(uint wad) public view returns (uint);
    function bid(uint wad) public view returns (uint);

    function join(uint wad) public;
    function lock(bytes32 cup, uint wad) public;
    function free(bytes32 cup, uint wad) public;
    function draw(bytes32 cup, uint wad) public;
    function cage(uint fit_, uint jam) public;
}

interface ERC20 {
    function totalSupply() public view returns (uint256);
    function balanceOf(address who) public view returns (uint256);
    function transfer(address to, uint256 value) public returns (bool);
    event Transfer(address indexed from, address indexed to, uint256 value);
    function allowance(address owner, address spender) public view returns (uint256);
    function transferFrom(address from, address to, uint256 value) public returns (bool);
    function approve(address spender, uint256 value) public returns (bool);
    event Approval(address indexed owner, address indexed spender, uint256 value);
}

interface IWETH {
    function deposit() public payable;
    function withdraw(uint wad) public;
}

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) public pure returns (uint z) {
        z = add(mul(x, WAD), y / 2) / y;
    }
    function rdiv(uint x, uint y) public 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 DaiMaker is DSMath {
    IMaker public maker;
    ERC20 public weth;
    ERC20 public peth;
    ERC20 public dai;

    event MakeDai(address indexed daiOwner, address indexed cdpOwner, uint256 ethAmount, uint256 daiAmount, uint256 pethAmount);

    function DaiMaker(IMaker _maker) {
        maker = _maker;
        weth = maker.gem();
        peth = maker.skr();
        dai = maker.sai();
    }

    function makeDai(uint256 daiAmount, address cdpOwner, address daiOwner) payable public returns (bytes32 cdpId) {
        IWETH(weth).deposit.value(msg.value)();      // wrap eth in weth token
        weth.approve(maker, msg.value);              // allow maker to pull weth

        // calculate how much peth we need to enter with
        uint256 inverseAsk = rdiv(msg.value, wmul(maker.gap(), maker.per())) - 1;

        maker.join(inverseAsk);                      // convert weth to peth
        uint256 pethAmount = peth.balanceOf(this);

        peth.approve(maker, pethAmount);             // allow maker to pull peth

        cdpId = maker.open();                        // create cdp in maker
        maker.lock(cdpId, pethAmount);               // lock peth into cdp
        maker.draw(cdpId, daiAmount);                // create dai from cdp

        dai.transfer(daiOwner, daiAmount);           // transfer dai to owner
        maker.give(cdpId, cdpOwner);                 // transfer cdp to owner

        MakeDai(daiOwner, cdpOwner, msg.value, daiAmount, pethAmount);
    }
}

    Contract ABI  
[{"constant":true,"inputs":[{"name":"x","type":"uint256"},{"name":"y","type":"uint256"}],"name":"rdiv","outputs":[{"name":"z","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"weth","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"maker","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"daiAmount","type":"uint256"},{"name":"cdpOwner","type":"address"},{"name":"daiOwner","type":"address"}],"name":"makeDai","outputs":[{"name":"cdpId","type":"bytes32"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[{"name":"x","type":"uint256"},{"name":"y","type":"uint256"}],"name":"wdiv","outputs":[{"name":"z","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"peth","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"dai","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_maker","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"daiOwner","type":"address"},{"indexed":true,"name":"cdpOwner","type":"address"},{"indexed":false,"name":"ethAmount","type":"uint256"},{"indexed":false,"name":"daiAmount","type":"uint256"},{"indexed":false,"name":"pethAmount","type":"uint256"}],"name":"MakeDai","type":"event"}]

  Contract Creation Code Switch To Opcodes View
6060604052341561000f57600080fd5b604051602080610c7f8339810160405280805160008054600160a060020a031916600160a060020a0383811691909117808355929450919091169150637bd2bea790604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561009f57600080fd5b6102c65a03f115156100b057600080fd5b505050604051805160018054600160a060020a031916600160a060020a03928316179055600080549091169150630f8a771e90604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561013157600080fd5b6102c65a03f1151561014257600080fd5b505050604051805160028054600160a060020a031916600160a060020a03928316179055600080549091169150639166cba490604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15156101c357600080fd5b6102c65a03f115156101d457600080fd5b505050604051805160038054600160a060020a03909216600160a060020a03199092169190911790555050610a718061020e6000396000f3006060604052600436106100825763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630e2286d381146100875780633fc8cef3146100b257806350655d8c146100ee5780635e5d926c146101015780635fde731c1461012b5780637d211c7514610144578063f4b9fa7514610157575b600080fd5b341561009257600080fd5b6100a060043560243561016a565b60405190815260200160405180910390f35b34156100bd57600080fd5b6100c56101a1565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b34156100f957600080fd5b6100c56101bd565b6100a060043573ffffffffffffffffffffffffffffffffffffffff602435811690604435166101d9565b341561013657600080fd5b6100a060043560243561098f565b341561014f57600080fd5b6100c56109a7565b341561016257600080fd5b6100c56109c3565b600081610190610186856b033b2e3c9fd0803ce80000006109df565b6002855b04610a0d565b81151561019957fe5b049392505050565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b6001546000908190819073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004016000604051808303818588803b151561024557600080fd5b6125ee5a03f1151561025657600080fd5b50506001546000805473ffffffffffffffffffffffffffffffffffffffff928316945063095ea7b39350909116903490604051602001526040517c010000000000000000000000000000000000000000000000000000000063ffffffff851602815273ffffffffffffffffffffffffffffffffffffffff90921660048301526024820152604401602060405180830381600087803b15156102f657600080fd5b6102c65a03f1151561030757600080fd5b505050604051805150506000805460019161043f91349161043a9173ffffffffffffffffffffffffffffffffffffffff1690636c32c0a690604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561038d57600080fd5b6102c65a03f1151561039e57600080fd5b50505060405180516000805491925073ffffffffffffffffffffffffffffffffffffffff90911690637ec9c3b890604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561041a57600080fd5b6102c65a03f1151561042b57600080fd5b50505060405180519050610a1d565b61016a565b600054919003925073ffffffffffffffffffffffffffffffffffffffff1663049878f3836040517c010000000000000000000000000000000000000000000000000000000063ffffffff84160281526004810191909152602401600060405180830381600087803b15156104b257600080fd5b6102c65a03f115156104c357600080fd5b505060025473ffffffffffffffffffffffffffffffffffffffff1690506370a08231306000604051602001526040517c010000000000000000000000000000000000000000000000000000000063ffffffff841602815273ffffffffffffffffffffffffffffffffffffffff9091166004820152602401602060405180830381600087803b151561055357600080fd5b6102c65a03f1151561056457600080fd5b50505060405180516002546000805492945073ffffffffffffffffffffffffffffffffffffffff918216935063095ea7b392909116908490604051602001526040517c010000000000000000000000000000000000000000000000000000000063ffffffff851602815273ffffffffffffffffffffffffffffffffffffffff90921660048301526024820152604401602060405180830381600087803b151561060c57600080fd5b6102c65a03f1151561061d57600080fd5b505050604051805150506000805473ffffffffffffffffffffffffffffffffffffffff169063fcfff16f90604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561069657600080fd5b6102c65a03f115156106a757600080fd5b505050604051805160005490945073ffffffffffffffffffffffffffffffffffffffff16905063b3b77a5184836040517c010000000000000000000000000000000000000000000000000000000063ffffffff851602815260048101929092526024820152604401600060405180830381600087803b151561072857600080fd5b6102c65a03f1151561073957600080fd5b505060005473ffffffffffffffffffffffffffffffffffffffff16905063440f19ba84886040517c010000000000000000000000000000000000000000000000000000000063ffffffff851602815260048101929092526024820152604401600060405180830381600087803b15156107b157600080fd5b6102c65a03f115156107c257600080fd5b505060035473ffffffffffffffffffffffffffffffffffffffff16905063a9059cbb85886000604051602001526040517c010000000000000000000000000000000000000000000000000000000063ffffffff851602815273ffffffffffffffffffffffffffffffffffffffff90921660048301526024820152604401602060405180830381600087803b151561085857600080fd5b6102c65a03f1151561086957600080fd5b5050506040518051505060005473ffffffffffffffffffffffffffffffffffffffff1663baa8529c84876040517c010000000000000000000000000000000000000000000000000000000063ffffffff8516028152600481019290925273ffffffffffffffffffffffffffffffffffffffff166024820152604401600060405180830381600087803b15156108fd57600080fd5b6102c65a03f1151561090e57600080fd5b5050508473ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fee07a22c3e3170ab0959dac3769da9b40b491ef370dbe9c8192fe7f3cc07487734898560405180848152602001838152602001828152602001935050505060405180910390a350509392505050565b60008161019061018685670de0b6b3a76400006109df565b60025473ffffffffffffffffffffffffffffffffffffffff1681565b60035473ffffffffffffffffffffffffffffffffffffffff1681565b60008115806109fc5750508082028282828115156109f957fe5b04145b1515610a0757600080fd5b92915050565b80820182811015610a0757600080fd5b6000670de0b6b3a7640000610190610a3585856109df565b6002670de0b6b3a764000061018a5600a165627a7a72305820f8d2a7a6e92dd73ef7a35e28266d77a345affff9c4f744464ae5a25c733587b10029000000000000000000000000448a5065aebb8e423f0896e6c5d525c040f59af3

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

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000448a5065aebb8e423f0896e6c5d525c040f59af3


   Swarm Source:
bzzr://f8d2a7a6e92dd73ef7a35e28266d77a345affff9c4f744464ae5a25c733587b1

 

View All
Block Age transaction Difficulty GasUsed Reward
View All
Block Age UncleNumber Difficulty GasUsed Reward
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.