Contract 0xdcd22750a182a7a055d069c9f3295f8f3290d6d2

Contract Overview

Balance:
0 Ether

Latest 25 internal transaction, Click here to view more Internal Transactions as a result of Contract Execution

Parent TxHash Block Age From To Value
0x056fe0291bc1313b470f11658a748c6b674b803c68cbb08e66b3887e284483981031738840 days 14 mins ago0xdcd22750a182a7a055d069c9f3295f8f3290d6d20xa944bd4b25c9f186a846fd5668941aa3d3b8425f0 Ether
0x056fe0291bc1313b470f11658a748c6b674b803c68cbb08e66b3887e284483981031738840 days 14 mins ago0x4183931cce346feece44eae2cf14d84c3347d7790xdcd22750a182a7a055d069c9f3295f8f3290d6d20 Ether
0x37d564cc74a6df27cf3ca2c4e147932596010b4c364ea55aef675c378367797c1031738740 days 15 mins ago0xdcd22750a182a7a055d069c9f3295f8f3290d6d20xa944bd4b25c9f186a846fd5668941aa3d3b8425f0 Ether
0x37d564cc74a6df27cf3ca2c4e147932596010b4c364ea55aef675c378367797c1031738740 days 15 mins ago0x4183931cce346feece44eae2cf14d84c3347d7790xdcd22750a182a7a055d069c9f3295f8f3290d6d20 Ether
0x37d564cc74a6df27cf3ca2c4e147932596010b4c364ea55aef675c378367797c1031738740 days 15 mins ago0xdcd22750a182a7a055d069c9f3295f8f3290d6d20xa944bd4b25c9f186a846fd5668941aa3d3b8425f0 Ether
0x37d564cc74a6df27cf3ca2c4e147932596010b4c364ea55aef675c378367797c1031738740 days 15 mins ago0x4183931cce346feece44eae2cf14d84c3347d7790xdcd22750a182a7a055d069c9f3295f8f3290d6d20 Ether
0xfdd4ed193f90bdb64a23f35aa7d539017bf4a3e2dc781aca3ef1bd41715ffdec1031738040 days 16 mins ago0xdcd22750a182a7a055d069c9f3295f8f3290d6d20xa944bd4b25c9f186a846fd5668941aa3d3b8425f0 Ether
0xfdd4ed193f90bdb64a23f35aa7d539017bf4a3e2dc781aca3ef1bd41715ffdec1031738040 days 16 mins ago0x4183931cce346feece44eae2cf14d84c3347d7790xdcd22750a182a7a055d069c9f3295f8f3290d6d20 Ether
0x2d72f85b0b810a96696526d517c71ce2aeacb4a3b7477dffc93a6ac63d9d4c011031720840 days 43 mins ago0xdcd22750a182a7a055d069c9f3295f8f3290d6d20xa944bd4b25c9f186a846fd5668941aa3d3b8425f0 Ether
0x2d72f85b0b810a96696526d517c71ce2aeacb4a3b7477dffc93a6ac63d9d4c011031720840 days 43 mins ago0x4183931cce346feece44eae2cf14d84c3347d7790xdcd22750a182a7a055d069c9f3295f8f3290d6d20 Ether
0x38f5e7b290c865350b3979b2656f85bea2f58cce8bd77f613735c36486bdf98e1031688740 days 1 hr ago0xdcd22750a182a7a055d069c9f3295f8f3290d6d20xa944bd4b25c9f186a846fd5668941aa3d3b8425f0 Ether
0x38f5e7b290c865350b3979b2656f85bea2f58cce8bd77f613735c36486bdf98e1031688740 days 1 hr ago0x4183931cce346feece44eae2cf14d84c3347d7790xdcd22750a182a7a055d069c9f3295f8f3290d6d20 Ether
0x2ff1ecca65ed8b932375573d42eaee8fdba347a2ad6e9e209d5c583c71eb2bc91031469840 days 7 hrs ago0xdcd22750a182a7a055d069c9f3295f8f3290d6d20xa944bd4b25c9f186a846fd5668941aa3d3b8425f0 Ether
0x2ff1ecca65ed8b932375573d42eaee8fdba347a2ad6e9e209d5c583c71eb2bc91031469840 days 7 hrs ago0x4183931cce346feece44eae2cf14d84c3347d7790xdcd22750a182a7a055d069c9f3295f8f3290d6d20 Ether
0xf7f0df12567f0373b47f630352e204f9cd7de67b77a3618fcdacb90a49cbcbc51031469640 days 7 hrs ago0xdcd22750a182a7a055d069c9f3295f8f3290d6d20xa944bd4b25c9f186a846fd5668941aa3d3b8425f0 Ether
0xf7f0df12567f0373b47f630352e204f9cd7de67b77a3618fcdacb90a49cbcbc51031469640 days 7 hrs ago0x4183931cce346feece44eae2cf14d84c3347d7790xdcd22750a182a7a055d069c9f3295f8f3290d6d20 Ether
0xf7f0df12567f0373b47f630352e204f9cd7de67b77a3618fcdacb90a49cbcbc51031469640 days 7 hrs ago0xdcd22750a182a7a055d069c9f3295f8f3290d6d20xa944bd4b25c9f186a846fd5668941aa3d3b8425f0 Ether
0xf7f0df12567f0373b47f630352e204f9cd7de67b77a3618fcdacb90a49cbcbc51031469640 days 7 hrs ago0x4183931cce346feece44eae2cf14d84c3347d7790xdcd22750a182a7a055d069c9f3295f8f3290d6d20 Ether
0x9575fc1d22a1072870cb3462fd02578ab3955d7dd99caad4deb8300bb7f7d9ae1031469040 days 7 hrs ago0xdcd22750a182a7a055d069c9f3295f8f3290d6d20xa944bd4b25c9f186a846fd5668941aa3d3b8425f0 Ether
0x9575fc1d22a1072870cb3462fd02578ab3955d7dd99caad4deb8300bb7f7d9ae1031469040 days 7 hrs ago0x4183931cce346feece44eae2cf14d84c3347d7790xdcd22750a182a7a055d069c9f3295f8f3290d6d20 Ether
0x8c688568d28349c93a7ef62e023d0f6063d4ca5dc9155daf320a87c9dd9951b61031456640 days 7 hrs ago0xdcd22750a182a7a055d069c9f3295f8f3290d6d20xa944bd4b25c9f186a846fd5668941aa3d3b8425f0 Ether
0x8c688568d28349c93a7ef62e023d0f6063d4ca5dc9155daf320a87c9dd9951b61031456640 days 7 hrs ago0x4183931cce346feece44eae2cf14d84c3347d7790xdcd22750a182a7a055d069c9f3295f8f3290d6d20 Ether
0xc686649bb79da56ac620fad0240f9002ecd7713de8c8cb6ff6c9d386c6c3bcdb1031421140 days 8 hrs ago0xdcd22750a182a7a055d069c9f3295f8f3290d6d20xa944bd4b25c9f186a846fd5668941aa3d3b8425f0 Ether
0xc686649bb79da56ac620fad0240f9002ecd7713de8c8cb6ff6c9d386c6c3bcdb1031421140 days 8 hrs ago0x4183931cce346feece44eae2cf14d84c3347d7790xdcd22750a182a7a055d069c9f3295f8f3290d6d20 Ether
0xa5f42da953468d40a85d9754726b571a3040fbb8d27aca2d9f7013b43ea840741031217540 days 14 hrs ago0xdcd22750a182a7a055d069c9f3295f8f3290d6d20xa944bd4b25c9f186a846fd5668941aa3d3b8425f0 Ether
[ Download CSV Export 

Contract Source Code Verified (Exact Match)

Contract Name:
PriceOracleInterface

Compiler Version
v0.4.21+commit.dfe3193c

Optimization Enabled:
Yes

Runs (Optimizer):
200

Contract Source Code

pragma solidity ^0.4.21;

// File: contracts/Oracle/DSAuth.sol

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

// File: contracts/Oracle/DSMath.sol

contract DSMath {
    
    /*
    standard uint256 functions
     */

    function add(uint256 x, uint256 y) constant internal returns (uint256 z) {
        assert((z = x + y) >= x);
    }

    function sub(uint256 x, uint256 y) constant internal returns (uint256 z) {
        assert((z = x - y) <= x);
    }

    function mul(uint256 x, uint256 y) constant internal returns (uint256 z) {
        assert((z = x * y) >= x);
    }

    function div(uint256 x, uint256 y) constant internal returns (uint256 z) {
        z = x / y;
    }

    function min(uint256 x, uint256 y) constant internal returns (uint256 z) {
        return x <= y ? x : y;
    }
    function max(uint256 x, uint256 y) constant internal returns (uint256 z) {
        return x >= y ? x : y;
    }

    /*
    uint128 functions (h is for half)
     */


    function hadd(uint128 x, uint128 y) constant internal returns (uint128 z) {
        assert((z = x + y) >= x);
    }

    function hsub(uint128 x, uint128 y) constant internal returns (uint128 z) {
        assert((z = x - y) <= x);
    }

    function hmul(uint128 x, uint128 y) constant internal returns (uint128 z) {
        assert((z = x * y) >= x);
    }

    function hdiv(uint128 x, uint128 y) constant internal returns (uint128 z) {
        z = x / y;
    }

    function hmin(uint128 x, uint128 y) constant internal returns (uint128 z) {
        return x <= y ? x : y;
    }
    function hmax(uint128 x, uint128 y) constant internal returns (uint128 z) {
        return x >= y ? x : y;
    }


    /*
    int256 functions
     */

    function imin(int256 x, int256 y) constant internal returns (int256 z) {
        return x <= y ? x : y;
    }
    function imax(int256 x, int256 y) constant internal returns (int256 z) {
        return x >= y ? x : y;
    }

    /*
    WAD math
     */

    uint128 constant WAD = 10 ** 18;

    function wadd(uint128 x, uint128 y) constant internal returns (uint128) {
        return hadd(x, y);
    }

    function wsub(uint128 x, uint128 y) constant internal returns (uint128) {
        return hsub(x, y);
    }

    function wmul(uint128 x, uint128 y) constant internal returns (uint128 z) {
        z = cast((uint256(x) * y + WAD / 2) / WAD);
    }

    function wdiv(uint128 x, uint128 y) constant internal returns (uint128 z) {
        z = cast((uint256(x) * WAD + y / 2) / y);
    }

    function wmin(uint128 x, uint128 y) constant internal returns (uint128) {
        return hmin(x, y);
    }
    function wmax(uint128 x, uint128 y) constant internal returns (uint128) {
        return hmax(x, y);
    }

    /*
    RAY math
     */

    uint128 constant RAY = 10 ** 27;

    function radd(uint128 x, uint128 y) constant internal returns (uint128) {
        return hadd(x, y);
    }

    function rsub(uint128 x, uint128 y) constant internal returns (uint128) {
        return hsub(x, y);
    }

    function rmul(uint128 x, uint128 y) constant internal returns (uint128 z) {
        z = cast((uint256(x) * y + RAY / 2) / RAY);
    }

    function rdiv(uint128 x, uint128 y) constant internal returns (uint128 z) {
        z = cast((uint256(x) * RAY + y / 2) / y);
    }

    function rpow(uint128 x, uint64 n) constant internal returns (uint128 z) {
        // 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].

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

    function rmin(uint128 x, uint128 y) constant internal returns (uint128) {
        return hmin(x, y);
    }
    function rmax(uint128 x, uint128 y) constant internal returns (uint128) {
        return hmax(x, y);
    }

    function cast(uint256 x) constant internal returns (uint128 z) {
        assert((z = uint128(x)) == x);
    }

}

// File: contracts/Oracle/DSNote.sol

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

        _;
    }
}

