Latest 3 txns

TxHash Age From To Value [TxFee]
0xda63a30b8e460f4361afe13d5c5f014bd8ec2576bc4fef9b27cb288a1e3e3b0212 days 17 hrs ago0x2bc0d4efef61e6f98c1bf03fcf3276197dd9b2dc  IN   0x205ddf0e4de776dbc68a7ce02b8e41798434918d0 Ether0.000038123
0xc5d4982cc4b51ab151f442afe4a7133ccc1d3c7e4d731be53fc355ae107b483512 days 18 hrs ago0x2bc0d4efef61e6f98c1bf03fcf3276197dd9b2dc  IN   0x205ddf0e4de776dbc68a7ce02b8e41798434918d0 Ether0.000077723
0xd1d232a48388f33d37376afffcc7aecc8052be3d99abd761611540142eeb097b12 days 18 hrs ago0x2bc0d4efef61e6f98c1bf03fcf3276197dd9b2dc  IN    Contract Creation0 Ether0.000923888
[ Download CSV Export  ] 
 Internal Transactions as a result of Contract Execution
 Latest 8 Internal Transactions

ParentTxHash Block Age From To Value
0xda63a30b8e460f4361afe13d5c5f014bd8ec2576bc4fef9b27cb288a1e3e3b021003052312 days 17 hrs ago0x205ddf0e4de776dbc68a7ce02b8e41798434918d0xdb3b642ebc6ff85a3ab335cff9af2954f92159940 Ether
0xda63a30b8e460f4361afe13d5c5f014bd8ec2576bc4fef9b27cb288a1e3e3b021003052312 days 17 hrs ago0x205ddf0e4de776dbc68a7ce02b8e41798434918d0xdb3b642ebc6ff85a3ab335cff9af2954f92159940 Ether
0xda63a30b8e460f4361afe13d5c5f014bd8ec2576bc4fef9b27cb288a1e3e3b021003052312 days 17 hrs ago0x205ddf0e4de776dbc68a7ce02b8e41798434918d0xdb3b642ebc6ff85a3ab335cff9af2954f92159940 Ether
0xda63a30b8e460f4361afe13d5c5f014bd8ec2576bc4fef9b27cb288a1e3e3b021003052312 days 17 hrs ago0x205ddf0e4de776dbc68a7ce02b8e41798434918d0xdb3b642ebc6ff85a3ab335cff9af2954f92159940 Ether
0xc5d4982cc4b51ab151f442afe4a7133ccc1d3c7e4d731be53fc355ae107b48351003047412 days 18 hrs ago0x205ddf0e4de776dbc68a7ce02b8e41798434918d0xdb3b642ebc6ff85a3ab335cff9af2954f92159940 Ether
0xc5d4982cc4b51ab151f442afe4a7133ccc1d3c7e4d731be53fc355ae107b48351003047412 days 18 hrs ago0x205ddf0e4de776dbc68a7ce02b8e41798434918d0xdb3b642ebc6ff85a3ab335cff9af2954f92159940 Ether
0xc5d4982cc4b51ab151f442afe4a7133ccc1d3c7e4d731be53fc355ae107b48351003047412 days 18 hrs ago0x205ddf0e4de776dbc68a7ce02b8e41798434918d0xdb3b642ebc6ff85a3ab335cff9af2954f92159940 Ether
0xc5d4982cc4b51ab151f442afe4a7133ccc1d3c7e4d731be53fc355ae107b48351003047412 days 18 hrs ago0x205ddf0e4de776dbc68a7ce02b8e41798434918d0xdb3b642ebc6ff85a3ab335cff9af2954f92159940 Ether
[ Download CSV Export  ] 
Contract Source Code Verified (Exact Match)
Contract Name: rebalance
Compiler Text: v0.5.2+commit.1df8f40c
Optimization Enabled: No
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 getBestOffer(address sell_gem, address buy_gem) public constant returns(uint256);
//        function getOffer(uint id) external returns (uint,address,uint,address);
    }
     

