Cryo Explorer Ethereum Mainnet

Address Contract Partially Verified

Address 0x5843F1Ccc5baA448528eb0e8Bc567Cda7eD1A1E8
Balance 0 ETH
Nonce 1
Code Size 3215 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

3215 bytes
0x608060405234801561001057600080fd5b5060043610610112576000357c0100000000000000000000000000000000000000000000000000000000900480637a9e5e4b116100b4578063bf7e214f11610083578063bf7e214f1461025f578063d4ee1d9014610267578063e3a940511461026f578063f2fde38b1461029257610112565b80637a9e5e4b146101f75780638da5cb5b1461021d57806393c0b09614610225578063b5c5f6721461022d57610112565b806342a02b18116100f057806342a02b181461018257806348f9e246146101a657806363bf444f146101cc57806379ba5097146101ef57610112565b80630efe6a8b14610117578063224a84321461015b578063379607f514610165575b600080fd5b6101496004803603606081101561012d57600080fd5b50600160a060020a0381351690602081013590604001356102b8565b60408051918252519081900360200190f35b6101636103b1565b005b6101496004803603602081101561017b57600080fd5b503561045a565b61018a610535565b60408051600160a060020a039092168252519081900360200190f35b610163600480360360208110156101bc57600080fd5b5035600160a060020a0316610544565b610163600480360360408110156101e257600080fd5b5080359060200135610634565b6101636106f9565b6101636004803603602081101561020d57600080fd5b5035600160a060020a03166107b8565b61018a61085e565b61016361086d565b6101496004803603606081101561024357600080fd5b50600160a060020a038135169060208101359060400135610906565b61018a6109ff565b61018a610a0e565b6101636004803603604081101561028557600080fd5b5080359060200135610a1d565b610163600480360360208110156102a857600080fd5b5035600160a060020a0316610af7565b600354604080517f20e8c565000000000000000000000000000000000000000000000000000000008152336004820152600160a060020a03868116602483015260448201869052606482018590529151600093849316916320e8c56591608480830192602092919082900301818787803b15801561033557600080fd5b505af1158015610349573d6000803e3d6000fd5b505050506040513d602081101561035f57600080fd5b5051604080518581526020810183905281519293503392600160a060020a038916927fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7928290030190a3949350505050565b6103ba33610bc3565b15156103fe576040805160e560020a62461bcd0281526020600482015260116024820152600080516020610bfa833981519152604482015290519081900360640190fd5b6004546003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392831617908190556040519116907fa20a793e95ff06a728b23185902e629b99a8db24d274aeedd1f00d715de8b47d90600090a2565b600354604080517faad3ec960000000000000000000000000000000000000000000000000000000081523360048201526024810184905290516000928392600160a060020a039091169163aad3ec969160448082019260209290919082900301818787803b1580156104cb57600080fd5b505af11580156104df573d6000803e3d6000fd5b505050506040513d60208110156104f557600080fd5b505160408051828152905191925033917f47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d49181900360200190a292915050565b600354600160a060020a031681565b61054d33610bc3565b1515610591576040805160e560020a62461bcd0281526020600482015260116024820152600080516020610bfa833981519152604482015290519081900360640190fd5b600160a060020a03811615156105db5760405160e560020a62461bcd028152600401808060200182810382526022815260200180610bd86022913960400191505060405180910390fd5b6004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03831690811790915560405133907fa4cda21336443f58fb792c9bb28d68a9ffeb44f081daf4b9e25d14042409188290600090a350565b600354604080517f615fa02b00000000000000000000000000000000000000000000000000000000815233600482015260248101859052604481018490529051600160a060020a039092169163615fa02b9160648082019260009290919082900301818387803b1580156106a757600080fd5b505af11580156106bb573d6000803e3d6000fd5b50506040805184815290513393507f1a7a7967c94a832e574705bea4dcc16985f946a1a5c2fdf81a2d845027c1d87392509081900360200190a25050565b600254600160a060020a031633146107455760405160e560020a62461bcd028152600401808060200182810382526028815260200180610c1a6028913960400191505060405180910390fd5b600254600154604051600160a060020a0392831692909116907f343765429aea5a34b3ff6a3785a98a5abb2597aca87bfbb58632c173d585373a90600090a3600280546001805473ffffffffffffffffffffffffffffffffffffffff19908116600160a060020a03841617909155169055565b6107c133610bc3565b1515610805576040805160e560020a62461bcd0281526020600482015260116024820152600080516020610bfa833981519152604482015290519081900360640190fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03838116919091178083556040519116917f1abebea81bfa2637f28358c371278fb15ede7ea8dd28d2e03b112ff6d936ada491a250565b600154600160a060020a031681565b61087633610bc3565b15156108ba576040805160e560020a62461bcd0281526020600482015260116024820152600080516020610bfa833981519152604482015290519081900360640190fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916905560405160009033907f343765429aea5a34b3ff6a3785a98a5abb2597aca87bfbb58632c173d585373a908390a3565b600354604080517f7bfe950c000000000000000000000000000000000000000000000000000000008152336004820152600160a060020a0386811660248301526044820186905260648201859052915160009384931691637bfe950c91608480830192602092919082900301818787803b15801561098357600080fd5b505af1158015610997573d6000803e3d6000fd5b505050506040513d60208110156109ad57600080fd5b5051604080518581526020810183905281519293503392600160a060020a038916927ff341246adaac6f497bc2a656f546ab9e182111d630394f0c57c710a59a2cb567928290030190a3949350505050565b600054600160a060020a031681565b600254600160a060020a031681565b600354604080517ffa0284ce00000000000000000000000000000000000000000000000000000000815233600482015260248101859052604481018490529051600160a060020a039092169163fa0284ce916064808201926020929091908290030181600087803b158015610a9157600080fd5b505af1158015610aa5573d6000803e3d6000fd5b505050506040513d6020811015610abb57600080fd5b505060408051828152905133917f81325e2a6c442af9d36e4ee9697f38d5f4bf0837ade0f6c411c6a40af7c057ee919081900360200190a25050565b610b0033610bc3565b1515610b44576040805160e560020a62461bcd0281526020600482015260116024820152600080516020610bfa833981519152604482015290519081900360640190fd5b600154600160a060020a0382811691161415610b945760405160e560020a62461bcd028152600401808060200182810382526022815260200180610c426022913960400191505060405180910390fd5b6002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600154600160a060020a039081169116149056fe5f6e65774446456e67696e653a20546865206164647265737320697320656d70747964732d617574682d6e6f6e2d6f776e65720000000000000000000000000000004163636570744f776e6572736869703a206f6e6c79206e6577206f776e657220646f20746869732e5472616e736665724f776e6572736869703a207468652073616d65206f776e65722ea165627a7a723058206ed68f52864ac7a354ac444bb8286fce04d39af249b78d0ac72e682e3ce1815b0029

