Contract Address Details

0x2078adfC93C4d059f8D038CD699bacADA37c76e7

Contract Name
RainMaker
Creator
0x39a905–6416db at 0x726b4b–899661
Balance
0 ETC ( )
Tokens
Fetching tokens...
Transactions
1,680 Transactions
Transfers
3 Transfers
Gas Used
247,456,759
Last Balance Update
16444390
Contract name:
RainMaker




Optimization enabled
true
Compiler version
v0.4.21+commit.dfe3193c




Verified at
2018-11-30T20:34:25.807118Z

Contract source code

pragma solidity ^0.4.21;
/***
 *     _______             __            __       __            __                           
 *    |       \           |  \          |  \     /  \          |  \                          
 *    | $$$$$$$\  ______   \$$ _______  | $$\   /  $$  ______  | $$   __   ______    ______  
 *    | $$__| $$ |      \ |  \|       \ | $$$\ /  $$$ |      \ | $$  /  \ /      \  /      \ 
 *    | $$    $$  \$$$$$$\| $$| $$$$$$$\| $$$$\  $$$$  \$$$$$$\| $$_/  $$|  $$$$$$\|  $$$$$$\
 *    | $$$$$$$\ /      $$| $$| $$  | $$| $$\$$ $$ $$ /      $$| $$   $$ | $$    $$| $$   \$$
 *    | $$  | $$|  $$$$$$$| $$| $$  | $$| $$ \$$$| $$|  $$$$$$$| $$$$$$\ | $$$$$$$$| $$      
 *    | $$  | $$ \$$    $$| $$| $$  | $$| $$  \$ | $$ \$$    $$| $$  \$$\ \$$     \| $$      
 *     \$$   \$$  \$$$$$$$ \$$ \$$   \$$ \$$      \$$  \$$$$$$$ \$$   \$$  \$$$$$$$ \$$      
 * 
 *   v 1.0.0         
 *  "Nobody gets left behind"    
 * 
 *  What?
 *  -> Holds onto P3Cv1.0.0 tokens, and can ONLY reinvest in the P3Cv1.0.0 contract and accumulate more tokens.
 *  -> Calculates ratio of old to new contract balances and makes sure to split divs from new contract to old.
 *  -> This contract CANNOT sell, give, or transfer any tokens it owns.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 
 * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
 
contract Hourglass {
    function reinvest() public {}
    function withdraw() public returns(address) {}
    function myTokens() public view returns(uint256) {}
    function myDividends(bool) public view returns(uint256) {}
    function buy(address) public payable returns(uint256) {}
}

contract Divies {
    function deposit() external payable {}
}

contract RainMaker {
    Hourglass currentP3C;
    Divies oldDivies;

    address public oldDiviesAddress = 0x073340cC5D03B221EEc5D72Fb2fB9DFCeA6F72ae;
    address public oldP3CAddress = 0xDF9AaC76b722B08511A4C561607A9bf3AfA62E49;
    address public currentP3CAddress = 0xDe6FB6a5adbe6415CDaF143F8d90Eb01883e42ac;
   
    uint256 public contractRatio = 10000;
    uint256 public oldBalance;
    uint256 public newBalance;

    function RainMaker() public {
        currentP3C = Hourglass(currentP3CAddress);
        oldDivies = Divies(oldDiviesAddress);
    }
    
    function() external payable {}
    
    function calculateOldContractPercentage() internal returns(uint256){
        oldBalance = oldP3CAddress.balance;
        newBalance = currentP3CAddress.balance;
        uint256 _aggregate = SafeMath.add(oldBalance, newBalance);
        // calculate what percentage (4 precision points should go to old)
        contractRatio = SafeMath.div(SafeMath.mul(oldBalance,10000), _aggregate);
    }
    

    function reinvest(address _playerAddress) public {
        calculateOldContractPercentage();
        // withdraw the rainmakers current dividends
        currentP3C.withdraw();
        uint256 bal = address(this).balance;
        
        // in case Current contract is 10000x bigger, just buy with the message sender
        if (contractRatio == 0){
            currentP3C.buy.value(bal)(_playerAddress);
        } else {
            uint256 oldContractCut = SafeMath.div(SafeMath.mul(bal, contractRatio), 10000 );
            uint256 newContractCut = SafeMath.sub(bal, oldContractCut);
            
            // deposit the oldContactCut into the divies contract
            oldDivies.deposit.value(oldContractCut)();
            
            // buy p3c with the remainder
            currentP3C.buy.value(newContractCut)(_playerAddress);
        }
    }

    function myTokens() public view returns(uint256) {
        return currentP3C.myTokens();
    }
    
    function myDividends() public view returns(uint256) {
        return currentP3C.myDividends(true);
    }
}

/**
 * @title SafeMath
 * @dev Math operations with safety checks that throw on error
 */
