Diff
checker
テキスト
テキスト
画像
ドキュメント
Excel
フォルダ
Legal
Enterprise
デスクトップ
料金
ログイン
Diffchecker デスクトップのダウンロード
テキスト比較
2 つのテキスト ファイルの違いを見つける
ツール
履歴
ライブエディター
未変更行を折りたたむ
折り返しなし
レイアウト
分割
統合
比較精度
スマート
単語
文字
シンタックスハイライト
構文を選択
無視
テキスト変換
最初の差分へ移動
入力を編集
Diffchecker Desktop
Diffcheckerを実行する最も安全な方法。Diffchecker Desktopアプリを入手:あなたの差分はコンピューターから出ることはありません!
Desktopを入手
Untitled diff
作成日
8 年前
差分は期限切れになりません
クリア
エクスポート
共有
2つのテキストは同一です
これら2つのテキストの間に違いはありません
0 削除
行
合計
削除
文字
合計
削除
この機能を引き続き使用するには、アップグレードしてください
Diff
checker
Pro
価格を見る
263 行
すべてコピー
0 追加
行
合計
追加
文字
合計
追加
この機能を引き続き使用するには、アップグレードしてください
Diff
checker
Pro
価格を見る
263 行
すべてコピー
pragma solidity ^0.4.25;
pragma solidity ^0.4.25;
/**
/**
* X2Profit contract
* X2Profit contract
*
*
* Improved, no bugs and backdoors! Your investments are safe!
* Improved, no bugs and backdoors! Your investments are safe!
*
*
* LOW RISK! You can take your deposit back ANY TIME!
* LOW RISK! You can take your deposit back ANY TIME!
* - Send 0.00000112 ETH to contract address
* - Send 0.00000112 ETH to contract address
*
*
* NO DEPOSIT FEES! All the money go to contract!
* NO DEPOSIT FEES! All the money go to contract!
*
*
* HIGH RETURN! Get 0.27% - 0.4% per hour (6.5% - 9.6% per day)
* HIGH RETURN! Get 0.27% - 0.4% per hour (6.5% - 9.6% per day)
*
*
* Contract balance daily percent
* Contract balance daily percent
* < 1000 ~6.5%
* < 1000 ~6.5%
* 1000 - 2500 ~7.7%
* 1000 - 2500 ~7.7%
* 2500 - 5000 ~9.1%
* 2500 - 5000 ~9.1%
* >= 5000 ~9.6%
* >= 5000 ~9.6%
*
*
* LOW WITHDRAWAL FEES! Advertising 4%-10%, charity 1%
* LOW WITHDRAWAL FEES! Advertising 4%-10%, charity 1%
*
*
* LONG LIFE! Maximum return is bounded by x2. Anyone has right to be rich!
* LONG LIFE! Maximum return is bounded by x2. Anyone has right to be rich!
*
*
* HOLD LONG AND GET BONUS!
* HOLD LONG AND GET BONUS!
* 1. If you hold long enough you can take more than x2 (one time only)
* 1. If you hold long enough you can take more than x2 (one time only)
* 2. The more you hold the less you pay for adv:
* 2. The more you hold the less you pay for adv:
* < 1 day 10%
* < 1 day 10%
* 1 - 3 days 9%
* 1 - 3 days 9%
* 3 - 7 days 8%
* 3 - 7 days 8%
* 1 - 2 weeks 7%
* 1 - 2 weeks 7%
* 2 - 3 weeks 6%
* 2 - 3 weeks 6%
* 3 - 4 weeks 5%
* 3 - 4 weeks 5%
* > 4 weeks 4%
* > 4 weeks 4%
* Because large balance is good advertisement on itself!
* Because large balance is good advertisement on itself!
*
*
* INSTRUCTIONS:
* INSTRUCTIONS:
*
*
* TO INVEST: send ETH to contract address
* TO INVEST: send ETH to contract address
* TO WITHDRAW INTEREST: send 0 ETH to contract address
* TO WITHDRAW INTEREST: send 0 ETH to contract address
* TO REINVEST AND WITHDRAW INTEREST: send ETH to contract address
* TO REINVEST AND WITHDRAW INTEREST: send ETH to contract address
* TO GET BACK YOUR DEPOSIT: send 0.00000112 ETH to contract address
* TO GET BACK YOUR DEPOSIT: send 0.00000112 ETH to contract address
*
*
*/
*/
contract X2Profit {
contract X2Profit {
//use library for safe math operations
//use library for safe math operations
using SafeMath for uint;
using SafeMath for uint;
// array containing information about beneficiaries
// array containing information about beneficiaries
mapping(address => uint) public userDeposit;
mapping(address => uint) public userDeposit;
//array containing information about the time of payment
//array containing information about the time of payment
mapping(address => uint) public userTime;
mapping(address => uint) public userTime;
//array containing information on interest paid
//array containing information on interest paid
mapping(address => uint) public percentWithdrawn;
mapping(address => uint) public percentWithdrawn;
//array containing information on interest paid (without tax)
//array containing information on interest paid (without tax)
mapping(address => uint) public percentWithdrawnPure;
mapping(address => uint) public percentWithdrawnPure;
//fund fo transfer percent for advertising
//fund fo transfer percent for advertising
address private constant ADDRESS_ADV_FUND = 0xE6AD1c76ec266348CB8E8aD2B1C95F372ad66c0e;
address private constant ADDRESS_ADV_FUND = 0xE6AD1c76ec266348CB8E8aD2B1C95F372ad66c0e;
//wallet for a charitable foundation
//wallet for a charitable foundation
address private constant ADDRESS_CHARITY_FUND = 0xC43Cf609440b53E25cdFfB4422EFdED78475C76B;
address private constant ADDRESS_CHARITY_FUND = 0xC43Cf609440b53E25cdFfB4422EFdED78475C76B;
//time through which you can take dividends
//time through which you can take dividends
uint private constant TIME_QUANT = 1 hours;
uint private constant TIME_QUANT = 1 hours;
//percent for a charitable foundation
//percent for a charitable foundation
uint private constant PERCENT_CHARITY_FUND = 1000;
uint private constant PERCENT_CHARITY_FUND = 1000;
//start percent 0.27% per hour
//start percent 0.27% per hour
uint private constant PERCENT_START = 270;
uint private constant PERCENT_START = 270;
uint private constant PERCENT_LOW = 320;
uint private constant PERCENT_LOW = 320;
uint private constant PERCENT_MIDDLE = 380;
uint private constant PERCENT_MIDDLE = 380;
uint private constant PERCENT_HIGH = 400;
uint private constant PERCENT_HIGH = 400;
//Adv tax for holders (10% for impatient, 4% for strong holders)
//Adv tax for holders (10% for impatient, 4% for strong holders)
uint private constant PERCENT_ADV_VERY_HIGH = 10000;
uint private constant PERCENT_ADV_VERY_HIGH = 10000;
uint private constant PERCENT_ADV_HIGH = 9000;
uint private constant PERCENT_ADV_HIGH = 9000;
uint private constant PERCENT_ADV_ABOVE_MIDDLE = 8000;
uint private constant PERCENT_ADV_ABOVE_MIDDLE = 8000;
uint private constant PERCENT_ADV_MIDDLE = 7000;
uint private constant PERCENT_ADV_MIDDLE = 7000;
uint private constant PERCENT_ADV_BELOW_MIDDLE = 6000;
uint private constant PERCENT_ADV_BELOW_MIDDLE = 6000;
uint private constant PERCENT_ADV_LOW = 5000;
uint private constant PERCENT_ADV_LOW = 5000;
uint private constant PERCENT_ADV_LOWEST = 4000;
uint private constant PERCENT_ADV_LOWEST = 4000;
//All percent should be divided by this
//All percent should be divided by this
uint private constant PERCENT_DIVIDER = 100000;
uint private constant PERCENT_DIVIDER = 100000;
//interest rate increase steps
//interest rate increase steps
uint private constant STEP_LOW = 1000 ether;
uint private constant STEP_LOW = 1000 ether;
uint private constant STEP_MIDDLE = 2500 ether;
uint private constant STEP_MIDDLE = 2500 ether;
uint private constant STEP_HIGH = 5000 ether;
uint private constant STEP_HIGH = 5000 ether;
uint public countOfInvestors = 0;
uint public countOfInvestors = 0;
uint public countOfCharity = 0;
uint public countOfCharity = 0;
modifier isIssetUser() {
modifier isIssetUser() {
require(userDeposit[msg.sender] > 0, "Deposit not found");
require(userDeposit[msg.sender] > 0, "Deposit not found");
_;
_;
}
}
modifier timePayment() {
modifier timePayment() {
require(now >= userTime[msg.sender].add(TIME_QUANT), "Too fast payout request");
require(now >= userTime[msg.sender].add(TIME_QUANT), "Too fast payout request");
_;
_;
}
}
//return of interest on the deposit
//return of interest on the deposit
function collectPercent() isIssetUser timePayment internal {
function collectPercent() isIssetUser timePayment internal {
//if the user received 200% or more of his contribution, delete the user
//if the user received 200% or more of his contribution, delete the user
if ((userDeposit[msg.sender].mul(2)) <= percentWithdrawnPure[msg.sender]) {
if ((userDeposit[msg.sender].mul(2)) <= percentWithdrawnPure[msg.sender]) {
_delete(msg.sender); //User has withdrawn more than x2
_delete(msg.sender); //User has withdrawn more than x2
} else {
} else {
uint payout = payoutAmount(msg.sender);
uint payout = payoutAmount(msg.sender);
_payout(msg.sender, payout);
_payout(msg.sender, payout);
}
}
}
}
//calculation of the current interest rate on the deposit
//calculation of the current interest rate on the deposit
function percentRate() public view returns(uint) {
function percentRate() public view returns(uint) {
//get contract balance
//get contract balance
uint balance = address(this).balance;
uint balance = address(this).balance;
//calculate percent rate
//calculate percent rate
if (balance < STEP_LOW) {
if (balance < STEP_LOW) {
return (PERCENT_START);
return (PERCENT_START);
}
}
if (balance < STEP_MIDDLE) {
if (balance < STEP_MIDDLE) {
return (PERCENT_LOW);
return (PERCENT_LOW);
}
}
if (balance < STEP_HIGH) {
if (balance < STEP_HIGH) {
return (PERCENT_MIDDLE);
return (PERCENT_MIDDLE);
}
}
return (PERCENT_HIGH);
return (PERCENT_HIGH);
}
}
//calculate the amount available for withdrawal on deposit
//calculate the amount available for withdrawal on deposit
function payoutAmount(address addr) public view returns(uint) {
function payoutAmount(address addr) public view returns(uint) {
uint percent = percentRate();
uint percent = percentRate();
uint rate = userDeposit[addr].mul(percent).div(PERCENT_DIVIDER);
uint rate = userDeposit[addr].mul(percent).div(PERCENT_DIVIDER);
uint interestRate = now.sub(userTime[addr]).div(TIME_QUANT);
uint interestRate = now.sub(userTime[addr]).div(TIME_QUANT);
uint withdrawalAmount = rate.mul(interestRate);
uint withdrawalAmount = rate.mul(interestRate);
return (withdrawalAmount);
return (withdrawalAmount);
}
}
function holderAdvPercent(address addr) public view returns(uint) {
function holderAdvPercent(address addr) public view returns(uint) {
uint timeHeld = (now - userTime[addr]);
uint timeHeld = (now - userTime[addr]);
if(timeHeld < 1 days)
if(timeHeld < 1 days)
return PERCENT_ADV_VERY_HIGH;
return PERCENT_ADV_VERY_HIGH;
if(timeHeld < 3 days)
if(timeHeld < 3 days)
return PERCENT_ADV_HIGH;
return PERCENT_ADV_HIGH;
if(timeHeld < 1 weeks)
if(timeHeld < 1 weeks)
return PERCENT_ADV_ABOVE_MIDDLE;
return PERCENT_ADV_ABOVE_MIDDLE;
if(timeHeld < 2 weeks)
if(timeHeld < 2 weeks)
return PERCENT_ADV_MIDDLE;
return PERCENT_ADV_MIDDLE;
if(timeHeld < 3 weeks)
if(timeHeld < 3 weeks)
return PERCENT_ADV_BELOW_MIDDLE;
return PERCENT_ADV_BELOW_MIDDLE;
if(timeHeld < 4 weeks)
if(timeHeld < 4 weeks)
return PERCENT_ADV_LOW;
return PERCENT_ADV_LOW;
return PERCENT_ADV_LOWEST;
return PERCENT_ADV_LOWEST;
}
}
//make a deposit
//make a deposit
function makeDeposit() private {
function makeDeposit() private {
if (msg.value > 0) {
if (msg.value > 0) {
if (userDeposit[msg.sender] == 0) {
if (userDeposit[msg.sender] == 0) {
countOfInvestors += 1;
countOfInvestors += 1;
}
}
if (userDeposit[msg.sender] > 0 && now >= userTime[msg.sender].add(TIME_QUANT)) {
if (userDeposit[msg.sender] > 0 && now >= userTime[msg.sender].add(TIME_QUANT)) {
collectPercent();
collectPercent();
}
}
userDeposit[msg.sender] += msg.value;
userDeposit[msg.sender] += msg.value;
userTime[msg.sender] = now;
userTime[msg.sender] = now;
} else {
} else {
collectPercent();
collectPercent();
}
}
}
}
//return of deposit balance
//return of deposit balance
function returnDeposit() isIssetUser private {
function returnDeposit() isIssetUser private {
//percentWithdrawn already include all taxes for charity and ads
//percentWithdrawn already include all taxes for charity and ads
//So we need pay taxes only for the rest of deposit
//So we need pay taxes only for the rest of deposit
uint withdrawalAmount = userDeposit[msg.sender]
uint withdrawalAmount = userDeposit[msg.sender]
.sub(percentWithdrawn[msg.sender]);
.sub(percentWithdrawn[msg.sender]);
//Pay the rest of deposit and take taxes
//Pay the rest of deposit and take taxes
_payout(msg.sender, withdrawalAmount);
_payout(msg.sender, withdrawalAmount);
//delete user record
//delete user record
_delete(msg.sender);
_delete(msg.sender);
}
}
function() external payable {
function() external payable {
//refund of remaining funds when transferring to a contract 0.00000112 ether
//refund of remaining funds when transferring to a contract 0.00000112 ether
if (msg.value == 0.00000112 ether) {
if (msg.value == 0.00000112 ether) {
returnDeposit();
returnDeposit();
} else {
} else {
makeDeposit();
makeDeposit();
}
}
}
}
//Pays out, takes taxes according to holding time
//Pays out, takes taxes according to holding time
function _payout(address addr, uint amount) private {
function _payout(address addr, uint amount) private {
//Remember this payout
//Remember this payout
percentWithdrawn[addr] += amount;
percentWithdrawn[addr] += amount;
//Get current holder adv percent
//Get current holder adv percent
uint advPct = holderAdvPercent(addr);
uint advPct = holderAdvPercent(addr);
//Calculate pure payout that user receives
//Calculate pure payout that user receives
uint interestPure = amount.mul(PERCENT_DIVIDER - PERCENT_CHARITY_FUND - advPct).div(PERCENT_DIVIDER);
uint interestPure = amount.mul(PERCENT_DIVIDER - PERCENT_CHARITY_FUND - advPct).div(PERCENT_DIVIDER);
percentWithdrawnPure[addr] += interestPure;
percentWithdrawnPure[addr] += interestPure;
userTime[addr] = now;
userTime[addr] = now;
//calculate money to charity
//calculate money to charity
uint charityMoney = amount.mul(PERCENT_CHARITY_FUND).div(PERCENT_DIVIDER);
uint charityMoney = amount.mul(PERCENT_CHARITY_FUND).div(PERCENT_DIVIDER);
countOfCharity += charityMoney;
countOfCharity += charityMoney;
//calculate money for advertising
//calculate money for advertising
uint advTax = amount.sub(interestPure).sub(charityMoney);
uint advTax = amount.sub(interestPure).sub(charityMoney);
//send money
//send money
ADDRESS_ADV_FUND.transfer(advTax);
ADDRESS_ADV_FUND.transfer(advTax);
ADDRESS_CHARITY_FUND.transfer(charityMoney);
ADDRESS_CHARITY_FUND.transfer(charityMoney);
addr.transfer(interestPure);
addr.transfer(interestPure);
}
}
//Clears user from registry
//Clears user from registry
function _delete(address addr) private {
function _delete(address addr) private {
userDeposit[addr] = 0;
userDeposit[addr] = 0;
userTime[addr] = 0;
userTime[addr] = 0;
percentWithdrawn[addr] = 0;
percentWithdrawn[addr] = 0;
percentWithdrawnPure[addr] = 0;
percentWithdrawnPure[addr] = 0;
}
}
}
}
/**
/**
* @title SafeMath
* @title SafeMath
* @dev Math operations with safety checks that throw on error
* @dev Math operations with safety checks that throw on error
*/
*/
library SafeMath {
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns(uint256) {
function mul(uint256 a, uint256 b) internal pure returns(uint256) {
uint256 c = a * b;
uint256 c = a * b;
assert(a == 0 || c / a == b);
assert(a == 0 || c / a == b);
return c;
return c;
}
}
function div(uint256 a, uint256 b) internal pure returns(uint256) {
function div(uint256 a, uint256 b) internal pure returns(uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
return c;
}
}
function sub(uint256 a, uint256 b) internal pure returns(uint256) {
function sub(uint256 a, uint256 b) internal pure returns(uint256) {
assert(b <= a);
assert(b <= a);
return a - b;
return a - b;
}
}
function add(uint256 a, uint256 b) internal pure returns(uint256) {
function add(uint256 a, uint256 b) internal pure returns(uint256) {
uint256 c = a + b;
uint256 c = a + b;
assert(c >= a);
assert(c >= a);
return c;
return c;
}
}
}
}
保存された差分
原文
ファイルを開く
pragma solidity ^0.4.25; /** * X2Profit contract * * Improved, no bugs and backdoors! Your investments are safe! * * LOW RISK! You can take your deposit back ANY TIME! * - Send 0.00000112 ETH to contract address * * NO DEPOSIT FEES! All the money go to contract! * * HIGH RETURN! Get 0.27% - 0.4% per hour (6.5% - 9.6% per day) * * Contract balance daily percent * < 1000 ~6.5% * 1000 - 2500 ~7.7% * 2500 - 5000 ~9.1% * >= 5000 ~9.6% * * LOW WITHDRAWAL FEES! Advertising 4%-10%, charity 1% * * LONG LIFE! Maximum return is bounded by x2. Anyone has right to be rich! * * HOLD LONG AND GET BONUS! * 1. If you hold long enough you can take more than x2 (one time only) * 2. The more you hold the less you pay for adv: * < 1 day 10% * 1 - 3 days 9% * 3 - 7 days 8% * 1 - 2 weeks 7% * 2 - 3 weeks 6% * 3 - 4 weeks 5% * > 4 weeks 4% * Because large balance is good advertisement on itself! * * INSTRUCTIONS: * * TO INVEST: send ETH to contract address * TO WITHDRAW INTEREST: send 0 ETH to contract address * TO REINVEST AND WITHDRAW INTEREST: send ETH to contract address * TO GET BACK YOUR DEPOSIT: send 0.00000112 ETH to contract address * */ contract X2Profit { //use library for safe math operations using SafeMath for uint; // array containing information about beneficiaries mapping(address => uint) public userDeposit; //array containing information about the time of payment mapping(address => uint) public userTime; //array containing information on interest paid mapping(address => uint) public percentWithdrawn; //array containing information on interest paid (without tax) mapping(address => uint) public percentWithdrawnPure; //fund fo transfer percent for advertising address private constant ADDRESS_ADV_FUND = 0xE6AD1c76ec266348CB8E8aD2B1C95F372ad66c0e; //wallet for a charitable foundation address private constant ADDRESS_CHARITY_FUND = 0xC43Cf609440b53E25cdFfB4422EFdED78475C76B; //time through which you can take dividends uint private constant TIME_QUANT = 1 hours; //percent for a charitable foundation uint private constant PERCENT_CHARITY_FUND = 1000; //start percent 0.27% per hour uint private constant PERCENT_START = 270; uint private constant PERCENT_LOW = 320; uint private constant PERCENT_MIDDLE = 380; uint private constant PERCENT_HIGH = 400; //Adv tax for holders (10% for impatient, 4% for strong holders) uint private constant PERCENT_ADV_VERY_HIGH = 10000; uint private constant PERCENT_ADV_HIGH = 9000; uint private constant PERCENT_ADV_ABOVE_MIDDLE = 8000; uint private constant PERCENT_ADV_MIDDLE = 7000; uint private constant PERCENT_ADV_BELOW_MIDDLE = 6000; uint private constant PERCENT_ADV_LOW = 5000; uint private constant PERCENT_ADV_LOWEST = 4000; //All percent should be divided by this uint private constant PERCENT_DIVIDER = 100000; //interest rate increase steps uint private constant STEP_LOW = 1000 ether; uint private constant STEP_MIDDLE = 2500 ether; uint private constant STEP_HIGH = 5000 ether; uint public countOfInvestors = 0; uint public countOfCharity = 0; modifier isIssetUser() { require(userDeposit[msg.sender] > 0, "Deposit not found"); _; } modifier timePayment() { require(now >= userTime[msg.sender].add(TIME_QUANT), "Too fast payout request"); _; } //return of interest on the deposit function collectPercent() isIssetUser timePayment internal { //if the user received 200% or more of his contribution, delete the user if ((userDeposit[msg.sender].mul(2)) <= percentWithdrawnPure[msg.sender]) { _delete(msg.sender); //User has withdrawn more than x2 } else { uint payout = payoutAmount(msg.sender); _payout(msg.sender, payout); } } //calculation of the current interest rate on the deposit function percentRate() public view returns(uint) { //get contract balance uint balance = address(this).balance; //calculate percent rate if (balance < STEP_LOW) { return (PERCENT_START); } if (balance < STEP_MIDDLE) { return (PERCENT_LOW); } if (balance < STEP_HIGH) { return (PERCENT_MIDDLE); } return (PERCENT_HIGH); } //calculate the amount available for withdrawal on deposit function payoutAmount(address addr) public view returns(uint) { uint percent = percentRate(); uint rate = userDeposit[addr].mul(percent).div(PERCENT_DIVIDER); uint interestRate = now.sub(userTime[addr]).div(TIME_QUANT); uint withdrawalAmount = rate.mul(interestRate); return (withdrawalAmount); } function holderAdvPercent(address addr) public view returns(uint) { uint timeHeld = (now - userTime[addr]); if(timeHeld < 1 days) return PERCENT_ADV_VERY_HIGH; if(timeHeld < 3 days) return PERCENT_ADV_HIGH; if(timeHeld < 1 weeks) return PERCENT_ADV_ABOVE_MIDDLE; if(timeHeld < 2 weeks) return PERCENT_ADV_MIDDLE; if(timeHeld < 3 weeks) return PERCENT_ADV_BELOW_MIDDLE; if(timeHeld < 4 weeks) return PERCENT_ADV_LOW; return PERCENT_ADV_LOWEST; } //make a deposit function makeDeposit() private { if (msg.value > 0) { if (userDeposit[msg.sender] == 0) { countOfInvestors += 1; } if (userDeposit[msg.sender] > 0 && now >= userTime[msg.sender].add(TIME_QUANT)) { collectPercent(); } userDeposit[msg.sender] += msg.value; userTime[msg.sender] = now; } else { collectPercent(); } } //return of deposit balance function returnDeposit() isIssetUser private { //percentWithdrawn already include all taxes for charity and ads //So we need pay taxes only for the rest of deposit uint withdrawalAmount = userDeposit[msg.sender] .sub(percentWithdrawn[msg.sender]); //Pay the rest of deposit and take taxes _payout(msg.sender, withdrawalAmount); //delete user record _delete(msg.sender); } function() external payable { //refund of remaining funds when transferring to a contract 0.00000112 ether if (msg.value == 0.00000112 ether) { returnDeposit(); } else { makeDeposit(); } } //Pays out, takes taxes according to holding time function _payout(address addr, uint amount) private { //Remember this payout percentWithdrawn[addr] += amount; //Get current holder adv percent uint advPct = holderAdvPercent(addr); //Calculate pure payout that user receives uint interestPure = amount.mul(PERCENT_DIVIDER - PERCENT_CHARITY_FUND - advPct).div(PERCENT_DIVIDER); percentWithdrawnPure[addr] += interestPure; userTime[addr] = now; //calculate money to charity uint charityMoney = amount.mul(PERCENT_CHARITY_FUND).div(PERCENT_DIVIDER); countOfCharity += charityMoney; //calculate money for advertising uint advTax = amount.sub(interestPure).sub(charityMoney); //send money ADDRESS_ADV_FUND.transfer(advTax); ADDRESS_CHARITY_FUND.transfer(charityMoney); addr.transfer(interestPure); } //Clears user from registry function _delete(address addr) private { userDeposit[addr] = 0; userTime[addr] = 0; percentWithdrawn[addr] = 0; percentWithdrawnPure[addr] = 0; } } /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns(uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns(uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } function sub(uint256 a, uint256 b) internal pure returns(uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b) internal pure returns(uint256) { uint256 c = a + b; assert(c >= a); return c; } }
変更されたテキスト
ファイルを開く
pragma solidity ^0.4.25; /** * X2Profit contract * * Improved, no bugs and backdoors! Your investments are safe! * * LOW RISK! You can take your deposit back ANY TIME! * - Send 0.00000112 ETH to contract address * * NO DEPOSIT FEES! All the money go to contract! * * HIGH RETURN! Get 0.27% - 0.4% per hour (6.5% - 9.6% per day) * * Contract balance daily percent * < 1000 ~6.5% * 1000 - 2500 ~7.7% * 2500 - 5000 ~9.1% * >= 5000 ~9.6% * * LOW WITHDRAWAL FEES! Advertising 4%-10%, charity 1% * * LONG LIFE! Maximum return is bounded by x2. Anyone has right to be rich! * * HOLD LONG AND GET BONUS! * 1. If you hold long enough you can take more than x2 (one time only) * 2. The more you hold the less you pay for adv: * < 1 day 10% * 1 - 3 days 9% * 3 - 7 days 8% * 1 - 2 weeks 7% * 2 - 3 weeks 6% * 3 - 4 weeks 5% * > 4 weeks 4% * Because large balance is good advertisement on itself! * * INSTRUCTIONS: * * TO INVEST: send ETH to contract address * TO WITHDRAW INTEREST: send 0 ETH to contract address * TO REINVEST AND WITHDRAW INTEREST: send ETH to contract address * TO GET BACK YOUR DEPOSIT: send 0.00000112 ETH to contract address * */ contract X2Profit { //use library for safe math operations using SafeMath for uint; // array containing information about beneficiaries mapping(address => uint) public userDeposit; //array containing information about the time of payment mapping(address => uint) public userTime; //array containing information on interest paid mapping(address => uint) public percentWithdrawn; //array containing information on interest paid (without tax) mapping(address => uint) public percentWithdrawnPure; //fund fo transfer percent for advertising address private constant ADDRESS_ADV_FUND = 0xE6AD1c76ec266348CB8E8aD2B1C95F372ad66c0e; //wallet for a charitable foundation address private constant ADDRESS_CHARITY_FUND = 0xC43Cf609440b53E25cdFfB4422EFdED78475C76B; //time through which you can take dividends uint private constant TIME_QUANT = 1 hours; //percent for a charitable foundation uint private constant PERCENT_CHARITY_FUND = 1000; //start percent 0.27% per hour uint private constant PERCENT_START = 270; uint private constant PERCENT_LOW = 320; uint private constant PERCENT_MIDDLE = 380; uint private constant PERCENT_HIGH = 400; //Adv tax for holders (10% for impatient, 4% for strong holders) uint private constant PERCENT_ADV_VERY_HIGH = 10000; uint private constant PERCENT_ADV_HIGH = 9000; uint private constant PERCENT_ADV_ABOVE_MIDDLE = 8000; uint private constant PERCENT_ADV_MIDDLE = 7000; uint private constant PERCENT_ADV_BELOW_MIDDLE = 6000; uint private constant PERCENT_ADV_LOW = 5000; uint private constant PERCENT_ADV_LOWEST = 4000; //All percent should be divided by this uint private constant PERCENT_DIVIDER = 100000; //interest rate increase steps uint private constant STEP_LOW = 1000 ether; uint private constant STEP_MIDDLE = 2500 ether; uint private constant STEP_HIGH = 5000 ether; uint public countOfInvestors = 0; uint public countOfCharity = 0; modifier isIssetUser() { require(userDeposit[msg.sender] > 0, "Deposit not found"); _; } modifier timePayment() { require(now >= userTime[msg.sender].add(TIME_QUANT), "Too fast payout request"); _; } //return of interest on the deposit function collectPercent() isIssetUser timePayment internal { //if the user received 200% or more of his contribution, delete the user if ((userDeposit[msg.sender].mul(2)) <= percentWithdrawnPure[msg.sender]) { _delete(msg.sender); //User has withdrawn more than x2 } else { uint payout = payoutAmount(msg.sender); _payout(msg.sender, payout); } } //calculation of the current interest rate on the deposit function percentRate() public view returns(uint) { //get contract balance uint balance = address(this).balance; //calculate percent rate if (balance < STEP_LOW) { return (PERCENT_START); } if (balance < STEP_MIDDLE) { return (PERCENT_LOW); } if (balance < STEP_HIGH) { return (PERCENT_MIDDLE); } return (PERCENT_HIGH); } //calculate the amount available for withdrawal on deposit function payoutAmount(address addr) public view returns(uint) { uint percent = percentRate(); uint rate = userDeposit[addr].mul(percent).div(PERCENT_DIVIDER); uint interestRate = now.sub(userTime[addr]).div(TIME_QUANT); uint withdrawalAmount = rate.mul(interestRate); return (withdrawalAmount); } function holderAdvPercent(address addr) public view returns(uint) { uint timeHeld = (now - userTime[addr]); if(timeHeld < 1 days) return PERCENT_ADV_VERY_HIGH; if(timeHeld < 3 days) return PERCENT_ADV_HIGH; if(timeHeld < 1 weeks) return PERCENT_ADV_ABOVE_MIDDLE; if(timeHeld < 2 weeks) return PERCENT_ADV_MIDDLE; if(timeHeld < 3 weeks) return PERCENT_ADV_BELOW_MIDDLE; if(timeHeld < 4 weeks) return PERCENT_ADV_LOW; return PERCENT_ADV_LOWEST; } //make a deposit function makeDeposit() private { if (msg.value > 0) { if (userDeposit[msg.sender] == 0) { countOfInvestors += 1; } if (userDeposit[msg.sender] > 0 && now >= userTime[msg.sender].add(TIME_QUANT)) { collectPercent(); } userDeposit[msg.sender] += msg.value; userTime[msg.sender] = now; } else { collectPercent(); } } //return of deposit balance function returnDeposit() isIssetUser private { //percentWithdrawn already include all taxes for charity and ads //So we need pay taxes only for the rest of deposit uint withdrawalAmount = userDeposit[msg.sender] .sub(percentWithdrawn[msg.sender]); //Pay the rest of deposit and take taxes _payout(msg.sender, withdrawalAmount); //delete user record _delete(msg.sender); } function() external payable { //refund of remaining funds when transferring to a contract 0.00000112 ether if (msg.value == 0.00000112 ether) { returnDeposit(); } else { makeDeposit(); } } //Pays out, takes taxes according to holding time function _payout(address addr, uint amount) private { //Remember this payout percentWithdrawn[addr] += amount; //Get current holder adv percent uint advPct = holderAdvPercent(addr); //Calculate pure payout that user receives uint interestPure = amount.mul(PERCENT_DIVIDER - PERCENT_CHARITY_FUND - advPct).div(PERCENT_DIVIDER); percentWithdrawnPure[addr] += interestPure; userTime[addr] = now; //calculate money to charity uint charityMoney = amount.mul(PERCENT_CHARITY_FUND).div(PERCENT_DIVIDER); countOfCharity += charityMoney; //calculate money for advertising uint advTax = amount.sub(interestPure).sub(charityMoney); //send money ADDRESS_ADV_FUND.transfer(advTax); ADDRESS_CHARITY_FUND.transfer(charityMoney); addr.transfer(interestPure); } //Clears user from registry function _delete(address addr) private { userDeposit[addr] = 0; userTime[addr] = 0; percentWithdrawn[addr] = 0; percentWithdrawnPure[addr] = 0; } } /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns(uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns(uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } function sub(uint256 a, uint256 b) internal pure returns(uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b) internal pure returns(uint256) { uint256 c = a + b; assert(c >= a); return c; } }
違いを見つける