Verified Source Code Partial Match

Compiler: v0.5.2+commit.1df8f40c EVM: byzantium Optimization: Yes (200 runs)
DFProtocol.sol 247 lines
pragma solidity ^0.5.2;

contract IDFEngine {
    function disableOwnership() public;
    function transferOwnership(address newOwner_) public;
    function acceptOwnership() public;
    function setAuthority(address authority_) public;
    function deposit(address _sender, address _tokenID, uint _feeTokenIdx, uint _amount) public returns (uint);
    function withdraw(address _sender, address _tokenID, uint _feeTokenIdx, uint _amount) public returns (uint);
    function destroy(address _sender, uint _feeTokenIdx, uint _amount) public returns (bool);
    function claim(address _sender, uint _feeTokenIdx) public returns (uint);
    function oneClickMinting(address _sender, uint _feeTokenIdx, uint _amount) public;
}

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);
    event OwnerUpdate     (address indexed owner, address indexed newOwner);
}

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

    constructor() public {
        owner = msg.sender;
        emit LogSetOwner(msg.sender);
    }

    // Warning: you should absolutely sure you want to give up authority!!!
    function disableOwnership() public onlyOwner {
        owner = address(0);
        emit OwnerUpdate(msg.sender, owner);
    }

    function transferOwnership(address newOwner_) public onlyOwner {
        require(newOwner_ != owner, "TransferOwnership: the same owner.");
        newOwner = newOwner_;
    }

    function acceptOwnership() public {
        require(msg.sender == newOwner, "AcceptOwnership: only new owner do this.");
        emit OwnerUpdate(owner, newOwner);
        owner = newOwner;
        newOwner = address(0x0);
    }

    ///[snow] guard is Authority who inherit DSAuth.
    function setAuthority(DSAuthority authority_)
        public
        onlyOwner
    {
        authority = authority_;
        emit LogSetAuthority(address(authority));
    }

    modifier onlyOwner {
        require(isOwner(msg.sender), "ds-auth-non-owner");
        _;
    }

    function isOwner(address src) internal view returns (bool) {
        return bool(src == owner);
    }

    modifier auth {
        require(isAuthorized(msg.sender, msg.sig), "ds-auth-unauthorized");
        _;
    }

    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, address(this), sig);
        }
    }
}

