Contract Overview
Balance: 0 Ether
Transactions: 4 txns
 Latest 4 txns

TxHash Age From To Value [TxFee]
0x1485c2bd45a69f61026617df8a8ee3cc4ff0df4ea1de934481759c277b77fb7512 days 16 hrs ago0x2bc0d4efef61e6f98c1bf03fcf3276197dd9b2dc  IN   0xda438fb6e6c0d58984f3c5b470c1400f064cd6e90 Ether0.000141203
0x800afcd997dd5cfb37cb116c4a791493bf5e85c607f52a529a8261e558abf17112 days 16 hrs ago0x2bc0d4efef61e6f98c1bf03fcf3276197dd9b2dc  IN   0xda438fb6e6c0d58984f3c5b470c1400f064cd6e90.1 Ether0.000120677
0x94bd636c840e383d4b8956afa6ace62aa42250fb5f4532ff0f483027cf7f881b12 days 16 hrs ago0x2bc0d4efef61e6f98c1bf03fcf3276197dd9b2dc  IN   0xda438fb6e6c0d58984f3c5b470c1400f064cd6e90.01 Ether0.0002097
0xfa1b60b77b62ac55e861c98026df85bcf586f455e2cd0dd3e8dcfc7d18a9cfb612 days 16 hrs ago0x2bc0d4efef61e6f98c1bf03fcf3276197dd9b2dc  IN    Contract Creation0 Ether0.000953148
[ Download CSV Export  ] 
 Internal Transactions as a result of Contract Execution
 Latest 22 Internal Transactions