library SafeMath {

    /**
    * @dev Multiplies two numbers, throws on overflow.
    */
    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;
    }

    /**
    * @dev Integer division of two numbers, truncating the quotient.
    */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        assert(b > 0); // Solidity automatically throws when dividing by 0
        uint256 c = a / b;
        assert(a == b * c + a % b); // There is no case in which this doesn't hold
        return c;
    }

    /**
    * @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
    */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        assert(b <= a);
        return a - b;
    }

    /**
    * @dev Adds two numbers, throws on overflow.
    */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        assert(c >= a);
        return c;
    }
}
        

Contract ABI

[{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"oldBalance","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":""}],"name":"oldP3CAddress","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"myDividends","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":""}],"name":"currentP3CAddress","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":""}],"name":"oldDiviesAddress","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"myTokens","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"contractRatio","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"reinvest","inputs":[{"type":"address","name":"_playerAddress"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"newBalance","inputs":[],"constant":true},{"type":"constructor","stateMutability":"nonpayable","payable":false,"inputs":[]},{"type":"fallback","stateMutability":"payable","payable":true}]
            

Deployed ByteCode

0x60606040526004361061007f5763ffffffff60e060020a6000350416631dc8228581146100815780632300656a146100a65780633151ecfc146100d55780634f36194f146100e857806379ad398c146100fb578063949e8acd1461010e578063b4d7d4e714610121578063b8872fb714610134578063bc464ba614610153575b005b341561008c57600080fd5b610094610166565b60405190815260200160405180910390f35b34156100b157600080fd5b6100b961016c565b604051600160a060020a03909116815260200160405180910390f35b34156100e057600080fd5b61009461017b565b34156100f357600080fd5b6100b96101e0565b341561010657600080fd5b6100b96101ef565b341561011957600080fd5b6100946101fe565b341561012c57600080fd5b61009461023e565b341561013f57600080fd5b61007f600160a060020a0360043516610244565b341561015e57600080fd5b610094610413565b60065481565b600354600160a060020a031681565b60008054600160a060020a031663688abbf7600160405160e060020a63ffffffff84160281529015156004820152602401602060405180830381600087803b15156101c557600080fd5b5af115156101d257600080fd5b505050604051805191505090565b600454600160a060020a031681565b600254600160a060020a031681565b60008054600160a060020a031663949e8acd6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156101c557600080fd5b60055481565b6000806000610251610419565b50600054600160a060020a0316633ccfd60b6040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561029157600080fd5b5af1151561029e57600080fd5b50505060405180515050600554600160a060020a033016319350151561032c57600054600160a060020a031663f088d547848660405160e060020a63ffffffff8516028152600160a060020a0390911660048201526024016020604051808303818588803b151561030e57600080fd5b5af1151561031b57600080fd5b50505050604051805190505061040d565b61034361033b84600554610468565b61271061049e565b915061034f83836104d2565b600154909150600160a060020a031663d0e30db0836040518263ffffffff1660e060020a0281526004016000604051808303818588803b151561039157600080fd5b5af1151561039e57600080fd5b5050600054600160a060020a0316915063f088d5479050828660405160e060020a63ffffffff8516028152600160a060020a0390911660048201526024016020604051808303818588803b15156103f457600080fd5b5af1151561040157600080fd5b50505050604051805150505b50505050565b60075481565b600354600160a060020a03908116316006819055600454909116316007819055600091829161044891906104e4565b905061046161045b600654612710610468565b8261049e565b6005555090565b60008083151561047b5760009150610497565b5082820282848281151561048b57fe5b041461049357fe5b8091505b5092915050565b6000808083116104aa57fe5b82848115156104b557fe5b04905082848115156104c357fe5b06818402018414151561049357fe5b6000828211156104de57fe5b50900390565b60008282018381101561049357fe00a165627a7a7230582005b5f96b2e32e8ac7af01e5b4d6a33b5d18e4943b29cbe06da2f0c8eff38c5220029