Latest 2 txns

TxHash Age From To Value [TxFee]
0x9281d6d5a38a2e85f13ee9b5ae3d3413e9a68a35f058fb941bf56010a342aef712 days 17 hrs ago0x2bc0d4efef61e6f98c1bf03fcf3276197dd9b2dc  IN   0x2a29f8a32d3397fa60dc5f13d34e7f1fd4120ac60.01 Ether0.000192792
0xb290f5d4a01c47fcbbc8f36fe266d852d2bea65a193a434ca6daa2475e68e19312 days 17 hrs ago0x2bc0d4efef61e6f98c1bf03fcf3276197dd9b2dc  IN    Contract Creation0 Ether0.000786669


[ Download CSV Export  ] 
 Internal Transactions as a result of Contract Execution
 Latest 9 Internal Transactions

ParentTxHash Block Age From To Value
0x9281d6d5a38a2e85f13ee9b5ae3d3413e9a68a35f058fb941bf56010a342aef71003072912 days 17 hrs ago0x2a29f8a32d3397fa60dc5f13d34e7f1fd4120ac60xc4375b7de8af5a38a93548eb8453a498222c4ff20 Ether
0x9281d6d5a38a2e85f13ee9b5ae3d3413e9a68a35f058fb941bf56010a342aef71003072912 days 17 hrs ago0x2a29f8a32d3397fa60dc5f13d34e7f1fd4120ac60xdb3b642ebc6ff85a3ab335cff9af2954f92159940 Ether
0x9281d6d5a38a2e85f13ee9b5ae3d3413e9a68a35f058fb941bf56010a342aef71003072912 days 17 hrs ago0x2a29f8a32d3397fa60dc5f13d34e7f1fd4120ac60xd0a1e359811322d97991e03f863a0c30c2cf029c0 Ether
0x9281d6d5a38a2e85f13ee9b5ae3d3413e9a68a35f058fb941bf56010a342aef71003072912 days 17 hrs ago0x2a29f8a32d3397fa60dc5f13d34e7f1fd4120ac60xd0a1e359811322d97991e03f863a0c30c2cf029c0 Ether
0x9281d6d5a38a2e85f13ee9b5ae3d3413e9a68a35f058fb941bf56010a342aef71003072912 days 17 hrs ago0x2a29f8a32d3397fa60dc5f13d34e7f1fd4120ac60xd0a1e359811322d97991e03f863a0c30c2cf029c0.01 Ether
0x9281d6d5a38a2e85f13ee9b5ae3d3413e9a68a35f058fb941bf56010a342aef71003072912 days 17 hrs ago0x2a29f8a32d3397fa60dc5f13d34e7f1fd4120ac60xdb3b642ebc6ff85a3ab335cff9af2954f92159940 Ether
0x9281d6d5a38a2e85f13ee9b5ae3d3413e9a68a35f058fb941bf56010a342aef71003072912 days 17 hrs ago0x2a29f8a32d3397fa60dc5f13d34e7f1fd4120ac60xdb3b642ebc6ff85a3ab335cff9af2954f92159940 Ether
0x9281d6d5a38a2e85f13ee9b5ae3d3413e9a68a35f058fb941bf56010a342aef71003072912 days 17 hrs ago0x2a29f8a32d3397fa60dc5f13d34e7f1fd4120ac60xdb3b642ebc6ff85a3ab335cff9af2954f92159940 Ether
0x9281d6d5a38a2e85f13ee9b5ae3d3413e9a68a35f058fb941bf56010a342aef71003072912 days 17 hrs ago0x2a29f8a32d3397fa60dc5f13d34e7f1fd4120ac60xdb3b642ebc6ff85a3ab335cff9af2954f92159940 Ether
[ Download CSV Export  ] 
Contract Source Code Verified (Exact Match)
Contract Name: rebalance
Compiler Text: v0.5.2+commit.1df8f40c
Optimization Enabled: Yes
Runs (Optimiser):  200



  Contract Source Code   Find Similiar Contracts

pragma solidity >0.4.99 <0.6.0;

/*
* http://ethedge.tech
* http://epictoken.dnsup.net/ (backup)
*
* Decentralized token exchange concept
* rebalancing eth contract value trade module with DAI (marketdao)
*
* ---How to use:
*  1. Send from ETH wallet to the smart contract address any amount ETH.
*  2.   1) Reinvest your profit by sending 0.00000001 ETH transaction to contract address
*       2) Claim your profit by sending 0.00000002 ETH transaction to contract address
*       3) Full exit (sell all and withdraw) by sending 0.00000003 ETH transaction to contract address
*  3. If you have innactive period more than 1 year - your account can be burned. Funds divided for token holders.
*  4. We use trade capital to invest to different crypto assets
*  5. Top big token holders can request audit.
*/


    interface DevsInterface {
        function payDividends(string calldata _sourceDesc) external payable;
//        function payDividends(string  _sourceDesc) public payable;
    }

    interface OasisInterface {
        function getBestOffer(address sell_gem, address buy_gem) external view returns(uint256);
        function getOffer(uint256 id) external view returns(uint256,address,uint256,address);
        function sellAllAmount(address pay_gem, uint pay_amt, address buy_gem, uint min_fill_amount) external returns (uint fill_amt);
    }

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

