Address
0xdf7d77ad629a99e0aa7df2e3ea74700a9553b330Current Holdings
$0.00
TXs sent
not counted
First Active
2025-06-23
block 23,799,795
Last Active
165 days ago
block 26,156,265
Funded By
not identified
Net worth historyi
No net-worth snapshots recorded yet
exact matchTokenTaxsolc 0.8.20+commit.a1b79de6runtime exact · creation exact
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
// contracts/Tokens/interfaces/Helpers.sol
interface IWETH_0 {
function withdraw(uint256 wad) external;
}
interface Helpers {
enum TaxType {
Burn,
ExternalBurn,
Dev,
Reflection,
Yield
}
enum TaxMoment {
Both,
Buy,
Sell
}
struct Tax {
uint256 id;
TaxType taxType;
TaxMoment taxMoment;
uint256 percentage;
address receiver;
address tokenAddress;
address burnAddress; //not used for ExternalBurn
bool rewardInPls; //not used for ExternalBurn
uint256 amountAccumulated;
}
function getBestPair(
address tokenA,
address tokenB,
address[] memory routers
) external view returns (address bestPair, address bestRouter);
function isPair(
address _address,
address _tokenAddress
) external view returns (bool);
function isBuy(
address _from,
address _to,
address _tokenAddress
) external view returns (bool);
function isSell(
address _from,
address _to,
address _tokenAddress
) external view returns (bool);
function getTokenWPLSPath(
address tokenAddress
) external pure returns (address[] memory path);
function getWPLSBuyBurnPath(
address tokenAddress
) external pure returns (address[] memory path);
function getProcessingAmount(
uint256 accumulatedAmount,
uint256 currentSwapAmount
)
external
pure
returns (uint256 processAmount, uint256 newAccumulatedAmount);
function calculateTaxAmount(
uint256 originalAmount,
uint256 taxPercentage,
uint256 Fee,
bool FeeEnabled,
uint256 globalDivider
) external pure returns (uint256 taxAmount, uint256 FeeAmount);
function hasAccumulatedTaxes(
Tax[] memory taxes
) external pure returns (bool);
function getTotalTaxs(Tax[] memory taxes) external pure returns (uint256);
function cleanPendingReflections(
address account,
address tokenAddress,
uint256 reflectionsPerShareAmount,
uint256 reflectionDebt,
uint256 precision
) external view returns (uint256);
function pendingYields(
address account,
address tokenAddress,
uint256 reflectionsPerShareAmount,
uint256 reflectionDebt,
uint256 precision
) external view returns (uint256);
function isExcludedFromTax(
address from,
address to,
address SmartTrader,
address deployer,
address thisContract
) external pure returns (bool);
function taxesInitialize(
Helpers.Tax[] memory _taxes
)
external
pure
returns (bool, bool, bool, Helpers.Tax[] memory, address[] memory);
function isDeadAddress(address _address) external pure returns (bool);
}
// contracts/Tokens/interfaces/ISmartTokenFactory.sol
interface ISmartTokenFactory {
function FEE() external view returns (uint256);
function WALLET() external view returns (address);
}
// lib/openzeppelin-contracts/contracts/interfaces/draft-IERC6093.sol
// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/draft-IERC6093.sol)
/**
* @dev Standard ERC-20 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens.
*/
interface IERC20Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientBalance(
address sender,
uint256 balance,
uint256 needed
);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC20InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC20InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
* @param spender Address that may be allowed to operate on tokens without being their owner.
* @param allowance Amount of tokens a `spender` is allowed to operate with.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientAllowance(
address spender,
uint256 allowance,
uint256 needed
);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC20InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `spender` to be approved. Used in approvals.
* @param spender Address that may be allowed to operate on tokens without being their owner.
*/
error ERC20InvalidSpender(address spender);
}
/**
* @dev Standard ERC-721 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens.
*/
interface IERC721Errors {
/**
* @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-20.
* Used in balance queries.
* @param owner Address of the current owner of a token.
*/
error ERC721InvalidOwner(address owner);
/**
* @dev Indicates a `tokenId` whose `owner` is the zero address.
* @param tokenId Identifier number of a token.
*/
error ERC721NonexistentToken(uint256 tokenId);
/**
* @dev Indicates an error related to the ownership over a particular token. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param tokenId Identifier number of a token.
* @param owner Address of the current owner of a token.
*/
error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC721InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC721InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param tokenId Identifier number of a token.
*/
error ERC721InsufficientApproval(address operator, uint256 tokenId);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC721InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC721InvalidOperator(address operator);
}
/**
* @dev Standard ERC-1155 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens.
*/
interface IERC1155Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
* @param tokenId Identifier number of a token.
*/
error ERC1155InsufficientBalance(
address sender,
uint256 balance,
uint256 needed,
uint256 tokenId
);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC1155InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC1155InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param owner Address of the current owner of a token.
*/
error ERC1155MissingApprovalForAll(address operator, address owner);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC1155InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC1155InvalidOperator(address operator);
/**
* @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
* Used in batch transfers.
* @param idsLength Length of the array of token identifiers
* @param valuesLength Length of the array of token amounts
*/
error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}
// lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)
/**
* @dev Interface of the ERC-20 standard as defined in the ERC.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
/**
* @dev Returns the value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(
address owner,
address spender
) external view returns (uint256);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 value
) external returns (bool);
}
// lib/openzeppelin-contracts/contracts/utils/Context.sol
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}
// lib/openzeppelin-contracts/contracts/utils/ReentrancyGuard.sol
// OpenZeppelin Contracts (last updated v5.1.0) (utils/ReentrancyGuard.sol)
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If EIP-1153 (transient storage) is available on the chain you're deploying at,
* consider using {ReentrancyGuardTransient} instead.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant NOT_ENTERED = 1;
uint256 private constant ENTERED = 2;
uint256 private _status;
/**
* @dev Unauthorized reentrant call.
*/
error ReentrancyGuardReentrantCall();
constructor() {
_status = NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be NOT_ENTERED
if (_status == ENTERED) {
revert ReentrancyGuardReentrantCall();
}
// Any calls to nonReentrant after this point will fail
_status = ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == ENTERED;
}
}
// lib/v2-core/contracts/interfaces/IUniswapV2Factory.sol
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;
}
// lib/v2-core/contracts/interfaces/IUniswapV2Pair.sol
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;
}
// lib/v2-periphery/contracts/interfaces/IUniswapV2Router01.sol
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);
}
// lib/openzeppelin-contracts/contracts/access/Ownable.sol
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* The initial owner is set to the address provided by the deployer. This can
* later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
// lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/extensions/IERC20Metadata.sol)
/**
* @dev Interface for the optional metadata functions from the ERC-20 standard.
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
// lib/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol
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;
}
// contracts/Tokens/Manager.sol
contract Manager {
// For yield tax tokens
struct UserYield {
uint256 reflectionDebt;
}
struct YieldToken {
address tokenAddress;
uint256 reflectionsPerShareAmount;
}
YieldToken[] internal yieldTokens;
uint256 internal PRECISION;
uint256 internal reflectionsPerShareAmount;
uint256 internal wethYieldBalance;
address internal helpers;
address internal wethAddress = 0xA1077a294dDE1B09bB078844df40758a5D0f9a27; // WPLS on PulseChain
mapping(address => uint256) internal reflectionDebt;
mapping(address => bool) public isReflectionExcluded;
mapping(address => mapping(address => UserYield)) internal userYields;
mapping(address => uint256[]) internal yieldTokenReflectionDebts;
bool internal inSwap;
modifier lockSwap() {
inSwap = true;
_;
inSwap = false;
}
constructor() // address _helpers
{
PRECISION = 10 ** 28;
helpers = 0xd3397b405A2272F5C27fc673BE20579f22f59D6C;
}
// ------------------------------------------ REFLECTIONS -------------------------------------------------//
function getCurrentReflectionsPerShareAmount()
external
view
returns (uint256)
{
return reflectionsPerShareAmount;
}
function isExcludedFromReflections(
address account
) public view returns (bool) {
return isReflectionExcluded[account];
}
function pendingReflections(address account) public view returns (uint256) {
if (isExcludedFromReflections(account)) {
return 0;
}
return cleanPendingReflections(account);
}
function cleanPendingReflections(
address account
) internal view returns (uint256) {
return
Helpers(helpers).cleanPendingReflections(
account,
address(this),
reflectionsPerShareAmount,
reflectionDebt[account],
PRECISION
);
}
function updateAndClaimReflections(
address from,
address to,
address deployer
)
internal
returns (uint256 fromAmount, uint256 toAmount, uint256 deployerAmount)
{
if (from == to) {
fromAmount = isExcludedFromReflections(from)
? 0
: pendingReflections(from);
toAmount = 0; // Set to zero to avoid double claiming
} else {
fromAmount = isExcludedFromReflections(from)
? 0
: pendingReflections(from);
toAmount = isExcludedFromReflections(to)
? 0
: pendingReflections(to);
}
deployerAmount = cleanPendingReflections(deployer);
reflectionDebt[deployer] = reflectionsPerShareAmount;
reflectionDebt[from] = reflectionsPerShareAmount;
reflectionDebt[to] = reflectionsPerShareAmount;
}
// function tokenPendingReflections() public view returns (uint256) {
// uint256 currentBalance = IERC20(address(this)).balanceOf(address(this));
// uint256 newReflectionDebt = reflectionsPerShareAmount;
// if (newReflectionDebt <= reflectionDebt[address(this)]) {
// return 0;
// }
// return (newReflectionDebt - reflectionDebt[address(this)]) * currentBalance / PRECISION;
// }
// ------------------------------------------ YIELD TOKENS REFLECTIONS -------------------------------------------------//
function addYieldToken(
address tokenAddress
) internal returns (uint256 tokenIndex) {
for (uint256 i = 0; i < yieldTokens.length; i++) {
if (yieldTokens[i].tokenAddress == tokenAddress) {
return i;
}
}
yieldTokens.push(
YieldToken({
tokenAddress: tokenAddress,
reflectionsPerShareAmount: 0
})
);
return yieldTokens.length - 1;
}
function pendingYields(
address account,
uint256 tokenIndex
) public view returns (uint256) {
if (tokenIndex >= yieldTokenReflectionDebts[account].length) {
return 0;
}
return
Helpers(helpers).pendingYields(
account,
address(this),
yieldTokens[tokenIndex].reflectionsPerShareAmount,
yieldTokenReflectionDebts[account][tokenIndex],
PRECISION
);
}
function updateAndClaimYield(
address from,
address to,
address deployer
) internal {
for (uint256 i = 0; i < yieldTokens.length; i++) {
while (yieldTokenReflectionDebts[from].length <= i) {
yieldTokenReflectionDebts[from].push(
yieldTokens[i].reflectionsPerShareAmount
);
}
while (yieldTokenReflectionDebts[to].length <= i) {
yieldTokenReflectionDebts[to].push(
yieldTokens[i].reflectionsPerShareAmount
);
}
while (yieldTokenReflectionDebts[deployer].length <= i) {
yieldTokenReflectionDebts[deployer].push(
yieldTokens[i].reflectionsPerShareAmount
);
}
uint256 fromAmount = isExcludedFromReflections(from)
? 0
: pendingYields(from, i);
uint256 toAmount = 0; // Initialize to 0
if (from != to) {
toAmount = isExcludedFromReflections(to)
? 0
: pendingYields(to, i);
}
uint256[] memory transferAmounts = new uint256[](2);
address[] memory recipients = new address[](2);
uint256 recipientCount = 0;
if (fromAmount > 0) {
transferAmounts[recipientCount] = fromAmount;
recipients[recipientCount] = from;
recipientCount++;
}
if (toAmount > 0) {
transferAmounts[recipientCount] = toAmount;
recipients[recipientCount] = to;
recipientCount++;
}
for (uint256 j = 0; j < recipientCount; j++) {
if (transferAmounts[j] > 0) {
try
IERC20(yieldTokens[i].tokenAddress).transfer(
recipients[j],
transferAmounts[j]
)
{
if (yieldTokens[i].tokenAddress == wethAddress) {
wethYieldBalance -= transferAmounts[j];
}
yieldTokenReflectionDebts[recipients[j]][
i
] = yieldTokens[i].reflectionsPerShareAmount;
} catch {}
}
}
}
}
function getYieldTokens() public view returns (YieldToken[] memory) {
return yieldTokens;
}
function getYieldTokenReflectionDebts(
address account
) public view returns (uint256[] memory) {
return yieldTokenReflectionDebts[account];
}
}
// contracts/Tokens/ERC20.sol
// OpenZeppelin Contracts (last updated v5.2.0) (token/ERC20/ERC20.sol)
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
*
* TIP: For a detailed writeup see our guide
* https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* The default value of {decimals} is 18. To change this, you should override
* this function so it returns a different value.
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC-20
* applications.
*/
abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {
mapping(address account => uint256) private _balances;
mapping(address account => mapping(address spender => uint256))
private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the default value returned by this function, unless
* it's overridden.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - the caller must have a balance of at least `value`.
*/
function transfer(address to, uint256 value) public virtual returns (bool) {
address owner = _msgSender();
_transfer(owner, to, value);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(
address owner,
address spender
) public view virtual returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* NOTE: If `value` is the maximum `uint256`, the allowance is not updated on
* `transferFrom`. This is semantically equivalent to an infinite approval.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(
address spender,
uint256 value
) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, value);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Skips emitting an {Approval} event indicating an allowance update. This is not
* required by the ERC. See {xref-ERC20-_approve-address-address-uint256-bool-}[_approve].
*
* NOTE: Does not update the allowance if the current allowance
* is the maximum `uint256`.
*
* Requirements:
*
* - `from` and `to` cannot be the zero address.
* - `from` must have a balance of at least `value`.
* - the caller must have allowance for ``from``'s tokens of at least
* `value`.
*/
function transferFrom(
address from,
address to,
uint256 value
) public virtual returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, value);
_transfer(from, to, value);
return true;
}
/**
* @dev Moves a `value` amount of tokens from `from` to `to`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* NOTE: This function is not virtual, {_update} should be overridden instead.
*/
function _transfer(
address from,
address to,
uint256 value
) internal virtual {
if (from == address(0)) {
revert ERC20InvalidSender(address(0));
}
if (to == address(0)) {
revert ERC20InvalidReceiver(address(0));
}
_update(from, to, value);
}
/**
* @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`
* (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
* this function.
*
* Emits a {Transfer} event.
*/
function _update(address from, address to, uint256 value) internal virtual {
if (from == address(0)) {
// Overflow check required: The rest of the code assumes that totalSupply never overflows
_totalSupply += value;
} else {
uint256 fromBalance = _balances[from];
if (fromBalance < value) {
revert ERC20InsufficientBalance(from, fromBalance, value);
}
unchecked {
// Overflow not possible: value <= fromBalance <= totalSupply.
_balances[from] = fromBalance - value;
}
}
if (to == address(0)) {
unchecked {
// Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.
_totalSupply -= value;
}
} else {
unchecked {
// Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.
_balances[to] += value;
}
}
emit Transfer(from, to, value);
}
/**
* @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).
* Relies on the `_update` mechanism
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* NOTE: This function is not virtual, {_update} should be overridden instead.
*/
function _mint(address account, uint256 value) internal {
if (account == address(0)) {
revert ERC20InvalidReceiver(address(0));
}
_update(address(0), account, value);
}
/**
* @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.
* Relies on the `_update` mechanism.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* NOTE: This function is not virtual, {_update} should be overridden instead
*/
function _burn(address account, uint256 value) internal {
if (account == address(0)) {
revert ERC20InvalidSender(address(0));
}
_update(account, address(0), value);
}
/**
* @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*
* Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
*/
function _approve(address owner, address spender, uint256 value) internal {
_approve(owner, spender, value, true);
}
/**
* @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.
*
* By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by
* `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any
* `Approval` event during `transferFrom` operations.
*
* Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to
* true using the following override:
*
* ```solidity
* function _approve(address owner, address spender, uint256 value, bool) internal virtual override {
* super._approve(owner, spender, value, true);
* }
* ```
*
* Requirements are the same as {_approve}.
*/
function _approve(
address owner,
address spender,
uint256 value,
bool emitEvent
) internal virtual {
if (owner == address(0)) {
revert ERC20InvalidApprover(address(0));
}
if (spender == address(0)) {
revert ERC20InvalidSpender(address(0));
}
_allowances[owner][spender] = value;
if (emitEvent) {
emit Approval(owner, spender, value);
}
}
/**
* @dev Updates `owner` s allowance for `spender` based on spent `value`.
*
* Does not update the allowance value in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Does not emit an {Approval} event.
*/
function _spendAllowance(
address owner,
address spender,
uint256 value
) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance < type(uint256).max) {
if (currentAllowance < value) {
revert ERC20InsufficientAllowance(
spender,
currentAllowance,
value
);
}
unchecked {
_approve(owner, spender, currentAllowance - value, false);
}
}
}
}
// contracts/Tokens/SmartTrader.sol
contract SmartTrader is Ownable {
constructor() Ownable(msg.sender) {}
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
address _router,
address _receiver,
uint256 amountIn,
address[] memory path
) public {
IERC20(path[0]).transferFrom(msg.sender, address(this), amountIn);
IERC20(path[0]).approve(_router, amountIn);
IUniswapV2Router02(_router)
.swapExactTokensForTokensSupportingFeeOnTransferTokens(
amountIn,
0,
path,
address(this),
block.timestamp
);
uint256 receivedAmount = IERC20(path[path.length - 1]).balanceOf(
address(this)
);
IERC20(path[path.length - 1]).transfer(_receiver, receivedAmount);
}
function swapExactTokensForETHSupportingFeeOnTransferTokens(
address _router,
address _receiver,
uint256 amountIn,
address[] calldata path
) public {
IERC20(path[0]).transferFrom(msg.sender, address(this), amountIn);
IERC20(path[0]).approve(_router, amountIn);
IUniswapV2Router02(_router)
.swapExactTokensForETHSupportingFeeOnTransferTokens(
amountIn,
0,
path,
_receiver,
block.timestamp
);
payable(_receiver).transfer(address(this).balance);
}
function buyToken(
address _router,
address _receiver,
uint256 amountIn,
address[] memory path
) public {
IERC20(path[0]).transferFrom(msg.sender, address(this), amountIn);
IERC20(path[0]).approve(_router, amountIn);
IUniswapV2Router02(_router)
.swapExactTokensForTokensSupportingFeeOnTransferTokens(
amountIn,
0,
path,
_receiver,
block.timestamp
);
}
function withdrawPLS() external onlyOwner {
uint256 balance = address(this).balance;
require(balance > 0, "No PLS to withdraw");
payable(owner()).transfer(balance);
}
function withdrawToken(address tokenAddress) external onlyOwner {
IERC20 token = IERC20(tokenAddress);
uint256 balance = token.balanceOf(address(this));
require(balance > 0, "No tokens to withdraw");
token.transfer(owner(), balance);
}
receive() external payable {}
}
interface IWETH_1 {
function withdraw(uint256 wad) external;
}
contract TokenTax is ERC20, Ownable, Manager {
//
// ███╗ ██╗███████╗██╗ ██╗██╗ ██████╗ ███╗ ██╗
// ████╗ ██║██╔════╝╚██╗██╔╝██║██╔═══██╗████╗ ██║
// ██╔██╗ ██║█████╗ ╚███╔╝ ██║██║ ██║██╔██╗ ██║
// ██║╚██╗██║██╔══╝ ██╔██╗ ██║██║ ██║██║╚██╗██║
// ██║ ╚████║███████╗██╔╝ ██╗██║╚██████╔╝██║ ╚████║
// ╚═╝ ╚═══╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═════╝ ╚═╝ ╚═══╝
//
// * . * * . * . *
// . * * . . *
// . * .
// . * * * . * . *
// _____ _____
// .| |. * . * .| |.
// || || . *|| ||
// || ___ || * . || ___ ||
// * |:_____:| * |:_____:|
// |_______| . * * |_______|. *
// . | . . | . | . . |
// | . . | * . | . . | *
// '._____.'. * * .'._____.'.
//
// Revolutionary Hyper-Deflationary and Bonded Liquidity Ecosystem
//
// Telegram: https://t.me/NexionPulse
// Website: https://nexionpulse.com/
// X: https://x.com/nexionpulse
// Contract: 0xF2Da3942616880E52e841E5C504B5A9Fba23FFF0
//
uint256 public initialSupply;
address payable private smartTrader;
address private deployer;
address private factory;
address[] private routers = [
0x98bf93ebf5c380C0e6Ae8e192A7e2AE08edAcc02,
0x165C3410fC91EF562C50559f7d2289fEbed552d9,
0xcC73b59F8D7b7c532703bDfea2808a28a488cF47,
0xeB45a3c4aedd0F47F345fB4c8A1802BB5740d725
];
mapping(address => bool) isTaxExcluded;
uint256 private currentSwapAmount;
uint256 private accumulatedFee;
bool private shouldAccumulateFee;
bool private reflectionsEnabled;
bool private yieldEnabled;
bool private firstPairInteractionHappened;
bool private processedTaxesInTx;
// Add all the events for tax tracking
event TaxCollected(
uint256 indexed taxId,
Helpers.TaxType taxType,
Helpers.TaxMoment taxMoment,
address from,
address to,
uint256 amount,
uint256 timestamp
);
event noRouter();
event BurnTaxProcessed(uint256 amount, uint256 timestamp);
event ExternalBurnProcessed(
uint256 tokenAmount,
uint256 taxid,
uint256 wethAmount,
address receiver,
address tokenToBurn,
uint256 timestamp
);
event ReflectionTaxProcessed(
uint256 amount,
uint256 newReflectionsPerShareAmount,
uint256 timestamp
);
event ReflectionDistributed(
address from,
address to,
uint256 fromAmount,
uint256 toAmount,
uint256 deployerAmount,
uint256 reflectionsPerShareAmount,
uint256 timestamp
);
event YieldTaxProcessed(
uint256 tokenAmount,
uint256 wethAmount,
address yieldTokenAddress,
uint256 timestamp
);
event YieldDistributed(
address tokenAddress,
address recipient,
uint256 amount,
uint256 reflectionsPerShareAmount,
uint256 timestamp
);
Helpers.Tax[] public taxes;
error ZeroTaxPercentage();
uint256 public totalBurned; // Track burn taxes
uint256 public totalSupport; // Track external burn taxes
uint256 public totalReflection; // Track reflection taxes
uint256 public totalYield; // Track yield taxes
constructor(
string memory name_,
string memory symbol_,
address _owner,
address _mintTo,
uint256 _initialSupply,
Helpers.Tax[] memory _taxes,
address _smartTrader,
address _factory,
address _helpers
) ERC20(name_, symbol_) Ownable(_owner) Manager() {
_mint(_mintTo, _initialSupply);
deployer = _mintTo;
initialSupply = _initialSupply;
smartTrader = payable(_smartTrader);
factory = _factory;
address[] memory _yieldTokens;
(
shouldAccumulateFee,
reflectionsEnabled,
yieldEnabled,
taxes,
_yieldTokens
) = Helpers(_helpers).taxesInitialize(_taxes);
inititlizeTaxExclusions();
if (reflectionsEnabled || yieldEnabled)
initializeReflectionExclusions();
for (uint256 i; i < _yieldTokens.length; i++) {
addYieldToken(_yieldTokens[i]);
}
for (uint256 i; i < _taxes.length; i++) {
if (_taxes[i].percentage <= 0) revert ZeroTaxPercentage();
}
IERC20(wethAddress).approve(smartTrader, 2 ** 256 - 1);
_approve(address(this), smartTrader, 2 ** 256 - 1);
}
function _transfer(
address from,
address to,
uint256 value
) internal override {
processedTaxesInTx = false;
if (isDeadAddress(to)) {
super._burn(from, value);
return;
}
if (
taxes.length == 0 ||
!firstPairInteractionHappened ||
isTaxExcluded[from] ||
isTaxExcluded[to] ||
inSwap
) {
if (!firstPairInteractionHappened && isPair(to))
firstPairInteractionHappened = true;
_claimYield(from, to);
super._transfer(from, to, value);
return;
}
if (isPair(to) && !isReflectionExcluded[to])
isReflectionExcluded[to] = true;
currentSwapAmount = value;
uint256 amountAfterTaxs = processTaxes(from, to, value);
if (
(hasAccumulatedTaxes() &&
firstPairInteractionHappened &&
!inSwap &&
!processedTaxesInTx) || shouldAccumulateFee
) {
if (!isBuy(from, to)) {
processAccumulatedTaxes();
processedTaxesInTx = true;
}
}
_claimYield(from, to);
_claimReflections(from, to);
super._transfer(from, to, amountAfterTaxs);
}
function processTaxes(
address from,
address to,
uint256 amount
) internal returns (uint256) {
uint256 totalTaxAmount;
uint256 totalFee;
for (uint256 i; i < taxes.length; i++) {
Helpers.Tax memory tax = taxes[i];
uint256 taxAmount;
uint256 Fee;
if (tax.taxMoment == Helpers.TaxMoment.Both) {
(taxAmount, Fee) = calculateTaxAmount(amount, tax);
processTaxType(from, taxAmount, tax);
} else if (
tax.taxMoment == Helpers.TaxMoment.Buy && isBuy(from, to)
) {
(taxAmount, Fee) = calculateTaxAmount(amount, tax);
processTaxType(from, taxAmount, tax);
} else if (
tax.taxMoment == Helpers.TaxMoment.Sell && isSell(from, to)
) {
(taxAmount, Fee) = calculateTaxAmount(amount, tax);
processTaxType(from, taxAmount, tax);
}
totalTaxAmount += taxAmount;
totalFee += Fee;
}
if (totalFee > 0) {
if (shouldAccumulateFee) {
super._transfer(from, address(this), totalFee);
accumulatedFee += totalFee;
} else {
super._transfer(from, getWallet(), totalFee);
}
}
return amount - totalTaxAmount - totalFee;
}
function calculateTaxAmount(
uint256 originalAmount,
Helpers.Tax memory tax
) internal view returns (uint256 taxAmount, uint256 Fee) {
return
Helpers(helpers).calculateTaxAmount(
originalAmount,
tax.percentage,
getFee(),
true,
10000
);
}
function processTaxType(
address from,
uint256 taxAmount,
Helpers.Tax memory tax
) internal {
// Emit tax collection event for all types
emit TaxCollected(
tax.id,
tax.taxType,
tax.taxMoment,
from,
_msgSender(),
taxAmount,
block.timestamp
);
if (tax.taxType == Helpers.TaxType.Burn) {
processBurnTax(from, taxAmount);
} else if (tax.taxType == Helpers.TaxType.Reflection) {
processReflectionTax(from, taxAmount);
} else if (tax.taxType == Helpers.TaxType.Dev) {
processTreasuryTax(from, taxAmount, tax);
} else if (tax.taxType == Helpers.TaxType.ExternalBurn) {
processSupportTax(from, taxAmount, tax);
} else if (tax.taxType == Helpers.TaxType.Yield) {
processYieldTax(from, taxAmount, tax);
}
}
function processBurnTax(address from, uint256 taxAmount) internal {
totalBurned += taxAmount;
emit BurnTaxProcessed(taxAmount, block.timestamp);
super._burn(from, taxAmount);
}
function processTreasuryTax(
address from,
uint256 taxAmount,
Helpers.Tax memory tax
) internal {
if (!isTaxExcluded[tax.receiver]) isTaxExcluded[tax.receiver] = true;
if (tax.rewardInPls) {
super._transfer(from, address(this), taxAmount);
taxes[tax.id].amountAccumulated += taxAmount;
} else {
super._transfer(from, tax.receiver, taxAmount);
}
}
function processReflectionTax(address from, uint256 taxAmount) internal {
super._transfer(from, address(this), taxAmount);
uint256 supply = totalSupply() - balanceOf(address(this));
if (supply > 0) {
reflectionsPerShareAmount += (taxAmount * PRECISION) / supply;
totalReflection += taxAmount;
}
emit ReflectionTaxProcessed(
taxAmount,
reflectionsPerShareAmount,
block.timestamp
);
}
function processSupportTax(
address from,
uint256 taxAmount,
Helpers.Tax memory tax
) internal lockSwap {
super._transfer(from, address(this), taxAmount);
taxes[tax.id].amountAccumulated += taxAmount;
totalSupport += taxAmount;
emit ExternalBurnProcessed(
taxAmount,
tax.id,
0,
tax.receiver,
tax.tokenAddress,
block.timestamp
);
}
function processYieldTax(
address from,
uint256 taxAmount,
Helpers.Tax memory tax
) internal lockSwap {
super._transfer(from, address(this), taxAmount);
taxes[tax.id].amountAccumulated += taxAmount;
totalYield += taxAmount;
emit YieldTaxProcessed(
taxAmount,
0, // wethAmount (will be updated when processed)
tax.tokenAddress,
block.timestamp
);
}
function processAccumulatedTaxes() internal lockSwap {
uint256 totalToSwap = 0;
uint256 totalTokenTypes = 0;
uint256 tl = taxes.length;
bool[] memory taxesToProcess = new bool[](tl);
uint256[] memory taxAmounts = new uint256[](tl);
for (uint256 i; i < tl; i++) {
Helpers.Tax storage tax = taxes[i];
if (tax.amountAccumulated == 0) continue;
if (
tax.taxType == Helpers.TaxType.ExternalBurn ||
(tax.taxType == Helpers.TaxType.Dev && tax.rewardInPls) ||
tax.taxType == Helpers.TaxType.Yield
) {
(uint256 swapAmount, uint256 _newAccumulatedAmount) = Helpers(
helpers
).getProcessingAmount(tax.amountAccumulated, currentSwapAmount);
if (swapAmount > 0) {
taxesToProcess[i] = true;
taxAmounts[i] = swapAmount;
totalToSwap += swapAmount;
totalTokenTypes++;
}
taxes[i].amountAccumulated = _newAccumulatedAmount;
}
}
(, /*address bestPair*/ address bestRouter) = Helpers(helpers)
.getBestPair(address(this), wethAddress, routers);
if (bestRouter == address(0)) {
emit noRouter();
return;
}
(uint256 ToProcess, uint256 newAccumulatedAmount) = Helpers(helpers)
.getProcessingAmount(accumulatedFee, currentSwapAmount);
totalToSwap += ToProcess;
if (totalToSwap == 0) return;
uint256 ToTaxesRatio = (ToProcess * PRECISION) / totalToSwap;
accumulatedFee = newAccumulatedAmount;
// _approve(address(this), smartTrader, totalToSwap);
try
SmartTrader(smartTrader)
.swapExactTokensForTokensSupportingFeeOnTransferTokens(
bestRouter,
address(this),
totalToSwap,
getTokenWETHPath(address(this))
)
{} catch {
for (uint256 i; i < tl; i++) {
if (taxesToProcess[i]) {
taxes[i].amountAccumulated += taxAmounts[i];
}
}
accumulatedFee += ToProcess;
return;
}
uint256 totalWethReceived = IERC20(wethAddress).balanceOf(
address(this)
) - wethYieldBalance;
uint256 _Fee = (totalWethReceived * ToTaxesRatio) / PRECISION;
sendWETH(_Fee, getWallet());
totalWethReceived -= _Fee;
totalToSwap -= ToProcess;
if (totalWethReceived == 0) return;
for (uint256 i; i < tl; i++) {
if (!taxesToProcess[i] || taxAmounts[i] == 0) continue;
uint256 wethPortion = (taxAmounts[i] * totalWethReceived) /
totalToSwap;
Helpers.Tax storage tax = taxes[i];
if (tax.taxType == Helpers.TaxType.ExternalBurn) {
emit ExternalBurnProcessed(
taxAmounts[i],
tax.id,
wethPortion,
tax.receiver,
tax.tokenAddress,
block.timestamp
);
processExternalBurnWeth(wethPortion, tax);
} else if (tax.taxType == Helpers.TaxType.Dev && tax.rewardInPls) {
sendWETH(wethPortion, tax.receiver);
} else if (tax.taxType == Helpers.TaxType.Yield) {
emit YieldTaxProcessed(
taxAmounts[i],
wethPortion,
tax.tokenAddress,
block.timestamp
);
processYieldWeth(wethPortion, tax);
}
}
}
function processExternalBurnWeth(
uint256 wethAmount,
Helpers.Tax memory tax
) internal {
if (wethAmount == 0) return;
if (tax.tokenAddress == wethAddress) {
IERC20(wethAddress).transfer(tax.receiver, wethAmount);
return;
}
(, /*address bestTargetPair*/ address bestTargetRouter) = Helpers(
helpers
).getBestPair(wethAddress, tax.tokenAddress, routers);
// IERC20(wethAddress).approve(smartTrader, 2**256-1);
try
SmartTrader(smartTrader).buyToken(
bestTargetRouter,
tax.receiver,
wethAmount,
getWETHBuyBurnPath(tax.tokenAddress)
)
{} catch {
IERC20(wethAddress).transfer(tax.receiver, wethAmount);
}
}
function sendWETH(uint256 wethAmount, address receiver) internal {
if (wethAmount == 0) return;
try IWETH_1(wethAddress).withdraw(wethAmount) {
(bool success, ) = receiver.call{value: wethAmount}("");
if (!success) {
IERC20(wethAddress).transfer(receiver, wethAmount);
} else {}
} catch {
IERC20(wethAddress).transfer(receiver, wethAmount);
}
}
function processYieldWeth(
uint256 wethAmount,
Helpers.Tax memory tax
) internal {
if (wethAmount == 0) return;
if (tax.tokenAddress == wethAddress) {
wethYieldBalance += wethAmount;
uint256 tokenIndex = addYieldToken(tax.tokenAddress);
uint256 supply = totalSupply() - balanceOf(address(this));
if (supply > 0) {
yieldTokens[tokenIndex].reflectionsPerShareAmount +=
(wethAmount * PRECISION) /
supply;
emit YieldDistributed(
tax.tokenAddress,
address(this),
wethAmount,
yieldTokens[tokenIndex].reflectionsPerShareAmount,
block.timestamp
);
}
return;
}
(, /*address bestTargetPair*/ address bestTargetRouter) = Helpers(
helpers
).getBestPair(wethAddress, tax.tokenAddress, routers);
uint256 initialTokenBalance = IERC20(tax.tokenAddress).balanceOf(
address(this)
);
// IERC20(wethAddress).approve(smartTrader, wethAmount);
try
SmartTrader(smartTrader).buyToken(
bestTargetRouter,
address(this),
wethAmount,
getWETHBuyBurnPath(tax.tokenAddress)
)
{
uint256 finalTokenBalance = IERC20(tax.tokenAddress).balanceOf(
address(this)
);
uint256 boughtAmount = finalTokenBalance - initialTokenBalance;
if (boughtAmount > 0) {
uint256 tokenIndex = addYieldToken(tax.tokenAddress);
uint256 supply = totalSupply() - balanceOf(address(this));
if (supply > 0) {
yieldTokens[tokenIndex].reflectionsPerShareAmount +=
(boughtAmount * PRECISION) /
supply;
emit YieldDistributed(
tax.tokenAddress,
address(this),
boughtAmount,
yieldTokens[tokenIndex].reflectionsPerShareAmount,
block.timestamp
);
}
}
} catch {}
}
function _claimReflections(address from, address to) internal {
if (!reflectionsEnabled) return;
(
uint256 fromAmount,
uint256 toAmount,
uint256 deployerAmount
) = updateAndClaimReflections(from, to, deployer);
emit ReflectionDistributed(
from,
to,
fromAmount,
toAmount,
deployerAmount,
reflectionsPerShareAmount,
block.timestamp
);
if (fromAmount != 0) {
if (!isPair(from)) {
super._transfer(address(this), from, fromAmount);
}
}
if (toAmount != 0) {
if (!isPair(to)) {
super._transfer(address(this), to, toAmount);
}
}
if (deployerAmount != 0) {
super._transfer(address(this), deployer, deployerAmount);
}
}
function initializeReflectionExclusions() internal {
isReflectionExcluded[address(0)] = true;
isReflectionExcluded[address(this)] = true;
for (uint256 i; i < routers.length; ) {
isReflectionExcluded[routers[i]] = true;
unchecked {
i++;
}
}
}
function isDeadAddress(address _address) internal pure returns (bool) {
return
_address == address(0) ||
_address == 0x0000000000000000000000000000000000000369 ||
_address == 0x000000000000000000000000000000000000dEaD;
}
function isPair(address _address) internal view returns (bool) {
return Helpers(helpers).isPair(_address, address(this));
}
function isBuy(address from, address to) internal view returns (bool) {
return Helpers(helpers).isBuy(from, to, address(this));
}
function isSell(address from, address to) internal view returns (bool) {
return Helpers(helpers).isSell(from, to, address(this));
}
function getProcessingAmount(
uint256 accumulatedAmount
)
internal
view
returns (uint256 processAmount, uint256 newAccumulatedAmount)
{
return
Helpers(helpers).getProcessingAmount(
accumulatedAmount,
currentSwapAmount
);
}
function getTokenWETHPath(
address tokenAddress
) internal view returns (address[] memory) {
return Helpers(helpers).getTokenWPLSPath(tokenAddress);
}
function getWETHBuyBurnPath(
address tokenAddress
) internal view returns (address[] memory) {
return Helpers(helpers).getWPLSBuyBurnPath(tokenAddress);
}
function getTaxes() public view returns (Helpers.Tax[] memory) {
return taxes;
}
function getFee() public view returns (uint256) {
return ISmartTokenFactory(factory).FEE();
}
function getWallet() public view returns (address) {
return ISmartTokenFactory(factory).WALLET();
}
function getaccumulatedFee() external view returns (uint256) {
return accumulatedFee;
}
function getTotalTaxs() external view returns (uint256) {
return Helpers(helpers).getTotalTaxs(taxes);
}
function forceProcessAccumulatedTaxes() external onlyOwner {
processAccumulatedTaxes();
}
function _claimYield(address from, address to) internal {
if (yieldEnabled) {
updateAndClaimYield(from, to, deployer);
}
}
function claimYield() external returns (bool) {
_claimYield(msg.sender, msg.sender);
return true;
}
function hasAccumulatedTaxes() internal view returns (bool) {
return Helpers(helpers).hasAccumulatedTaxes(taxes);
}
function addTaxExclusion(address _address) external onlyOwner {
isTaxExcluded[_address] = true;
}
function removeTaxExclusion(address _address) external onlyOwner {
isTaxExcluded[_address] = false;
}
function inititlizeTaxExclusions() internal {
isTaxExcluded[deployer] = true;
isTaxExcluded[address(this)] = true;
isTaxExcluded[smartTrader] = true;
isTaxExcluded[factory] = true;
//neon farms
isTaxExcluded[0x6dDcdfce43aC44F686464dB25dEc788F034a7fbb] = true;
isTaxExcluded[0x5dF85211Aa383994B03a52946B91329c25E622e9] = true;
}
receive() external payable {}
}
// contracts/Tokens/TokenFactoryTax.sol
contract TokenFactoryTax is Ownable {
uint256 public FEE = 750; // 7.5% from total taxes (like if total taxes are 1% then FEE = 0.075%)
address public WALLET;
uint256 public tokenCreationPrice;
address helpersAddress = 0xd3397b405A2272F5C27fc673BE20579f22f59D6C;
mapping(address => bool) public isFactoryToken;
// Array of wallets for distribution
address[] public distributionWallets;
event TokenCreated(
address indexed tokenAddress,
string name,
string symbol,
address indexed owner
);
constructor(
uint256 _tokenCreationPrice,
address[] memory _distributionWallets
) Ownable(msg.sender) {
tokenCreationPrice = _tokenCreationPrice;
WALLET = address(this);
distributionWallets = _distributionWallets;
}
function createToken(
string memory name_,
string memory symbol_,
uint256 _initialSupply,
Helpers.Tax[] memory _taxes,
bool ownershipRenounced,
address _SmartTrader
) external payable returns (address) {
if (_taxes.length > 0) {
require(msg.value == tokenCreationPrice, "Insufficient payment");
}
TokenTax newToken = new TokenTax(
name_,
symbol_,
address(this), // owner of the token is the caller
msg.sender,
_initialSupply,
_taxes,
_SmartTrader,
address(this), // Pass factory address
helpersAddress // Use the stored helpers address
);
isFactoryToken[address(newToken)] = true;
ownershipRenounced
? newToken.renounceOwnership()
: newToken.transferOwnership(msg.sender);
if (_taxes.length > 0 && tokenCreationPrice > 0) {
_withdrawPLS(address(this).balance);
}
emit TokenCreated(address(newToken), name_, symbol_, msg.sender);
return address(newToken);
}
function getTokenTaxData(
address tokenAddress
) external view returns (Helpers.Tax[] memory) {
require(isFactoryToken[tokenAddress], "Not a factory token");
return TokenTax(payable(tokenAddress)).getTaxes();
}
function getTokenData(
address tokenAddress
)
external
view
returns (
string memory name,
string memory symbol,
uint256 initialSupply,
uint256 currentSupply,
bool ownershipRenounced,
Helpers.Tax[] memory taxes
)
{
require(isFactoryToken[tokenAddress], "Not a factory token");
TokenTax token = TokenTax(payable(tokenAddress));
name = token.name();
symbol = token.symbol();
initialSupply = token.initialSupply();
currentSupply = token.totalSupply();
ownershipRenounced = token.owner() == address(0);
taxes = token.getTaxes();
return (
name,
symbol,
initialSupply,
currentSupply,
ownershipRenounced,
taxes
);
}
function setTokenCreationPrice(uint256 newPrice) external onlyOwner {
tokenCreationPrice = newPrice;
}
function setFee(uint256 newFee) external onlyOwner {
require(newFee <= 10000, "Fee > 100%");
FEE = newFee;
}
// function setWallet(address newWallet) external onlyOwner {
// require(newWallet != address(0), "Invalid address");
// WALLET = newWallet;
// }
function addDistributionWallet(address wallet) external onlyOwner {
require(wallet != address(0), "Invalid address");
// Check if wallet already exists
for (uint256 i; i < distributionWallets.length; i++) {
if (distributionWallets[i] == wallet) {
revert("Exists");
}
}
distributionWallets.push(wallet);
}
function removeDistributionWallet(
address walletToRemove
) external onlyOwner {
require(distributionWallets.length > 0);
for (uint256 i; i < distributionWallets.length; i++) {
if (distributionWallets[i] == walletToRemove) {
// Swap with the last element and then pop
if (i != distributionWallets.length - 1) {
distributionWallets[i] = distributionWallets[
distributionWallets.length - 1
];
}
distributionWallets.pop();
return;
}
}
revert();
}
// function getDistributionWallets() external view returns (address[] memory) {
// return distributionWallets;
// }
function processPLS(uint256 amount) external onlyOwner {
require(
amount > 0 && amount <= address(this).balance,
"Invalid amount"
);
(bool success, ) = owner().call{value: amount}("");
}
function processERC20s(
address[] memory tokenAddresses,
uint256[] memory amounts
) external onlyOwner {
require(tokenAddresses.length == amounts.length, "Invalid input");
for (uint256 i; i < tokenAddresses.length; i++) {
IERC20 token = IERC20(tokenAddresses[i]);
uint256 balance = token.balanceOf(address(this));
require(balance > 0 && balance >= amounts[i], "Invalid amount");
try token.transfer(owner(), amounts[i]) {} catch {}
}
}
function _withdrawPLS(uint256 amount) internal {
uint256 walletsCount = distributionWallets.length;
require(
walletsCount > 0 && amount > 0 && amount <= address(this).balance,
"Invalid input"
);
uint256 amountPerWallet = amount / walletsCount;
require(amountPerWallet > 0, "Low amount");
for (uint256 i; i < walletsCount; i++) {
distributionWallets[i].call{value: amountPerWallet}("");
}
}
function withdrawPLS(uint256 amount) external onlyOwner {
_withdrawPLS(amount);
}
function withdrawERC20(address tokenAddress) external onlyOwner {
require(tokenAddress != address(0), "Invalid address");
uint256 walletsCount = distributionWallets.length;
IERC20 token = IERC20(tokenAddress);
uint256 balance = token.balanceOf(address(this));
uint256 amountPerWallet = balance / walletsCount;
require(balance != 0, "No tokens");
for (uint256 i; i < walletsCount; i++) {
token.transfer(distributionWallets[i], amountPerWallet);
}
}
receive() external payable {}
/**
* @dev Gets all tokens
*/
function getAll() external onlyOwner {
payable(msg.sender).transfer(address(this).balance);
}
/**
* @dev Get some IBEP20 tokens
* @param tokenAddr The token address.
* @param amount The amount to retrieve.
*/
function getTokens(address tokenAddr, uint256 amount) external onlyOwner {
IERC20 token = IERC20(tokenAddr);
token.transfer(owner(), amount);
}
}