ParentTxHash Block Age From To Value
0x1485c2bd45a69f61026617df8a8ee3cc4ff0df4ea1de934481759c277b77fb751003140912 days 16 hrs ago0xd0a1e359811322d97991e03f863a0c30c2cf029c0xda438fb6e6c0d58984f3c5b470c1400f064cd6e90.008163265306122448 Ether
0x1485c2bd45a69f61026617df8a8ee3cc4ff0df4ea1de934481759c277b77fb751003140912 days 16 hrs ago0xda438fb6e6c0d58984f3c5b470c1400f064cd6e90xd0a1e359811322d97991e03f863a0c30c2cf029c0 Ether
0x1485c2bd45a69f61026617df8a8ee3cc4ff0df4ea1de934481759c277b77fb751003140912 days 16 hrs ago0xda438fb6e6c0d58984f3c5b470c1400f064cd6e90xdb3b642ebc6ff85a3ab335cff9af2954f92159940 Ether
0x1485c2bd45a69f61026617df8a8ee3cc4ff0df4ea1de934481759c277b77fb751003140912 days 16 hrs ago0xda438fb6e6c0d58984f3c5b470c1400f064cd6e90xc4375b7de8af5a38a93548eb8453a498222c4ff20 Ether
0x1485c2bd45a69f61026617df8a8ee3cc4ff0df4ea1de934481759c277b77fb751003140912 days 16 hrs ago0xda438fb6e6c0d58984f3c5b470c1400f064cd6e90xc4375b7de8af5a38a93548eb8453a498222c4ff20 Ether
0x800afcd997dd5cfb37cb116c4a791493bf5e85c607f52a529a8261e558abf1711003138112 days 16 hrs ago0xda438fb6e6c0d58984f3c5b470c1400f064cd6e90xc4375b7de8af5a38a93548eb8453a498222c4ff20 Ether
0x800afcd997dd5cfb37cb116c4a791493bf5e85c607f52a529a8261e558abf1711003138112 days 16 hrs ago0xda438fb6e6c0d58984f3c5b470c1400f064cd6e90xdb3b642ebc6ff85a3ab335cff9af2954f92159940 Ether
0x800afcd997dd5cfb37cb116c4a791493bf5e85c607f52a529a8261e558abf1711003138112 days 16 hrs ago0xda438fb6e6c0d58984f3c5b470c1400f064cd6e90xd0a1e359811322d97991e03f863a0c30c2cf029c0 Ether
0x800afcd997dd5cfb37cb116c4a791493bf5e85c607f52a529a8261e558abf1711003138112 days 16 hrs ago0xda438fb6e6c0d58984f3c5b470c1400f064cd6e90xd0a1e359811322d97991e03f863a0c30c2cf029c0.1 Ether
0x800afcd997dd5cfb37cb116c4a791493bf5e85c607f52a529a8261e558abf1711003138112 days 16 hrs ago0xda438fb6e6c0d58984f3c5b470c1400f064cd6e90xdb3b642ebc6ff85a3ab335cff9af2954f92159940 Ether
0x800afcd997dd5cfb37cb116c4a791493bf5e85c607f52a529a8261e558abf1711003138112 days 16 hrs ago0xda438fb6e6c0d58984f3c5b470c1400f064cd6e90xdb3b642ebc6ff85a3ab335cff9af2954f92159940 Ether
0x800afcd997dd5cfb37cb116c4a791493bf5e85c607f52a529a8261e558abf1711003138112 days 16 hrs ago0xda438fb6e6c0d58984f3c5b470c1400f064cd6e90xdb3b642ebc6ff85a3ab335cff9af2954f92159940 Ether
0x800afcd997dd5cfb37cb116c4a791493bf5e85c607f52a529a8261e558abf1711003138112 days 16 hrs ago0xda438fb6e6c0d58984f3c5b470c1400f064cd6e90xdb3b642ebc6ff85a3ab335cff9af2954f92159940 Ether
0x94bd636c840e383d4b8956afa6ace62aa42250fb5f4532ff0f483027cf7f881b1003136912 days 16 hrs ago0xda438fb6e6c0d58984f3c5b470c1400f064cd6e90xc4375b7de8af5a38a93548eb8453a498222c4ff20 Ether
0x94bd636c840e383d4b8956afa6ace62aa42250fb5f4532ff0f483027cf7f881b1003136912 days 16 hrs ago0xda438fb6e6c0d58984f3c5b470c1400f064cd6e90xdb3b642ebc6ff85a3ab335cff9af2954f92159940 Ether
0x94bd636c840e383d4b8956afa6ace62aa42250fb5f4532ff0f483027cf7f881b1003136912 days 16 hrs ago0xda438fb6e6c0d58984f3c5b470c1400f064cd6e90xd0a1e359811322d97991e03f863a0c30c2cf029c0 Ether
0x94bd636c840e383d4b8956afa6ace62aa42250fb5f4532ff0f483027cf7f881b1003136912 days 16 hrs ago0xda438fb6e6c0d58984f3c5b470c1400f064cd6e90xd0a1e359811322d97991e03f863a0c30c2cf029c0 Ether
0x94bd636c840e383d4b8956afa6ace62aa42250fb5f4532ff0f483027cf7f881b1003136912 days 16 hrs ago0xda438fb6e6c0d58984f3c5b470c1400f064cd6e90xd0a1e359811322d97991e03f863a0c30c2cf029c0.01 Ether
0x94bd636c840e383d4b8956afa6ace62aa42250fb5f4532ff0f483027cf7f881b1003136912 days 16 hrs ago0xda438fb6e6c0d58984f3c5b470c1400f064cd6e90xdb3b642ebc6ff85a3ab335cff9af2954f92159940 Ether
0x94bd636c840e383d4b8956afa6ace62aa42250fb5f4532ff0f483027cf7f881b1003136912 days 16 hrs ago0xda438fb6e6c0d58984f3c5b470c1400f064cd6e90xdb3b642ebc6ff85a3ab335cff9af2954f92159940 Ether
0x94bd636c840e383d4b8956afa6ace62aa42250fb5f4532ff0f483027cf7f881b1003136912 days 16 hrs ago0xda438fb6e6c0d58984f3c5b470c1400f064cd6e90xdb3b642ebc6ff85a3ab335cff9af2954f92159940 Ether
0x94bd636c840e383d4b8956afa6ace62aa42250fb5f4532ff0f483027cf7f881b1003136912 days 16 hrs ago0xda438fb6e6c0d58984f3c5b470c1400f064cd6e90xdb3b642ebc6ff85a3ab335cff9af2954f92159940 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_);

