Contract 0x4f3db6d4c97b8248ad5e244e4f619086084f6848

 

Contract Overview

Balance:
0.003863658578046575 Ether

EtherValue:
$0.57 (@ $146.86/ETH)
TxHash Block Age From To Value [TxFee]
0xa8e39063feaa7225df4dbfff417b91bdc324475829b7dc0a6c014f3af573263e72076208 days 3 hrs ago0x4a9485da998d50e1d3e69b8026ad0ddeba0ac562 IN  0x4f3db6d4c97b8248ad5e244e4f619086084f68480 Ether0.000042
0x10014ce554781d80e07144777ebd460d5ccb03853ffafbd997d4e698de1ed1b2699601348 days 14 hrs ago0x0f3fefc594060cd4183ba980bfae6c58199dfe4c IN  0x4f3db6d4c97b8248ad5e244e4f619086084f68480 Ether0.000872357
0x2974c88e49c0279d16f4565c7d5056bf34c07c26978298e024aa7afb9b2ee4ab699594048 days 15 hrs ago0x0f3fefc594060cd4183ba980bfae6c58199dfe4c IN  0x4f3db6d4c97b8248ad5e244e4f619086084f68480 Ether0.000861
0xe522e6232e787645920813bfac437fe4838213b3a1964c3e7f2f501b5155e26f689175766 days 6 hrs ago0x90572f224b66c1322da3fe69b341ae85c2b021eb IN  0x4f3db6d4c97b8248ad5e244e4f619086084f68480 Ether0.000872357
0x3616b2869c96ac830f7f414c5897d1eaff53b9175acec3850c936706f069147c687624668 days 19 hrs ago0xa241e8b28b6ba888b13ac5709dcdb6fa80c9b5f6 IN  0x4f3db6d4c97b8248ad5e244e4f619086084f68480 Ether0.00021277
0xcebb95d17aa8b9825bc652e9a4eb41b8446599fcb10b72c5dc55ef38aafa7dcb686133571 days 6 hrs ago0x310783aad25a59ce6a7142c793bff52366d462dc IN  0x4f3db6d4c97b8248ad5e244e4f619086084f68480 Ether0.000872357
0x7a0f15c6e4c78258477c87885c4608931d2cb08d5f5f00f078dfa1902934775f686129371 days 6 hrs ago0x310783aad25a59ce6a7142c793bff52366d462dc IN  0x4f3db6d4c97b8248ad5e244e4f619086084f68480 Ether0.000872357
0x127afdee4c760f93c8d50e7023262abb9ddb9a3f24f3605148f46c4bafbdbccd686127671 days 6 hrs ago0x310783aad25a59ce6a7142c793bff52366d462dc IN  0x4f3db6d4c97b8248ad5e244e4f619086084f68480 Ether0.000861
0x92786e6777040afdc8a3f5cccb70c9d0dc675d79e2f14e0b5f71b511d3476db1685878971 days 16 hrs ago0x17384f91dc63c9cf5776fee69798fb647ca59489 IN  0x4f3db6d4c97b8248ad5e244e4f619086084f68480 Ether0.000106385
0x7237e27454e087b7da563e45d2a9068e6c87fb563842d4401ded6fc2f3a56783684189574 days 11 hrs ago0x17384f91dc63c9cf5776fee69798fb647ca59489 IN  0x4f3db6d4c97b8248ad5e244e4f619086084f68480 Ether0.000127662
0x6f94a887f3228290330e2772afe60b3e26c2853d7f34d81276cbc359cceedc84683837875 days 1 hr ago0x7cd20dab1f2a383551d7cb8c6d4f82ccf64d3451 IN  0x4f3db6d4c97b8248ad5e244e4f619086084f68480 Ether0.000872357
0x6122571d42a7300b53fb4c60fac24b5a78291d2812b876c5e1561f15822a7d06683369675 days 19 hrs ago0x45daabc1bc8ba8dd477986580b556d9dfa178cc7 IN  0x4f3db6d4c97b8248ad5e244e4f619086084f68480 Ether0.000872357
0x49f326959532c74d8f58742bebdaee670c730d9bc494a5e9e48368f3b39702ff683070576 days 7 hrs ago0xa856787ab04731cd5c127068278894f69abcf7c0 IN  0x4f3db6d4c97b8248ad5e244e4f619086084f68480 Ether0.000872357
0x589209a2f86877c27bd9566cf7aa256276a45ab492bcb768e6190e3176864708682611877 days 2 hrs ago0x199999a0ec2b4e66364052f97764cfd71d61801f IN  0x4f3db6d4c97b8248ad5e244e4f619086084f68480 Ether0.00021277
0x9eb1adfa77b3866bf88c087bebf62e3afac75bb2d35b5571a1648772a39d2376682552877 days 4 hrs ago0xc50637735799fd21fcc963d85c2d8ca6e9754aa2 IN  0x4f3db6d4c97b8248ad5e244e4f619086084f68480 Ether0.00017106708
0x69eb0b4a5e13dd17ccf0c0ce6d7dfc44d1014318cdee5384549a76f5e39b8215682551877 days 4 hrs ago0xc50637735799fd21fcc963d85c2d8ca6e9754aa2 IN  0x4f3db6d4c97b8248ad5e244e4f619086084f68480 Ether0.00022000418
0x6ae9b0270c451a67922fa8ee93a7458536df486ed9f45e458d004bb343d73ab6682446677 days 8 hrs ago0xa856787ab04731cd5c127068278894f69abcf7c0 IN  0x4f3db6d4c97b8248ad5e244e4f619086084f68480 Ether0.000872357
0x4d33ff4b3e4395d1689156e68a3f1e097e485a5070b224c08edf0837d73f9184682386077 days 11 hrs ago0x0f86b21f97a9643f13326195ae8431d9a8c88c4f IN  0x4f3db6d4c97b8248ad5e244e4f619086084f68480 Ether0.000191493
0x068ec764b9f38e46574ab649f230c870a16f5e4ce4e8d5ab5d8c77cae462a8a7682336077 days 13 hrs ago0x3df9ff7ad0ab69df1fc6d9944042080111d5626a IN  0x4f3db6d4c97b8248ad5e244e4f619086084f68480 Ether0.002106423
0xe2a4b32549ce8bf4b49fce8f867aa56806027bc722491089c4681b530991e775682281077 days 15 hrs ago0x1aed5355b64397dd0666c96f20c73c3e70620fe0 IN  0x4f3db6d4c97b8248ad5e244e4f619086084f68480 Ether0.000340432
0xd3fe4c144516b1c297e82829b722aca11a5228b803c20c305ad659be33026dbe682012278 days 1 hr ago0xa241e8b28b6ba888b13ac5709dcdb6fa80c9b5f6 IN  0x4f3db6d4c97b8248ad5e244e4f619086084f68480 Ether0.000255324
0x143530adba3fe3e4143b776c521d3d4e2eda10b26854fedf9dd23d39ade4296e681974778 days 3 hrs ago0xba86bbf81709b3155fb93052947515356d68a11e IN  0x4f3db6d4c97b8248ad5e244e4f619086084f68480 Ether0.000872357
0x6784696374ccc4daad088abc60c4b317f4b4fdd9f2084549b1ecac3656b40bc2681973678 days 3 hrs ago0x023ca598e2d24be3be88b2a941c30151cc71d272 IN  0x4f3db6d4c97b8248ad5e244e4f619086084f68480 Ether0.000191493
0xbce25a46d89b6174194d28ba6d0f6d7b05de6372941d2fe4fcdf8fc64d4925a9681972878 days 3 hrs ago0x94217fcfb03b67bb49ad976816f5b038b6bc5c68 IN  0x4f3db6d4c97b8248ad5e244e4f619086084f68480 Ether0.000231
0x76fde626904ced07746b3c37a185bab2128a48c45626d8a960cd7852f416efed681969678 days 3 hrs ago0x8dc9736ba32081becff3eeb73d3820cfe3181a86 IN  0x4f3db6d4c97b8248ad5e244e4f619086084f68480 Ether0.00042554
[ Download CSV Export 

Latest 25 Internal Transaction, Click here to view more Internal Transactions as a result of Contract Execution

Parent TxHash Block Age From To Value
0xbdc6a867d34b9e9c8bf6282b62efdb098ce838777db013c4e90a58c2270960a0681715078 days 13 hrs ago0x4f3db6d4c97b8248ad5e244e4f619086084f68480xa0f1f12000be9c4f3439bd25adff969829fde3940.005 Ether
0x9ac40d87538540f5cec76a705234b72484002936c03a520ad88e6262a9e8cbe6681705078 days 14 hrs ago0x4f3db6d4c97b8248ad5e244e4f619086084f68480x731299c19fec50211bf503016cd31f734761dd7c0.007303171277083333 Ether
0x1b1518b5f87b3aa373ab8301911fb312cdc49f339926d08208d2b36aa2619b58681704678 days 14 hrs ago0x4f3db6d4c97b8248ad5e244e4f619086084f68480x83fbea5c94bc921040515e1cc19f6f351e2da2480.006708942497857232 Ether
0xaddf0f92a8342bf5e73819fa776be41f2c65f73296c8e8490a2ad8f0cd9c2506681701178 days 14 hrs ago0x4f3db6d4c97b8248ad5e244e4f619086084f68480x6534b05b57243adbc8a3258d7590bb31f8a553580.02 Ether
0x397ec53015e6b0fb3c5a198899c1757ed1e1797cda5f1c8a425ec1ec5796dc9f681696478 days 14 hrs ago0x4f3db6d4c97b8248ad5e244e4f619086084f68480x15421962634d22eb8ceb9ad64831ae1ff3936a0a0.046263069891975308 Ether
0x6daa89d501a30d3349c82e761939798b19136953b74d1049891a7baab4ad16df681696178 days 14 hrs ago0x4f3db6d4c97b8248ad5e244e4f619086084f68480xa856787ab04731cd5c127068278894f69abcf7c00.022722222222222222 Ether
0x54af1d388be455c0c64c740a49f0e950841c08f6914f03ffce4b5584ae1d6c42681694178 days 14 hrs ago0x4f3db6d4c97b8248ad5e244e4f619086084f68480x1213321605b9e389f9646714defb3459bc9c688f0.007013888888888888 Ether
0x36a3c60a80dcd5c3b1b5be9459f3d757500e4939dcbbffed44914c254b7a767b681691778 days 14 hrs ago0x4f3db6d4c97b8248ad5e244e4f619086084f68480xc54683feb533d10eaf0ee8b73a145eba619456240.006166666666666666 Ether
0xeba5f166fceb6ee0281f8636dd9de836ca81d1a6195c872765fbe65d5480f555681689978 days 14 hrs ago0x4f3db6d4c97b8248ad5e244e4f619086084f68480x179899d02c6c1c06a422969a3a7e4f5e266f73810.0125 Ether
0x3c7ee538d5f106745e2d572e3f36058989c30209a8b3c19b524140b54eb28edf681688078 days 14 hrs ago0x4f3db6d4c97b8248ad5e244e4f619086084f68480xa79dd2d94772bbe4949e5bca5df5cb875df4d9950.04375 Ether
0x88379cb7be44b34033c0b3e745f4d3a6a7d7b7940a99d6d92df725414b7b2b26681683078 days 14 hrs ago0x4f3db6d4c97b8248ad5e244e4f619086084f68480xd43fe19b187caadc79cd9a1e2440e012aefb901e0.006875 Ether
0x84c539ca3239f9a7c5f9b107abc5cb24f78aa7376cefc97a601bbea094f8b36f681680778 days 15 hrs ago0x4f3db6d4c97b8248ad5e244e4f619086084f68480x6d49550079a37ca07a6fde6b3335ae6e7e14bd460.0264796875 Ether
0x0e61071b926d3bbe0b9f8253199c17943f7dd487018fcd3bd1c4283a6eb81b92681677178 days 15 hrs ago0x4f3db6d4c97b8248ad5e244e4f619086084f68480x50a38012ad0b6efe6f79b3b0af20b673b8bb7da50.277333333333333333 Ether
0xea1c0b1994688635491a4cf0457278addb860bd9a85ad427fe3a409fb68c4926681676478 days 15 hrs ago0x4f3db6d4c97b8248ad5e244e4f619086084f68480x4b291d4bddb64cad1c00fac0816bbcf7cdb549630.170666666666666666 Ether
0xbe4058840cd94283964827bf740f4f39f713cad501f302d6640f81533f7c0579681674078 days 15 hrs ago0x4f3db6d4c97b8248ad5e244e4f619086084f68480x199999a0ec2b4e66364052f97764cfd71d61801f0.151527777777777777 Ether
0x979392747dc5e1584d8f4593703bd07c6512a68dc91d8c3fc80f8533ab22b63f681672778 days 15 hrs ago0x4f3db6d4c97b8248ad5e244e4f619086084f68480x3df9ff7ad0ab69df1fc6d9944042080111d5626a0.784027777777777777 Ether
0xb9202421693e4ede9f55cad1bd320c1f78f7dd5ae2a05bdaf0d352f5a2659eb2681671178 days 15 hrs ago0x4f3db6d4c97b8248ad5e244e4f619086084f68480x01a90409f82e940a9ab5ee3a7d458a3b32f5e7000.01005 Ether
0x2a0252b852d34753988daf3ab7a3818fde75ac4e6f66eef947185f3fdb6d446a681664778 days 15 hrs ago0x4f3db6d4c97b8248ad5e244e4f619086084f68480x0f86b21f97a9643f13326195ae8431d9a8c88c4f0.017916666666666666 Ether
0x6cc6ad9f0e3a72f50b3c511a983a813564a1aa3cc50b1dc9a6b3206df65bfedd681664578 days 15 hrs ago0x4f3db6d4c97b8248ad5e244e4f619086084f68480xafd26668707d392d5df25443b050bacbf01464cc0.039583333333333333 Ether
0x889c99f27c2b41f72e56ec1dba1126c49793c5545eeb9f33b9374b60e98f00ea681664478 days 15 hrs ago0x4f3db6d4c97b8248ad5e244e4f619086084f68480x17384f91dc63c9cf5776fee69798fb647ca594890.004242424242424242 Ether
0x48397d463fe2b1becd26fde08fb9eda8846fdc1d85367fe899e9f2217de55dfd681661378 days 15 hrs ago0x4f3db6d4c97b8248ad5e244e4f619086084f68480xdd0f1fc527522e85a56e19ad05022e2903052b290.0396 Ether
0x14c7f032c3db7683d64ebc2533b9e9532d9e5e4838c128f410fd6cad7bcb6037681653878 days 16 hrs ago0x4f3db6d4c97b8248ad5e244e4f619086084f68480x179899d02c6c1c06a422969a3a7e4f5e266f73810.0875 Ether
0x0c7b878579bf93c086d234b89bbfee1409b573113a0321c6cdb079cabeea65b8681650978 days 16 hrs ago0x4f3db6d4c97b8248ad5e244e4f619086084f68480x5c4446d037c1cfc7d82012cd07ef5b5168784d680.008268748089531986 Ether
0xbf6d759a247bfea2350b667ab452712ae33b5b00ec61392cb22a903206038efb681648378 days 16 hrs ago0x4f3db6d4c97b8248ad5e244e4f619086084f68480xa0f1f12000be9c4f3439bd25adff969829fde3940.01515625 Ether
0x4925c54f36c876d0f407edaf0b23bc7f86ac8e932126605a1b38f909fc550d47681632878 days 16 hrs ago0x4f3db6d4c97b8248ad5e244e4f619086084f68480xdd0f1fc527522e85a56e19ad05022e2903052b290.0462 Ether
[ Download CSV Export 
Contract Source Code Verified (Exact Match)
Contract Name: SmartContractBank
Compiler Version: v0.4.25+commit.59dbf8f1
Optimization Enabled: Yes
Runs (Optimizer):  200


Contract Source Code
pragma solidity ^0.4.24;

/**
* It is "Smart Contract Bank" smart-contract.
* - You can take profit 4% per day.
* - You can buy insurance and receive part of insurance fund when balance will be lesser then 0.01 ETH.
* - You can increase your percent on 0.5% if you have 10 CBC Token (0x790bFaCaE71576107C068f494c8A6302aea640cb ico.cryptoboss.me)
*    1. To buy CBC Tokens send 0.01 ETH on Sale Token Address 0x369fc7de8aee87a167244eb10b87eb3005780872
*    2. To increase your profit percent if you already have tokens, you should send to SmartContractBank address 0.0001 ETH
* - If your percent balance will be beyond of 200% you will able to take your profit only once time.
* HODL your profit and take more then 200% percents.
* - If balance of contract will be lesser then 0.1 ETH every user able stop contract and start insurance payments.
*
* - Percent of profit depends on balance of contract. Percent chart below:
* - If balance < 100 ETH - 4% per day
* - If balance >= 100 ETH and < 600 - 2% per day
* - If balance >= 600 ETH and < 1000 - 1% per day
* - If balance >= 1000 ETH and < 3000 - 0.9% per day
* - If balance >= 3000 ETH and < 5000 - 0.8% per day
* - If balance >= 5000  - 0.7% per day
* - If balance of contract will be beyond threshold, your payout will be reevaluate depends on currently balance of contract
* -
* - You can calm your profit every 5 minutes
*
* To invest:
* - Send minimum 0.01 ETH to contract address
*
* To calm profit:
* - Send 0 ETH to contract address
*/
contract SmartContractBank {
    using SafeMath for uint256;
    struct Investor {
        uint256 deposit;
        uint256 paymentTime;
        uint256 withdrawals;
        bool increasedPercent;
        bool insured;
    }
    uint public countOfInvestors;
    mapping (address => Investor) public investors;

    uint256 public minimum = 0.01 ether;
    uint step = 5 minutes;
    uint ownerPercent = 4;
    uint promotionPercent = 8;
    uint insurancePercent = 2;
    bool public closed = false;

    address public ownerAddressOne = 0xaB5007407d8A686B9198079816ebBaaa2912ecC1;
    address public ownerAddressTwo = 0x4A5b00cDDAeE928B8De7a7939545f372d6727C06;
    address public promotionAddress = 0x3878E2231f7CA61c0c1D0Aa3e6962d7D23Df1B3b;
    address public insuranceFundAddress;
    address public CBCTokenAddress = 0x790bFaCaE71576107C068f494c8A6302aea640cb;
    address public MainSaleAddress = 0x369fc7de8aee87a167244eb10b87eb3005780872;

    InsuranceFund IFContract;
    CBCToken CBCTokenContract = CBCToken(CBCTokenAddress);
    MainSale MainSaleContract = MainSale(MainSaleAddress);
    
    event Invest(address investor, uint256 amount);
    event Withdraw(address investor, uint256 amount);
    event UserDelete(address investor);

    /**
    * @dev Modifier for access from the InsuranceFund
    */
    modifier onlyIF() {
        require(insuranceFundAddress == msg.sender, "access denied");
        _;
    }

    /**
    * @dev  Setter the InsuranceFund address. Address can be set only once.
    * @param _insuranceFundAddress Address of the InsuranceFund
    */
    function setInsuranceFundAddress(address _insuranceFundAddress) public{
        require(insuranceFundAddress == address(0x0));
        insuranceFundAddress = _insuranceFundAddress;
        IFContract = InsuranceFund(insuranceFundAddress);
    }

    /**
    * @dev  Set insured from the InsuranceFund.
    * @param _address Investor's address
    * @return Object of investor's information
    */
    function setInsured(address _address) public onlyIF returns(uint256, uint256, bool){
        Investor storage investor = investors[_address];
        investor.insured = true;
        return (investor.deposit, investor.withdrawals, investor.insured);
    }

    /**
    * @dev  Function for close entrance.
    */
    function closeEntrance() public {
        require(address(this).balance < 0.1 ether && !closed);
        closed = true;
    }

    /**
    * @dev Get percent depends on balance of contract
    * @return Percent
    */
    function getPhasePercent() view public returns (uint){
        Investor storage investor = investors[msg.sender];
        uint contractBalance = address(this).balance;
        uint percent;
        if (contractBalance < 100 ether) {
            percent = 40;
        }
        if (contractBalance >= 100 ether && contractBalance < 600 ether) {
            percent = 20;
        }
        if (contractBalance >= 600 ether && contractBalance < 1000 ether) {
            percent = 10;
        }
        if (contractBalance >= 1000 ether && contractBalance < 3000 ether) {
            percent = 9;
        }
        if (contractBalance >= 3000 ether && contractBalance < 5000 ether) {
            percent = 8;
        }
        if (contractBalance >= 5000 ether) {
            percent = 7;
        }

        if (investor.increasedPercent){
            percent = percent.add(5);
        }

        return percent;
    }

    /**
    * @dev Allocation budgets
    */
    function allocation() private{
        ownerAddressOne.transfer(msg.value.mul(ownerPercent.div(2)).div(100));
        ownerAddressTwo.transfer(msg.value.mul(ownerPercent.div(2)).div(100));
        promotionAddress.transfer(msg.value.mul(promotionPercent).div(100));
        insuranceFundAddress.transfer(msg.value.mul(insurancePercent).div(100));
    }

    /**
    * @dev Evaluate current balance
    * @param _address Address of investor
    * @return Payout amount
    */
    function getUserBalance(address _address) view public returns (uint256) {
        Investor storage investor = investors[_address];
        uint percent = getPhasePercent();
        uint256 differentTime = now.sub(investor.paymentTime).div(step);
        uint256 differentPercent = investor.deposit.mul(percent).div(1000);
        uint256 payout = differentPercent.mul(differentTime).div(288);

        return payout;
    }

    /**
    * @dev Withdraw profit from contract. Investor will be deleted if he will try withdraw after received x2
    */
    function withdraw() private {
        Investor storage investor = investors[msg.sender];
        uint256 balance = getUserBalance(msg.sender);
        if (investor.deposit > 0 && address(this).balance > balance && balance > 0) {
            uint256 tempWithdrawals = investor.withdrawals;

            investor.withdrawals = investor.withdrawals.add(balance);
            investor.paymentTime = now;

            if (investor.withdrawals >= investor.deposit.mul(2)){
                investor.deposit = 0;
                investor.paymentTime = 0;
                investor.withdrawals = 0;
                investor.increasedPercent = false;
                investor.insured = false;
                countOfInvestors--;
                if (investor.insured)
                    IFContract.deleteInsured(msg.sender);
                emit UserDelete(msg.sender);
            } else {
                if (investor.insured && tempWithdrawals < investor.deposit){
                    IFContract.setInfo(msg.sender, investor.deposit, investor.withdrawals);
                }
            }
            msg.sender.transfer(balance);
            emit Withdraw(msg.sender, balance);
        }

    }

    /**
    * @dev Increase percent with CBC Token
    */
    function increasePercent() public {
        Investor storage investor = investors[msg.sender];
        if (CBCTokenContract.balanceOf(msg.sender) >= 10 ether){
            MainSaleContract.authorizedBurnTokens(msg.sender, 10 ether);
            investor.increasedPercent = true;
        }
    }

    /**
    * @dev  Payable function for
    * - receive funds (send minimum 0.01 ETH),
    * - increase percent and receive profit (send 0.0001 ETH if you already have CBC Tokens on your address).
    * - calm your profit (send 0 ETH)
    */
    function () external payable {
        require(!closed);
        Investor storage investor = investors[msg.sender];
        if (msg.value >= minimum){
        
            withdraw();

            if (investor.deposit == 0){
                countOfInvestors++;
            }

            investor.deposit = investor.deposit.add(msg.value);
            investor.paymentTime = now;

            if (investor.insured){
                IFContract.setInfo(msg.sender, investor.deposit, investor.withdrawals);
            }
            allocation();
            emit Invest(msg.sender, msg.value);
        } else if (msg.value == 0.0001 ether) {
            increasePercent();
        } else {
            withdraw();
        }
    }
}


/**
 * @title Ownable
 * @dev The Ownable contract has an owner address, and provides basic authorization control
 * functions, this simplifies the implementation of "user permissions".
 */
contract Ownable {
    address public owner;


    /**
     * @dev The Ownable constructor sets the original `owner` of the contract to the sender
     * account.
     */
    function Ownable() public {
        owner = msg.sender;
    }


    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require (msg.sender == owner);
        _;
    }


    /**
     * @dev Allows the current owner to transfer control of the contract to a newOwner.
     * @param newOwner The address to transfer ownership to.
     */
    function transferOwnership(address newOwner) onlyOwner {
        require(newOwner != address(0));
        owner = newOwner;
    }
}



/**
 * @title Authorizable
 * @dev Allows to authorize access to certain function calls
 *
 * ABI
 * [{"constant":true,"inputs":[{"name":"authorizerIndex","type":"uint256"}],"name":"getAuthorizer","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_addr","type":"address"}],"name":"addAuthorized","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_addr","type":"address"}],"name":"isAuthorized","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"inputs":[],"payable":false,"type":"constructor"}]
 */
contract Authorizable {

    address[] authorizers;
    mapping(address => uint) authorizerIndex;

    /**
     * @dev Throws if called by any account tat is not authorized.
     */
    modifier onlyAuthorized {
        require(isAuthorized(msg.sender));
        _;
    }

    /**
     * @dev Contructor that authorizes the msg.sender.
     */
    function Authorizable() public {
        authorizers.length = 2;
        authorizers[1] = msg.sender;
        authorizerIndex[msg.sender] = 1;
    }

    /**
     * @dev Function to get a specific authorizer
     * @param authorizerIndex index of the authorizer to be retrieved.
     * @return The address of the authorizer.
     */
    function getAuthorizer(uint authorizerIndex) external constant returns(address) {
        return address(authorizers[authorizerIndex + 1]);
    }

    /**
     * @dev Function to check if an address is authorized
     * @param _addr the address to check if it is authorized.
     * @return boolean flag if address is authorized.
     */
    function isAuthorized(address _addr) public constant returns(bool) {
        return authorizerIndex[_addr] > 0;
    }

    /**
     * @dev Function to add a new authorizer
     * @param _addr the address to add as a new authorizer.
     */
    function addAuthorized(address _addr) external onlyAuthorized {
        authorizerIndex[_addr] = authorizers.length;
        authorizers.length++;
        authorizers[authorizers.length - 1] = _addr;
    }

}

/**
 * @title ExchangeRate
 * @dev Allows updating and retrieveing of Conversion Rates for PAY tokens
 *
 * ABI
 * [{"constant":false,"inputs":[{"name":"_symbol","type":"string"},{"name":"_rate","type":"uint256"}],"name":"updateRate","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"data","type":"uint256[]"}],"name":"updateRates","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_symbol","type":"string"}],"name":"getRate","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"rates","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"type":"function"},{"anonymous":false,"inputs":[{"indexed":false,"name":"timestamp","type":"uint256"},{"indexed":false,"name":"symbol","type":"bytes32"},{"indexed":false,"name":"rate","type":"uint256"}],"name":"RateUpdated","type":"event"}]
 */
contract ExchangeRate is Ownable {

    event RateUpdated(uint timestamp, bytes32 symbol, uint rate);

    mapping(bytes32 => uint) public rates;

    /**
     * @dev Allows the current owner to update a single rate.
     * @param _symbol The symbol to be updated.
     * @param _rate the rate for the symbol.
     */
    function updateRate(string _symbol, uint _rate) public onlyOwner {
        rates[keccak256(_symbol)] = _rate;
        RateUpdated(now, keccak256(_symbol), _rate);
    }

    /**
     * @dev Allows the current owner to update multiple rates.
     * @param data an array that alternates keccak256 hashes of the symbol and the corresponding rate .
     */
    function updateRates(uint[] data) public onlyOwner {
        require (data.length % 2 <= 0);
        uint i = 0;
        while (i < data.length / 2) {
            bytes32 symbol = bytes32(data[i * 2]);
            uint rate = data[i * 2 + 1];
            rates[symbol] = rate;
            RateUpdated(now, symbol, rate);
            i++;
        }
    }

    /**
     * @dev Allows the anyone to read the current rate.
     * @param _symbol the symbol to be retrieved.
     */
    function getRate(string _symbol) public constant returns(uint) {
        return rates[keccak256(_symbol)];
    }

}

/**
 * Math operations with safety checks
 */
library SafeMath {
    function mul(uint a, uint b) internal returns (uint) {
        uint c = a * b;
        assert(a == 0 || c / a == b);
        return c;
    }

    function div(uint a, uint b) internal returns (uint) {
        // assert(b > 0); // Solidity automatically throws when dividing by 0
        uint c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold
        return c;
    }

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

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

    function max64(uint64 a, uint64 b) internal constant returns (uint64) {
        return a >= b ? a : b;
    }

    function min64(uint64 a, uint64 b) internal constant returns (uint64) {
        return a < b ? a : b;
    }

    function max256(uint256 a, uint256 b) internal constant returns (uint256) {
        return a >= b ? a : b;
    }

    function min256(uint256 a, uint256 b) internal constant returns (uint256) {
        return a < b ? a : b;
    }

    function assert(bool assertion) internal {
        require(assertion);
    }
}


/**
 * @title ERC20Basic
 * @dev Simpler version of ERC20 interface
 * @dev see https://github.com/ethereum/EIPs/issues/20
 */
contract ERC20Basic {
    uint public totalSupply;
    function balanceOf(address who) public constant returns (uint);
    function transfer(address to, uint value) public;
    event Transfer(address indexed from, address indexed to, uint value);
}




/**
 * @title ERC20 interface
 * @dev see https://github.com/ethereum/EIPs/issues/20
 */
contract ERC20 is ERC20Basic {
    function allowance(address owner, address spender) constant returns (uint);
    function transferFrom(address from, address to, uint value);
    function approve(address spender, uint value);
    event Approval(address indexed owner, address indexed spender, uint value);
}




/**
 * @title Basic token
 * @dev Basic version of StandardToken, with no allowances.
 */
contract BasicToken is ERC20Basic {
    using SafeMath for uint;

    mapping(address => uint) balances;

    /**
     * @dev Fix for the ERC20 short address attack.
     */
    modifier onlyPayloadSize(uint size) {
        require (size + 4 <= msg.data.length);
        _;
    }

    /**
    * @dev transfer token for a specified address
    * @param _to The address to transfer to.
    * @param _value The amount to be transferred.
    */
    function transfer(address _to, uint _value) onlyPayloadSize(2 * 32) {
        balances[msg.sender] = balances[msg.sender].sub(_value);
        balances[_to] = balances[_to].add(_value);
        Transfer(msg.sender, _to, _value);
    }

    /**
    * @dev Gets the balance of the specified address.
    * @param _owner The address to query the the balance of.
    * @return An uint representing the amount owned by the passed address.
    */
    function balanceOf(address _owner) constant returns (uint balance) {
        return balances[_owner];
    }

}




/**
 * @title Standard ERC20 token
 *
 * @dev Implemantation of the basic standart token.
 * @dev https://github.com/ethereum/EIPs/issues/20
 * @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
 */
contract StandardToken is BasicToken, ERC20 {

    mapping (address => mapping (address => uint)) allowed;


    /**
     * @dev Transfer tokens from one address to another
     * @param _from address The address which you want to send tokens from
     * @param _to address The address which you want to transfer to
     * @param _value uint the amout of tokens to be transfered
     */
    function transferFrom(address _from, address _to, uint _value) onlyPayloadSize(3 * 32) {
        var _allowance = allowed[_from][msg.sender];

        // Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
        // if (_value > _allowance) throw;

        balances[_to] = balances[_to].add(_value);
        balances[_from] = balances[_from].sub(_value);
        allowed[_from][msg.sender] = _allowance.sub(_value);
        Transfer(_from, _to, _value);
    }

    /**
     * @dev Aprove the passed address to spend the specified amount of tokens on beahlf of msg.sender.
     * @param _spender The address which will spend the funds.
     * @param _value The amount of tokens to be spent.
     */
    function approve(address _spender, uint _value) {

        // To change the approve amount you first have to reduce the addresses`
        //  allowance to zero by calling `approve(_spender, 0)` if it is not
        //  already 0 to mitigate the race condition described here:
        //  https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
        if ((_value != 0) && (allowed[msg.sender][_spender] != 0)) throw;

        allowed[msg.sender][_spender] = _value;
        Approval(msg.sender, _spender, _value);
    }

    /**
     * @dev Function to check the amount of tokens than an owner allowed to a spender.
     * @param _owner address The address which owns the funds.
     * @param _spender address The address which will spend the funds.
     * @return A uint specifing the amount of tokens still avaible for the spender.
     */
    function allowance(address _owner, address _spender) constant returns (uint remaining) {
        return allowed[_owner][_spender];
    }

}


/**
 * @title Mintable token
 * @dev Simple ERC20 Token example, with mintable token creation
 * @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120
 * Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
 */

contract MintableToken is StandardToken, Ownable {
    event Mint(address indexed to, uint value);
    event MintFinished();
    event Burn(address indexed burner, uint256 value);

    bool public mintingFinished = false;
    uint public totalSupply = 0;


    modifier canMint() {
        require(!mintingFinished);
        _;
    }

    /**
     * @dev Function to mint tokens
     * @param _to The address that will recieve the minted tokens.
     * @param _amount The amount of tokens to mint.
     * @return A boolean that indicates if the operation was successful.
     */
    function mint(address _to, uint _amount) onlyOwner canMint returns (bool) {
        totalSupply = totalSupply.add(_amount);
        balances[_to] = balances[_to].add(_amount);
        Mint(_to, _amount);
        return true;
    }

    /**
     * @dev Function to stop minting new tokens.
     * @return True if the operation was successful.
     */
    function finishMinting() onlyOwner returns (bool) {
        mintingFinished = true;
        MintFinished();
        return true;
    }


    /**
     * @dev Burns a specific amount of tokens.
     * @param _value The amount of token to be burned.
     */
    function burn(address _who, uint256 _value) onlyOwner public {
        _burn(_who, _value);
    }

    function _burn(address _who, uint256 _value) internal {
        require(_value <= balances[_who]);
        // no need to require value <= totalSupply, since that would imply the
        // sender's balance is greater than the totalSupply, which *should* be an assertion failure

        balances[_who] = balances[_who].sub(_value);
        totalSupply = totalSupply.sub(_value);
        Burn(_who, _value);
        Transfer(_who, address(0), _value);
    }
}


/**
 * @title CBCToken
 * @dev The main CBC token contract
 *
 * ABI
 * [{"constant":true,"inputs":[],"name":"mintingFinished","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"startTrading","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"mint","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"tradingStarted","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"finishMinting","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[],"name":"MintFinished","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"}]
 */
contract CBCToken is MintableToken {

    string public name = "Crypto Boss Coin";
    string public symbol = "CBC";
    uint public decimals = 18;

    bool public tradingStarted = false;
    /**
     * @dev modifier that throws if trading has not started yet
     */
    modifier hasStartedTrading() {
        require(tradingStarted);
        _;
    }


    /**
     * @dev Allows the owner to enable the trading. This can not be undone
     */
    function startTrading() onlyOwner {
        tradingStarted = true;
    }

    /**
     * @dev Allows anyone to transfer the PAY tokens once trading has started
     * @param _to the recipient address of the tokens.
     * @param _value number of tokens to be transfered.
     */
    function transfer(address _to, uint _value) hasStartedTrading {
        super.transfer(_to, _value);
    }

    /**
    * @dev Allows anyone to transfer the CBC tokens once trading has started
    * @param _from address The address which you want to send tokens from
    * @param _to address The address which you want to transfer to
    * @param _value uint the amout of tokens to be transfered
    */
    function transferFrom(address _from, address _to, uint _value) hasStartedTrading {
        super.transferFrom(_from, _to, _value);
    }

}

/**
 * @title MainSale
 * @dev The main CBC token sale contract
 *
 * ABI
 * [{"constant":false,"inputs":[{"name":"_multisigVault","type":"address"}],"name":"setMultisigVault","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"authorizerIndex","type":"uint256"}],"name":"getAuthorizer","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"exchangeRate","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"altDeposits","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"recipient","type":"address"},{"name":"tokens","type":"uint256"}],"name":"authorizedCreateTokens","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"finishMinting","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_exchangeRate","type":"address"}],"name":"setExchangeRate","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"retrieveTokens","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"totalAltDeposits","type":"uint256"}],"name":"setAltDeposit","outputs":[],"payable":false,"type":"function"},{"constant":!1,"inputs":[{"name":"victim","type":"address"},{"name":"amount","type":"uint256"}],"name":"burnTokens","outputs":[],"payable":!1,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"start","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"recipient","type":"address"}],"name":"createTokens","outputs":[],"payable":true,"type":"function"},{"constant":false,"inputs":[{"name":"_addr","type":"address"}],"name":"addAuthorized","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"multisigVault","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_hardcap","type":"uint256"}],"name":"setHardCap","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_start","type":"uint256"}],"name":"setStart","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"token","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_addr","type":"address"}],"name":"isAuthorized","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"payable":true,"type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"recipient","type":"address"},{"indexed":false,"name":"ether_amount","type":"uint256"},{"indexed":false,"name":"pay_amount","type":"uint256"},{"indexed":false,"name":"exchangerate","type":"uint256"}],"name":"TokenSold","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"recipient","type":"address"},{"indexed":false,"name":"pay_amount","type":"uint256"}],"name":"AuthorizedCreate","type":"event"},{"anonymous":false,"inputs":[],"name":"MainSaleClosed","type":"event"}]
 */
contract MainSale is Ownable, Authorizable {
    using SafeMath for uint;
    event TokenSold(address recipient, uint ether_amount, uint pay_amount, uint exchangerate);
    event AuthorizedCreate(address recipient, uint pay_amount);
    event AuthorizedBurn(address receiver, uint value);
    event AuthorizedStartTrading();
    event MainSaleClosed();
    CBCToken public token = new CBCToken();

    address public multisigVault;

    uint hardcap = 100000000000000 ether;
    ExchangeRate public exchangeRate;

    uint public altDeposits = 0;
    uint public start = 1525996800;

    /**
     * @dev modifier to allow token creation only when the sale IS ON
     */
    modifier saleIsOn() {
        require(now > start && now < start + 28 days);
        _;
    }

    /**
     * @dev modifier to allow token creation only when the hardcap has not been reached
     */
    modifier isUnderHardCap() {
        require(multisigVault.balance + altDeposits <= hardcap);
        _;
    }

    /**
     * @dev Allows anyone to create tokens by depositing ether.
     * @param recipient the recipient to receive tokens.
     */
    function createTokens(address recipient) public isUnderHardCap saleIsOn payable {
        uint rate = exchangeRate.getRate("ETH");
        uint tokens = rate.mul(msg.value).div(1 ether);
        token.mint(recipient, tokens);
        require(multisigVault.send(msg.value));
        TokenSold(recipient, msg.value, tokens, rate);
    }

    /**
     * @dev Allows to set the toal alt deposit measured in ETH to make sure the hardcap includes other deposits
     * @param totalAltDeposits total amount ETH equivalent
     */
    function setAltDeposit(uint totalAltDeposits) public onlyOwner {
        altDeposits = totalAltDeposits;
    }

    /**
     * @dev Allows authorized acces to create tokens. This is used for Bitcoin and ERC20 deposits
     * @param recipient the recipient to receive tokens.
     * @param tokens number of tokens to be created.
     */
    function authorizedCreateTokens(address recipient, uint tokens) public onlyAuthorized {
        token.mint(recipient, tokens);
        AuthorizedCreate(recipient, tokens);
    }

    function authorizedStartTrading() public onlyAuthorized {
        token.startTrading();
        AuthorizedStartTrading();
    }

    /**
     * @dev Allows authorized acces to burn tokens.
     * @param receiver the receiver to receive tokens.
     * @param value number of tokens to be created.
     */
    function authorizedBurnTokens(address receiver, uint value) public onlyAuthorized {
        token.burn(receiver, value);
        AuthorizedBurn(receiver, value);
    }

    /**
     * @dev Allows the owner to set the hardcap.
     * @param _hardcap the new hardcap
     */
    function setHardCap(uint _hardcap) public onlyOwner {
        hardcap = _hardcap;
    }

    /**
     * @dev Allows the owner to set the starting time.
     * @param _start the new _start
     */
    function setStart(uint _start) public onlyOwner {
        start = _start;
    }

    /**
     * @dev Allows the owner to set the multisig contract.
     * @param _multisigVault the multisig contract address
     */
    function setMultisigVault(address _multisigVault) public onlyOwner {
        if (_multisigVault != address(0)) {
            multisigVault = _multisigVault;
        }
    }

    /**
     * @dev Allows the owner to set the exchangerate contract.
     * @param _exchangeRate the exchangerate address
     */
    function setExchangeRate(address _exchangeRate) public onlyOwner {
        exchangeRate = ExchangeRate(_exchangeRate);
    }

    /**
     * @dev Allows the owner to finish the minting. This will create the
     * restricted tokens and then close the minting.
     * Then the ownership of the PAY token contract is transfered
     * to this owner.
     */
    function finishMinting() public onlyOwner {
        uint issuedTokenSupply = token.totalSupply();
        uint restrictedTokens = issuedTokenSupply.mul(49).div(51);
        token.mint(multisigVault, restrictedTokens);
        token.finishMinting();
        token.transferOwnership(owner);
        MainSaleClosed();
    }

    /**
     * @dev Allows the owner to transfer ERC20 tokens to the multi sig vault
     * @param _token the contract address of the ERC20 contract
     */
    function retrieveTokens(address _token) public onlyOwner {
        ERC20 token = ERC20(_token);
        token.transfer(multisigVault, token.balanceOf(this));
    }

    /**
     * @dev Fallback function which receives ether and created the appropriate number of tokens for the
     * msg.sender.
     */
    function() external payable {
        createTokens(msg.sender);
    }

}

/**
* It is insurance smart-contract for the SmartContractBank.
* You can buy insurance for 0.1 ETH and if you do not take 100% profit when balance of
* the SmartContractBank will be lesser then 0.01 you can receive part of insurance fund depend on your not received money.
*
* To buy insurance:
* Send to the contract address 0.01 ETH, and you will be accounted to.
*
* To receive insurance payout:
* Send to the contract address 0 ETH, and you will receive part of insurance depend on your not received money.
* If you already received 100% from your deposit, you will take error.
*/
contract InsuranceFund {
    using SafeMath for uint256;

    /**
    * @dev Structure for evaluating payout
    * @param deposit Duplicated from SmartContractBank deposit
    * @param withdrawals Duplicated from SmartContractBank withdrawals
    * @param insured Flag for available payout
    */
    struct Investor {
        uint256 deposit;
        uint256 withdrawals;
        bool insured;
    }
    mapping (address => Investor) public investors;
    uint public countOfInvestors;

    bool public startOfPayments = false;
    uint256 public totalSupply;

    uint256 public totalNotReceived;
    address public SCBAddress;

    SmartContractBank SCBContract;

    event Paid(address investor, uint256 amount, uint256  notRecieve, uint256  partOfNotReceived);
    event SetInfo(address investor, uint256  notRecieve, uint256 deposit, uint256 withdrawals);

    /**
    * @dev  Modifier for access from the SmartContractBank
    */
    modifier onlySCB() {
        require(msg.sender == SCBAddress, "access denied");
        _;
    }

    /**
    * @dev  Setter the SmartContractBank address. Address can be set only once.
    * @param _SCBAddress Address of the SmartContractBank
    */
    function setSCBAddress(address _SCBAddress) public {
        require(SCBAddress == address(0x0));
        SCBAddress = _SCBAddress;
        SCBContract = SmartContractBank(SCBAddress);
    }

    /**
    * @dev  Private setter info about investor. Can be call if payouts not started.
    * Needing for evaluating not received total amount without loops.
    * @param _address Investor's address
    * @param _address Investor's deposit
    * @param _address Investor's withdrawals
    */
    function privateSetInfo(address _address, uint256 deposit, uint256 withdrawals) private{
        if (!startOfPayments) {
            Investor storage investor = investors[_address];

            if (investor.deposit != deposit){
                totalNotReceived = totalNotReceived.add(deposit.sub(investor.deposit));
                investor.deposit = deposit;
            }

            if (investor.withdrawals != withdrawals){
                uint256 different;
                if (deposit <= withdrawals){
                    different = deposit.sub(withdrawals);
                    if (totalNotReceived >= different)
                        totalNotReceived = totalNotReceived.sub(different);
                    else
                        totalNotReceived = 0;
                } else {
                    different = withdrawals.sub(investor.withdrawals);
                    if (totalNotReceived >= different)
                        totalNotReceived = totalNotReceived.sub(different);
                    else
                        totalNotReceived = 0;
                }
                investor.withdrawals = withdrawals;
            }

            emit SetInfo(_address, totalNotReceived, investor.deposit, investor.withdrawals);
        }
    }

    /**
    * @dev  Setter info about investor from the SmartContractBank.
    * @param _address Investor's address
    * @param _address Investor's deposit
    * @param _address Investor's withdrawals
    */
    function setInfo(address _address, uint256 deposit, uint256 withdrawals) public onlySCB {
        privateSetInfo(_address, deposit, withdrawals);
    }

    /**
    * @dev  Delete insured from the SmartContractBank.
    * @param _address Investor's address
    */
    function deleteInsured(address _address) public onlySCB {
        Investor storage investor = investors[_address];
        investor.deposit = 0;
        investor.withdrawals = 0;
        investor.insured = false;
        countOfInvestors--;
    }

    /**
    * @dev  Function for starting payouts and stopping receive funds.
    */
    function beginOfPayments() public {
        require(address(SCBAddress).balance < 0.1 ether && !startOfPayments);
        startOfPayments = true;
        totalSupply = address(this).balance;
    }

    /**
    * @dev  Payable function for receive funds, buying insurance and receive insurance payouts .
    */
    function () external payable {
        Investor storage investor = investors[msg.sender];
        if (msg.value > 0 ether){
            require(!startOfPayments);
            if (msg.sender != SCBAddress && msg.value >= 0.1 ether) {
                uint256 deposit;
                uint256 withdrawals;
                (deposit, withdrawals, investor.insured) = SCBContract.setInsured(msg.sender);
                countOfInvestors++;
                privateSetInfo(msg.sender, deposit, withdrawals);
            }
        } else if (msg.value == 0){
            uint256 notReceived = investor.deposit.sub(investor.withdrawals);
            uint256 partOfNotReceived = notReceived.mul(100).div(totalNotReceived);
            uint256 payAmount = totalSupply.div(100).mul(partOfNotReceived);
            require(startOfPayments && investor.insured && notReceived > 0);
            investor.insured = false;
            msg.sender.transfer(payAmount);
            emit Paid(msg.sender, payAmount, notReceived, partOfNotReceived);
        }
    }
}

Contract ABI
[{"constant":false,"inputs":[],"name":"closeEntrance","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getPhasePercent","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"increasePercent","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_address","type":"address"}],"name":"setInsured","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"MainSaleAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_address","type":"address"}],"name":"getUserBalance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"minimum","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_insuranceFundAddress","type":"address"}],"name":"setInsuranceFundAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"closed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"investors","outputs":[{"name":"deposit","type":"uint256"},{"name":"paymentTime","type":"uint256"},{"name":"withdrawals","type":"uint256"},{"name":"increasedPercent","type":"bool"},{"name":"insured","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CBCTokenAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ownerAddressTwo","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ownerAddressOne","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"promotionAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"insuranceFundAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"countOfInvestors","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"investor","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"Invest","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"investor","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"investor","type":"address"}],"name":"UserDelete","type":"event"}]