contract DFUpgrader is DSAuth {

    // MEMBERS
    // @dev  The reference to the active converter implementation.
    IDFEngine public iDFEngine;

    /// @dev  The map of lock ids to pending implementation changes.
    address newDFEngine;

    // CONSTRUCTOR
    constructor () public {
        iDFEngine = IDFEngine(0x0);
    }

    // PUBLIC FUNCTIONS
    // (UPGRADE)
    /** @notice  Requests a change of the active implementation associated
      * with this contract.
      *
      * @dev  Anyone can call this function, but confirming the request is authorized
      * by the custodian.
      *
      * @param  _newDFEngine  The address of the new active implementation.
      */
    function requestImplChange(address _newDFEngine) public onlyOwner {
        require(_newDFEngine != address(0), "_newDFEngine: The address is empty");

        newDFEngine = _newDFEngine;

        emit ImplChangeRequested(msg.sender, _newDFEngine);
    }

    /** @notice  Confirms a pending change of the active implementation
      * associated with this contract.
      *
      * @dev  the `Converter ConverterImpl` member will be updated
      * with the requested address.
      *
      */
    function confirmImplChange() public onlyOwner {
        iDFEngine = IDFEngine(newDFEngine);

        emit ImplChangeConfirmed(address(iDFEngine));
    }

    /// @dev  Emitted by successful `requestImplChange` calls.
    event ImplChangeRequested(address indexed _msgSender, address indexed _proposedImpl);

    /// @dev Emitted by successful `confirmImplChange` calls.
    event ImplChangeConfirmed(address indexed _newImpl);
}