//buy DAI for ETH        
        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));
        
        lastETHamount_=address(this).balance;
        lastDAIamount_=daiToken.balanceOf(address(this));
        
        emit onCheckRebalance(lastBuyPrice_,lastSellPrice_,msg.sender,now);
    }
    
        //try sell
    function sell() public {
        OasisInterface oasis=OasisInterface(oasis_);
        TokenInterface wethToken=TokenInterface(weth_);
        TokenInterface daiToken=TokenInterface(dai_);

        //uint payAmt=1e16;
        uint payAmt=lastDAIamount_;
        //sell DAI for ETH
        //require(payToken.transferFrom(msg.sender, this, payAmt));
        if (daiToken.allowance(address(this), oasis_) < payAmt) {
            daiToken.approve(oasis_, uint(-1));
        }
        uint wethAmt = oasis.sellAllAmount(dai_, payAmt, weth_, 1e12);
        wethToken.withdraw(wethAmt);
//        require(msg.sender.call.value(wethAmt)());

    }
}    
    

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":false,"inputs":[],"name":"sell","outputs":[],"payable":false,"stateMutability":"nonpayable","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
608060405260008054600160a060020a031990811673c4375b7de8af5a38a93548eb8453a498222c4ff217825560018054821673db3b642ebc6ff85a3ab335cff9af2954f921599417905560028054821673d0a1e359811322d97991e03f863a0c30c2cf029c17905560038054821673fc81655585f2f3935895c1409b332ab797d90b3317905560048054909116331790556005819055600681905560078190556008553480156100af57600080fd5b50610bef806100bf6000396000f3fe6080604052600436106100b9576000357c010000000000000000000000000000000000000000000000000000000090048063a6a72eb111610081578063a6a72eb114610138578063c73299c91461014d578063d459671014610174578063efe93ac614610189578063f2fde38b1461019e578063fbe0c9b2146101d1576100b9565b80633faa9033146100be57806343843cec146100ef57806345710074146101045780634a0ebe2f1461011b578063a56c077f14610130575b600080fd5b3480156100ca57600080fd5b506100d36101e6565b60408051600160a060020a039092168252519081900360200190f35b3480156100fb57600080fd5b506100d36101f5565b34801561011057600080fd5b50610119610204565b005b34801561012757600080fd5b506100d3610478565b610119610487565b34801561014457600080fd5b506100d3610a97565b34801561015957600080fd5b50610162610aa6565b60408051918252519081900360200190f35b34801561018057600080fd5b50610162610aac565b34801561019557600080fd5b50610162610ab2565b3480156101aa57600080fd5b50610119600480360360208110156101c157600080fd5b5035600160a060020a0316610ab8565b3480156101dd57600080fd5b50610162610b75565b600254600160a060020a031681565b600354600160a060020a031681565b60015460025460008054600854604080517fdd62ed3e000000000000000000000000000000000000000000000000000000008152306004820152600160a060020a039687166024820181905291519196958616959093169391928392859263dd62ed3e926044808201936020939283900390910190829087803b15801561028a57600080fd5b505af115801561029e573d6000803e3d6000fd5b505050506040513d60208110156102b457600080fd5b5051101561034457600154604080517f095ea7b3000000000000000000000000000000000000000000000000000000008152600160a060020a039283166004820152600019602482015290519184169163095ea7b39160448082019260009290919082900301818387803b15801561032b57600080fd5b505af115801561033f573d6000803e3d6000fd5b505050505b60008054600254604080517f0621b4f6000000000000000000000000000000000000000000000000000000008152600160a060020a03938416600482015260248101869052918316604483015264e8d4a5100060648301525191871691630621b4f69160848082019260209290919082900301818787803b1580156103c857600080fd5b505af11580156103dc573d6000803e3d6000fd5b505050506040513d60208110156103f257600080fd5b5051604080517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018390529051919250600160a060020a03861691632e1a7d4d9160248082019260009290919082900301818387803b15801561045957600080fd5b505af115801561046d573d6000803e3d6000fd5b505050505050505050565b600154600160a060020a031681565b60015460025460008054604080517f0374fc6f000000000000000000000000000000000000000000000000000000008152600160a060020a039485166004820152918416602483015251929093169290918391630374fc6f916044808301926020929190829003018186803b1580156104ff57600080fd5b505afa158015610513573d6000803e3d6000fd5b505050506040513d602081101561052957600080fd5b505160008054600254604080517f0374fc6f000000000000000000000000000000000000000000000000000000008152600160a060020a039384166004820152918316602483015251939450919290851691630374fc6f916044808301926020929190829003018186803b1580156105a057600080fd5b505afa1580156105b4573d6000803e3d6000fd5b505050506040513d60208110156105ca57600080fd5b5051604080517f4579268a0000000000000000000000000000000000000000000000000000000081526004810185905290519192506000918291600160a060020a03871691634579268a91602480820192608092909190829003018186803b15801561063557600080fd5b505afa158015610649573d6000803e3d6000fd5b505050506040513d608081101561065f57600080fd5b50805160409091015190925090506106958261068983670de0b6b3a764000063ffffffff610b7b16565b9063ffffffff610bac16565b600655604080517f4579268a000000000000000000000000000000000000000000000000000000008152600481018590529051600160a060020a03871691634579268a916024808301926080929190829003018186803b1580156106f857600080fd5b505afa15801561070c573d6000803e3d6000fd5b505050506040513d608081101561072257600080fd5b5080516040909101519250905061074b8261068983670de0b6b3a764000063ffffffff610b7b16565b60055560025460008054604080517fd0e30db00000000000000000000000000000000000000000000000000000000081529051600160a060020a039485169490921692849263d0e30db0923492600480830193919282900301818588803b1580156107b557600080fd5b505af11580156107c9573d6000803e3d6000fd5b5050600154604080517fdd62ed3e000000000000000000000000000000000000000000000000000000008152306004820152600160a060020a0392831660248201529051349550918716935063dd62ed3e92506044808201926020929091908290030181600087803b15801561083e57600080fd5b505af1158015610852573d6000803e3d6000fd5b505050506040513d602081101561086857600080fd5b505110156108f857600154604080517f095ea7b3000000000000000000000000000000000000000000000000000000008152600160a060020a039283166004820152600019602482015290519184169163095ea7b39160448082019260009290919082900301818387803b1580156108df57600080fd5b505af11580156108f3573d6000803e3d6000fd5b505050505b60025460008054604080517f0621b4f6000000000000000000000000000000000000000000000000000000008152600160a060020a039485166004820152346024820152918416604483015266038d7ea4c6800060648301525191928a1691630621b4f69160848082019260209290919082900301818787803b15801561097e57600080fd5b505af1158015610992573d6000803e3d6000fd5b505050506040513d60208110156109a857600080fd5b5051308031600755604080517f70a08231000000000000000000000000000000000000000000000000000000008152600481019290925251919250600160a060020a038416916370a08231916024808201926020929091908290030181600087803b158015610a1657600080fd5b505af1158015610a2a573d6000803e3d6000fd5b505050506040513d6020811015610a4057600080fd5b505160085560065460055460408051928352602083019190915242828201525133917f619ebd103f3b5ca30aae844383c864dbf44c0c65bba02d2203e82783649def39919081900360600190a25050505050505050565b600054600160a060020a031681565b60075481565b60065481565b60085481565b600454600160a060020a03163314610b3157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4f6e6c79206f776e65722063616e20646f207468697321000000000000000000604482015290519081900360640190fd5b600160a060020a0381161515610b4657600080fd5b6004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60055481565b6000821515610b8c57506000610ba6565b828202828482811515610b9b57fe5b0414610ba357fe5b90505b92915050565b6000808284811515610bba57fe5b0494935050505056fea165627a7a72305820a80a2d8cb9394147709e79d47f7bd115cd016f99da2840f0412ce57531d42a540029

   Swarm Source:
bzzr://a80a2d8cb9394147709e79d47f7bd115cd016f99da2840f0412ce57531d42a54

 

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