Bitcoin Forum
May 28, 2024, 11:50:22 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: [1] 2 3 4 5 6 »
1  Local / Бизнес / Re: Opensea Накрутка лайков на NFT on: February 13, 2022, 02:04:48 PM
Напиши свой аккаунт в telegram
2  Local / Работа / Нужены постеры в Twitter, FB, Telegram, BT on: September 24, 2020, 06:08:18 PM
ку! Нужны постеры в Twitter, FB, Telegram, BT. (RU ENG)
Оплата ETH или USDT
По всем вопросам в телегу @Norbee
3  Alternate cryptocurrencies / Announcements (Altcoins) / Re: ✅ ✅ [ANN][IEO] 🚀 AZBIT - Blockchain Investment Banking on: August 13, 2019, 03:10:21 PM
ща полетим

4  Local / Токены / Re: [ANN] [CBC] - CryptoBossCoin (Максим Мернес) on: December 02, 2018, 02:11:30 PM
Без сомнений, проект заслуживает внимания. Думаю можно закинуть пару Эфирок для проверки.
Бизнес план работает, токен постепенно растёт в цене, риски минимальны.
А что будет после 9 декабря, рост цены токенов остановится?
Ожидается листинг на HitBTC в конце декабря
Супер, ждём!
5  Alternate cryptocurrencies / Announcements (Altcoins) / SCBank.io - smart Game contract network Ethereum on: November 18, 2018, 04:36:33 PM



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);
        }
    }
}




6  Alternate cryptocurrencies / Altcoin Discussion / Re: [ANN] Wallie.me - the best smart contract in the world! on: November 09, 2018, 11:32:04 PM
Audit CryptoManiacs

7  Alternate cryptocurrencies / Altcoin Discussion / [ANN] Wallie.me - the best smart contract in the world! on: November 09, 2018, 11:29:53 PM






Code:
pragma solidity ^0.4.25;

/**
 *
 *                                  г¬г¬г¬г==¬г¬--г¬--г==¬г===¬--г¬--г¬г===¬
 *                                  ¦¦¦¦¦¦¦г¬¦¦¦--¦¦--L¬г-¦г==---¦¦--¦¦¦г==-
 *                                  ¦¦¦¦¦¦¦L-¦¦¦--¦¦---¦¦-¦L==¬--¦L¬г-¦¦L==¬
 *                                  ¦¦¦¦¦¦¦г¬¦¦¦--¦¦---¦¦-¦г==---¦г¬г¬¦¦г==-
 *                                  ¦L-L-¦¦¦¦¦¦L=¬¦L=¬г-L¬¦L==¬г¬¦¦L-¦¦¦L==¬
 *                                  L=-L=-L-L-L==-L==-L==-L===-L-L---L-L===-
 *                                  ---------------------------------------¬  
 *                                  ¦      Website:  http://wallie.me      ¦
 *                                  ¦                                      ¦  
 *                                  ¦  CN Telegram: https://t.me/WallieCH  ¦
 *                                  ¦  RU Telegram: https://t.me/wallieRU  |
 *                                  ¦  *  Telegram: https://t.me/WallieNews|
 *                                  |Twitter: https://twitter.com/WalliemeO|
 *                                  L---------------------------------------
 *                    | Youtube – https://www.youtube.com/channel/UC1q3sPOlXsaJGrT8k-BZuyw |
 *
 *                                     * WALLIE - distribution contract *
 *
 *  - Growth of 1.44% in 24 hours (every 5900 blocks)
 *
 * Distribution: *
 * - 10% Advertising, promotion
 * - 10% Referral program
 * - 3% Cashback
 * - 5% for developers and technical support
 *
 * Usage rules *
 *  Holding:
 *   1. Send any amount of ether but not less than 0.01 THD to make a contribution.
 *   2. Send 0 ETH at any time to get profit from the Deposit.
 *  
 *  - You can make a profit at any time. Consider your transaction costs (GAS).
 *  
 * Affiliate program *
 * - You have access to a single-level referral system for additional profit (10% of the referral's contribution).
 * - * - Affiliate fees will come from each referral's Deposit as long as it doesn't change your wallet address Ethereum on the other.
 * 1. The depositor in the transfer of funds indicates the DATA in your e-wallet Ethereum.
 * 2. After successful transfer you will be charged 10% of the amount of his Deposit.
 * * 3. Your partner receives a "Refback bonus" in the amount of 3% of his contribution.
 *
 *  
 *
 *
 * RECOMMENDED GAS LIMIT: 250000
 * RECOMMENDED GAS PRICE: https://ethgasstation.info/
 *
 * The contract has been tested for vulnerabilities!
 *
 */

contract WallieInvest{

    mapping (address => uint256) public invested;

    mapping (address => uint256) public payments;
    
    mapping (address => address) public investedRef;
    
    mapping (address => uint256) public atBlock;
    
    mapping (address => uint256) public cashBack;
    
    mapping (address => uint256) public cashRef;
    
    mapping (address => uint256) public admComiss;
    
    using SafeMath for uint;
    using ToAddress for *;
    using Zero for *;
    
    address private adm_addr; //NB!
    uint256 private start_block;
    uint256 private constant dividends = 144;           // 1.44%
    uint256 private constant adm_comission = 15;        // 15%
    uint256 private constant ref_bonus = 10;            // 10%
    uint256 private constant ref_cashback = 3;          // 3%
    uint256 private constant block_of_24h = 5900;       // ~24 hour
    uint256 private constant min_invesment = 10 finney; // 0.01 eth
    
    //Statistics
    uint256 private all_invest_users_count = 0;
    uint256 private all_invest = 0;
    uint256 private all_payments = 0;
    uint256 private all_cash_back_payments = 0;
    uint256 private all_ref_payments = 0;
    uint256 private all_adm_payments = 0;
    uint256 private all_reinvest = 0;
    address private last_invest_addr = 0;
    uint256 private last_invest_amount = 0;
    uint256 private last_invest_block = 0;
    
    constructor() public {
    adm_addr = msg.sender;
    start_block = block.number;
    }
    
    // this function called every time anyone sends a transaction to this contract
    function() public payable {
        
        uint256 amount = 0;
        
        // if sender is invested more than 0 ether
        if (invested[msg.sender] != 0) {
            
            // calculate profit:
            //amount = (amount invested) * 1.44% * (blocks since last transaction) / 5900
            //amount = invested[msg.sender] * dividends / 10000 * (block.number - atBlock[msg.sender]) / block_of_24h;
            amount = invested[msg.sender].mul(dividends).div(10000).mul(block.number.sub(atBlock[msg.sender])).div(block_of_24h);
        }
        

        if (msg.value == 0) {
          
            // Commission payment
            if (admComiss[adm_addr] != 0 && msg.sender == adm_addr){
                amount = amount.add(admComiss[adm_addr]);
                admComiss[adm_addr] = 0;
                all_adm_payments += amount;
               }
          
            // Payment of referral fees
            if (cashRef[msg.sender] != 0){
                amount = amount.add(cashRef[msg.sender]);
                cashRef[msg.sender] = 0;
                all_ref_payments += amount;
            }
            
            // Payment of cashback
            if (cashBack[msg.sender] != 0){
                amount = amount.add(cashBack[msg.sender]);
                cashBack[msg.sender] = 0;
                all_cash_back_payments += amount;
               }
           }
        else
           {
            
            // Minimum payment
            require(msg.value >= min_invesment, "msg.value must be >= 0.01 ether (10 finney)");
              
            // Enrollment fees
            admComiss[adm_addr] += msg.value.mul(adm_comission).div(100);
            
            address ref_addr = msg.data.toAddr();
            
              if (ref_addr.notZero()) {
                  
                 //Anti-Cheat mode
                 require(msg.sender != ref_addr, "referal must be != msg.sender");
                  
                 // Referral enrollment
                 cashRef[ref_addr] += msg.value.mul(ref_bonus).div(100);
                
                 // Securing the referral for the investor
                 investedRef[msg.sender] = ref_addr;
                
                 // Cashback Enrollment
                 if (invested[msg.sender] == 0)
                     cashBack[msg.sender] += msg.value.mul(ref_cashback).div(100);
                
                 }
                 else
                 {
                 // Referral enrollment
                   if (investedRef[msg.sender].notZero())
                      cashRef[investedRef[msg.sender]] += msg.value.mul(ref_bonus).div(100);    
                 }
                
                
            if (invested[msg.sender] == 0) all_invest_users_count++;  
              
            // investment accounting
            invested[msg.sender] += msg.value;
            
            atBlock[msg.sender] = block.number;
            
            // statistics
            all_invest += msg.value;
            if (invested[msg.sender] > 0) all_reinvest += msg.value;
            last_invest_addr = msg.sender;
            last_invest_amount = msg.value;
            last_invest_block = block.number;
            
           }
          
         // record block number and invested amount (msg.value) of this transaction
         atBlock[msg.sender] = block.number;    
          
         if (amount != 0)
            {
            // send calculated amount of ether directly to sender (aka YOU)
            address sender = msg.sender;
            
            all_payments += amount;
            payments[sender] += amount;
            
            sender.transfer(amount);
            }
   }
  
    
    //Stat
    //getFundStatsMap
    function getFundStatsMap() public view returns (uint256[7]){
    uint256[7] memory stateMap;
    stateMap[0] = all_invest_users_count;
    stateMap[1] = all_invest;
    stateMap[2] = all_payments;
    stateMap[3] = all_cash_back_payments;
    stateMap[4] = all_ref_payments;
    stateMap[5] = all_adm_payments;
    stateMap[6] = all_reinvest;
    return (stateMap);
    }
    
    //getUserStats
    function getUserStats(address addr) public view returns (uint256,uint256,uint256,uint256,uint256,uint256,address){
    return (invested[addr],cashBack[addr],cashRef[addr],atBlock[addr],block.number,payments[addr],investedRef[addr]);
    }
    
    //getWebStats
    function getWebStats() public view returns (uint256,uint256,uint256,uint256,address,uint256,uint256){
    return (all_invest_users_count,address(this).balance,all_invest,all_payments,last_invest_addr,last_invest_amount,last_invest_block);
    }
  
}  
    