contract rebalance {
    
    using SafeMath for uint256;

    event onDebug(
        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
    //address public pricefeed_=0x729D19f657BD0614b4985Cf1D82531c67569197B; //mainnet
    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;

    
    //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 returns (uint lastBuyPrice,uint lastSellPrice){
        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);
        emit onDebug(lastBuyPrice_,lastSellPrice_,msg.sender,now);
        return (lastBuyPrice_,lastSellPrice_);
    }
}    
    

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":[{"name":"lastBuyPrice","type":"uint256"},{"name":"lastSellPrice","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"dai_","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"pricefeed_","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"lastBuyPrice_","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":"onDebug","type":"event"}]

  Contract Creation Code Switch To Opcodes View
608060405273c4375b7de8af5a38a93548eb8453a498222c4ff26000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550739fffe440258b79c5d6604001674a4722ffc0f7bc600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555073db3b642ebc6ff85a3ab335cff9af2954f9215994600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555073d0a1e359811322d97991e03f863a0c30c2cf029c600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555073fc81655585f2f3935895c1409b332ab797d90b33600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555033600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600655600060075534801561020357600080fd5b50610aa0806102136000396000f3fe608060405234801561001057600080fd5b50600436106100b0576000357c010000000000000000000000000000000000000000000000000000000090048063a6a72eb111610083578063a6a72eb1146101b8578063a6f3da6f14610202578063d45967101461024c578063f2fde38b1461026a578063fbe0c9b2146102ae576100b0565b80633faa9033146100b557806343843cec146100ff5780634a0ebe2f14610149578063a56c077f14610193575b600080fd5b6100bd6102cc565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101076102f2565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610151610318565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61019b61033e565b604051808381526020018281526020019250505060405180910390f35b6101c0610882565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61020a6108a7565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102546108cd565b6040518082815260200191505060405180910390f35b6102ac6004803603602081101561028057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108d3565b005b6102b6610a18565b6040518082815260200191505060405180910390f35b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060008173ffffffffffffffffffffffffffffffffffffffff16630374fc6f600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b15801561047a57600080fd5b505afa15801561048e573d6000803e3d6000fd5b505050506040513d60208110156104a457600080fd5b8101908080519060200190929190505050905060008273ffffffffffffffffffffffffffffffffffffffff16630374fc6f6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b1580156105c957600080fd5b505afa1580156105dd573d6000803e3d6000fd5b505050506040513d60208110156105f357600080fd5b810190808051906020019092919050505090506000808473ffffffffffffffffffffffffffffffffffffffff16634579268a856040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018082815260200191505060806040518083038186803b15801561067657600080fd5b505afa15801561068a573d6000803e3d6000fd5b505050506040513d60808110156106a057600080fd5b8101908080519060200190929190805190602001909291908051906020019092919080519060200190929190505050509250509150610702826106f4670de0b6b3a764000084610a1e90919063ffffffff16565b610a5990919063ffffffff16565b6007819055508473ffffffffffffffffffffffffffffffffffffffff16634579268a846040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018082815260200191505060806040518083038186803b15801561077557600080fd5b505afa158015610789573d6000803e3d6000fd5b505050506040513d608081101561079f57600080fd5b8101908080519060200190929190805190602001909291908051906020019092919080519060200190929190505050909150508093508192505050610807826107f9670de0b6b3a764000084610a1e90919063ffffffff16565b610a5990919063ffffffff16565b6006819055503373ffffffffffffffffffffffffffffffffffffffff167f15cfbb531e785026d47fff2d36cf728a2848628d84c580e199ab51d325bd37ae6007546006544260405180848152602001838152602001828152602001935050505060405180910390a26007546006549650965050505050509091565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60075481565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610998576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f4f6e6c79206f776e65722063616e20646f20746869732100000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156109d457600080fd5b80600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60065481565b600080831415610a315760009050610a53565b60008284029050828482811515610a4457fe5b04141515610a4e57fe5b809150505b92915050565b6000808284811515610a6757fe5b049050809150509291505056fea165627a7a7230582071af6bcccacdb4ea8ab837cbe6ce014b34bd36f1c496eccb1c781362fa65017a0029

   Swarm Source:
bzzr://71af6bcccacdb4ea8ab837cbe6ce014b34bd36f1c496eccb1c781362fa65017a

 

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