// File: contracts/Oracle/DSThing.sol

contract DSThing is DSAuth, DSNote, DSMath {
}

// File: contracts/Oracle/DSValue.sol

contract DSValue is DSThing {
    bool    has;
    bytes32 val;
    function peek() constant returns (bytes32, bool) {
        return (val,has);
    }
    function read() constant returns (bytes32) {
        var (wut, has) = peek();
        assert(has);
        return wut;
    }
    function poke(bytes32 wut) note auth {
        val = wut;
        has = true;
    }
    function void() note auth { // unset the value
        has = false;
    }
}

// File: contracts/Oracle/Medianizer.sol

contract Medianizer is DSValue {
    mapping (bytes12 => address) public values;
    mapping (address => bytes12) public indexes;
    bytes12 public next = 0x1;

    uint96 public min = 0x1;

    function set(address wat) auth {
        bytes12 nextId = bytes12(uint96(next) + 1);
        assert(nextId != 0x0);
        set(next, wat);
        next = nextId;
    }

    function set(bytes12 pos, address wat) note auth {
        if (pos == 0x0) throw;

        if (wat != 0 && indexes[wat] != 0) throw;

        indexes[values[pos]] = 0; // Making sure to remove a possible existing address in that position

        if (wat != 0) {
            indexes[wat] = pos;
        }

        values[pos] = wat;
    }

    function setMin(uint96 min_) note auth {
        if (min_ == 0x0) throw;
        min = min_;
    }

    function setNext(bytes12 next_) note auth {
        if (next_ == 0x0) throw;
        next = next_;
    }

    function unset(bytes12 pos) {
        set(pos, 0);
    }

    function unset(address wat) {
        set(indexes[wat], 0);
    }

    function poke() {
        poke(0);
    }

    function poke(bytes32) note {
        (val, has) = compute();
    }

    function compute() constant returns (bytes32, bool) {
        bytes32[] memory wuts = new bytes32[](uint96(next) - 1);
        uint96 ctr = 0;
        for (uint96 i = 1; i < uint96(next); i++) {
            if (values[bytes12(i)] != 0) {
                var (wut, wuz) = DSValue(values[bytes12(i)]).peek();
                if (wuz) {
                    if (ctr == 0 || wut >= wuts[ctr - 1]) {
                        wuts[ctr] = wut;
                    } else {
                        uint96 j = 0;
                        while (wut >= wuts[j]) {
                            j++;
                        }
                        for (uint96 k = ctr; k > j; k--) {
                            wuts[k] = wuts[k - 1];
                        }
                        wuts[j] = wut;
                    }
                    ctr++;
                }
            }
        }

        if (ctr < min) return (val, false);

        bytes32 value;
        if (ctr % 2 == 0) {
            uint128 val1 = uint128(wuts[(ctr / 2) - 1]);
            uint128 val2 = uint128(wuts[ctr / 2]);
            value = bytes32(wdiv(hadd(val1, val2), 2 ether));
        } else {
            value = wuts[(ctr - 1) / 2];
        }

        return (value, true);
    }
}