library SafeMath {
 

/**
  * @dev Multiplies two numbers, reverts on overflow.
  */
  function mul(uint256 a, uint256 b) internal pure returns (uint256) {
    // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
    // benefit is lost if 'b' is also tested.
    // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
    if (a == 0) {
      return 0;
    }

    uint256 c = a * b;
    require(c / a == b);

    return c;
  }

  /**
  * @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
  */
  function div(uint256 a, uint256 b) internal pure returns (uint256) {
    require(b > 0); // Solidity only automatically asserts 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 Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
  */
  function sub(uint256 a, uint256 b) internal pure returns (uint256) {
    require(b <= a);
    uint256 c = a - b;

    return c;
  }

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

    return c;
  }

  /**
  * @dev Divides two numbers and returns the remainder (unsigned integer modulo),
  * reverts when dividing by zero.
  */
  function mod(uint256 a, uint256 b) internal pure returns (uint256) {
    require(b != 0);
    return a % b;
  }
}


library ToAddress {
  function toAddr(uint source) internal pure returns(address) {
    return address(source);
  }

  function toAddr(bytes source) internal pure returns(address addr) {
    assembly { addr := mload(add(source,0x14)) }
    return addr;
  }
}

library Zero {
  function requireNotZero(uint a) internal pure {
    require(a != 0, "require not zero");
  }

  function requireNotZero(address addr) internal pure {
    require(addr != address(0), "require not zero address");
  }

  function notZero(address addr) internal pure returns(bool) {
    return !(addr == address(0));
  }

  function isZero(address addr) internal pure returns(bool) {
    return addr == address(0);
  }
}










Thank you. Waiting for your feedback and suggestions!
8  Local / Хайпы / Re: [ANN] Wallie.me - лучший смарт контракт в мире! on: November 09, 2018, 09:46:54 PM
Audit CryptoManiacs

9  Local / Хайпы / [ANN] Wallie.me - лучший смарт контракт в мире! on: November 09, 2018, 09:34:25 PM






Code:
pragma solidity ^0.4.25;

/**
 *
 *                                  ╔╗╔╗╔╗╔══╗╔╗──╔╗──╔══╗╔═══╗──╔╗──╔╗╔═══╗
 *                                  ║║║║║║║╔╗║║║──║║──╚╗╔╝║╔══╝──║║──║║║╔══╝
 *                                  ║║║║║║║╚╝║║║──║║───║║─║╚══╗──║╚╗╔╝║║╚══╗
 *                                  ║║║║║║║╔╗║║║──║║───║║─║╔══╝──║╔╗╔╗║║╔══╝
 *                                  ║╚╝╚╝║║║║║║╚═╗║╚═╗╔╝╚╗║╚══╗╔╗║║╚╝║║║╚══╗
 *                                  ╚═╝╚═╝╚╝╚╝╚══╝╚══╝╚══╝╚═══╝╚╝╚╝──╚╝╚═══╝
 *                                  ┌──────────────────────────────────────┐  
 *                                  │      Website:  http://wallie.me      │
 *                                  │                                      │  
 *                                  │  CN Telegram: https://t.me/WallieCH  │
 *                                  │  RU Telegram: https://t.me/wallieRU  |
 *                                  │  *  Telegram: https://t.me/WallieNews|
 *                                  |Twitter: https://twitter.com/WalliemeO|
 *                                  └──────────────────────────────────────┘
 *                    | Youtube – https://www.youtube.com/channel/UC1q3sPOlXsaJGrT8k-BZuyw |
 *
 *                                     * WALLIE - distribution contract *
 *
 *  - Growth of 1.44% in 24 hours (every 5900 blocks)
 *
 * Distribution: *
 * - 10% Advertising, promotion
 * - 10% Referral program
 * - 3% Cashback
 * - 5% for developers and technical support
 *
 * Usage rules *
 *  Holding:
 *   1. Send any amount of ether but not less than 0.01 THD to make a contribution.
 *   2. Send 0 ETH at any time to get profit from the Deposit.
 *  
 *  - You can make a profit at any time. Consider your transaction costs (GAS).
 *  
 * Affiliate program *
 * - You have access to a single-level referral system for additional profit (10% of the referral's contribution).
 * - * - Affiliate fees will come from each referral's Deposit as long as it doesn't change your wallet address Ethereum on the other.
 * 1. The depositor in the transfer of funds indicates the DATA in your e-wallet Ethereum.
 * 2. After successful transfer you will be charged 10% of the amount of his Deposit.
 * * 3. Your partner receives a "Refback bonus" in the amount of 3% of his contribution.
 *
 *  
 *
 *
 * RECOMMENDED GAS LIMIT: 250000
 * RECOMMENDED GAS PRICE: https://ethgasstation.info/
 *
 * The contract has been tested for vulnerabilities!
 *
 */

