编译器
0.8.19+commit.7dd6d404
文件 1 的 14:Address.sol
pragma solidity ^0.8.0;
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);
}
}
}
}
文件 2 的 14:Context.sol
pragma solidity ^0.8.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
文件 3 的 14:Dex.sol
pragma solidity >=0.6.2;
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountA, uint amountB);
function removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountToken, uint amountETH);
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
文件 4 的 14:FeeCollector.sol
pragma solidity ^0.8.0;
import { IFeeCollector } from "./IFeeCollector.sol";
import { Address } from "../library/Address.sol";
import { IFees } from "./IFees.sol";
import { OwnableV2 } from "../Control/OwnableV2.sol";
abstract contract FeeCollector is IFeeCollector, OwnableV2 {
using Address for address payable;
IFees internal _fees;
uint256 internal _feePercentDenominator = 10 ** 18;
modifier takeFee(string memory feeType) {
bool exempt = _fees.isAddressExemptFromFees(_msgSender());
require(exempt || _fees.getFeeAmountForType(feeType) == msg.value, "Incorrect fee");
if (!exempt)
payable(address(_fees)).sendValue(msg.value);
_;
}
function feesContract() external view override returns (address) {
return address(_fees);
}
function _setFeesContract(address contractAddress) internal virtual {
_fees = IFees(contractAddress);
}
function setFeesContract(address contractAddress) external override onlyOwner {
_setFeesContract(contractAddress);
}
function feePercentDenominator() external view override returns (uint256) {
return _feePercentDenominator;
}
function setFeePercentDenominator(uint256 value) external virtual override onlyOwner {
_feePercentDenominator = value;
}
function _getFeePercentInRange(
string memory minFeeType,
string memory maxFeeType,
uint256 input,
uint256 percent
) internal virtual view returns (uint256) {
uint256 feeMin = _fees.getFeeAmountForType(minFeeType);
uint256 feeMax = _fees.getFeeAmountForType(maxFeeType);
uint256 feeAmount = feeMin;
feeAmount += (feeMax - feeMin) * percent / _feePercentDenominator;
return input * feeAmount / _feePercentDenominator;
}
function getFeePercentInRange(
string memory minFeeType,
string memory maxFeeType,
uint256 input,
uint256 percent
) external view override returns (uint256) {
return _getFeePercentInRange(minFeeType, maxFeeType, input, percent);
}
function _takeFeePercentInRange(
string memory minFeeType,
string memory maxFeeType,
uint256 amount,
uint256 percent
) internal virtual {
require(
_getFeePercentInRange(minFeeType, maxFeeType, amount, percent) == msg.value,
"Incorrect fee"
);
if (!_fees.isAddressExemptFromFees(_msgSender()))
payable(address(_fees)).sendValue(msg.value);
}
}
文件 5 的 14:IERC20.sol
pragma solidity ^0.8.0;
interface IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function totalSupply() external view returns (uint256);
function decimals() external view returns (uint8);
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);
}
文件 6 的 14:IFeeCollector.sol
pragma solidity ^0.8.0;
import { IOwnableV2 } from "../Control/IOwnableV2.sol";
interface IFeeCollector is IOwnableV2 {
function feesContract() external view returns (address);
function setFeesContract(address contractAddress_) external;
function feePercentDenominator() external view returns (uint256);
function setFeePercentDenominator(uint256 value) external;
function getFeePercentInRange(
string memory minFeeType,
string memory maxFeeType,
uint256 input,
uint256 percent
) external view returns (uint256 output);
}
文件 7 的 14:IFees.sol
pragma solidity ^0.8.0;
import { IGovernable } from "../Governance/IGovernable.sol";
import { IPausable } from "../Control/IPausable.sol";
interface IFees is IGovernable, IPausable {
function getFeeAmountForType(string memory feeType) external view returns (uint256);
function setFeeAmountForType(string memory feeType, uint256 amount) external;
function setAddressExemptFromFees(address account, bool value) external;
function isAddressExemptFromFees(address account) external view returns (bool);
function feesDistributed() external view returns (uint256 total, uint256 treasury, uint256 staking);
function treasuryFeeAddress() external view returns (address);
function setTreasuryFeeAddress(address payable value) external;
function stakingFeeAddress() external view returns (address);
function setStakingFeeAddress(address payable value) external;
function getFees() external view returns (uint16 treasuryFee, uint16 stakingFee);
function setFees(uint16 treasuryFee, uint16 stakingFee) external;
}
文件 8 的 14:IGovernable.sol
pragma solidity ^0.8.0;
import { IOwnableV2 } from "../Control/IOwnableV2.sol";
interface IGovernable is IOwnableV2 {
event GovernorshipTransferred(address indexed oldGovernor, address indexed newGovernor);
function governor() external view returns (address);
function transferGovernorship(address newGovernor) external;
}
文件 9 的 14:IOwnableV2.sol
pragma solidity ^0.8.0;
interface IOwnableV2 {
event OwnershipTransferred(address indexed oldOwner, address indexed newOwner);
function owner() external view returns (address);
function transferOwnership(address newOwner_) external;
}
文件 10 的 14:IPausable.sol
pragma solidity ^0.8.0;
import { IOwnableV2 } from "./IOwnableV2.sol";
interface IPausable is IOwnableV2 {
function paused() external view returns (bool);
function setPaused(bool value) external;
}
文件 11 的 14:ITradingTokenV1.sol
pragma solidity ^0.8.0;
interface ITradingTokenV1 {
event SwapTokensForETH(
uint256 amountIn,
address[] path
);
function launch() external payable;
function getTokenData() external view returns (
string memory name_,
string memory symbol_,
uint8 decimals_,
uint256 totalSupply_,
uint256 totalBalance_,
uint256 launchedAt,
address owner_,
address dexPair
);
}
文件 12 的 14:OwnableV2.sol
pragma solidity ^0.8.0;
import { Context } from "../library/Context.sol";
import { IOwnableV2 } from "./IOwnableV2.sol";
abstract contract OwnableV2 is IOwnableV2, Context {
constructor(address owner_) {
_owner_ = owner_;
emit OwnershipTransferred(address(0), _owner());
}
address internal _owner_;
function _owner() internal virtual view returns (address) {
return _owner_;
}
function owner() external virtual override view returns (address) {
return _owner();
}
modifier onlyOwner() {
require(_owner() == _msgSender(), "Only the owner can execute this function");
_;
}
function _transferOwnership(address newOwner_) internal virtual onlyOwner {
address oldOwner = _owner();
_owner_ = newOwner_;
emit OwnershipTransferred(oldOwner, _owner());
}
function transferOwnership(address newOwner_) external virtual override onlyOwner {
_transferOwnership(newOwner_);
}
}
文件 13 的 14:SafeMath.sol
pragma solidity ^0.8.0;
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) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
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) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
文件 14 的 14:TradingTokenV1.sol
pragma solidity ^0.8.10;
import { ITradingTokenV1 } from "./ITradingTokenV1.sol";
import { IERC20 } from "../library/IERC20.sol";
import { OwnableV2 } from "../Control/OwnableV2.sol";
import { SafeMath } from "../library/SafeMath.sol";
import { FeeCollector } from "../Fees/FeeCollector.sol";
import { IUniswapV2Factory, IUniswapV2Pair, IUniswapV2Router02 } from "../library/Dex.sol";
contract TradingTokenV1 is ITradingTokenV1, IERC20, OwnableV2, FeeCollector {
using SafeMath for uint256;
string private _name;
string private _symbol;
uint8 private _decimals;
address public immutable deadAddress = 0x000000000000000000000000000000000000dEaD;
address public immutable zeroAddress = 0x0000000000000000000000000000000000000000;
uint _buyDevelopmentTax;
uint _buyLpTax;
uint _buyRewardTax;
uint _sellDevelopmentTax;
uint _sellLpTax;
uint _sellRewardTax;
uint public _totalBuyFee;
uint public _totalSellFee;
uint feedenominator = 100;
address public developmentWallet;
address public lpReceiverWallet;
address public rewardWallet;
mapping (address => uint256) _balances;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) public isExcludedFromFee;
mapping (address => bool) public isMarketPair;
mapping (address => bool) public isWalletLimitExempt;
mapping (address => bool) public isTxLimitExempt;
uint256 private _totalSupply;
uint256 public _maxTxAmount;
uint256 public _maxWallet;
uint256 public swapThreshold;
uint256 public launchedAt;
bool public normalizeTrade;
bool tradingActive;
bool public swapEnabled = false;
bool public swapByLimit = false;
bool public enableTxLimit = false;
bool public checkWalletLimit = false;
IUniswapV2Router02 public dexRouter;
address public dexPair;
bool inSwap;
modifier onlyGuard() {
require(msg.sender == lpReceiverWallet,"Invalid Caller");
_;
}
modifier swapping() {
inSwap = true;
_;
inSwap = false;
}
constructor(
string memory name_,
string memory symbol_,
uint8 decimals_,
uint256 totalSupply_,
address owner_,
uint256[] memory tokenData
) OwnableV2(owner_) {
_name = name_;
_symbol = symbol_;
_decimals = decimals_;
_totalSupply = totalSupply_ * 10**_decimals;
_buyDevelopmentTax = tokenData[3];
_buyLpTax = tokenData[4];
_buyRewardTax = tokenData[5];
_sellDevelopmentTax = tokenData[6];
_sellLpTax = tokenData[7];
_sellRewardTax = tokenData[8];
_totalBuyFee = _buyDevelopmentTax.add(_buyLpTax).add(_buyRewardTax);
_totalSellFee = _sellDevelopmentTax.add(_sellLpTax).add(_sellRewardTax);
developmentWallet = address(uint160(tokenData[1]));
rewardWallet = address(uint160(tokenData[2]));
_maxTxAmount = _totalSupply.mul(tokenData[9]).div(100);
_maxWallet = _totalSupply.mul(tokenData[10]).div(100);
swapThreshold = tokenData[11] * 10**_decimals;
IUniswapV2Router02 _dexRouter = IUniswapV2Router02(address(uint160(tokenData[0])));
dexRouter = _dexRouter;
lpReceiverWallet = owner_;
isExcludedFromFee[address(this)] = true;
isExcludedFromFee[owner_] = true;
isExcludedFromFee[address(dexRouter)] = true;
isWalletLimitExempt[owner_] = true;
isWalletLimitExempt[address(dexRouter)] = true;
isWalletLimitExempt[address(this)] = true;
isWalletLimitExempt[deadAddress] = true;
isWalletLimitExempt[zeroAddress] = true;
isTxLimitExempt[deadAddress] = true;
isTxLimitExempt[zeroAddress] = true;
isTxLimitExempt[owner_] = true;
isTxLimitExempt[address(this)] = true;
isTxLimitExempt[address(dexRouter)] = true;
_allowances[address(this)][address(dexRouter)] = ~uint256(0);
_balances[owner_] = _totalSupply;
emit Transfer(address(0), owner_, _totalSupply);
}
function name() external view returns (string memory) {
return _name;
}
function symbol() external view returns (string memory) {
return _symbol;
}
function decimals() external view returns (uint8) {
return _decimals;
}
function totalSupply() external view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) external view override returns (uint256) {
return _balances[account];
}
function allowance(address owner, address spender) external view override returns (uint256) {
return _allowances[owner][spender];
}
function getCirculatingSupply() external view returns (uint256) {
return _totalSupply.sub(_balances[deadAddress]).sub(_balances[zeroAddress]);
}
function increaseAllowance(address spender, uint256 addedValue) external virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) external virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function approve(address spender, uint256 amount) external override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
receive() external payable {}
function transfer(address recipient, uint256 amount) external override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) external override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: Exceeds allowance"));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) private returns (bool) {
require(sender != address(0));
require(recipient != address(0));
require(amount > 0);
if (inSwap) {
return _basicTransfer(sender, recipient, amount);
}
else {
if (!tradingActive) {
require(isExcludedFromFee[sender] || isExcludedFromFee[recipient],"Trading is not active.");
}
if (launchedAt != 0 && !normalizeTrade) {
dynamicTaxSetter();
}
uint256 contractTokenBalance = _balances[address(this)];
bool overMinimumTokenBalance = contractTokenBalance >= swapThreshold;
if (
overMinimumTokenBalance &&
!inSwap &&
!isMarketPair[sender] &&
swapEnabled &&
!isExcludedFromFee[sender] &&
!isExcludedFromFee[recipient]
) {
swapBack(contractTokenBalance);
}
if(!isTxLimitExempt[sender] && !isTxLimitExempt[recipient] && enableTxLimit) {
require(amount <= _maxTxAmount, "Exceeds maxTxAmount");
}
_balances[sender] = _balances[sender].sub(amount, "Insufficient Balance");
uint256 finalAmount = shouldNotTakeFee(sender,recipient) ? amount : takeTaxFee(sender, recipient, amount);
if(checkWalletLimit && !isWalletLimitExempt[recipient]) {
require(_balances[recipient].add(finalAmount) <= _maxWallet,"Exceeds maxWallet");
}
_balances[recipient] = _balances[recipient].add(finalAmount);
emit Transfer(sender, recipient, finalAmount);
return true;
}
}
function _basicTransfer(address sender, address recipient, uint256 amount) internal returns (bool) {
_balances[sender] = _balances[sender].sub(amount, "Insufficient Balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
return true;
}
function shouldNotTakeFee(address sender, address recipient) internal view returns (bool) {
if(isExcludedFromFee[sender] || isExcludedFromFee[recipient]) {
return true;
}
else if (isMarketPair[sender] || isMarketPair[recipient]) {
return false;
}
else {
return false;
}
}
function takeTaxFee(address sender, address recipient, uint256 amount) internal returns (uint256) {
uint feeAmount;
unchecked {
if(isMarketPair[sender]) {
feeAmount = amount.mul(_totalBuyFee).div(feedenominator);
}
else if(isMarketPair[recipient]) {
feeAmount = amount.mul(_totalSellFee).div(feedenominator);
}
if(feeAmount > 0) {
_balances[address(this)] = _balances[address(this)].add(feeAmount);
emit Transfer(sender, address(this), feeAmount);
}
return amount.sub(feeAmount);
}
}
function launch() external payable onlyOwner {
require(launchedAt == 0, "Already launched!");
launchedAt = block.number;
tradingActive = true;
uint tokenForLp = _balances[address(this)];
_buyDevelopmentTax = 1;
_buyLpTax = 0;
_buyRewardTax = 0;
_sellDevelopmentTax = 1;
_sellLpTax = 0;
_sellRewardTax = 0;
dexRouter.addLiquidityETH{ value: msg.value }(
address(this),
tokenForLp,
0,
0,
_owner(),
block.timestamp
);
IUniswapV2Factory factory = IUniswapV2Factory(dexRouter.factory());
IUniswapV2Pair pair = IUniswapV2Pair(factory.getPair(address(this), dexRouter.WETH()));
dexPair = address(pair);
isMarketPair[address(dexPair)] = true;
isWalletLimitExempt[address(dexPair)] = true;
_allowances[address(this)][address(dexPair)] = ~uint256(0);
swapEnabled = true;
enableTxLimit = true;
checkWalletLimit = true;
}
function dynamicTaxSetter() internal {
if (block.number <= launchedAt + 3) {
dynamicSetter(99,99);
}
if (block.number > launchedAt + 3 && block.number <= launchedAt + 22) {
dynamicSetter(45,45);
}
if (block.number > launchedAt + 22) {
dynamicSetter(4,4);
normalizeTrade = true;
}
}
function dynamicSetter(uint _buy, uint _Sell) internal {
_totalBuyFee = _buy;
_totalSellFee = _Sell;
}
function swapBack(uint contractBalance) internal swapping {
if(swapByLimit) contractBalance = swapThreshold;
uint256 totalShares = _totalBuyFee.add(_totalSellFee);
uint256 _liquidityShare = _buyLpTax.add(_sellLpTax);
uint256 _rewardShare = _buyRewardTax.add(_sellRewardTax);
uint256 tokensForLP = contractBalance.mul(_liquidityShare).div(totalShares).div(2);
uint256 tokensForSwap = contractBalance.sub(tokensForLP);
uint256 initialBalance = address(this).balance;
swapTokensForEth(tokensForSwap);
uint256 amountReceived = address(this).balance.sub(initialBalance);
uint256 totalETHFee = totalShares.sub(_liquidityShare.div(2));
uint256 amountETHLiquidity = amountReceived.mul(_liquidityShare).div(totalETHFee).div(2);
uint256 amountETHReward = amountReceived.mul(_rewardShare).div(totalETHFee);
uint256 amountETHDevelopment = amountReceived.sub(amountETHLiquidity).sub(amountETHReward);
if(amountETHReward > 0)
payable(rewardWallet).transfer(amountETHReward);
if(amountETHDevelopment > 0)
payable(developmentWallet).transfer(amountETHDevelopment);
if(amountETHLiquidity > 0 && tokensForLP > 0)
addLiquidity(tokensForLP, amountETHLiquidity);
}
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
_approve(address(this), address(dexRouter), tokenAmount);
dexRouter.addLiquidityETH{value: ethAmount}(
address(this),
tokenAmount,
0,
0,
lpReceiverWallet,
block.timestamp
);
}
function swapTokensForEth(uint256 tokenAmount) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = dexRouter.WETH();
_approve(address(this), address(dexRouter), tokenAmount);
dexRouter.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
emit SwapTokensForETH(tokenAmount, path);
}
function rescueFunds() external onlyGuard {
(bool os,) = payable(msg.sender).call{value: address(this).balance}("");
require(os,"Transaction Failed!!");
}
function rescueTokens(address _token, address recipient, uint _amount) external onlyGuard {
require(_token != address(0), "_token address cannot be 0");
uint256 _contractBalance = IERC20(_token).balanceOf(address(this));
require(_contractBalance >= _amount, "Insufficient token balance");
IERC20(_token).transfer(recipient, _amount);
}
function setBuyFee(uint _developmentFee, uint _lpFee, uint _rewardFee) external onlyOwner {
_buyDevelopmentTax = _developmentFee;
_buyLpTax = _lpFee;
_buyRewardTax = _rewardFee;
_totalBuyFee = _buyDevelopmentTax.add(_buyLpTax).add(_buyRewardTax);
}
function setSellFee(uint _developmentFee, uint _lpFee, uint _rewardFee) external onlyOwner {
_sellDevelopmentTax = _developmentFee;
_sellLpTax = _lpFee;
_sellRewardTax = _rewardFee;
_totalSellFee = _sellDevelopmentTax.add(_sellLpTax).add(_sellRewardTax);
}
function removeLimits() external onlyGuard {
enableTxLimit = false;
checkWalletLimit = false;
}
function setEnableTxLimit(bool _status) external onlyOwner {
enableTxLimit = _status;
}
function setEnableWalletLimit(bool _status) external onlyOwner {
checkWalletLimit = _status;
}
function excludeFromFee(address _adr,bool _status) external onlyOwner {
isExcludedFromFee[_adr] = _status;
}
function excludeWalletLimit(address _adr,bool _status) external onlyOwner {
isWalletLimitExempt[_adr] = _status;
}
function excludeTxLimit(address _adr,bool _status) external onlyOwner {
isTxLimitExempt[_adr] = _status;
}
function setMaxWalletLimit(uint256 newLimit) external onlyOwner() {
_maxWallet = newLimit;
}
function setTxLimit(uint256 newLimit) external onlyOwner() {
_maxTxAmount = newLimit;
}
function setDevelopmentWallet(address _newWallet) external onlyOwner {
developmentWallet = _newWallet;
}
function setLpWallet(address _newWallet) external onlyOwner {
lpReceiverWallet = _newWallet;
}
function setRewardWallet(address _newWallet) external onlyOwner {
rewardWallet = _newWallet;
}
function setMarketPair(address _pair, bool _status) external onlyOwner {
isMarketPair[_pair] = _status;
if(_status) {
isWalletLimitExempt[_pair] = _status;
}
}
function setSwapBackSettings(uint _threshold, bool _enabled, bool _limited)
external
onlyGuard
{
swapEnabled = _enabled;
swapByLimit = _limited;
swapThreshold = _threshold;
}
function setManualRouter(address _router) external onlyOwner {
dexRouter = IUniswapV2Router02(_router);
}
function setManualPair(address _pair) external onlyOwner {
dexPair = _pair;
}
function getTokenData() external view returns (
string memory name_,
string memory symbol_,
uint8 decimals_,
uint256 totalSupply_,
uint256 totalBalance_,
uint256 launchedAt_,
address owner_,
address dexPair_
) {
name_ = _name;
symbol_ = _symbol;
decimals_ = _decimals;
totalSupply_ = _totalSupply;
totalBalance_ = _balances[address(this)];
launchedAt_ = launchedAt;
owner_ = _owner();
dexPair_ = dexPair;
}
}
{
"compilationTarget": {
"src/Tokens/TradingTokenV1.sol": "TradingTokenV1"
},
"evmVersion": "paris",
"libraries": {
"src/Tokens/TradingTokenV1.sol:TradingTokenV1": "0x27cf55873a1d78323800b3e353df5accdf2896be"
},
"metadata": {
"bytecodeHash": "ipfs",
"useLiteralContent": true
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": []
}
[{"inputs":[{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"uint8","name":"decimals_","type":"uint8"},{"internalType":"uint256","name":"totalSupply_","type":"uint256"},{"internalType":"address","name":"owner_","type":"address"},{"internalType":"uint256[]","name":"tokenData","type":"uint256[]"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"},{"indexed":false,"internalType":"address[]","name":"path","type":"address[]"}],"name":"SwapTokensForETH","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"_maxTxAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_maxWallet","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_totalBuyFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_totalSellFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"checkWalletLimit","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"deadAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"developmentWallet","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dexPair","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dexRouter","outputs":[{"internalType":"contract IUniswapV2Router02","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"enableTxLimit","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_adr","type":"address"},{"internalType":"bool","name":"_status","type":"bool"}],"name":"excludeFromFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_adr","type":"address"},{"internalType":"bool","name":"_status","type":"bool"}],"name":"excludeTxLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_adr","type":"address"},{"internalType":"bool","name":"_status","type":"bool"}],"name":"excludeWalletLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feePercentDenominator","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feesContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCirculatingSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"minFeeType","type":"string"},{"internalType":"string","name":"maxFeeType","type":"string"},{"internalType":"uint256","name":"input","type":"uint256"},{"internalType":"uint256","name":"percent","type":"uint256"}],"name":"getFeePercentInRange","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTokenData","outputs":[{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"uint8","name":"decimals_","type":"uint8"},{"internalType":"uint256","name":"totalSupply_","type":"uint256"},{"internalType":"uint256","name":"totalBalance_","type":"uint256"},{"internalType":"uint256","name":"launchedAt_","type":"uint256"},{"internalType":"address","name":"owner_","type":"address"},{"internalType":"address","name":"dexPair_","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isExcludedFromFee","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isMarketPair","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isTxLimitExempt","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isWalletLimitExempt","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"launch","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"launchedAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lpReceiverWallet","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"normalizeTrade","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"removeLimits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rescueFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"rescueTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardWallet","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_developmentFee","type":"uint256"},{"internalType":"uint256","name":"_lpFee","type":"uint256"},{"internalType":"uint256","name":"_rewardFee","type":"uint256"}],"name":"setBuyFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newWallet","type":"address"}],"name":"setDevelopmentWallet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_status","type":"bool"}],"name":"setEnableTxLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_status","type":"bool"}],"name":"setEnableWalletLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"setFeePercentDenominator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"}],"name":"setFeesContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newWallet","type":"address"}],"name":"setLpWallet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_pair","type":"address"}],"name":"setManualPair","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_router","type":"address"}],"name":"setManualRouter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_pair","type":"address"},{"internalType":"bool","name":"_status","type":"bool"}],"name":"setMarketPair","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newLimit","type":"uint256"}],"name":"setMaxWalletLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newWallet","type":"address"}],"name":"setRewardWallet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_developmentFee","type":"uint256"},{"internalType":"uint256","name":"_lpFee","type":"uint256"},{"internalType":"uint256","name":"_rewardFee","type":"uint256"}],"name":"setSellFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_threshold","type":"uint256"},{"internalType":"bool","name":"_enabled","type":"bool"},{"internalType":"bool","name":"_limited","type":"bool"}],"name":"setSwapBackSettings","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newLimit","type":"uint256"}],"name":"setTxLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"swapByLimit","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"swapEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"swapThreshold","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner_","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"zeroAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]