contract rebalance {
    
    using SafeMath for uint256;

    event onCheckRebalance(
        uint256 bestBid,
        uint256 bestAsk,
        address indexed customerAddress,
        uint timestamp
);

    //Modifier that only allows owner of the bag to Smart Contract AKA Good to use the function
    modifier onlyOwner{
        require(msg.sender == owner_, "Only owner can do this!");
        _;
    }
    

    address public dai_=0xC4375B7De8af5a38a93548eb8453a498222C4fF2; //kovan
    //address public dai_=0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359; //mainnet
    //address public pricefeed_=0x9FfFE440258B79c5d6604001674A4722FfC0f7Bc; //kovan NOT NEEDED!
    //address public pricefeed_=0x729D19f657BD0614b4985Cf1D82531c67569197B; //mainnet NOT NEEDED!
    address public oasis_=0xdB3b642eBc6Ff85A3AB335CFf9af2954F9215994; //kovan
    //address public oasis_=0xB7ac09C2c0217B07d7c103029B4918a2C401eeCB; //mainnet
    address public weth_=0xd0A1E359811322d97991E03f863a0C30C2cF029C; //kovan
    //address public weth_=0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; //mainnet
    
    address public devsReward_=0xfc81655585F2F3935895C1409b332AB797D90B33; //this is contract!
    address private owner_=msg.sender;
    uint256 public lastSellPrice_=0;
    uint256 public lastBuyPrice_=0;
    uint256 public lastETHamount_=0;
    uint256 public lastDAIamount_=0;

    
    //This function transfer ownership of contract from one entity to another
    function transferOwnership(address _newOwner) public onlyOwner{
        require(_newOwner != address(0));
        owner_ = _newOwner;
    }
    
    //Check if rebalance needed and do swap
    function checkRebalance() public payable{
        OasisInterface oasis=OasisInterface(oasis_);
        uint bestBid=oasis.getBestOffer(weth_,dai_);
        uint bestAsk=oasis.getBestOffer(dai_,weth_);
        (uint amountWEth,,uint amountDai,)=oasis.getOffer(bestBid);
        lastBuyPrice_=amountDai.mul(1e18).div(amountWEth);
        (amountDai,,amountWEth,)=oasis.getOffer(bestAsk);
        lastSellPrice_=amountDai.mul(1e18).div(amountWEth);
        
        TokenInterface wethToken=TokenInterface(weth_);
        TokenInterface daiToken=TokenInterface(dai_);
        wethToken.deposit.value(msg.value)();
        if (wethToken.allowance(address(this), oasis_) < msg.value) {
            wethToken.approve(oasis_, uint(-1));
        }
        uint buyAmt = oasis.sellAllAmount(weth_, msg.value, dai_, 1e15);
        require(daiToken.transfer(msg.sender,buyAmt));
        emit onCheckRebalance(lastBuyPrice_,lastSellPrice_,msg.sender,now);
    }
}    
    

library SafeMath {
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }
        uint256 c = a * b;
        assert(c / a == b);
        return c;
    }

    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a / b;
        return c;
    }

    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        assert(b <= a);
        return a - b;
    }

    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        assert(c >= a);
        return c;
    }
}

    Contract ABI  
[{"constant":true,"inputs":[],"name":"weth_","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"devsReward_","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"oasis_","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"checkRebalance","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"dai_","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"lastETHamount_","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"lastBuyPrice_","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"lastDAIamount_","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"lastSellPrice_","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":false,"name":"bestBid","type":"uint256"},{"indexed":false,"name":"bestAsk","type":"uint256"},{"indexed":true,"name":"customerAddress","type":"address"},{"indexed":false,"name":"timestamp","type":"uint256"}],"name":"onCheckRebalance","type":"event"}]

  Contract Creation Code Switch To Opcodes View