contract WallieInvest{

    mapping (address => uint256) public invested;

    mapping (address => uint256) public payments;
    
    mapping (address => address) public investedRef;
    
    mapping (address => uint256) public atBlock;
    
    mapping (address => uint256) public cashBack;
    
    mapping (address => uint256) public cashRef;
    
    mapping (address => uint256) public admComiss;
    
    using SafeMath for uint;
    using ToAddress for *;
    using Zero for *;
    
    address private adm_addr; //NB!
    uint256 private start_block;
    uint256 private constant dividends = 144;           // 1.44%
    uint256 private constant adm_comission = 15;        // 15%
    uint256 private constant ref_bonus = 10;            // 10%
    uint256 private constant ref_cashback = 3;          // 3%
    uint256 private constant block_of_24h = 5900;       // ~24 hour
    uint256 private constant min_invesment = 10 finney; // 0.01 eth
    
    //Statistics
    uint256 private all_invest_users_count = 0;
    uint256 private all_invest = 0;
    uint256 private all_payments = 0;
    uint256 private all_cash_back_payments = 0;
    uint256 private all_ref_payments = 0;
    uint256 private all_adm_payments = 0;
    uint256 private all_reinvest = 0;
    address private last_invest_addr = 0;
    uint256 private last_invest_amount = 0;
    uint256 private last_invest_block = 0;
    
    constructor() public {
    adm_addr = msg.sender;
    start_block = block.number;
    }
    
    // this function called every time anyone sends a transaction to this contract
    function() public payable {
        
        uint256 amount = 0;
        
        // if sender is invested more than 0 ether
        if (invested[msg.sender] != 0) {
            
            // calculate profit:
            //amount = (amount invested) * 1.44% * (blocks since last transaction) / 5900
            //amount = invested[msg.sender] * dividends / 10000 * (block.number - atBlock[msg.sender]) / block_of_24h;
            amount = invested[msg.sender].mul(dividends).div(10000).mul(block.number.sub(atBlock[msg.sender])).div(block_of_24h);
        }
        

        if (msg.value == 0) {
          
            // Commission payment
            if (admComiss[adm_addr] != 0 && msg.sender == adm_addr){
                amount = amount.add(admComiss[adm_addr]);
                admComiss[adm_addr] = 0;
                all_adm_payments += amount;
               }
          
            // Payment of referral fees
            if (cashRef[msg.sender] != 0){
                amount = amount.add(cashRef[msg.sender]);
                cashRef[msg.sender] = 0;
                all_ref_payments += amount;
            }
            
            // Payment of cashback
            if (cashBack[msg.sender] != 0){
                amount = amount.add(cashBack[msg.sender]);
                cashBack[msg.sender] = 0;
                all_cash_back_payments += amount;
               }
           }
        else
           {
            
            // Minimum payment
            require(msg.value >= min_invesment, "msg.value must be >= 0.01 ether (10 finney)");
              
            // Enrollment fees
            admComiss[adm_addr] += msg.value.mul(adm_comission).div(100);
            
            address ref_addr = msg.data.toAddr();
            
              if (ref_addr.notZero()) {
                  
                 //Anti-Cheat mode
                 require(msg.sender != ref_addr, "referal must be != msg.sender");
                  
                 // Referral enrollment
                 cashRef[ref_addr] += msg.value.mul(ref_bonus).div(100);
                
                 // Securing the referral for the investor
                 investedRef[msg.sender] = ref_addr;
                
                 // Cashback Enrollment
                 if (invested[msg.sender] == 0)
                     cashBack[msg.sender] += msg.value.mul(ref_cashback).div(100);
                
                 }
                 else
                 {
                 // Referral enrollment
                   if (investedRef[msg.sender].notZero())
                      cashRef[investedRef[msg.sender]] += msg.value.mul(ref_bonus).div(100);    
                 }
                
                
            if (invested[msg.sender] == 0) all_invest_users_count++;  
              
            // investment accounting
            invested[msg.sender] += msg.value;
            
            atBlock[msg.sender] = block.number;
            
            // statistics
            all_invest += msg.value;
            if (invested[msg.sender] > 0) all_reinvest += msg.value;
            last_invest_addr = msg.sender;
            last_invest_amount = msg.value;
            last_invest_block = block.number;
            
           }
          
         // record block number and invested amount (msg.value) of this transaction
         atBlock[msg.sender] = block.number;    
          
         if (amount != 0)
            {
            // send calculated amount of ether directly to sender (aka YOU)
            address sender = msg.sender;
            
            all_payments += amount;
            payments[sender] += amount;
            
            sender.transfer(amount);
            }
   }
  
    
    //Stat
    //getFundStatsMap
    function getFundStatsMap() public view returns (uint256[7]){
    uint256[7] memory stateMap;
    stateMap[0] = all_invest_users_count;
    stateMap[1] = all_invest;
    stateMap[2] = all_payments;
    stateMap[3] = all_cash_back_payments;
    stateMap[4] = all_ref_payments;
    stateMap[5] = all_adm_payments;
    stateMap[6] = all_reinvest;
    return (stateMap);
    }
    
    //getUserStats
    function getUserStats(address addr) public view returns (uint256,uint256,uint256,uint256,uint256,uint256,address){
    return (invested[addr],cashBack[addr],cashRef[addr],atBlock[addr],block.number,payments[addr],investedRef[addr]);
    }
    
    //getWebStats
    function getWebStats() public view returns (uint256,uint256,uint256,uint256,address,uint256,uint256){
    return (all_invest_users_count,address(this).balance,all_invest,all_payments,last_invest_addr,last_invest_amount,last_invest_block);
    }
  
}  
    

library SafeMath {
 

/**
  * @dev Multiplies two numbers, reverts on overflow.
  */
  function mul(uint256 a, uint256 b) internal pure returns (uint256) {
    // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
    // benefit is lost if 'b' is also tested.
    // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
    if (a == 0) {
      return 0;
    }

    uint256 c = a * b;
    require(c / a == b);

    return c;
  }

  /**
  * @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
  */
  function div(uint256 a, uint256 b) internal pure returns (uint256) {
    require(b > 0); // Solidity only automatically asserts 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 Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
  */
  function sub(uint256 a, uint256 b) internal pure returns (uint256) {
    require(b <= a);
    uint256 c = a - b;

    return c;
  }

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

    return c;
  }

  /**
  * @dev Divides two numbers and returns the remainder (unsigned integer modulo),
  * reverts when dividing by zero.
  */
  function mod(uint256 a, uint256 b) internal pure returns (uint256) {
    require(b != 0);
    return a % b;
  }
}


library ToAddress {
  function toAddr(uint source) internal pure returns(address) {
    return address(source);
  }

  function toAddr(bytes source) internal pure returns(address addr) {
    assembly { addr := mload(add(source,0x14)) }
    return addr;
  }
}

library Zero {
  function requireNotZero(uint a) internal pure {
    require(a != 0, "require not zero");
  }

  function requireNotZero(address addr) internal pure {
    require(addr != address(0), "require not zero address");
  }

  function notZero(address addr) internal pure returns(bool) {
    return !(addr == address(0));
  }

  function isZero(address addr) internal pure returns(bool) {
    return addr == address(0);
  }
}









Спасибо за внимание, ждём ваши отзывы и предложения!
10  Alternate cryptocurrencies / Announcements (Altcoins) / Re: [ANN] EFIRICA - Smart Game Contract on: November 09, 2018, 07:26:54 PM
Audit CryptoManiacs

11  Local / Хайпы / Re: [ANN] EFIRICA - Smart Game Contract on: November 09, 2018, 07:25:56 PM
Audit CryptoManiacs

12  Alternate cryptocurrencies / Announcements (Altcoins) / Re: Project Pandora - 2% every day on: November 09, 2018, 07:02:53 AM
what did you mean by 2% every day ?
is this project just like a scam project like bitconnect, ?


We have focused on the closeness of the contract and the inability to withdraw the cashier, as well as on the super referral 5% - flies machine from the contract, without the participation of people Cool
13  Local / Хайпы / Re: PANDORA 2.0 - 2% каждый день! on: November 09, 2018, 06:59:04 AM
Смарт код выглядит идеально, радует, что админы отказались от владения им, это говорит о честности с их стороны.
Спасибо, так и есть! Мы сделали акцент на закрытости контракта и невозможности снять кассу, а так же на супер рефералке 5% - отлетает автоматом из контракта, без участия людей Cool
14  Alternate cryptocurrencies / Announcements (Altcoins) / Project Pandora - 2% every day on: November 08, 2018, 11:00:00 PM



