Diff
checker
텍스트
텍스트
이미지
문서
Excel
폴더
Legal
Enterprise
데스크톱
요금제
로그인
데스크톱 앱 다운로드
텍스트 비교
두 텍스트 파일의 차이점을 찾아보세요
도구
기록
표시
레이아웃
나란히 보기
합쳐 보기
실시간 편집
공백 변경 숨기기
변경 없는 행 숨기기
줄바꿈 비활성화
비교 단위
스마트
구문
없음
모양 변경
처리
제외
텍스트 변환
첫 변경으로
수정
Diffchecker Desktop
가장 안전하게 Diffchecker를 사용하는 방법. 데스크톱 앱을 사용하면 비교 데이터가 외부로 전송되지 않습니다!
데스크톱 앱 받기
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(
저장된 비교 결과
원본
파일 열기
/** *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; } }
비교하기