608060405260008054600160a060020a031990811673c4375b7de8af5a38a93548eb8453a498222c4ff217825560018054821673db3b642ebc6ff85a3ab335cff9af2954f921599417905560028054821673d0a1e359811322d97991e03f863a0c30c2cf029c17905560038054821673fc81655585f2f3935895c1409b332ab797d90b3317905560048054909116331790556005819055600681905560078190556008553480156100af57600080fd5b50610963806100bf6000396000f3fe6080604052600436106100ae576000357c010000000000000000000000000000000000000000000000000000000090048063c73299c911610076578063c73299c91461012d578063d459671014610154578063efe93ac614610169578063f2fde38b1461017e578063fbe0c9b2146101b1576100ae565b80633faa9033146100b357806343843cec146100e45780634a0ebe2f146100f9578063a56c077f1461010e578063a6a72eb114610118575b600080fd5b3480156100bf57600080fd5b506100c86101c6565b60408051600160a060020a039092168252519081900360200190f35b3480156100f057600080fd5b506100c86101d5565b34801561010557600080fd5b506100c86101e4565b6101166101f3565b005b34801561012457600080fd5b506100c861080b565b34801561013957600080fd5b5061014261081a565b60408051918252519081900360200190f35b34801561016057600080fd5b50610142610820565b34801561017557600080fd5b50610142610826565b34801561018a57600080fd5b50610116600480360360208110156101a157600080fd5b5035600160a060020a031661082c565b3480156101bd57600080fd5b506101426108e9565b600254600160a060020a031681565b600354600160a060020a031681565b600154600160a060020a031681565b60015460025460008054604080517f0374fc6f000000000000000000000000000000000000000000000000000000008152600160a060020a039485166004820152918416602483015251929093169290918391630374fc6f916044808301926020929190829003018186803b15801561026b57600080fd5b505afa15801561027f573d6000803e3d6000fd5b505050506040513d602081101561029557600080fd5b505160008054600254604080517f0374fc6f000000000000000000000000000000000000000000000000000000008152600160a060020a039384166004820152918316602483015251939450919290851691630374fc6f916044808301926020929190829003018186803b15801561030c57600080fd5b505afa158015610320573d6000803e3d6000fd5b505050506040513d602081101561033657600080fd5b5051604080517f4579268a0000000000000000000000000000000000000000000000000000000081526004810185905290519192506000918291600160a060020a03871691634579268a91602480820192608092909190829003018186803b1580156103a157600080fd5b505afa1580156103b5573d6000803e3d6000fd5b505050506040513d60808110156103cb57600080fd5b5080516040909101519092509050610401826103f583670de0b6b3a764000063ffffffff6108ef16565b9063ffffffff61092016565b600655604080517f4579268a000000000000000000000000000000000000000000000000000000008152600481018590529051600160a060020a03871691634579268a916024808301926080929190829003018186803b15801561046457600080fd5b505afa158015610478573d6000803e3d6000fd5b505050506040513d608081101561048e57600080fd5b508051604090910151925090506104b7826103f583670de0b6b3a764000063ffffffff6108ef16565b60055560025460008054604080517fd0e30db00000000000000000000000000000000000000000000000000000000081529051600160a060020a039485169490921692849263d0e30db0923492600480830193919282900301818588803b15801561052157600080fd5b505af1158015610535573d6000803e3d6000fd5b5050600154604080517fdd62ed3e000000000000000000000000000000000000000000000000000000008152306004820152600160a060020a0392831660248201529051349550918716935063dd62ed3e92506044808201926020929091908290030181600087803b1580156105aa57600080fd5b505af11580156105be573d6000803e3d6000fd5b505050506040513d60208110156105d457600080fd5b5051101561066457600154604080517f095ea7b3000000000000000000000000000000000000000000000000000000008152600160a060020a039283166004820152600019602482015290519184169163095ea7b39160448082019260009290919082900301818387803b15801561064b57600080fd5b505af115801561065f573d6000803e3d6000fd5b505050505b60025460008054604080517f0621b4f6000000000000000000000000000000000000000000000000000000008152600160a060020a039485166004820152346024820152918416604483015266038d7ea4c6800060648301525191928a1691630621b4f69160848082019260209290919082900301818787803b1580156106ea57600080fd5b505af11580156106fe573d6000803e3d6000fd5b505050506040513d602081101561071457600080fd5b5051604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152336004820152602481018390529051919250600160a060020a0384169163a9059cbb916044808201926020929091908290030181600087803b15801561078257600080fd5b505af1158015610796573d6000803e3d6000fd5b505050506040513d60208110156107ac57600080fd5b505115156107b957600080fd5b60065460055460408051928352602083019190915242828201525133917f619ebd103f3b5ca30aae844383c864dbf44c0c65bba02d2203e82783649def39919081900360600190a25050505050505050565b600054600160a060020a031681565b60075481565b60065481565b60085481565b600454600160a060020a031633146108a557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4f6e6c79206f776e65722063616e20646f207468697321000000000000000000604482015290519081900360640190fd5b600160a060020a03811615156108ba57600080fd5b6004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60055481565b60008215156109005750600061091a565b82820282848281151561090f57fe5b041461091757fe5b90505b92915050565b600080828481151561092e57fe5b0494935050505056fea165627a7a72305820af9b59f186e9f54522392ab507999cc7ba8d30492b71d64fb72f76a37a0b1f4c0029

   Swarm Source:
bzzr://af9b59f186e9f54522392ab507999cc7ba8d30492b71d64fb72f76a37a0b1f4c

 

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