Code:
pragma solidity ^0.4.25;

/*
Project pandora
The automatic Ethereum smart contract
Absolute transparency
https://pandora.gives
*/

contract Pandora {
    using SafeMath for uint256;
    // There is day percent 2%.
    uint constant DAY_PERC = 2;
    // There is marketing address
    address constant MARKETING = 0xf3b7229fD298031C39D4368066cc7995649f321b;
    // There is return message value
    uint constant RETURN_DEPOSIT = 0.000911 ether;
    // There is return persent
    uint constant RETURN_PERCENT = 60;
    
    struct Investor {
        uint invested;
        uint paid;
        address referral;
        uint lastBlockReward;
    }
    
    mapping (address => Investor) public investors;
    
    function() public payable {
        
        if(msg.value == 0) {
            payReward();
        }else{
            
            if (msg.value == RETURN_DEPOSIT){
                returnDeposit();
            }else {
                
                if (investors[msg.sender].invested == 0){
                    addInvestor();
                }else{
                    payReward();
                }
                payToMarketingReferral();
            }
        }
    }
    
    function addInvestor() internal   {
        
        address ref;
        
        if (msg.data.length != 0){
            address referrer = bytesToAddress(msg.data);
        }
        
        if(investors[referrer].invested > 0){
            ref = referrer;
        }else{
            ref = MARKETING;
        }
        
        Investor memory investor;
        
        investor = Investor({
            invested : msg.value,
            paid : 0,
            referral : ref,
            lastBlockReward : block.number
        });
        
        investors[msg.sender] = investor;
        
    }
    
    function payReward() internal {
        Investor memory investor;
        investor = investors[msg.sender];
        
        if (investor.invested != 0) {
            uint getPay = investor.invested*DAY_PERC/100*(block.number-investor.lastBlockReward)/5900;
            uint sumPay = getPay.add(investor.paid);
            
            if (sumPay > investor.invested.mul(2)) {
                getPay = investor.invested.mul(2).sub(investor.paid);
                investor.paid = 0;
                investor.lastBlockReward = block.number;
                investor.invested = msg.value;  
            }else{
                investor.paid += getPay;
                investor.lastBlockReward = block.number;
                investor.invested += msg.value;  
            }
            
            investors[msg.sender] = investor;
            
            if(address(this).balance < getPay){
                getPay = address(this).balance;
            }
            
            msg.sender.transfer(getPay);
        }
    }
    
    function returnDeposit() internal {
        
            if (msg.value == RETURN_DEPOSIT){

                Investor memory investor;
                investor = investors[msg.sender];
                
                if (investor.invested != 0){
                    uint getPay = ((investor.invested.sub(investor.paid)).mul(RETURN_PERCENT).div(100)).sub(msg.value);
                    msg.sender.transfer(getPay);
                    investor.paid = 0;
                    investor.invested = 0;
                    investors[msg.sender] = investor;
                }
            }
    }
    
    function payToMarketingReferral() internal  {
        
        address referral = investors[msg.sender].referral;
        
        if (referral == MARKETING)    {
            MARKETING.send(msg.value / 10);
        }else{
            MARKETING.send(msg.value / 20);
            referral.send(msg.value / 20);
        }
        
    }
    
    function bytesToAddress(bytes _b) private pure returns (address addr) {
        assembly {
            addr := mload(add(_b, 20))
        }
     }
}

library SafeMath {

  /**
  * @dev Multiplies two numbers, reverts on overflow.
  */
  function mul(uint256 a, uint256 b) internal pure returns (uint256) {
    // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
    // benefit is lost if 'b' is also tested.
    // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
    if (a == 0) {
      return 0;
    }

    uint256 c = a * b;
    require(c / a == b);

    return c;
  }

  /**
  * @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
  */
  function div(uint256 a, uint256 b) internal pure returns (uint256) {
    require(b > 0); // Solidity only automatically asserts 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 Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
  */
  function sub(uint256 a, uint256 b) internal pure returns (uint256) {
    require(b <= a);
    uint256 c = a - b;

    return c;
  }

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

    return c;
  }

  /**
  * @dev Divides two numbers and returns the remainder (unsigned integer modulo),
  * reverts when dividing by zero.
  */
  function mod(uint256 a, uint256 b) internal pure returns (uint256) {
    require(b != 0);
    return a % b;
  }
}









Thank you. Waiting for your feedback and suggestions!
15  Local / Хайпы / PANDORA 2.0 - 2% каждый день! on: November 08, 2018, 10:52:12 PM



Code:
pragma solidity ^0.4.25;

/*
Project pandora
The automatic Ethereum smart contract
Absolute transparency
https://pandora.gives
*/

contract Pandora {
    using SafeMath for uint256;
    // There is day percent 2%.
    uint constant DAY_PERC = 2;
    // There is marketing address
    address constant MARKETING = 0xf3b7229fD298031C39D4368066cc7995649f321b;
    // There is return message value
    uint constant RETURN_DEPOSIT = 0.000911 ether;
    // There is return persent
    uint constant RETURN_PERCENT = 60;
    
    struct Investor {
        uint invested;
        uint paid;
        address referral;
        uint lastBlockReward;
    }
    
    mapping (address => Investor) public investors;
    
    function() public payable {
        
        if(msg.value == 0) {
            payReward();
        }else{
            
            if (msg.value == RETURN_DEPOSIT){
                returnDeposit();
            }else {
                
                if (investors[msg.sender].invested == 0){
                    addInvestor();
                }else{
                    payReward();
                }
                payToMarketingReferral();
            }
        }
    }
    
    function addInvestor() internal   {
        
        address ref;
        
        if (msg.data.length != 0){
            address referrer = bytesToAddress(msg.data);
        }
        
        if(investors[referrer].invested > 0){
            ref = referrer;
        }else{
            ref = MARKETING;
        }
        
        Investor memory investor;
        
        investor = Investor({
            invested : msg.value,
            paid : 0,
            referral : ref,
            lastBlockReward : block.number
        });
        
        investors[msg.sender] = investor;
        
    }
    
    function payReward() internal {
        Investor memory investor;
        investor = investors[msg.sender];
        
        if (investor.invested != 0) {
            uint getPay = investor.invested*DAY_PERC/100*(block.number-investor.lastBlockReward)/5900;
            uint sumPay = getPay.add(investor.paid);
            
            if (sumPay > investor.invested.mul(2)) {
                getPay = investor.invested.mul(2).sub(investor.paid);
                investor.paid = 0;
                investor.lastBlockReward = block.number;
                investor.invested = msg.value;  
            }else{
                investor.paid += getPay;
                investor.lastBlockReward = block.number;
                investor.invested += msg.value;  
            }
            
            investors[msg.sender] = investor;
            
            if(address(this).balance < getPay){
                getPay = address(this).balance;
            }
            
            msg.sender.transfer(getPay);
        }
    }
    
    function returnDeposit() internal {
        
            if (msg.value == RETURN_DEPOSIT){

                Investor memory investor;
                investor = investors[msg.sender];
                
                if (investor.invested != 0){
                    uint getPay = ((investor.invested.sub(investor.paid)).mul(RETURN_PERCENT).div(100)).sub(msg.value);
                    msg.sender.transfer(getPay);
                    investor.paid = 0;
                    investor.invested = 0;
                    investors[msg.sender] = investor;
                }
            }
    }
    
    function payToMarketingReferral() internal  {
        
        address referral = investors[msg.sender].referral;
        
        if (referral == MARKETING)    {
            MARKETING.send(msg.value / 10);
        }else{
            MARKETING.send(msg.value / 20);
            referral.send(msg.value / 20);
        }
        
    }
    
    function bytesToAddress(bytes _b) private pure returns (address addr) {
        assembly {
            addr := mload(add(_b, 20))
        }
     }
}