contract DFProtocol is DFUpgrader {
    /******************************************/
    /* Public events that will notify clients */
    /******************************************/

    /**
     * @dev Emmit when `_tokenAmount` tokens of `_tokenID` deposits from one account(`_sender`),
     * and show the amout(`_usdxAmount`) tokens generate.
     */
    event Deposit (address indexed _tokenID, address indexed _sender, uint _tokenAmount, uint _usdxAmount);

    /**
     * @dev Emmit when `_expectedAmount` tokens of `_tokenID` withdraws from one account(`_sender`),
     * and show the amount(`_actualAmount`) tokens have been withdrawed successfully.
     *
     * Note that `_actualAmount` may be less than or equal to `_expectedAmount`.
     */
    event Withdraw(address indexed _tokenID, address indexed _sender, uint _expectedAmount, uint _actualAmount);

    /**
     * @dev Emmit when `_amount` USDx were destroied from one account(`_sender`).
     */
    event Destroy (address indexed _sender, uint _usdxAmount);

    /**
     * @dev Emmit when `_usdxAmount` USDx were claimed from one account(`_sender`).
     */
    event Claim(address indexed _sender, uint _usdxAmount);

    /**
     * @dev Emmit when `_amount` USDx were minted from one account(`_sender`).
     */
    event OneClickMinting(address indexed _sender, uint _usdxAmount);

    /******************************************/
    /*            User interfaces             */
    /******************************************/

    /**
     * @dev The caller deposits `_tokenAmount` tokens of `_tokenID`,
     * and the caller would like to use `_feeTokenIdx` as the transaction fee.
     *
     * Note that: 1)For `_tokenID`: it should be one of the supported stabel currencies.
     *            2)For `_feeTokenIdx`: 0 is DF, and 1 is USDx.
     *
     * Returns a uint value indicating the total amount that generating USDx.
     *
     * Emits a `Deposit` event.
     */
    function deposit(address _tokenID, uint _feeTokenIdx, uint _tokenAmount) public returns (uint){
        uint _usdxAmount = iDFEngine.deposit(msg.sender, _tokenID, _feeTokenIdx, _tokenAmount);
        emit Deposit(_tokenID, msg.sender, _tokenAmount, _usdxAmount);
        return _usdxAmount;
    }

    /**
     * @dev The caller withdraws `_expectedAmount` tokens of `_tokenID`,
     * and the caller would like to use `_feeTokenIdx` as the transaction fee.
     *
     * Returns a uint value indicating the total amount of the caller has withdrawed successfully.
     *
     * Emits a `Withdraw` event.
     */
    function withdraw(address _tokenID, uint _feeTokenIdx, uint _expectedAmount) public returns (uint) {
        uint _actualAmount = iDFEngine.withdraw(msg.sender, _tokenID, _feeTokenIdx, _expectedAmount);
        emit Withdraw(_tokenID, msg.sender, _expectedAmount, _actualAmount);
        return _actualAmount;
    }

    /**
     * @dev The caller destroies `_usdxAmount` USDx,
     * and the caller would like to use `_feeTokenIdx` as the transaction fee.
     *
     * Emits a `Destroy` event.
     */
    function destroy(uint _feeTokenIdx, uint _usdxAmount) public {
        iDFEngine.destroy(msg.sender, _feeTokenIdx, _usdxAmount);
        emit Destroy(msg.sender, _usdxAmount);
    }

    /**
     * @dev The caller claims to get spare USDx he can get,
     * and the caller would like to use `_feeTokenIdx` as the transaction fee.
     *
     * Returns a uint value indicating the total amount of the caller has claimed.
     *
     * Emits a `Claim` event.
     */
    function claim(uint _feeTokenIdx) public returns (uint) {
        uint _usdxAmount = iDFEngine.claim(msg.sender, _feeTokenIdx);
        emit Claim(msg.sender, _usdxAmount);
        return _usdxAmount;
    }

    /**
     * @dev The caller mints `_usdxAmount` USDx directly,
     * and the caller would like to use `_feeTokenIdx` as the transaction fee.
     *
     * Emits a `OneClickMinting` event.
     */
    function oneClickMinting(uint _feeTokenIdx, uint _usdxAmount) public {
        iDFEngine.oneClickMinting(msg.sender, _feeTokenIdx, _usdxAmount);
        emit OneClickMinting(msg.sender, _usdxAmount);
    }
}

Read Contract

authority 0xbf7e214f → address
iDFEngine 0x42a02b18 → address
newOwner 0xd4ee1d90 → address
owner 0x8da5cb5b → address

Write Contract 11 functions

These functions modify contract state and require a wallet transaction to execute.

acceptOwnership 0x79ba5097
No parameters
claim 0x379607f5
uint256 _feeTokenIdx
returns: uint256
confirmImplChange 0x224a8432
No parameters
deposit 0x0efe6a8b
address _tokenID
uint256 _feeTokenIdx
uint256 _tokenAmount
returns: uint256
destroy 0xe3a94051
uint256 _feeTokenIdx
uint256 _usdxAmount
disableOwnership 0x93c0b096
No parameters
oneClickMinting 0x63bf444f
uint256 _feeTokenIdx
uint256 _usdxAmount
requestImplChange 0x48f9e246
address _newDFEngine
setAuthority 0x7a9e5e4b
address authority_
transferOwnership 0xf2fde38b
address newOwner_
withdraw 0xb5c5f672
address _tokenID
uint256 _feeTokenIdx
uint256 _expectedAmount
returns: uint256

Recent Transactions

No transactions found for this address