Contract Creation Code
6080604052662386f26fc10000600290815561012c60035560048055600860058190556006919091556007805474ab5007407d8a686b9198079816ebbaaa2912ecc100600160a860020a03199091161790558054600160a060020a0319908116734a5b00cddaee928b8de7a7939545f372d6727c0617909155600980548216733878e2231f7ca61c0c1d0aa3e6962d7d23df1b3b179055600b8054821673790bfacae71576107c068f494c8a6302aea640cb1790819055600c8054831673369fc7de8aee87a167244eb10b87eb30057808721790819055600e80548416600160a060020a03938416179055600f8054909316911617905534801561010257600080fd5b50610df1806101126000396000f3006080604052600436106100e55763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631ab09fd581146102585780631c729b091461026f57806325a2b5751461029657806329dc4928146102ab5780633c813530146102ec578063477348921461031d57806352d6804d1461033e5780635668577014610353578063597e1fb5146103745780636f7bc9be1461039d5780636fb54797146103ed5780638fe5ead11461040257806397670a3914610417578063b54ba9d91461042c578063e7c398f514610441578063f3f7d63314610456575b60075460009060ff16156100f857600080fd5b5033600090815260016020526040902060025434106102325761011961046b565b8054151561012b576000805460010190555b805461013d903463ffffffff6106fb16565b81554260018201556003810154610100900460ff16156101eb57600d5481546002830154604080517ff9bb86870000000000000000000000000000000000000000000000000000000081523360048201526024810193909352604483019190915251600160a060020a039092169163f9bb86879160648082019260009290919082900301818387803b1580156101d257600080fd5b505af11580156101e6573d6000803e3d6000fd5b505050505b6101f3610713565b6040805133815234602082015281517fd90d253a9de34d2fdd5a75ae49ea17fcb43af32fc8ea08cc6d2341991dd3872e929181900390910190a1610255565b34655af3107a4000141561024d576102486108a0565b610255565b61025561046b565b50005b34801561026457600080fd5b5061026d6109ee565b005b34801561027b57600080fd5b50610284610a23565b60408051918252519081900360200190f35b3480156102a257600080fd5b5061026d6108a0565b3480156102b757600080fd5b506102cc600160a060020a0360043516610b2e565b604080519384526020840192909252151582820152519081900360600190f35b3480156102f857600080fd5b50610301610bf2565b60408051600160a060020a039092168252519081900360200190f35b34801561032957600080fd5b50610284600160a060020a0360043516610c01565b34801561034a57600080fd5b50610284610c84565b34801561035f57600080fd5b5061026d600160a060020a0360043516610c8a565b34801561038057600080fd5b50610389610cdc565b604080519115158252519081900360200190f35b3480156103a957600080fd5b506103be600160a060020a0360043516610ce5565b604080519586526020860194909452848401929092521515606084015215156080830152519081900360a00190f35b3480156103f957600080fd5b50610301610d19565b34801561040e57600080fd5b50610301610d28565b34801561042357600080fd5b50610301610d37565b34801561043857600080fd5b50610301610d4b565b34801561044d57600080fd5b50610301610d5a565b34801561046257600080fd5b50610284610d69565b33600081815260016020526040812091819061048690610c01565b91506000836000015411801561049c5750303182105b80156104a85750600082115b156106f6575060028201546104c3818363ffffffff6106fb16565b60028085019190915542600185015583546104e39163ffffffff610d6f16565b6002840154106105da576000808455600184018190556002840181905560038401805461ffff1916815581546000190190915554610100900460ff16156105a257600d54604080517f40a1bad60000000000000000000000000000000000000000000000000000000081523360048201529051600160a060020a03909216916340a1bad69160248082019260009290919082900301818387803b15801561058957600080fd5b505af115801561059d573d6000803e3d6000fd5b505050505b6040805133815290517f4735ab4590702f37dab0350e961fbfa30c5c66cda49f02be5d26e7dc5390c4a89181900360200190a161068c565b6003830154610100900460ff1680156105f35750825481105b1561068c57600d5483546002850154604080517ff9bb86870000000000000000000000000000000000000000000000000000000081523360048201526024810193909352604483019190915251600160a060020a039092169163f9bb86879160648082019260009290919082900301818387803b15801561067357600080fd5b505af1158015610687573d6000803e3d6000fd5b505050505b604051339083156108fc029084906000818181858888f193505050501580156106b9573d6000803e3d6000fd5b50604080513381526020810184905281517f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364929181900390910190a15b505050565b600082820161070c84821015610d8e565b9392505050565b600760019054906101000a9004600160a060020a0316600160a060020a03166108fc61076c60646107606107536002600454610d9a90919063ffffffff16565b349063ffffffff610d6f16565b9063ffffffff610d9a16565b6040518115909202916000818181858888f19350505050158015610794573d6000803e3d6000fd5b50600854600454600160a060020a03909116906108fc906107c7906064906107609061075390600263ffffffff610d9a16565b6040518115909202916000818181858888f193505050501580156107ef573d6000803e3d6000fd5b50600954600554600160a060020a03909116906108fc9061081e9060649061076090349063ffffffff610d6f16565b6040518115909202916000818181858888f19350505050158015610846573d6000803e3d6000fd5b50600a54600654600160a060020a03909116906108fc906108759060649061076090349063ffffffff610d6f16565b6040518115909202916000818181858888f1935050505015801561089d573d6000803e3d6000fd5b50565b336000818152600160209081526040808320600e5482517f70a08231000000000000000000000000000000000000000000000000000000008152600481019690965291519094678ac7230489e8000094600160a060020a03909316936370a082319360248084019492938390030190829087803b15801561092057600080fd5b505af1158015610934573d6000803e3d6000fd5b505050506040513d602081101561094a57600080fd5b50511061089d57600f54604080517f0142d7b4000000000000000000000000000000000000000000000000000000008152336004820152678ac7230489e8000060248201529051600160a060020a0390921691630142d7b49160448082019260009290919082900301818387803b1580156109c457600080fd5b505af11580156109d8573d6000803e3d6000fd5b50505060038201805460ff191660011790555050565b67016345785d8a00003031108015610a09575060075460ff16155b1515610a1457600080fd5b6007805460ff19166001179055565b33600090815260016020526040812030318268056bc75e2d63100000821015610a4a575060285b68056bc75e2d631000008210158015610a6b5750682086ac35105260000082105b15610a74575060145b682086ac3510526000008210158015610a955750683635c9adc5dea0000082105b15610a9e5750600a5b683635c9adc5dea000008210158015610abf575068a2a15d09519be0000082105b15610ac8575060095b68a2a15d09519be000008210158015610aea575069010f0cf064dd5920000082105b15610af3575060085b69010f0cf064dd592000008210610b08575060075b600383015460ff161561070c57610b2681600563ffffffff6106fb16565b949350505050565b600a54600090819081908190600160a060020a03163314610bb057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f6163636573732064656e69656400000000000000000000000000000000000000604482015290519081900360640190fd5b50505050600160a060020a0316600090815260016020526040902060038101805461ff0019166101009081179182905582546002909301549293910460ff1690565b600c54600160a060020a031681565b600160a060020a038116600090815260016020526040812081808080610c25610a23565b9350610c44600354610760876001015442610db190919063ffffffff16565b8554909350610c61906103e890610760908763ffffffff610d6f16565b9150610c79610120610760848663ffffffff610d6f16565b979650505050505050565b60025481565b600a54600160a060020a031615610ca057600080fd5b600a805473ffffffffffffffffffffffffffffffffffffffff19908116600160a060020a039384161791829055600d8054929093169116179055565b60075460ff1681565b6001602081905260009182526040909120805491810154600282015460039092015490919060ff8082169161010090041685565b600b54600160a060020a031681565b600854600160a060020a031681565b6007546101009004600160a060020a031681565b600954600160a060020a031681565b600a54600160a060020a031681565b60005481565b600082820261070c841580610d8e5750838583811515610d8b57fe5b04145b80151561089d57600080fd5b6000808284811515610da857fe5b04949350505050565b6000610dbf83831115610d8e565b509003905600a165627a7a72305820660de5bd0ae644e80e295d640674f967dd57b90488da4da15502168bd743e1000029


   Swarm Source:
bzzr://660de5bd0ae644e80e295d640674f967dd57b90488da4da15502168bd743e100
Block Age transaction Difficulty GasUsed Reward
Block Age Uncle Number Difficulty GasUsed Reward
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.