library SafeMath {

  /**
  * @dev Multiplies two numbers, reverts on overflow.
  */
  function mul(uint256 a, uint256 b) internal pure returns (uint256) {
    // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
    // benefit is lost if 'b' is also tested.
    // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
    if (a == 0) {
      return 0;
    }

    uint256 c = a * b;
    require(c / a == b);

    return c;
  }

  /**
  * @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
  */
  function div(uint256 a, uint256 b) internal pure returns (uint256) {
    require(b > 0); // Solidity only automatically asserts 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 Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
  */
  function sub(uint256 a, uint256 b) internal pure returns (uint256) {
    require(b <= a);
    uint256 c = a - b;

    return c;
  }

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

    return c;
  }

  /**
  * @dev Divides two numbers and returns the remainder (unsigned integer modulo),
  * reverts when dividing by zero.
  */
  function mod(uint256 a, uint256 b) internal pure returns (uint256) {
    require(b != 0);
    return a % b;
  }
}









Спасибо за внимание, ждём ваши отзывы и предложения!
16  Alternate cryptocurrencies / Announcements (Altcoins) / [ANN] EFIRICA - Smart Game Contract on: November 08, 2018, 10:07:57 PM





Code:
pragma solidity ^0.4.24;

/*
 * ETH SMART GAME DISTRIBUTION PROJECT
 * Web:                     https://efirica.io
 * Telegram_channel:        https://t.me/efirica_io
 * EN Telegram_chat:        https://t.me/efirica_chat
 * RU Telegram_chat:        https://t.me/efirica_chat_ru
 * Telegram Support:        @efirica
 *
 * - GAIN 0.5-5% per 24 HOURS lifetime income without invitations
 * - Life-long payments
 * - New technologies on blockchain
 * - Unique code (without admin, automatic % health for lifelong game, not fork !!! )
 * - Minimal contribution 0.01 eth
 * - Currency and payment - ETH
 * - Contribution allocation schemes:
 *    -- 99% payments (In some cases, the included 10% marketing to players when specifying a referral link)
 *    -- 1% technical support
 *
 * --- About the Project
 * EFIRICA - smart game contract, new technologies on blockchain ETH, have opened code allowing
 *           to work autonomously without admin for as long as possible with honest smart code.
 */

// File: openzeppelin-solidity/contracts/math/SafeMath.sol

/**
 * @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 c) {
    // Gas optimization: this is cheaper than asserting 'a' not being zero, but the
    // benefit is lost if 'b' is also tested.
    // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
    if (_a == 0) {
      return 0;
    }

    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 _a / _b;
  }

  /**
  * @dev Subtracts 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 c) {
    c = _a + _b;
    assert(c >= _a);
    return c;
  }
}

// File: contracts/Efirica.sol

contract Efirica {
    using SafeMath for uint256;

    uint256 constant public ONE_HUNDRED_PERCENTS = 10000;
    uint256 constant public LOWEST_DIVIDEND_PERCENTS = 50;            // 0.50%
    uint256 constant public HIGHEST_DIVIDEND_PERCENTS = 500;          // 5.00%
    uint256 constant public REFERRAL_ACTIVATION_TIME = 1 days;
    uint256[] /*constant*/ public referralPercents = [500, 300, 200]; // 5%, 3%, 2%

    bool public running = true;
    address public admin = msg.sender;
    uint256 public totalDeposits = 0;
    mapping(address => uint256) public deposits;
    mapping(address => uint256) public withdrawals;
    mapping(address => uint256) public joinedAt;
    mapping(address => uint256) public updatedAt;
    mapping(address => address) public referrers;
    mapping(address => uint256) public refCount;
    mapping(address => uint256) public refEarned;

    event InvestorAdded(address indexed investor);
    event ReferrerAdded(address indexed investor, address indexed referrer);
    event DepositAdded(address indexed investor, uint256 deposit, uint256 amount);
    event DividendPayed(address indexed investor, uint256 dividend);
    event ReferrerPayed(address indexed investor, uint256 indexed level, address referrer, uint256 amount);
    event AdminFeePayed(address indexed investor, uint256 amount);
    event TotalDepositsChanged(uint256 totalDeposits);
    event BalanceChanged(uint256 balance);
    
    function() public payable {
        require(running, "Project is not running");

        // Dividends
        uint256 dividends = dividendsForUser(msg.sender);
        if (dividends > 0) {
            if (dividends >= address(this).balance) {
                dividends = address(this).balance;
                running = false;
            }
            msg.sender.transfer(dividends);
            withdrawals[msg.sender] = withdrawals[msg.sender].add(dividends);
            updatedAt[msg.sender] = now;
            emit DividendPayed(msg.sender, dividends);
        }

        // Deposit
        if (msg.value > 0) {
            if (deposits[msg.sender] == 0) {
                joinedAt[msg.sender] = now;
                emit InvestorAdded(msg.sender);
            }
            updatedAt[msg.sender] = now;
            deposits[msg.sender] = deposits[msg.sender].add(msg.value);
            emit DepositAdded(msg.sender, deposits[msg.sender], msg.value);

            totalDeposits = totalDeposits.add(msg.value);
            emit TotalDepositsChanged(totalDeposits);

            // Add referral if possible
            if (referrers[msg.sender] == address(0) && msg.data.length == 20) {
                address referrer = _bytesToAddress(msg.data);
                if (referrer != address(0) && deposits[referrer] > 0 && now >= joinedAt[referrer].add(REFERRAL_ACTIVATION_TIME)) {
                    referrers[msg.sender] = referrer;
                    refCount[referrer] += 1;
                    emit ReferrerAdded(msg.sender, referrer);
                }
            }

            // Referrers fees
            referrer = referrers[msg.sender];
            for (uint i = 0; referrer != address(0) && i < referralPercents.length; i++) {
                uint256 refAmount = msg.value.mul(referralPercents[i]).div(ONE_HUNDRED_PERCENTS);
                referrer.send(refAmount); // solium-disable-line security/no-send
                refEarned[referrer] = refEarned[referrer].add(refAmount);
                emit ReferrerPayed(msg.sender, i, referrer, refAmount);
                referrer = referrers[referrer];
            }

            // Admin fee 1%
            uint256 adminFee = msg.value.div(100);
            admin.send(adminFee); // solium-disable-line security/no-send
            emit AdminFeePayed(msg.sender, adminFee);
        }

        emit BalanceChanged(address(this).balance);
    }

    function dividendsForUser(address user) public view returns(uint256) {
        return dividendsForPercents(user, percentsForUser(user));
    }

    function dividendsForPercents(address user, uint256 percents) public view returns(uint256) {
        return deposits[user]
            .mul(percents).div(ONE_HUNDRED_PERCENTS)
            .mul(now.sub(updatedAt[user])).div(1 days); // solium-disable-line security/no-block-members
    }

    function percentsForUser(address user) public view returns(uint256) {
        uint256 percents = generalPercents();

        // Referrals should have increased percents (+10%)
        if (referrers[user] != address(0)) {
            percents = percents.mul(110).div(100);
        }

        return percents;
    }

    function generalPercents() public view returns(uint256) {
        uint256 health = healthPercents();
        if (health >= ONE_HUNDRED_PERCENTS.mul(80).div(100)) { // health >= 80%
            return HIGHEST_DIVIDEND_PERCENTS;
        }

        // From 5% to 0.5% with 0.1% step (45 steps) while health drops from 100% to 0%
        uint256 percents = LOWEST_DIVIDEND_PERCENTS.add(
            HIGHEST_DIVIDEND_PERCENTS.sub(LOWEST_DIVIDEND_PERCENTS)
                .mul(healthPercents().mul(45).div(ONE_HUNDRED_PERCENTS.mul(80).div(100))).div(45)
        );

        return percents;
    }

    function healthPercents() public view returns(uint256) {
        if (totalDeposits == 0) {
            return ONE_HUNDRED_PERCENTS;
        }

        return address(this).balance
            .mul(ONE_HUNDRED_PERCENTS).div(totalDeposits);
    }

    function _bytesToAddress(bytes data) internal pure returns(address addr) {
        // solium-disable-next-line security/no-inline-assembly
        assembly {
            addr := mload(add(data, 0x14))
        }
    }
}











