Diff
checker
テキスト
テキスト
画像
ドキュメント
Excel
フォルダ
Legal
Enterprise
デスクトップ
料金
ログイン
Diffchecker デスクトップのダウンロード
テキスト比較
2 つのテキスト ファイルの違いを見つける
ツール
履歴
ライブエディター
未変更行を折りたたむ
折り返しなし
レイアウト
分割
統合
比較精度
スマート
単語
文字
シンタックスハイライト
構文を選択
無視
テキスト変換
最初の差分へ移動
入力を編集
Diffchecker Desktop
Diffcheckerを実行する最も安全な方法。Diffchecker Desktopアプリを入手:あなたの差分はコンピューターから出ることはありません!
Desktopを入手
BUSD Auto Miner vs BUSDWealth
作成日
4 年前
差分は期限切れになりません
クリア
エクスポート
共有
説明
50 削除
行
合計
削除
文字
合計
削除
この機能を引き続き使用するには、アップグレードしてください
Diff
checker
Pro
価格を見る
493 行
すべてコピー
20 追加
行
合計
追加
文字
合計
追加
この機能を引き続き使用するには、アップグレードしてください
Diff
checker
Pro
価格を見る
476 行
すべてコピー
コピー
コピー済み
コピー
コピー済み
/**
*Submitted for verification at BscScan.com on 2022-08-31
*/
/**
/**
コピー
コピー済み
コピー
コピー済み
* ____ _ _ ____ ____ _ _ _ _____ ___ __ __ ___ _ _ _____
*Submitted for verification at BscScan.com on 2022-09-16
* | __ )| | | / ___|| _ \ / \ | | | |_ _/ _ \| \/ |_ _| \ | | ____|
* | _ \| | | \___ \| | | | / _ \| | | | | || | | | |\/| || || \| | _|
* | |_) | |_| |___) | |_| | / ___ \ |_| | | || |_| | | | || || |\ | |___
* |____/ \___/|____/|____/ /_/ \_\___/ |_| \___/|_| |_|___|_| \_|_____|
*
*/
*/
// SPDX-License-Identifier: MIT
// SPDX-License-Identifier: MIT
コピー
コピー済み
コピー
コピー済み
/*
Official Website: BUSDWealth.com
Telegram: @busdwealth
*/
pragma solidity 0.8.16;
pragma solidity 0.8.16;
interface IERC20 {
interface IERC20 {
function totalSupply() external view returns (uint256);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
function transferFrom(
address sender,
address sender,
address recipient,
address recipient,
uint256 amount
uint256 amount
) external returns (bool);
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
}
library Address {
library Address {
function isContract(address account) internal view returns (bool) {
function isContract(address account) internal view returns (bool) {
uint256 size; assembly {
uint256 size; assembly {
size := extcodesize(account)
size := extcodesize(account)
} return size > 0;
} return size > 0;
}
}
function sendValue(address payable recipient, uint256 amount) internal {
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
require(success, "Address: unable to send value, recipient may have reverted");
}
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
return functionCall(target, data, "Address: low-level call failed");
}
}
function functionCall(address target,bytes memory data,string memory errorMessage) internal returns (bytes memory) {
function functionCall(address target,bytes memory data,string memory errorMessage) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
return functionCallWithValue(target, data, 0, errorMessage);
}
}
function functionCallWithValue(address target,bytes memory data,uint256 value) internal returns (bytes memory) {
function functionCallWithValue(address target,bytes memory data,uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
}
function functionCallWithValue(address target,bytes memory data,uint256 value,string memory errorMessage) internal returns (bytes memory) {
function functionCallWithValue(address target,bytes memory data,uint256 value,string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
return verifyCallResult(success, returndata, errorMessage);
}
}
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
return functionStaticCall(target, data, "Address: low-level static call failed");
}
}
function functionStaticCall(address target,bytes memory data,string memory errorMessage) internal view returns (bytes memory) {
function functionStaticCall(address target,bytes memory data,string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
return verifyCallResult(success, returndata, errorMessage);
}
}
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
}
function functionDelegateCall(address target,bytes memory data,string memory errorMessage) internal returns (bytes memory) {
function functionDelegateCall(address target,bytes memory data,string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
return verifyCallResult(success, returndata, errorMessage);
}
}
function verifyCallResult(bool success,bytes memory returndata,string memory errorMessage) internal pure returns (bytes memory) {
function verifyCallResult(bool success,bytes memory returndata,string memory errorMessage) internal pure returns (bytes memory) {
if (success) {
if (success) {
return returndata;
return returndata;
} else {
} else {
if (returndata.length > 0) {
if (returndata.length > 0) {
assembly {
assembly {
let returndata_size := mload(returndata)
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
revert(add(32, returndata), returndata_size)
}
}
} else {
} else {
revert(errorMessage);
revert(errorMessage);
}
}
}
}
}
}
}
}
library SafeERC20 {
library SafeERC20 {
using Address for address;
using Address for address;
function safeTransfer(
function safeTransfer(
IERC20 token,
IERC20 token,
address to,
address to,
uint256 value
uint256 value
) internal {
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
}
function safeTransferFrom(
function safeTransferFrom(
IERC20 token,
IERC20 token,
address from,
address from,
address to,
address to,
uint256 value
uint256 value
) internal {
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
}
function safeApprove(
function safeApprove(
IERC20 token,
IERC20 token,
address spender,
address spender,
uint256 value
uint256 value
) internal {
) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance");
"SafeERC20: approve from non-zero to non-zero allowance");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
}
function safeIncreaseAllowance(IERC20 token,address spender,uint256 value) internal {
function safeIncreaseAllowance(IERC20 token,address spender,uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
function safeDecreaseAllowance(IERC20 token,address spender,uint256 value) internal {
function safeDecreaseAllowance(IERC20 token,address spender,uint256 value) internal {
unchecked {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
}
}
function _callOptionalReturn(IERC20 token, bytes memory data) private {
function _callOptionalReturn(IERC20 token, bytes memory data) private {
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
if (returndata.length > 0) {
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
}
}
}
library SafeMath {
library SafeMath {
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;
require(c >= a, "SafeMath: addition overflow");
require(c >= a, "SafeMath: addition overflow");
return c;
return c;
}
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
require(b <= a, "SafeMath: subtraction overflow");
uint256 c = a - b;
uint256 c = a - b;
return c;
return c;
}
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
if (a == 0) {
return 0;
return 0;
}
}
uint256 c = a * b;
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
require(c / a == b, "SafeMath: multiplication overflow");
return c;
return c;
}
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: division by zero");
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
uint256 c = a / b;
return c;
return c;
}
}
}
}
//libraries
//libraries
struct User {
struct User {
uint256 startDate;
uint256 startDate;
uint256 divs;
uint256 divs;
uint256 refBonus;
uint256 refBonus;
uint256 totalInits;
uint256 totalInits;
uint256 totalWiths;
uint256 totalWiths;
uint256 totalAccrued;
uint256 totalAccrued;
uint256 lastWith;
uint256 lastWith;
uint256 timesCmpd;
uint256 timesCmpd;
uint256 keyCounter;
uint256 keyCounter;
Depo [] depoList;
Depo [] depoList;
}
}
struct Depo {
struct Depo {
uint256 key;
uint256 key;
uint256 depoTime;
uint256 depoTime;
uint256 amt;
uint256 amt;
address reffy;
address reffy;
bool initialWithdrawn;
bool initialWithdrawn;
}
}
struct Main {
struct Main {
uint256 ovrTotalDeps;
uint256 ovrTotalDeps;
uint256 ovrTotalWiths;
uint256 ovrTotalWiths;
uint256 users;
uint256 users;
uint256 compounds;
uint256 compounds;
}
}
struct DivPercs{
struct DivPercs{
uint256 daysInSeconds; // updated to be in seconds
uint256 daysInSeconds; // updated to be in seconds
uint256 divsPercentage;
uint256 divsPercentage;
}
}
struct FeesPercs{
struct FeesPercs{
uint256 daysInSeconds;
uint256 daysInSeconds;
uint256 feePercentage;
uint256 feePercentage;
}
}
コピー
コピー済み
コピー
コピー済み
contract
BUSDAutoMine
{
contract
BUSDWealth
{
using SafeMath for uint256;
using SafeMath for uint256;
コピー
コピー済み
コピー
コピー済み
uint256 constant launch = 166
21380
00;
uint256 constant launch = 166
38588
00;
//Launch 22nd September, 7 pm utc
uint256 constant hardDays = 86400;
uint256 constant hardDays = 86400;
コピー
コピー済み
コピー
コピー済み
uint256 constant minStakeAmt =
50
* 10**18;
uint256 constant minStakeAmt =
10
* 10**18;
//10 BUSD
uint256 constant percentdiv = 1000;
uint256 constant percentdiv = 1000;
コピー
コピー済み
コピー
コピー済み
uint256 refPercentage =
100;
uint256 refPercentage =
30; //3% referral, can only be staked
uint256 devPercentage =
100;
uint256 devPercentage =
50; //5% buy and sell tax
mapping (address => mapping(uint256 => Depo)) public DeposMap;
mapping (address => mapping(uint256 => Depo)) public DeposMap;
mapping (address => User) public UsersKey;
mapping (address => User) public UsersKey;
mapping (uint256 => DivPercs) public PercsKey;
mapping (uint256 => DivPercs) public PercsKey;
mapping (uint256 => FeesPercs) public FeesKey;
mapping (uint256 => FeesPercs) public FeesKey;
mapping (uint256 => Main) public MainKey;
mapping (uint256 => Main) public MainKey;
using SafeERC20 for IERC20;
using SafeERC20 for IERC20;
IERC20 public BUSD;
IERC20 public BUSD;
address public owner;
address public owner;
constructor() {
constructor() {
owner = msg.sender;
owner = msg.sender;
コピー
コピー済み
コピー
コピー済み
PercsKey[10] = DivPercs(864000,
15
);
PercsKey[10] = DivPercs(864000,
10
);
PercsKey[20] = DivPercs(1728000,
25
);
PercsKey[20] = DivPercs(1728000,
20
);
PercsKey[30] = DivPercs(2592000,
35
);
PercsKey[30] = DivPercs(2592000,
30
);
PercsKey[40] = DivPercs(3456000,
45
);
PercsKey[40] = DivPercs(3456000,
40
);
PercsKey[50] = DivPercs(4320000,
55
);
PercsKey[50] = DivPercs(4320000,
50
);
FeesKey[10] = FeesPercs(864000,
2
00);
FeesKey[10] = FeesPercs(864000,
1
00);
FeesKey[20] = FeesPercs(1728000,
1
80);
FeesKey[20] = FeesPercs(1728000,
80);
FeesKey[30] = FeesPercs(3456000,
1
50);
FeesKey[30] = FeesPercs(3456000,
50);
FeesKey[40] = FeesPercs(4320000,
1
20);
FeesKey[40] = FeesPercs(4320000,
20);
BUSD = IERC20(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56);
BUSD = IERC20(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56);
}
}
function stakeStablecoins(uint256 amtx, address ref) external {
function stakeStablecoins(uint256 amtx, address ref) external {
require(block.timestamp >= launch, "App did not launch yet.");
require(block.timestamp >= launch, "App did not launch yet.");
require(ref != msg.sender, "You cannot refer yourself!");
require(ref != msg.sender, "You cannot refer yourself!");
コピー
コピー済み
コピー
コピー済み
require(amtx >= minStakeAmt, "You should stake at least
50
.");
require(amtx >= minStakeAmt, "You should stake at least
10
.");
BUSD.safeTransferFrom(msg.sender, address(this), amtx);
BUSD.safeTransferFrom(msg.sender, address(this), amtx);
User storage user = UsersKey[msg.sender];
User storage user = UsersKey[msg.sender];
User storage user2 = UsersKey[ref];
User storage user2 = UsersKey[ref];
Main storage main = MainKey[1];
Main storage main = MainKey[1];
if (user.lastWith == 0){
if (user.lastWith == 0){
user.lastWith = block.timestamp;
user.lastWith = block.timestamp;
user.startDate = block.timestamp;
user.startDate = block.timestamp;
}
}
uint256 userStakePercentAdjustment = 1000 - devPercentage;
uint256 userStakePercentAdjustment = 1000 - devPercentage;
uint256 adjustedAmt = amtx.mul(userStakePercentAdjustment).div(percentdiv);
uint256 adjustedAmt = amtx.mul(userStakePercentAdjustment).div(percentdiv);
uint256 stakeFee = amtx.mul(devPercentage).div(percentdiv);
uint256 stakeFee = amtx.mul(devPercentage).div(percentdiv);
user.totalInits += adjustedAmt;
user.totalInits += adjustedAmt;
uint256 refAmtx = adjustedAmt.mul(refPercentage).div(percentdiv);
uint256 refAmtx = adjustedAmt.mul(refPercentage).div(percentdiv);
if (ref != 0x000000000000000000000000000000000000dEaD) {
if (ref != 0x000000000000000000000000000000000000dEaD) {
user2.refBonus += refAmtx;
user2.refBonus += refAmtx;
}
}
user.depoList.push(Depo({
user.depoList.push(Depo({
key: user.depoList.length,
key: user.depoList.length,
depoTime: block.timestamp,
depoTime: block.timestamp,
amt: adjustedAmt,
amt: adjustedAmt,
reffy: ref,
reffy: ref,
initialWithdrawn: false
initialWithdrawn: false
}));
}));
user.keyCounter += 1;
user.keyCounter += 1;
main.ovrTotalDeps += 1;
main.ovrTotalDeps += 1;
main.users += 1;
main.users += 1;
BUSD.safeTransfer(owner, stakeFee);
BUSD.safeTransfer(owner, stakeFee);
}
}
function userInfo() view external returns (Depo [] memory depoList) {
function userInfo() view external returns (Depo [] memory depoList) {
User storage user = UsersKey[msg.sender];
User storage user = UsersKey[msg.sender];
return(
return(
user.depoList
user.depoList
);
);
}
}
function withdrawDivs() external returns (uint256 withdrawAmount) {
function withdrawDivs() external returns (uint256 withdrawAmount) {
User storage user = UsersKey[msg.sender];
User storage user = UsersKey[msg.sender];
Main storage main = MainKey[1];
Main storage main = MainKey[1];
uint256 x = calcdiv(msg.sender);
uint256 x = calcdiv(msg.sender);
for (uint i = 0; i < user.depoList.length; i++){
for (uint i = 0; i < user.depoList.length; i++){
if (user.depoList[i].initialWithdrawn == false) {
if (user.depoList[i].initialWithdrawn == false) {
user.depoList[i].depoTime = block.timestamp;
user.depoList[i].depoTime = block.timestamp;
}
}
}
}
uint256 adjustedPercent = 1000 - devPercentage;
uint256 adjustedPercent = 1000 - devPercentage;
uint256 adjustedAmt = x.mul(adjustedPercent).div(percentdiv);
uint256 adjustedAmt = x.mul(adjustedPercent).div(percentdiv);
uint256 withdrawFee = x.mul(devPercentage).div(percentdiv);
uint256 withdrawFee = x.mul(devPercentage).div(percentdiv);
main.ovrTotalWiths += x;
main.ovrTotalWiths += x;
user.lastWith = block.timestamp;
user.lastWith = block.timestamp;
BUSD.safeTransfer(msg.sender, adjustedAmt);
BUSD.safeTransfer(msg.sender, adjustedAmt);
BUSD.safeTransfer(owner, withdrawFee);
BUSD.safeTransfer(owner, withdrawFee);
return x;
return x;
}
}
function withdrawInitial(uint256 keyy) external {
function withdrawInitial(uint256 keyy) external {
User storage user = UsersKey[msg.sender];
User storage user = UsersKey[msg.sender];
require(user.depoList[keyy].initialWithdrawn == false, "This has already been withdrawn.");
require(user.depoList[keyy].initialWithdrawn == false, "This has already been withdrawn.");
uint256 initialAmt = user.depoList[keyy].amt;
uint256 initialAmt = user.depoList[keyy].amt;
uint256 currDays1 = user.depoList[keyy].depoTime;
uint256 currDays1 = user.depoList[keyy].depoTime;
uint256 currTime = block.timestamp;
uint256 currTime = block.timestamp;
uint256 currDays = currTime - currDays1;
uint256 currDays = currTime - currDays1;
uint256 transferAmt;
uint256 transferAmt;
コピー
コピー済み
コピー
コピー済み
if (currDays < FeesKey[10].daysInSeconds){
// LESS THAN 10 DAYS STAKED
if (currDays < FeesKey[10].daysInSeconds){
uint256 minusAmt = initialAmt.mul(FeesKey[10].feePercentage).div(percentdiv);
//20% fee
uint256 minusAmt = initialAmt.mul(FeesKey[10].feePercentage).div(percentdiv);
uint256 dailyReturn = initialAmt.mul(PercsKey[10].divsPercentage).div(percentdiv);
uint256 dailyReturn = initialAmt.mul(PercsKey[10].divsPercentage).div(percentdiv);
uint256 currentReturn = dailyReturn.mul(currDays).div(hardDays);
uint256 currentReturn = dailyReturn.mul(currDays).div(hardDays);
transferAmt = initialAmt + currentReturn - minusAmt;
transferAmt = initialAmt + currentReturn - minusAmt;
user.depoList[keyy].amt = 0;
user.depoList[keyy].amt = 0;
user.depoList[keyy].initialWithdrawn = true;
user.depoList[keyy].initialWithdrawn = true;
user.depoList[keyy].depoTime = block.timestamp;
user.depoList[keyy].depoTime = block.timestamp;
BUSD.safeTransfer(msg.sender, transferAmt);
BUSD.safeTransfer(msg.sender, transferAmt);
コピー
コピー済み
コピー
コピー済み
BUSD.safeTransfer(owner, minusAmt);
コピー
コピー済み
コピー
コピー済み
} else if (currDays >= FeesKey[10].daysInSeconds && currDays < FeesKey[20].daysInSeconds){
// BETWEEN 20 and 30 DAYS
} else if (currDays >= FeesKey[10].daysInSeconds && currDays < FeesKey[20].daysInSeconds){
uint256 minusAmt = initialAmt.mul(FeesKey[20].feePercentage).div(percentdiv);
//18% fee
uint256 minusAmt = initialAmt.mul(FeesKey[20].feePercentage).div(percentdiv);
uint256 dailyReturn = initialAmt.mul(PercsKey[10].divsPercentage).div(percentdiv);
uint256 dailyReturn = initialAmt.mul(PercsKey[10].divsPercentage).div(percentdiv);
uint256 currentReturn = dailyReturn.mul(currDays).div(hardDays);
uint256 currentReturn = dailyReturn.mul(currDays).div(hardDays);
transferAmt = initialAmt + currentReturn - minusAmt;
transferAmt = initialAmt + currentReturn - minusAmt;
user.depoList[keyy].amt = 0;
user.depoList[keyy].amt = 0;
user.depoList[keyy].initialWithdrawn = true;
user.depoList[keyy].initialWithdrawn = true;
user.depoList[keyy].depoTime = block.timestamp;
user.depoList[keyy].depoTime = block.timestamp;
BUSD.safeTransfer(msg.sender, transferAmt);
BUSD.safeTransfer(msg.sender, transferAmt);
コピー
コピー済み
コピー
コピー済み
BUSD.safeTransfer(owner, minusAmt);
コピー
コピー済み
コピー
コピー済み
} else if (currDays >= FeesKey[20].daysInSeconds && currDays < FeesKey[30].daysInSeconds){
// BETWEEN 30 and 40 DAYS
} else if (currDays >= FeesKey[20].daysInSeconds && currDays < FeesKey[30].daysInSeconds){
uint256 minusAmt = initialAmt.mul(FeesKey[30].feePercentage).div(percentdiv);
//15% fee
uint256 minusAmt = initialAmt.mul(FeesKey[30].feePercentage).div(percentdiv);
uint256 dailyReturn = initialAmt.mul(PercsKey[20].divsPercentage).div(percentdiv);
uint256 dailyReturn = initialAmt.mul(PercsKey[20].divsPercentage).div(percentdiv);
uint256 currentReturn = dailyReturn.mul(currDays).div(hardDays);
uint256 currentReturn = dailyReturn.mul(currDays).div(hardDays);
transferAmt = initialAmt + currentReturn - minusAmt;
transferAmt = initialAmt + currentReturn - minusAmt;
user.depoList[keyy].amt = 0;
user.depoList[keyy].amt = 0;
user.depoList[keyy].initialWithdrawn = true;
user.depoList[keyy].initialWithdrawn = true;
user.depoList[keyy].depoTime = block.timestamp;
user.depoList[keyy].depoTime = block.timestamp;
BUSD.safeTransfer(msg.sender, transferAmt);
BUSD.safeTransfer(msg.sender, transferAmt);
コピー
コピー済み
コピー
コピー済み
BUSD.safeTransfer(owner, minusAmt);
コピー
コピー済み
コピー
コピー済み
} else if (currDays >= FeesKey[30].daysInSeconds && currDays < FeesKey[40].daysInSeconds){
// BETWEEN 30 and 40 DAYS
} else if (currDays >= FeesKey[30].daysInSeconds && currDays < FeesKey[40].daysInSeconds){
uint256 minusAmt = initialAmt.mul(FeesKey[40].feePercentage).div(percentdiv);
//15% fee
uint256 minusAmt = initialAmt.mul(FeesKey[40].feePercentage).div(percentdiv);
uint256 dailyReturn = initialAmt.mul(PercsKey[30].divsPercentage).div(percentdiv);
uint256 dailyReturn = initialAmt.mul(PercsKey[30].divsPercentage).div(percentdiv);
uint256 currentReturn = dailyReturn.mul(currDays).div(hardDays);
uint256 currentReturn = dailyReturn.mul(currDays).div(hardDays);
transferAmt = initialAmt + currentReturn - minusAmt;
transferAmt = initialAmt + currentReturn - minusAmt;
user.depoList[keyy].amt = 0;
user.depoList[keyy].amt = 0;
user.depoList[keyy].initialWithdrawn = true;
user.depoList[keyy].initialWithdrawn = true;
user.depoList[keyy].depoTime = block.timestamp;
user.depoList[keyy].depoTime = block.timestamp;
BUSD.safeTransfer(msg.sender, transferAmt);
BUSD.safeTransfer(msg.sender, transferAmt);
コピー
コピー済み
コピー
コピー済み
BUSD.safeTransfer(owner, minusAmt);
コピー
コピー済み
コピー
コピー済み
} else if (currDays >= FeesKey[40].daysInSeconds && currDays < FeesKey[50].daysInSeconds){
// BETWEEN 30 and 40 DAYS
} else if (currDays >= FeesKey[40].daysInSeconds && currDays < FeesKey[50].daysInSeconds){
uint256 minusAmt = initialAmt.mul(FeesKey[40].feePercentage).div(percentdiv);
//12% fee
uint256 minusAmt = initialAmt.mul(FeesKey[40].feePercentage).div(percentdiv);
uint256 dailyReturn = initialAmt.mul(PercsKey[40].divsPercentage).div(percentdiv);
uint256 dailyReturn = initialAmt.mul(PercsKey[40].divsPercentage).div(percentdiv);
uint256 currentReturn = dailyReturn.mul(currDays).div(hardDays);
uint256 currentReturn = dailyReturn.mul(currDays).div(hardDays);
transferAmt = initialAmt + currentReturn - minusAmt;
transferAmt = initialAmt + currentReturn - minusAmt;
user.depoList[keyy].amt = 0;
user.depoList[keyy].amt = 0;
user.depoList[keyy].initialWithdrawn = true;
user.depoList[keyy].initialWithdrawn = true;
user.depoList[keyy].depoTime = block.timestamp;
user.depoList[keyy].depoTime = block.timestamp;
BUSD.safeTransfer(msg.sender, transferAmt);
BUSD.safeTransfer(msg.sender, transferAmt);
コピー
コピー済み
コピー
コピー済み
BUSD.safeTransfer(owner, minusAmt);
コピー
コピー済み
コピー
コピー済み
} else if (currDays >= FeesKey[50].daysInSeconds){
// 40+ DAYS
} else if (currDays >= FeesKey[50].daysInSeconds){
uint256 minusAmt = initialAmt.mul(FeesKey[40].feePercentage).div(percentdiv);
//12% fee
uint256 minusAmt = initialAmt.mul(FeesKey[40].feePercentage).div(percentdiv);
uint256 dailyReturn = initialAmt.mul(PercsKey[50].divsPercentage).div(percentdiv);
uint256 dailyReturn = initialAmt.mul(PercsKey[50].divsPercentage).div(percentdiv);
uint256 currentReturn = dailyReturn.mul(currDays).div(hardDays);
uint256 currentReturn = dailyReturn.mul(currDays).div(hardDays);
transferAmt = initialAmt + currentReturn - minusAmt;
transferAmt = initialAmt + currentReturn - minusAmt;
user.depoList[keyy].amt = 0;
user.depoList[keyy].amt = 0;
user.depoList[keyy].initialWithdrawn = true;
user.depoList[keyy].initialWithdrawn = true;
user.depoList[keyy].depoTime = block.timestamp;
user.depoList[keyy].depoTime = block.timestamp;
BUSD.safeTransfer(msg.sender, transferAmt);
BUSD.safeTransfer(msg.sender, transferAmt);
コピー
コピー済み
コピー
コピー済み
BUSD.safeTransfer(owner, minusAmt);
} else {
} else {
revert("Could not calculate the # of days youv've been staked.");
revert("Could not calculate the # of days youv've been staked.");
}
}
}
}
コピー
コピー済み
コピー
コピー済み
function withdrawRefBonus() external {
User storage user = UsersKey[msg.sender];
uint256 amtz = user.refBonus;
user.refBonus = 0;
BUSD.safeTransfer(msg.sender, amtz);
}
function stakeRefBonus() external {
function stakeRefBonus() external {
User storage user = UsersKey[msg.sender];
User storage user = UsersKey[msg.sender];
Main storage main = MainKey[1];
Main storage main = MainKey[1];
require(user.refBonus > 10);
require(user.refBonus > 10);
uint256 refferalAmount = user.refBonus;
uint256 refferalAmount = user.refBonus;
user.refBonus = 0;
user.refBonus = 0;
address ref = 0x000000000000000000000000000000000000dEaD; //DEAD ADDRESS
address ref = 0x000000000000000000000000000000000000dEaD; //DEAD ADDRESS
user.depoList.push(Depo({
user.depoList.push(Depo({
key: user.keyCounter,
key: user.keyCounter,
depoTime: block.timestamp,
depoTime: block.timestamp,
amt: refferalAmount,
amt: refferalAmount,
reffy: ref,
reffy: ref,
initialWithdrawn: false
initialWithdrawn: false
}));
}));
user.keyCounter += 1;
user.keyCounter += 1;
main.ovrTotalDeps += 1;
main.ovrTotalDeps += 1;
}
}
function calcdiv(address dy) public view returns (uint256 totalWithdrawable) {
function calcdiv(address dy) public view returns (uint256 totalWithdrawable) {
User storage user = UsersKey[dy];
User storage user = UsersKey[dy];
uint256 with;
uint256 with;
for (uint256 i = 0; i < user.depoList.length; i++){
for (uint256 i = 0; i < user.depoList.length; i++){
uint256 elapsedTime = block.timestamp.sub(user.depoList[i].depoTime);
uint256 elapsedTime = block.timestamp.sub(user.depoList[i].depoTime);
uint256 amount = user.depoList[i].amt;
uint256 amount = user.depoList[i].amt;
if (user.depoList[i].initialWithdrawn == false){
if (user.depoList[i].initialWithdrawn == false){
if (elapsedTime <= PercsKey[20].daysInSeconds){
if (elapsedTime <= PercsKey[20].daysInSeconds){
uint256 dailyReturn = amount.mul(PercsKey[10].divsPercentage).div(percentdiv);
uint256 dailyReturn = amount.mul(PercsKey[10].divsPercentage).div(percentdiv);
uint256 currentReturn = dailyReturn.mul(elapsedTime).div(PercsKey[10].daysInSeconds / 10);
uint256 currentReturn = dailyReturn.mul(elapsedTime).div(PercsKey[10].daysInSeconds / 10);
with += currentReturn;
with += currentReturn;
}
}
if (elapsedTime > PercsKey[20].daysInSeconds && elapsedTime <= PercsKey[30].daysInSeconds){
if (elapsedTime > PercsKey[20].daysInSeconds && elapsedTime <= PercsKey[30].daysInSeconds){
uint256 dailyReturn = amount.mul(PercsKey[20].divsPercentage).div(percentdiv);
uint256 dailyReturn = amount.mul(PercsKey[20].divsPercentage).div(percentdiv);
uint256 currentReturn = dailyReturn.mul(elapsedTime).div(PercsKey[10].daysInSeconds / 10);
uint256 currentReturn = dailyReturn.mul(elapsedTime).div(PercsKey[10].daysInSeconds / 10);
with += currentReturn;
with += currentReturn;
}
}
if (elapsedTime > PercsKey[30].daysInSeconds && elapsedTime <= PercsKey[40].daysInSeconds){
if (elapsedTime > PercsKey[30].daysInSeconds && elapsedTime <= PercsKey[40].daysInSeconds){
uint256 dailyReturn = amount.mul(PercsKey[30].divsPercentage).div(percentdiv);
uint256 dailyReturn = amount.mul(PercsKey[30].divsPercentage).div(percentdiv);
uint256 currentReturn = dailyReturn.mul(elapsedTime).div(PercsKey[10].daysInSeconds / 10);
uint256 currentReturn = dailyReturn.mul(elapsedTime).div(PercsKey[10].daysInSeconds / 10);
with += currentReturn;
with += currentReturn;
}
}
if (elapsedTime > PercsKey[40].daysInSeconds && elapsedTime <= PercsKey[50].daysInSeconds){
if (elapsedTime > PercsKey[40].daysInSeconds && elapsedTime <= PercsKey[50].daysInSeconds){
uint256 dailyReturn = amount.mul(PercsKey[40].divsPercentage).div(percentdiv);
uint256 dailyReturn = amount.mul(PercsKey[40].divsPercentage).div(percentdiv);
uint256 currentReturn = dailyReturn.mul(elapsedTime).div(PercsKey[10].daysInSeconds / 10);
uint256 currentReturn = dailyReturn.mul(elapsedTime).div(PercsKey[10].daysInSeconds / 10);
with += currentReturn;
with += currentReturn;
}
}
if (elapsedTime > PercsKey[50].daysInSeconds){
if (elapsedTime > PercsKey[50].daysInSeconds){
uint256 dailyReturn = amount.mul(PercsKey[50].divsPercentage).div(percentdiv);
uint256 dailyReturn = amount.mul(PercsKey[50].divsPercentage).div(percentdiv);
uint256 currentReturn = dailyReturn.mul(elapsedTime).div(PercsKey[10].daysInSeconds / 10);
uint256 currentReturn = dailyReturn.mul(elapsedTime).div(PercsKey[10].daysInSeconds / 10);
with += currentReturn;
with += currentReturn;
}
}
}
}
}
}
return with;
return with;
}
}
function compound() external {
function compound() external {
User storage user = UsersKey[msg.sender];
User storage user = UsersKey[msg.sender];
Main storage main = MainKey[1];
Main storage main = MainKey[1];
uint256 y = calcdiv(msg.sender);
uint256 y = calcdiv(msg.sender);
for (uint i = 0; i < user.depoList.length; i++){
for (uint i = 0; i < user.depoList.length; i++){
if (user.depoList[i].initialWithdrawn == false) {
if (user.depoList[i].initialWithdrawn == false) {
user.depoList[i].depoTime = block.timestamp;
user.depoList[i].depoTime = block.timestamp;
}
}
}
}
user.depoList.push(Depo({
user.depoList.push(Depo({
key: user.keyCounter,
key: user.keyCounter,
depoTime: block.timestamp,
depoTime: block.timestamp,
amt: y,
amt: y,
reffy: 0x000000000000000000000000000000000000dEaD,
reffy: 0x000000000000000000000000000000000000dEaD,
initialWithdrawn: false
initialWithdrawn: false
}));
}));
user.keyCounter += 1;
user.keyCounter += 1;
main.ovrTotalDeps += 1;
main.ovrTotalDeps += 1;
main.compounds += 1;
main.compounds += 1;
user.lastWith = block.timestamp;
user.lastWith = block.timestamp;
}
}
}
}
保存された差分
原文
ファイルを開く
/** *Submitted for verification at BscScan.com on 2022-08-31 */ /** * ____ _ _ ____ ____ _ _ _ _____ ___ __ __ ___ _ _ _____ * | __ )| | | / ___|| _ \ / \ | | | |_ _/ _ \| \/ |_ _| \ | | ____| * | _ \| | | \___ \| | | | / _ \| | | | | || | | | |\/| || || \| | _| * | |_) | |_| |___) | |_| | / ___ \ |_| | | || |_| | | | || || |\ | |___ * |____/ \___/|____/|____/ /_/ \_\___/ |_| \___/|_| |_|___|_| \_|_____| * */ // SPDX-License-Identifier: MIT pragma solidity 0.8.16; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library Address { function isContract(address account) internal view returns (bool) { uint256 size; assembly { size := extcodesize(account) } return size > 0; } function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } function functionCall(address target,bytes memory data,string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } function functionCallWithValue(address target,bytes memory data,uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } function functionCallWithValue(address target,bytes memory data,uint256 value,string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } function functionStaticCall(address target,bytes memory data,string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } function functionDelegateCall(address target,bytes memory data,string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } function verifyCallResult(bool success,bytes memory returndata,string memory errorMessage) internal pure returns (bytes memory) { if (success) { return returndata; } else { if (returndata.length > 0) { assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } function safeApprove( IERC20 token, address spender, uint256 value ) internal { require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token,address spender,uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token,address spender,uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function _callOptionalReturn(IERC20 token, bytes memory data) private { bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: division by zero"); uint256 c = a / b; return c; } } //libraries struct User { uint256 startDate; uint256 divs; uint256 refBonus; uint256 totalInits; uint256 totalWiths; uint256 totalAccrued; uint256 lastWith; uint256 timesCmpd; uint256 keyCounter; Depo [] depoList; } struct Depo { uint256 key; uint256 depoTime; uint256 amt; address reffy; bool initialWithdrawn; } struct Main { uint256 ovrTotalDeps; uint256 ovrTotalWiths; uint256 users; uint256 compounds; } struct DivPercs{ uint256 daysInSeconds; // updated to be in seconds uint256 divsPercentage; } struct FeesPercs{ uint256 daysInSeconds; uint256 feePercentage; } contract BUSDAutoMine { using SafeMath for uint256; uint256 constant launch = 1662138000; uint256 constant hardDays = 86400; uint256 constant minStakeAmt = 50 * 10**18; uint256 constant percentdiv = 1000; uint256 refPercentage = 100; uint256 devPercentage = 100; mapping (address => mapping(uint256 => Depo)) public DeposMap; mapping (address => User) public UsersKey; mapping (uint256 => DivPercs) public PercsKey; mapping (uint256 => FeesPercs) public FeesKey; mapping (uint256 => Main) public MainKey; using SafeERC20 for IERC20; IERC20 public BUSD; address public owner; constructor() { owner = msg.sender; PercsKey[10] = DivPercs(864000, 15); PercsKey[20] = DivPercs(1728000, 25); PercsKey[30] = DivPercs(2592000, 35); PercsKey[40] = DivPercs(3456000, 45); PercsKey[50] = DivPercs(4320000, 55); FeesKey[10] = FeesPercs(864000, 200); FeesKey[20] = FeesPercs(1728000, 180); FeesKey[30] = FeesPercs(3456000, 150); FeesKey[40] = FeesPercs(4320000, 120); BUSD = IERC20(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56); } function stakeStablecoins(uint256 amtx, address ref) external { require(block.timestamp >= launch, "App did not launch yet."); require(ref != msg.sender, "You cannot refer yourself!"); require(amtx >= minStakeAmt, "You should stake at least 50."); BUSD.safeTransferFrom(msg.sender, address(this), amtx); User storage user = UsersKey[msg.sender]; User storage user2 = UsersKey[ref]; Main storage main = MainKey[1]; if (user.lastWith == 0){ user.lastWith = block.timestamp; user.startDate = block.timestamp; } uint256 userStakePercentAdjustment = 1000 - devPercentage; uint256 adjustedAmt = amtx.mul(userStakePercentAdjustment).div(percentdiv); uint256 stakeFee = amtx.mul(devPercentage).div(percentdiv); user.totalInits += adjustedAmt; uint256 refAmtx = adjustedAmt.mul(refPercentage).div(percentdiv); if (ref != 0x000000000000000000000000000000000000dEaD) { user2.refBonus += refAmtx; } user.depoList.push(Depo({ key: user.depoList.length, depoTime: block.timestamp, amt: adjustedAmt, reffy: ref, initialWithdrawn: false })); user.keyCounter += 1; main.ovrTotalDeps += 1; main.users += 1; BUSD.safeTransfer(owner, stakeFee); } function userInfo() view external returns (Depo [] memory depoList) { User storage user = UsersKey[msg.sender]; return( user.depoList ); } function withdrawDivs() external returns (uint256 withdrawAmount) { User storage user = UsersKey[msg.sender]; Main storage main = MainKey[1]; uint256 x = calcdiv(msg.sender); for (uint i = 0; i < user.depoList.length; i++){ if (user.depoList[i].initialWithdrawn == false) { user.depoList[i].depoTime = block.timestamp; } } uint256 adjustedPercent = 1000 - devPercentage; uint256 adjustedAmt = x.mul(adjustedPercent).div(percentdiv); uint256 withdrawFee = x.mul(devPercentage).div(percentdiv); main.ovrTotalWiths += x; user.lastWith = block.timestamp; BUSD.safeTransfer(msg.sender, adjustedAmt); BUSD.safeTransfer(owner, withdrawFee); return x; } function withdrawInitial(uint256 keyy) external { User storage user = UsersKey[msg.sender]; require(user.depoList[keyy].initialWithdrawn == false, "This has already been withdrawn."); uint256 initialAmt = user.depoList[keyy].amt; uint256 currDays1 = user.depoList[keyy].depoTime; uint256 currTime = block.timestamp; uint256 currDays = currTime - currDays1; uint256 transferAmt; if (currDays < FeesKey[10].daysInSeconds){ // LESS THAN 10 DAYS STAKED uint256 minusAmt = initialAmt.mul(FeesKey[10].feePercentage).div(percentdiv); //20% fee uint256 dailyReturn = initialAmt.mul(PercsKey[10].divsPercentage).div(percentdiv); uint256 currentReturn = dailyReturn.mul(currDays).div(hardDays); transferAmt = initialAmt + currentReturn - minusAmt; user.depoList[keyy].amt = 0; user.depoList[keyy].initialWithdrawn = true; user.depoList[keyy].depoTime = block.timestamp; BUSD.safeTransfer(msg.sender, transferAmt); BUSD.safeTransfer(owner, minusAmt); } else if (currDays >= FeesKey[10].daysInSeconds && currDays < FeesKey[20].daysInSeconds){ // BETWEEN 20 and 30 DAYS uint256 minusAmt = initialAmt.mul(FeesKey[20].feePercentage).div(percentdiv); //18% fee uint256 dailyReturn = initialAmt.mul(PercsKey[10].divsPercentage).div(percentdiv); uint256 currentReturn = dailyReturn.mul(currDays).div(hardDays); transferAmt = initialAmt + currentReturn - minusAmt; user.depoList[keyy].amt = 0; user.depoList[keyy].initialWithdrawn = true; user.depoList[keyy].depoTime = block.timestamp; BUSD.safeTransfer(msg.sender, transferAmt); BUSD.safeTransfer(owner, minusAmt); } else if (currDays >= FeesKey[20].daysInSeconds && currDays < FeesKey[30].daysInSeconds){ // BETWEEN 30 and 40 DAYS uint256 minusAmt = initialAmt.mul(FeesKey[30].feePercentage).div(percentdiv); //15% fee uint256 dailyReturn = initialAmt.mul(PercsKey[20].divsPercentage).div(percentdiv); uint256 currentReturn = dailyReturn.mul(currDays).div(hardDays); transferAmt = initialAmt + currentReturn - minusAmt; user.depoList[keyy].amt = 0; user.depoList[keyy].initialWithdrawn = true; user.depoList[keyy].depoTime = block.timestamp; BUSD.safeTransfer(msg.sender, transferAmt); BUSD.safeTransfer(owner, minusAmt); } else if (currDays >= FeesKey[30].daysInSeconds && currDays < FeesKey[40].daysInSeconds){ // BETWEEN 30 and 40 DAYS uint256 minusAmt = initialAmt.mul(FeesKey[40].feePercentage).div(percentdiv); //15% fee uint256 dailyReturn = initialAmt.mul(PercsKey[30].divsPercentage).div(percentdiv); uint256 currentReturn = dailyReturn.mul(currDays).div(hardDays); transferAmt = initialAmt + currentReturn - minusAmt; user.depoList[keyy].amt = 0; user.depoList[keyy].initialWithdrawn = true; user.depoList[keyy].depoTime = block.timestamp; BUSD.safeTransfer(msg.sender, transferAmt); BUSD.safeTransfer(owner, minusAmt); } else if (currDays >= FeesKey[40].daysInSeconds && currDays < FeesKey[50].daysInSeconds){ // BETWEEN 30 and 40 DAYS uint256 minusAmt = initialAmt.mul(FeesKey[40].feePercentage).div(percentdiv); //12% fee uint256 dailyReturn = initialAmt.mul(PercsKey[40].divsPercentage).div(percentdiv); uint256 currentReturn = dailyReturn.mul(currDays).div(hardDays); transferAmt = initialAmt + currentReturn - minusAmt; user.depoList[keyy].amt = 0; user.depoList[keyy].initialWithdrawn = true; user.depoList[keyy].depoTime = block.timestamp; BUSD.safeTransfer(msg.sender, transferAmt); BUSD.safeTransfer(owner, minusAmt); } else if (currDays >= FeesKey[50].daysInSeconds){ // 40+ DAYS uint256 minusAmt = initialAmt.mul(FeesKey[40].feePercentage).div(percentdiv); //12% fee uint256 dailyReturn = initialAmt.mul(PercsKey[50].divsPercentage).div(percentdiv); uint256 currentReturn = dailyReturn.mul(currDays).div(hardDays); transferAmt = initialAmt + currentReturn - minusAmt; user.depoList[keyy].amt = 0; user.depoList[keyy].initialWithdrawn = true; user.depoList[keyy].depoTime = block.timestamp; BUSD.safeTransfer(msg.sender, transferAmt); BUSD.safeTransfer(owner, minusAmt); } else { revert("Could not calculate the # of days youv've been staked."); } } function withdrawRefBonus() external { User storage user = UsersKey[msg.sender]; uint256 amtz = user.refBonus; user.refBonus = 0; BUSD.safeTransfer(msg.sender, amtz); } function stakeRefBonus() external { User storage user = UsersKey[msg.sender]; Main storage main = MainKey[1]; require(user.refBonus > 10); uint256 refferalAmount = user.refBonus; user.refBonus = 0; address ref = 0x000000000000000000000000000000000000dEaD; //DEAD ADDRESS user.depoList.push(Depo({ key: user.keyCounter, depoTime: block.timestamp, amt: refferalAmount, reffy: ref, initialWithdrawn: false })); user.keyCounter += 1; main.ovrTotalDeps += 1; } function calcdiv(address dy) public view returns (uint256 totalWithdrawable) { User storage user = UsersKey[dy]; uint256 with; for (uint256 i = 0; i < user.depoList.length; i++){ uint256 elapsedTime = block.timestamp.sub(user.depoList[i].depoTime); uint256 amount = user.depoList[i].amt; if (user.depoList[i].initialWithdrawn == false){ if (elapsedTime <= PercsKey[20].daysInSeconds){ uint256 dailyReturn = amount.mul(PercsKey[10].divsPercentage).div(percentdiv); uint256 currentReturn = dailyReturn.mul(elapsedTime).div(PercsKey[10].daysInSeconds / 10); with += currentReturn; } if (elapsedTime > PercsKey[20].daysInSeconds && elapsedTime <= PercsKey[30].daysInSeconds){ uint256 dailyReturn = amount.mul(PercsKey[20].divsPercentage).div(percentdiv); uint256 currentReturn = dailyReturn.mul(elapsedTime).div(PercsKey[10].daysInSeconds / 10); with += currentReturn; } if (elapsedTime > PercsKey[30].daysInSeconds && elapsedTime <= PercsKey[40].daysInSeconds){ uint256 dailyReturn = amount.mul(PercsKey[30].divsPercentage).div(percentdiv); uint256 currentReturn = dailyReturn.mul(elapsedTime).div(PercsKey[10].daysInSeconds / 10); with += currentReturn; } if (elapsedTime > PercsKey[40].daysInSeconds && elapsedTime <= PercsKey[50].daysInSeconds){ uint256 dailyReturn = amount.mul(PercsKey[40].divsPercentage).div(percentdiv); uint256 currentReturn = dailyReturn.mul(elapsedTime).div(PercsKey[10].daysInSeconds / 10); with += currentReturn; } if (elapsedTime > PercsKey[50].daysInSeconds){ uint256 dailyReturn = amount.mul(PercsKey[50].divsPercentage).div(percentdiv); uint256 currentReturn = dailyReturn.mul(elapsedTime).div(PercsKey[10].daysInSeconds / 10); with += currentReturn; } } } return with; } function compound() external { User storage user = UsersKey[msg.sender]; Main storage main = MainKey[1]; uint256 y = calcdiv(msg.sender); for (uint i = 0; i < user.depoList.length; i++){ if (user.depoList[i].initialWithdrawn == false) { user.depoList[i].depoTime = block.timestamp; } } user.depoList.push(Depo({ key: user.keyCounter, depoTime: block.timestamp, amt: y, reffy: 0x000000000000000000000000000000000000dEaD, initialWithdrawn: false })); user.keyCounter += 1; main.ovrTotalDeps += 1; main.compounds += 1; user.lastWith = block.timestamp; } }
変更されたテキスト
ファイルを開く
/** *Submitted for verification at BscScan.com on 2022-09-16 */ // SPDX-License-Identifier: MIT /* Official Website: BUSDWealth.com Telegram: @busdwealth */ pragma solidity 0.8.16; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library Address { function isContract(address account) internal view returns (bool) { uint256 size; assembly { size := extcodesize(account) } return size > 0; } function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } function functionCall(address target,bytes memory data,string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } function functionCallWithValue(address target,bytes memory data,uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } function functionCallWithValue(address target,bytes memory data,uint256 value,string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } function functionStaticCall(address target,bytes memory data,string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } function functionDelegateCall(address target,bytes memory data,string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } function verifyCallResult(bool success,bytes memory returndata,string memory errorMessage) internal pure returns (bytes memory) { if (success) { return returndata; } else { if (returndata.length > 0) { assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } function safeApprove( IERC20 token, address spender, uint256 value ) internal { require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token,address spender,uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token,address spender,uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function _callOptionalReturn(IERC20 token, bytes memory data) private { bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: division by zero"); uint256 c = a / b; return c; } } //libraries struct User { uint256 startDate; uint256 divs; uint256 refBonus; uint256 totalInits; uint256 totalWiths; uint256 totalAccrued; uint256 lastWith; uint256 timesCmpd; uint256 keyCounter; Depo [] depoList; } struct Depo { uint256 key; uint256 depoTime; uint256 amt; address reffy; bool initialWithdrawn; } struct Main { uint256 ovrTotalDeps; uint256 ovrTotalWiths; uint256 users; uint256 compounds; } struct DivPercs{ uint256 daysInSeconds; // updated to be in seconds uint256 divsPercentage; } struct FeesPercs{ uint256 daysInSeconds; uint256 feePercentage; } contract BUSDWealth { using SafeMath for uint256; uint256 constant launch = 1663858800; //Launch 22nd September, 7 pm utc uint256 constant hardDays = 86400; uint256 constant minStakeAmt = 10 * 10**18; //10 BUSD uint256 constant percentdiv = 1000; uint256 refPercentage = 30; //3% referral, can only be staked uint256 devPercentage = 50; //5% buy and sell tax mapping (address => mapping(uint256 => Depo)) public DeposMap; mapping (address => User) public UsersKey; mapping (uint256 => DivPercs) public PercsKey; mapping (uint256 => FeesPercs) public FeesKey; mapping (uint256 => Main) public MainKey; using SafeERC20 for IERC20; IERC20 public BUSD; address public owner; constructor() { owner = msg.sender; PercsKey[10] = DivPercs(864000, 10); PercsKey[20] = DivPercs(1728000, 20); PercsKey[30] = DivPercs(2592000, 30); PercsKey[40] = DivPercs(3456000, 40); PercsKey[50] = DivPercs(4320000, 50); FeesKey[10] = FeesPercs(864000, 100); FeesKey[20] = FeesPercs(1728000, 80); FeesKey[30] = FeesPercs(3456000, 50); FeesKey[40] = FeesPercs(4320000, 20); BUSD = IERC20(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56); } function stakeStablecoins(uint256 amtx, address ref) external { require(block.timestamp >= launch, "App did not launch yet."); require(ref != msg.sender, "You cannot refer yourself!"); require(amtx >= minStakeAmt, "You should stake at least 10."); BUSD.safeTransferFrom(msg.sender, address(this), amtx); User storage user = UsersKey[msg.sender]; User storage user2 = UsersKey[ref]; Main storage main = MainKey[1]; if (user.lastWith == 0){ user.lastWith = block.timestamp; user.startDate = block.timestamp; } uint256 userStakePercentAdjustment = 1000 - devPercentage; uint256 adjustedAmt = amtx.mul(userStakePercentAdjustment).div(percentdiv); uint256 stakeFee = amtx.mul(devPercentage).div(percentdiv); user.totalInits += adjustedAmt; uint256 refAmtx = adjustedAmt.mul(refPercentage).div(percentdiv); if (ref != 0x000000000000000000000000000000000000dEaD) { user2.refBonus += refAmtx; } user.depoList.push(Depo({ key: user.depoList.length, depoTime: block.timestamp, amt: adjustedAmt, reffy: ref, initialWithdrawn: false })); user.keyCounter += 1; main.ovrTotalDeps += 1; main.users += 1; BUSD.safeTransfer(owner, stakeFee); } function userInfo() view external returns (Depo [] memory depoList) { User storage user = UsersKey[msg.sender]; return( user.depoList ); } function withdrawDivs() external returns (uint256 withdrawAmount) { User storage user = UsersKey[msg.sender]; Main storage main = MainKey[1]; uint256 x = calcdiv(msg.sender); for (uint i = 0; i < user.depoList.length; i++){ if (user.depoList[i].initialWithdrawn == false) { user.depoList[i].depoTime = block.timestamp; } } uint256 adjustedPercent = 1000 - devPercentage; uint256 adjustedAmt = x.mul(adjustedPercent).div(percentdiv); uint256 withdrawFee = x.mul(devPercentage).div(percentdiv); main.ovrTotalWiths += x; user.lastWith = block.timestamp; BUSD.safeTransfer(msg.sender, adjustedAmt); BUSD.safeTransfer(owner, withdrawFee); return x; } function withdrawInitial(uint256 keyy) external { User storage user = UsersKey[msg.sender]; require(user.depoList[keyy].initialWithdrawn == false, "This has already been withdrawn."); uint256 initialAmt = user.depoList[keyy].amt; uint256 currDays1 = user.depoList[keyy].depoTime; uint256 currTime = block.timestamp; uint256 currDays = currTime - currDays1; uint256 transferAmt; if (currDays < FeesKey[10].daysInSeconds){ uint256 minusAmt = initialAmt.mul(FeesKey[10].feePercentage).div(percentdiv); uint256 dailyReturn = initialAmt.mul(PercsKey[10].divsPercentage).div(percentdiv); uint256 currentReturn = dailyReturn.mul(currDays).div(hardDays); transferAmt = initialAmt + currentReturn - minusAmt; user.depoList[keyy].amt = 0; user.depoList[keyy].initialWithdrawn = true; user.depoList[keyy].depoTime = block.timestamp; BUSD.safeTransfer(msg.sender, transferAmt); } else if (currDays >= FeesKey[10].daysInSeconds && currDays < FeesKey[20].daysInSeconds){ uint256 minusAmt = initialAmt.mul(FeesKey[20].feePercentage).div(percentdiv); uint256 dailyReturn = initialAmt.mul(PercsKey[10].divsPercentage).div(percentdiv); uint256 currentReturn = dailyReturn.mul(currDays).div(hardDays); transferAmt = initialAmt + currentReturn - minusAmt; user.depoList[keyy].amt = 0; user.depoList[keyy].initialWithdrawn = true; user.depoList[keyy].depoTime = block.timestamp; BUSD.safeTransfer(msg.sender, transferAmt); } else if (currDays >= FeesKey[20].daysInSeconds && currDays < FeesKey[30].daysInSeconds){ uint256 minusAmt = initialAmt.mul(FeesKey[30].feePercentage).div(percentdiv); uint256 dailyReturn = initialAmt.mul(PercsKey[20].divsPercentage).div(percentdiv); uint256 currentReturn = dailyReturn.mul(currDays).div(hardDays); transferAmt = initialAmt + currentReturn - minusAmt; user.depoList[keyy].amt = 0; user.depoList[keyy].initialWithdrawn = true; user.depoList[keyy].depoTime = block.timestamp; BUSD.safeTransfer(msg.sender, transferAmt); } else if (currDays >= FeesKey[30].daysInSeconds && currDays < FeesKey[40].daysInSeconds){ uint256 minusAmt = initialAmt.mul(FeesKey[40].feePercentage).div(percentdiv); uint256 dailyReturn = initialAmt.mul(PercsKey[30].divsPercentage).div(percentdiv); uint256 currentReturn = dailyReturn.mul(currDays).div(hardDays); transferAmt = initialAmt + currentReturn - minusAmt; user.depoList[keyy].amt = 0; user.depoList[keyy].initialWithdrawn = true; user.depoList[keyy].depoTime = block.timestamp; BUSD.safeTransfer(msg.sender, transferAmt); } else if (currDays >= FeesKey[40].daysInSeconds && currDays < FeesKey[50].daysInSeconds){ uint256 minusAmt = initialAmt.mul(FeesKey[40].feePercentage).div(percentdiv); uint256 dailyReturn = initialAmt.mul(PercsKey[40].divsPercentage).div(percentdiv); uint256 currentReturn = dailyReturn.mul(currDays).div(hardDays); transferAmt = initialAmt + currentReturn - minusAmt; user.depoList[keyy].amt = 0; user.depoList[keyy].initialWithdrawn = true; user.depoList[keyy].depoTime = block.timestamp; BUSD.safeTransfer(msg.sender, transferAmt); } else if (currDays >= FeesKey[50].daysInSeconds){ uint256 minusAmt = initialAmt.mul(FeesKey[40].feePercentage).div(percentdiv); uint256 dailyReturn = initialAmt.mul(PercsKey[50].divsPercentage).div(percentdiv); uint256 currentReturn = dailyReturn.mul(currDays).div(hardDays); transferAmt = initialAmt + currentReturn - minusAmt; user.depoList[keyy].amt = 0; user.depoList[keyy].initialWithdrawn = true; user.depoList[keyy].depoTime = block.timestamp; BUSD.safeTransfer(msg.sender, transferAmt); } else { revert("Could not calculate the # of days youv've been staked."); } } function stakeRefBonus() external { User storage user = UsersKey[msg.sender]; Main storage main = MainKey[1]; require(user.refBonus > 10); uint256 refferalAmount = user.refBonus; user.refBonus = 0; address ref = 0x000000000000000000000000000000000000dEaD; //DEAD ADDRESS user.depoList.push(Depo({ key: user.keyCounter, depoTime: block.timestamp, amt: refferalAmount, reffy: ref, initialWithdrawn: false })); user.keyCounter += 1; main.ovrTotalDeps += 1; } function calcdiv(address dy) public view returns (uint256 totalWithdrawable) { User storage user = UsersKey[dy]; uint256 with; for (uint256 i = 0; i < user.depoList.length; i++){ uint256 elapsedTime = block.timestamp.sub(user.depoList[i].depoTime); uint256 amount = user.depoList[i].amt; if (user.depoList[i].initialWithdrawn == false){ if (elapsedTime <= PercsKey[20].daysInSeconds){ uint256 dailyReturn = amount.mul(PercsKey[10].divsPercentage).div(percentdiv); uint256 currentReturn = dailyReturn.mul(elapsedTime).div(PercsKey[10].daysInSeconds / 10); with += currentReturn; } if (elapsedTime > PercsKey[20].daysInSeconds && elapsedTime <= PercsKey[30].daysInSeconds){ uint256 dailyReturn = amount.mul(PercsKey[20].divsPercentage).div(percentdiv); uint256 currentReturn = dailyReturn.mul(elapsedTime).div(PercsKey[10].daysInSeconds / 10); with += currentReturn; } if (elapsedTime > PercsKey[30].daysInSeconds && elapsedTime <= PercsKey[40].daysInSeconds){ uint256 dailyReturn = amount.mul(PercsKey[30].divsPercentage).div(percentdiv); uint256 currentReturn = dailyReturn.mul(elapsedTime).div(PercsKey[10].daysInSeconds / 10); with += currentReturn; } if (elapsedTime > PercsKey[40].daysInSeconds && elapsedTime <= PercsKey[50].daysInSeconds){ uint256 dailyReturn = amount.mul(PercsKey[40].divsPercentage).div(percentdiv); uint256 currentReturn = dailyReturn.mul(elapsedTime).div(PercsKey[10].daysInSeconds / 10); with += currentReturn; } if (elapsedTime > PercsKey[50].daysInSeconds){ uint256 dailyReturn = amount.mul(PercsKey[50].divsPercentage).div(percentdiv); uint256 currentReturn = dailyReturn.mul(elapsedTime).div(PercsKey[10].daysInSeconds / 10); with += currentReturn; } } } return with; } function compound() external { User storage user = UsersKey[msg.sender]; Main storage main = MainKey[1]; uint256 y = calcdiv(msg.sender); for (uint i = 0; i < user.depoList.length; i++){ if (user.depoList[i].initialWithdrawn == false) { user.depoList[i].depoTime = block.timestamp; } } user.depoList.push(Depo({ key: user.keyCounter, depoTime: block.timestamp, amt: y, reffy: 0x000000000000000000000000000000000000dEaD, initialWithdrawn: false })); user.keyCounter += 1; main.ovrTotalDeps += 1; main.compounds += 1; user.lastWith = block.timestamp; } }
違いを見つける