// File: contracts/Oracle/PriceFeed.sol

/// price-feed.sol

// Copyright (C) 2017  DappHub, LLC

// Licensed under the Apache License, Version 2.0 (the "License").
// You may not use this file except in compliance with the License.

// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND (express or implied).



contract PriceFeed is DSThing {

    uint128 val;
    uint32 public zzz;

    function peek() public view
        returns (bytes32, bool)
    {
        return (bytes32(val), now < zzz);
    }

    function read() public view
        returns (bytes32)
    {
        assert(now < zzz);
        return bytes32(val);
    }

    function post(uint128 val_, uint32 zzz_, address med_) public note auth
    {
        val = val_;
        zzz = zzz_;
        bool ret = med_.call(bytes4(keccak256("poke()")));
        ret;
    }

    function void() public note auth
    {
        zzz = 0;
    }

}

// File: contracts/Oracle/PriceOracleInterface.sol

/*
This contract is the interface between the MakerDAO priceFeed and our DX platform.
*/



contract PriceOracleInterface {

    address public priceFeedSource;
    address public owner;
    bool public emergencyMode;

    event NonValidPriceFeed(address priceFeedSource);

    // Modifiers
    modifier onlyOwner() {
        require(msg.sender == owner);
        _;
    }

    /// @dev constructor of the contract
    /// @param _priceFeedSource address of price Feed Source -> should be maker feeds Medianizer contract
    function PriceOracleInterface(
        address _owner,
        address _priceFeedSource
    )
        public
    {
        owner = _owner;
        priceFeedSource = _priceFeedSource;
    }
    /// @dev gives the owner the possibility to put the Interface into an emergencyMode, which will 
    /// output always a price of 600 USD. This gives everyone time to set up a new pricefeed.
    function raiseEmergency(bool _emergencyMode)
        public
        onlyOwner()
    {
        emergencyMode = _emergencyMode;
    }

    /// @dev updates the priceFeedSource
    /// @param _owner address of owner
    function updateCurator(
        address _owner
    )
        public
        onlyOwner()
    {
        owner = _owner;
    }

    /// @dev returns the USDETH price, ie gets the USD price from Maker feed with 18 digits, but last 18 digits are cut off
    function getUSDETHPrice() 
        public
        returns (uint256)
    {
        // if the contract is in the emergencyMode, because there is an issue with the oracle, we will simply return a price of 600 USD
        if(emergencyMode){
            return 600;
        }

        bytes32 price;
        bool valid=true;
        (price, valid) = Medianizer(priceFeedSource).peek();
        if (!valid) {
            NonValidPriceFeed(priceFeedSource);
        }
        // ensuring that there is no underflow or overflow possible,
        // even if the price is compromised
        uint priceUint = uint256(price)/(1 ether);
        if (priceUint == 0) return 1;
        if (priceUint > 1000000) return 1000000; 
        return priceUint;
    }  
}