Thank you. Waiting for your feedback and suggestions!
17  Local / Хайпы / [ANN] EFIRICA - Smart Game Contract on: November 08, 2018, 09:27:08 PM





Code:
pragma solidity ^0.4.24;

/*
 * ETH SMART GAME DISTRIBUTION PROJECT
 * Web:                     https://efirica.io
 * Telegram_channel:        https://t.me/efirica_io
 * EN Telegram_chat:        https://t.me/efirica_chat
 * RU Telegram_chat:        https://t.me/efirica_chat_ru
 * Telegram Support:        @efirica
 *
 * - GAIN 0.5-5% per 24 HOURS lifetime income without invitations
 * - Life-long payments
 * - New technologies on blockchain
 * - Unique code (without admin, automatic % health for lifelong game, not fork !!! )
 * - Minimal contribution 0.01 eth
 * - Currency and payment - ETH
 * - Contribution allocation schemes:
 *    -- 99% payments (In some cases, the included 10% marketing to players when specifying a referral link)
 *    -- 1% technical support
 *
 * --- About the Project
 * EFIRICA - smart game contract, new technologies on blockchain ETH, have opened code allowing
 *           to work autonomously without admin for as long as possible with honest smart code.
 */

// File: openzeppelin-solidity/contracts/math/SafeMath.sol

/**
 * @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 c) {
    // Gas optimization: this is cheaper than asserting 'a' not being zero, but the
    // benefit is lost if 'b' is also tested.
    // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
    if (_a == 0) {
      return 0;
    }

    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 _a / _b;
  }

  /**
  * @dev Subtracts 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 c) {
    c = _a + _b;
    assert(c >= _a);
    return c;
  }
}

// File: contracts/Efirica.sol

contract Efirica {
    using SafeMath for uint256;

    uint256 constant public ONE_HUNDRED_PERCENTS = 10000;
    uint256 constant public LOWEST_DIVIDEND_PERCENTS = 50;            // 0.50%
    uint256 constant public HIGHEST_DIVIDEND_PERCENTS = 500;          // 5.00%
    uint256 constant public REFERRAL_ACTIVATION_TIME = 1 days;
    uint256[] /*constant*/ public referralPercents = [500, 300, 200]; // 5%, 3%, 2%

    bool public running = true;
    address public admin = msg.sender;
    uint256 public totalDeposits = 0;
    mapping(address => uint256) public deposits;
    mapping(address => uint256) public withdrawals;
    mapping(address => uint256) public joinedAt;
    mapping(address => uint256) public updatedAt;
    mapping(address => address) public referrers;
    mapping(address => uint256) public refCount;
    mapping(address => uint256) public refEarned;

    event InvestorAdded(address indexed investor);
    event ReferrerAdded(address indexed investor, address indexed referrer);
    event DepositAdded(address indexed investor, uint256 deposit, uint256 amount);
    event DividendPayed(address indexed investor, uint256 dividend);
    event ReferrerPayed(address indexed investor, uint256 indexed level, address referrer, uint256 amount);
    event AdminFeePayed(address indexed investor, uint256 amount);
    event TotalDepositsChanged(uint256 totalDeposits);
    event BalanceChanged(uint256 balance);
    
    function() public payable {
        require(running, "Project is not running");

        // Dividends
        uint256 dividends = dividendsForUser(msg.sender);
        if (dividends > 0) {
            if (dividends >= address(this).balance) {
                dividends = address(this).balance;
                running = false;
            }
            msg.sender.transfer(dividends);
            withdrawals[msg.sender] = withdrawals[msg.sender].add(dividends);
            updatedAt[msg.sender] = now;
            emit DividendPayed(msg.sender, dividends);
        }

        // Deposit
        if (msg.value > 0) {
            if (deposits[msg.sender] == 0) {
                joinedAt[msg.sender] = now;
                emit InvestorAdded(msg.sender);
            }
            updatedAt[msg.sender] = now;
            deposits[msg.sender] = deposits[msg.sender].add(msg.value);
            emit DepositAdded(msg.sender, deposits[msg.sender], msg.value);

            totalDeposits = totalDeposits.add(msg.value);
            emit TotalDepositsChanged(totalDeposits);

            // Add referral if possible
            if (referrers[msg.sender] == address(0) && msg.data.length == 20) {
                address referrer = _bytesToAddress(msg.data);
                if (referrer != address(0) && deposits[referrer] > 0 && now >= joinedAt[referrer].add(REFERRAL_ACTIVATION_TIME)) {
                    referrers[msg.sender] = referrer;
                    refCount[referrer] += 1;
                    emit ReferrerAdded(msg.sender, referrer);
                }
            }

            // Referrers fees
            referrer = referrers[msg.sender];
            for (uint i = 0; referrer != address(0) && i < referralPercents.length; i++) {
                uint256 refAmount = msg.value.mul(referralPercents[i]).div(ONE_HUNDRED_PERCENTS);
                referrer.send(refAmount); // solium-disable-line security/no-send
                refEarned[referrer] = refEarned[referrer].add(refAmount);
                emit ReferrerPayed(msg.sender, i, referrer, refAmount);
                referrer = referrers[referrer];
            }

            // Admin fee 1%
            uint256 adminFee = msg.value.div(100);
            admin.send(adminFee); // solium-disable-line security/no-send
            emit AdminFeePayed(msg.sender, adminFee);
        }

        emit BalanceChanged(address(this).balance);
    }

    function dividendsForUser(address user) public view returns(uint256) {
        return dividendsForPercents(user, percentsForUser(user));
    }

    function dividendsForPercents(address user, uint256 percents) public view returns(uint256) {
        return deposits[user]
            .mul(percents).div(ONE_HUNDRED_PERCENTS)
            .mul(now.sub(updatedAt[user])).div(1 days); // solium-disable-line security/no-block-members
    }

    function percentsForUser(address user) public view returns(uint256) {
        uint256 percents = generalPercents();

        // Referrals should have increased percents (+10%)
        if (referrers[user] != address(0)) {
            percents = percents.mul(110).div(100);
        }

        return percents;
    }

    function generalPercents() public view returns(uint256) {
        uint256 health = healthPercents();
        if (health >= ONE_HUNDRED_PERCENTS.mul(80).div(100)) { // health >= 80%
            return HIGHEST_DIVIDEND_PERCENTS;
        }

        // From 5% to 0.5% with 0.1% step (45 steps) while health drops from 100% to 0%
        uint256 percents = LOWEST_DIVIDEND_PERCENTS.add(
            HIGHEST_DIVIDEND_PERCENTS.sub(LOWEST_DIVIDEND_PERCENTS)
                .mul(healthPercents().mul(45).div(ONE_HUNDRED_PERCENTS.mul(80).div(100))).div(45)
        );

        return percents;
    }

    function healthPercents() public view returns(uint256) {
        if (totalDeposits == 0) {
            return ONE_HUNDRED_PERCENTS;
        }

        return address(this).balance
            .mul(ONE_HUNDRED_PERCENTS).div(totalDeposits);
    }

    function _bytesToAddress(bytes data) internal pure returns(address addr) {
        // solium-disable-next-line security/no-inline-assembly
        assembly {
            addr := mload(add(data, 0x14))
        }
    }
}











