contract NOLLYCOIN is BasicToken {

    using SafeMath for uint256;

    string public name = "Nolly Coin";                        //name of the token
    string public symbol = "NOLLY";                                // symbol of the token
    uint8 public decimals = 18;                                  // decimals
    uint256 public totalSupply = 500000000 * 10 ** 18;             // total supply of NOLLY Tokens  

    // variables
    uint256 public reservedForFounders;              // fund allocated to key founder 
    uint256 public bountiesAllocation;                  // fund allocated for bounty
    uint256 public affiliatesAllocation;                  // fund allocated to affiliates 
    uint256 public totalAllocatedTokens;                // variable to keep track of funds allocated
    uint256 public tokensAllocatedToCrowdFund;          // funds allocated to crowdfund



    // addresses
    // multi sign address of founders which hold 
    address public founderMultiSigAddress =    0x59b645EB51B1e47e45F14A56F271030182393Efd;
    address public bountiesAllocAddress = 0x6C2625A8b19c7Bfa88d1420120DE45A60dCD6e28;  //CHANGE THIS
    address public affiliatesAllocAddress = 0x0f0345699Afa5EE03d2B089A5aF73C405885B592;  //CHANGE THIS
    address public crowdFundAddress;                    // address of crowdfund contract   
    address public owner;                               // owner of the contract
    
    


    //events
    event ChangeFoundersWalletAddress(uint256  _blockTimeStamp, address indexed _foundersWalletAddress);

    //modifiers
    modifier onlyCrowdFundAddress() {
        require(msg.sender == crowdFundAddress);
        _;
    }

    modifier nonZeroAddress(address _to) {
        require(_to != 0x0);
        _;
    }

    modifier onlyFounders() {
        require(msg.sender == founderMultiSigAddress);
        _;
    }



    // creation of the token contract 
    function NOLLYCOIN(address _crowdFundAddress) {
        owner = msg.sender;
        crowdFundAddress = _crowdFundAddress;


        // Token Distribution         
        reservedForFounders        = 97500000 * 10 ** 18;           // 97,500,000 [19.50%]
        tokensAllocatedToCrowdFund = 300000000 * 10 ** 18;      // 300,000,000NOLLY [50%]
        // tokensAllocatedToPreICO    = 50000000 * 10 ** 18;       // 50,000,000 [10%]
        affiliatesAllocation =       25000000 * 10 ** 18;               // 25, 000, 000[5.0 %]
        bountiesAllocation         = 27750000 * 10 ** 18;               // 27,750,000[5.5%] 
                                                


        // Assigned balances to respective stakeholders
        balances[founderMultiSigAddress] = reservedForFounders;
        balances[affiliatesAllocAddress] = affiliatesAllocation;
        balances[crowdFundAddress] = tokensAllocatedToCrowdFund;
        balances[bountiesAllocAddress] = bountiesAllocation;
        totalAllocatedTokens = balances[founderMultiSigAddress] + balances[affiliatesAllocAddress] + balances[bountiesAllocAddress];
    }


    // function to keep track of the total token allocation
    function changeTotalSupply(uint256 _amount) onlyCrowdFundAddress {
        totalAllocatedTokens += _amount;
    }

    // function to change founder multisig wallet address            
    function changeFounderMultiSigAddress(address _newFounderMultiSigAddress) onlyFounders nonZeroAddress(_newFounderMultiSigAddress) {
        founderMultiSigAddress = _newFounderMultiSigAddress;
        ChangeFoundersWalletAddress(now, founderMultiSigAddress);
    }


    // fallback function to restrict direct sending of ether
    function () {
        revert();
    }

}
function changeFounderMultiSigAddress(address _newFounderMultiSigAddress) onlyFounders nonZeroAddress(_newFounderMultiSigAddress) {
        founderMultiSigAddress = _newFounderMultiSigAddress;
        ChangeFoundersWalletAddress(now, founderMultiSigAddress);
    }
// function to change founder multisig wallet address            