Contract ABI

[{"constant":true,"inputs":[],"name":"emergencyMode","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_owner","type":"address"}],"name":"updateCurator","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_emergencyMode","type":"bool"}],"name":"raiseEmergency","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"getUSDETHPrice","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"priceFeedSource","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_owner","type":"address"},{"name":"_priceFeedSource","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"priceFeedSource","type":"address"}],"name":"NonValidPriceFeed","type":"event"}]

Contract Creation Code

6060604052341561000f57600080fd5b6040516040806103e9833981016040528080519190602001805160018054600160a060020a03958616600160a060020a03199182161790915560008054929095169116178355506103829182915061006790396000f3006060604052600436106100775763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630905f560811461007c5780630c6a62dd146100a35780638da5cb5b146100c45780639e385fa4146100f3578063a3ca17b21461010b578063c5ace44314610130575b600080fd5b341561008757600080fd5b61008f610143565b604051901515815260200160405180910390f35b34156100ae57600080fd5b6100c2600160a060020a0360043516610164565b005b34156100cf57600080fd5b6100d76101ae565b604051600160a060020a03909116815260200160405180910390f35b34156100fe57600080fd5b6100c260043515156101bd565b341561011657600080fd5b61011e610218565b60405190815260200160405180910390f35b341561013b57600080fd5b6100d7610347565b60015474010000000000000000000000000000000000000000900460ff1681565b60015433600160a060020a0390811691161461017f57600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600154600160a060020a031681565b60015433600160a060020a039081169116146101d857600080fd5b60018054911515740100000000000000000000000000000000000000000274ff000000000000000000000000000000000000000019909216919091179055565b600080600080600160149054906101000a900460ff161561023d576102589350610341565b60005460019250600160a060020a03166359e02dd76040518163ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004016040805180830381600087803b151561029857600080fd5b5af115156102a557600080fd5b50505060405180519060200180519194509092505081151561030b576000547f364c0d3d8c056dff125868f781751ed53d48fb1b927b60ab972436741b61e3c990600160a060020a0316604051600160a060020a03909116815260200160405180910390a15b50670de0b6b3a764000082048015156103275760019350610341565b620f424081111561033d57620f42409350610341565b8093505b50505090565b600054600160a060020a0316815600a165627a7a72305820f8abef9b2babdbe10fedaeefb2bd59b626990f86a15e167003c43e1744dcd05e0029000000000000000000000000f85d1a0e1b71e72013db51139f285c6d5356b712000000000000000000000000a944bd4b25c9f186a846fd5668941aa3d3b8425f

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

000000000000000000000000f85d1a0e1b71e72013db51139f285c6d5356b712000000000000000000000000a944bd4b25c9f186a846fd5668941aa3d3b8425f

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000f85d1a0e1b71e72013db51139f285c6d5356b712
Arg [1] : 000000000000000000000000a944bd4b25c9f186a846fd5668941aa3d3b8425f

Swarm Source

bzzr://f8abef9b2babdbe10fedaeefb2bd59b626990f86a15e167003c43e1744dcd05e
Block Age Transaction Difficulty GasUsed Reward
Block Age Uncle Number Difficulty GasUsed Reward