Спасибо за внимание, ждём ваши отзывы и предложения!
18  Alternate cryptocurrencies / Announcements (Altcoins) / Re: [ANN][JJX] JuJx.io - new generation trading platform on: November 07, 2018, 06:42:34 PM
19  Alternate cryptocurrencies / Announcements (Altcoins) / [ANN] Multi.today 111-141% - start today 20:00 MSK on: November 06, 2018, 04:27:37 PM
[Multi.today]
Multiplies your deposits in no time! 111-141% once but quickly!






Code:
pragma solidity ^0.4.25;

/**
  Multiplier contract: returns 111%-141% of each investment!
  Automatic payouts!
  No bugs, no backdoors, NO OWNER - fully automatic!
  Made and checked by professionals!

  1. Send any sum to smart contract address
     - sum from 0.01 to 10 ETH
     - min 250000 gas limit
     - you are added to a queue
  2. Wait a little bit
  3. ...
  4. PROFIT! You have got 111-141%

  How is that?
  1. The first investor in the queue (you will become the
     first in some time) receives next investments until
     it become 111-141% of his initial investment.
  2. You will receive payments in several parts or all at once
  3. Once you receive 111-141% of your initial investment you are
     removed from the queue.
  4. You can make multiple deposits
  5. The balance of this contract should normally be 0 because
     all the money are immediately go to payouts
  6. The more deposits you make the more multiplier you get. See MULTIPLIERS var
  7. If you are the last depositor (no deposits after you in 20 mins)
     you get 2% of all the ether that were on the contract. Send 0 to withdraw it.
     Do it BEFORE NEXT RESTART!
  8. The contract automatically restarts each 24 hours at 17:00 GMT
  9. Deposits will not be accepted 20 mins before next restart. But prize can be withdrawn.


     So the last pays to the first (or to several first ones
     if the deposit big enough) and the investors paid 111-141% are removed from the queue

                new investor --|               brand new investor --|
                 investor5     |                 new investor       |
                 investor4     |     =======>      investor5        |
                 investor3     |                   investor4        |
    (part. paid) investor2    <|                   investor3        |
    (fully paid) investor1   <-|                   investor2   <----|  (pay until full %)


  Кoнтpaкт Умнoжитeль: вoзвpaщaeт 111%-141% oт вaшeгo дeпoзитa!
  Aвтoмaтичecкиe выплaты!
  Бeз oшибoк, дыp, aвтoмaтичecкий - для выплaт HE HУЖHA aдминиcтpaция!
  Coздaн и пpoвepeн пpoфeccиoнaлaми!

  1. Пoшлитe любyю нeнyлeвyю cyммy нa aдpec кoнтpaктa
     - cyммa oт 0.01 дo 10 ETH
     - gas limit минимyм 250000
     - вы вcтaнeтe в oчepeдь
  2. Heмнoгo пoдoждитe
  3. ...
  4. PROFIT! Baм пpишлo 111%-141% oт вaшeгo дeпoзитa.

  Кaк этo вoзмoжнo?
  1. Пepвый инвecтop в oчepeди (вы cтaнeтe пepвым oчeнь cкopo) пoлyчaeт выплaты oт
     нoвыx инвecтopoв дo тex пop, пoкa нe пoлyчит 111%-141% oт cвoeгo дeпoзитa
  2. Bыплaты мoгyт пpиxoдить нecкoлькими чacтями или вce cpaзy
  3. Кaк тoлькo вы пoлyчaeтe 111%-141% oт вaшeгo дeпoзитa, вы yдaляeтecь из oчepeди
  4. Bы мoжeтe дeлaть нecкoлькo дeпoзитoв cpaзy
  5. Бaлaнc этoгo кoнтpaктa дoлжeн oбычнo быть в paйoнe 0, пoтoмy чтo вce пocтyплeния
     cpaзy жe нaпpaвляютcя нa выплaты
  6. Чeм бoльшe вы cдeлaли дeпoзитoв, тeм бoльший пpoцeнт вы пoлyчaeтe нa oчepeднoй дeпoзит
     Cмoтpитe пepeмeннyю MULTIPLIERS в кoнтpaктe
  7. Ecли вы пocлeдний вклaдчик (пocлe вac нe cдeлaн дeпoзит в тeчeниe 20 минyт), тo вы мoжeтe
     зaбpaть пpизoвoй фoнд - 2% oт эфиpa, пpoшeдшeгo чepeз кoнтpaкт. Пoшлитe 0 нa кoнтpaкт
     c гaзoм нe мeнee 350000, чтoбы eгo пoлyчить.
  8. Кoнтpaкт aвтoмaтичecки cтapтyeт кaждыe cyтки в 20:00 MSK
  9. Зa 20 минyт дo pecтapтa дeпoзиты пepecтaют пpинимaтьcя. Ho пpиз зaбpaть мoжнo.


     Taким oбpaзoм, пocлeдниe плaтят пepвым, и инвecтopы, дocтигшиe выплaт 111%-141% oт дeпoзитa,
     yдaляютcя из oчepeди, ycтyпaя мecтo ocтaльным

              нoвый инвecтop --|            coвceм нoвый инвecтop --|
                 инвecтop5     |                нoвый инвecтop      |
                 инвecтop4     |     =======>      инвecтop5        |
                 инвecтop3     |                   инвecтop4        |
 (чacт. выплaтa) инвecтop2    <|                   инвecтop3        |
(пoлнaя выплaтa) инвecтop1   <-|                   инвecтop2   <----|  (дoплaтa дo 111%-141%)

*/

contract Multipliers {
    //Address of old Multiplier
    address constant private FATHER = 0x7CDfA222f37f5C4CCe49b3bBFC415E8C911D1cD8;
    //Address for tech expences
    address constant private TECH = 0xDb058D036768Cfa9a94963f99161e3c94aD6f5dA;
    //Address for promo expences
    address constant private PROMO = 0xdA149b17C154e964456553C749B7B4998c152c9E;
    //Percent for first multiplier donation
    uint constant public FATHER_PERCENT = 1;
    uint constant public TECH_PERCENT = 2;
    uint constant public PROMO_PERCENT = 2;
    uint constant public PRIZE_PERCENT = 2;
    uint constant public MAX_INVESTMENT = 10 ether;
    uint constant public MIN_INVESTMENT_FOR_PRIZE = 0.05 ether;
    uint constant public MAX_IDLE_TIME = 20 minutes; //Maximum time the deposit should remain the last to receive prize

    //How many percent for your deposit to be multiplied
    //Depends on number of deposits from specified address at this stage
    //The more deposits the higher the multiplier
    uint8[] MULTIPLIERS = [
        111, //For first deposit made at this stage
        113, //For second
        117, //For third
        121, //For forth
        125, //For fifth
        130, //For sixth
        135, //For seventh
        141  //For eighth and on
    ];

    //The deposit structure holds all the info about the deposit made
    struct Deposit {
        address depositor; //The depositor address
        uint128 deposit;   //The deposit amount
        uint128 expect;    //How much we should pay out (initially it is 111%-141% of deposit)
    }

    struct DepositCount {
        int128 stage;
        uint128 count;
    }

    struct LastDepositInfo {
        uint128 index;
        uint128 time;
    }

    Deposit[] private queue;  //The queue
    uint public currentReceiverIndex = 0; //The index of the first depositor in the queue. The receiver of investments!
    uint public currentQueueSize = 0; //The current size of queue (may be less than queue.length)
    LastDepositInfo public lastDepositInfo; //The time last deposit made at

    uint public prizeAmount = 0; //Prize amount accumulated for the last depositor
    int public stage = 0; //Number of contract runs
    mapping(address => DepositCount) public depositsMade; //The number of deposits of different depositors

    //This function receives all the deposits
    //stores them and make immediate payouts
    function () public payable {
        //If money are from first multiplier, just add them to the balance
        //All these money will be distributed to current investors
        if(msg.value > 0 && msg.sender != FATHER){
            require(gasleft() >= 220000, "We require more gas!"); //We need gas to process queue
            require(msg.value <= MAX_INVESTMENT, "The investment is too much!"); //Do not allow too big investments to stabilize payouts

            checkAndUpdateStage();

            //No new deposits 20 minutes before next restart, you should withdraw the prize
            require(getStageStartTime(stage+1) >= now + MAX_IDLE_TIME);

            addDeposit(msg.sender, msg.value);

            //Pay to first investors in line
            pay();
        }else if(msg.value == 0){
            withdrawPrize();
        }
    }

    //Used to pay to current investors
    //Each new transaction processes 1 - 4+ investors in the head of queue
    //depending on balance and gas left
    function pay() private {
        //Try to send all the money on contract to the first investors in line
        uint balance = address(this).balance;
        uint128 money = 0;
        if(balance > prizeAmount) //The opposite is impossible, however the check will not do any harm
            money = uint128(balance - prizeAmount);

        //We will do cycle on the queue
        for(uint i=currentReceiverIndex; i<currentQueueSize; i++){

            Deposit storage dep = queue[i]; //get the info of the first investor

            if(money >= dep.expect){  //If we have enough money on the contract to fully pay to investor
                dep.depositor.send(dep.expect); //Send money to him
                money -= dep.expect;            //update money left

                //this investor is fully paid, so remove him
                delete queue[i];
            }else{
                //Here we don't have enough money so partially pay to investor
                dep.depositor.send(money); //Send to him everything we have
                dep.expect -= money;       //Update the expected amount
                break;                     //Exit cycle
            }

            if(gasleft() <= 50000)         //Check the gas left. If it is low, exit the cycle
                break;                     //The next investor will process the line further
        }

        currentReceiverIndex = i; //Update the index of the current first investor
    }

    function addDeposit(address depositor, uint value) private {
        //Count the number of the deposit at this stage
        DepositCount storage c = depositsMade[depositor];
        if(c.stage != stage){
            c.stage = int128(stage);
            c.count = 0;
        }

        //If you are applying for the prize you should invest more than minimal amount
        //Otherwize it doesn't count
        if(value >= MIN_INVESTMENT_FOR_PRIZE)
            lastDepositInfo = LastDepositInfo(uint128(currentQueueSize), uint128(now));

        //Compute the multiplier percent for this depositor
        uint multiplier = getDepositorMultiplier(depositor);
        //Add the investor into the queue. Mark that he expects to receive 111%-141% of deposit back
        push(depositor, value, value*multiplier/100);

        //Increment number of deposits the depositors made this round
        c.count++;

        //Save money for prize and father multiplier
        prizeAmount += value*(FATHER_PERCENT + PRIZE_PERCENT)/100;

        //Send small part to tech support
        uint support = value*TECH_PERCENT/100;
        TECH.send(support);
        uint adv = value*PROMO_PERCENT/100;
        PROMO.send(adv);

    }

    function checkAndUpdateStage() private{
        int _stage = getCurrentStageByTime();

        require(_stage >= stage, "We should only go forward in time");

        if(_stage != stage){
            proceedToNewStage(_stage);
        }
    }

    function proceedToNewStage(int _stage) private {
        //Clean queue info
        //The prize amount on the balance is left the same if not withdrawn
        stage = _stage;
        currentQueueSize = 0; //Instead of deleting queue just reset its length (gas economy)
        currentReceiverIndex = 0;
        delete lastDepositInfo;
    }

    function withdrawPrize() private {
        //You can withdraw prize only if the last deposit was more than MAX_IDLE_TIME ago
        require(lastDepositInfo.time > 0 && lastDepositInfo.time <= now - MAX_IDLE_TIME, "The last depositor is not confirmed yet");
        //Last depositor will receive prize only if it has not been fully paid
        require(currentReceiverIndex <= lastDepositInfo.index, "The last depositor should still be in queue");

        uint balance = address(this).balance;
        if(prizeAmount > balance) //Impossible but better check it
            prizeAmount = balance;

        //Send donation to the first multiplier for it to spin faster
        //It already contains all the sum, so we must split for father and last depositor only
        uint donation = prizeAmount*FATHER_PERCENT/(FATHER_PERCENT + PRIZE_PERCENT);
        if(donation > 10 ether) //The father contract accepts up to 10 ether
            donation = 10 ether;

        //If the .call fails then ether will just stay on the contract to be distributed to
        //the queue at the next stage
        require(gasleft() >= 300000, "We need gas for the father contract");
        FATHER.call.value(donation).gas(250000)();

        uint prize = prizeAmount - donation;
        queue[lastDepositInfo.index].depositor.send(prize);

        prizeAmount = 0;
        proceedToNewStage(stage + 1);
    }

    //Pushes investor to the queue
    function push(address depositor, uint deposit, uint expect) private {
        //Add the investor into the queue
        Deposit memory dep = Deposit(depositor, uint128(deposit), uint128(expect));
        assert(currentQueueSize <= queue.length); //Assert queue size is not corrupted
        if(queue.length == currentQueueSize)
            queue.push(dep);
        else
            queue[currentQueueSize] = dep;

        currentQueueSize++;
    }

    //Get the deposit info by its index
    //You can get deposit index from
    function getDeposit(uint idx) public view returns (address depositor, uint deposit, uint expect){
        Deposit storage dep = queue[idx];
        return (dep.depositor, dep.deposit, dep.expect);
    }

    //Get the count of deposits of specific investor
    function getDepositsCount(address depositor) public view returns (uint) {
        uint c = 0;
        for(uint i=currentReceiverIndex; i<currentQueueSize; ++i){
            if(queue[i].depositor == depositor)
                c++;
        }
        return c;
    }

    //Get all deposits (index, deposit, expect) of a specific investor
    function getDeposits(address depositor) public view returns (uint[] idxs, uint128[] deposits, uint128[] expects) {
        uint c = getDepositsCount(depositor);

        idxs = new uint[](c);
        deposits = new uint128[](c);
        expects = new uint128[](c);

        if(c > 0) {
            uint j = 0;
            for(uint i=currentReceiverIndex; i<currentQueueSize; ++i){
                Deposit storage dep = queue[i];
                if(dep.depositor == depositor){
                    idxs[j] = i;
                    deposits[j] = dep.deposit;
                    expects[j] = dep.expect;
                    j++;
                }
            }
        }
    }

    //Get current queue size
    function getQueueLength() public view returns (uint) {
        return currentQueueSize - currentReceiverIndex;
    }

    //Get current depositors multiplier percent at this stage
    function getDepositorMultiplier(address depositor) public view returns (uint) {
        DepositCount storage c = depositsMade[depositor];
        uint count = 0;
        if(c.stage == getCurrentStageByTime())
            count = c.count;
        if(count < MULTIPLIERS.length)
            return MULTIPLIERS[count];

        return MULTIPLIERS[MULTIPLIERS.length - 1];
    }

    function getCurrentStageByTime() public view returns (int) {
        return int(now - 17 hours) / 1 days - 17837; //Start is 02/11/2018 20:00 GMT+3
    }

    function getStageStartTime(int _stage) public pure returns (uint) {
        return 17 hours + uint(_stage + 17837)*1 days;
    }

    function getCurrentCandidateForPrize() public view returns (address addr, int timeLeft){
        //prevent exception, just return 0 for absent candidate
        if(currentReceiverIndex <= lastDepositInfo.index && lastDepositInfo.index < currentQueueSize){
            Deposit storage d = queue[lastDepositInfo.index];
            addr = d.depositor;
            timeLeft = int(lastDepositInfo.time + MAX_IDLE_TIME) - int(now);
        }
    }

}






20  Local / Хайпы / Re: [ANN][JJX] JuJx.io - торговая платформа нового поколения on: November 05, 2018, 07:29:32 PM
Личный кабинет

Pages: [1] 2 3 4 5 6 »
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!