// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @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;
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "./IERC20.sol";
import {IERC20Metadata} from "./extensions/IERC20Metadata.sol";
import {Context} from "../../utils/Context.sol";
import {IERC20Errors} from "../../interfaces/draft-IERC6093.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 ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*/
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}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* 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 {
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:
* ```
* 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);
}
}
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
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);
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 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);
}
pragma solidity >=0.5.0;
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;
}
pragma solidity >=0.5.0;
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;
}
pragma solidity >=0.6.2;
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);
}
pragma solidity >=0.6.2;
import './IUniswapV2Router01.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;
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.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);
}
}
// SPDX-License-Identifier: MIT
// Author: A.P
// Organization: Rare Art
// Development: Kibernacia
// Product: R4RE
// Version: 1.0.0
// Link: https://linktr.ee/rareuniverse
pragma solidity >=0.8.23 <0.9.0;
// OpenZeppelin
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
// Uniswap V2
import {IUniswapV2Factory} from "@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol";
import {IUniswapV2Router02} from "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol";
// R4RE
import {R4REPool} from "./R4REPool.sol";
contract R4RE is ERC20, Ownable, R4REPool {
/// @notice Stores token name.
/// @dev Stores constant string.
string private constant _NAME = "R4RE";
/// @notice Stores token symbol.
/// @dev Stores constant string.
string private constant _SYMBOL = "R4RE";
/// @notice Stores max wallet factor.
/// @dev Stores number.
uint32 private _maxWalletFactor = 50;
/// @notice Stores max transaction factor.
/// @dev Stores number.
uint32 private _maxTransactionFactor = 50;
/// @notice Stores time-based restriction per address.
/// @dev Stores map from address to timestamp.
mapping(address => uint256) public lastTransactionTimestamp;
/// @notice Stores cooldown time per address.
/// @dev Stores timestamp.
uint256 public cooldownTime = 5 seconds;
/// @notice Indicates whether automatic liquidity provision to the pool is enabled.
/// @dev Set to `true` by default, allowing the contract to automatically add liquidity. This can be toggled to enable or disable the feature.
bool public autoLiquidityProviding = true;
/// @notice Stores tax factor.
/// @dev Stores number.
uint32 private _taxFactor = 100;
/// @notice Stores buy tax.
/// @dev Stores number.
uint32 public buyTax = 6; // 6.00% (default)
/// @notice Stores sell tax.
/// @dev Stores number.
uint32 public sellTax = 6; // 6.00% (default)
/// @notice Defines the fee percentage for liquidity provision.
/// @notice LP tax will be fractionated from both buy and sell tax.
/// @dev Stored number.
uint32 public liquidityFee = 50; // 50.00% (default)
/// @notice Stores tax collecting address.
/// @dev Stores address.
address payable public taxCollector;
/// @notice Stores excluded from fee addresses.
/// @dev Stores map from address to bool.
mapping(address => bool) public isExcluded;
constructor(
uint256 initialSupply
) ERC20(_NAME, _SYMBOL) Ownable(_msgSender()) {
// Create token supply
_mint(_msgSender(), initialSupply);
// Set tax collection address
taxCollector = payable(_msgSender());
// Setup uniswap v2 router
uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
// Set uniswap v2 factory
IUniswapV2Factory uniswapV2Factory = IUniswapV2Factory(
uniswapV2Router.factory()
);
// Create uniswap v2 pair
uniswapV2Pair = uniswapV2Factory.createPair(
address(this),
uniswapV2Router.WETH()
);
// Exclude owner, contract, uniswap v2 router and pair from fees by default
isExcluded[_msgSender()] = true;
isExcluded[address(this)] = true;
isExcluded[address(uniswapV2Router)] = true;
isExcluded[uniswapV2Pair] = true;
}
// Modifiers
/**
* @dev Throws if called by any account other than the tax collector.
*/
modifier onlyTaxCollector() {
if (taxCollector != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
_;
}
/**
* @dev Throws if transaction conditions are not valid.
* @param from The address to which tokens are being transferred.
* @param to The address to which tokens are being transferred.
* @param value The amount of tokens being transferred.
*/
modifier validateTransfer(
address from,
address to,
uint256 value
) {
// Validation
if (from == address(0)) {
revert TransferFromZeroAddress();
}
if (to == address(0)) {
revert TransferToZeroAddress();
}
if (!isExcluded[from] && isUniswap(to)) {
// Max transaction size validation
if (value > maxTransactionSize()) {
revert MaxTransactionSizeExceeded();
}
// Time-based restriction validation
uint256 timestamp = lastTransactionTimestamp[from];
uint256 restriction = timestamp + cooldownTime;
if (block.timestamp < restriction) {
revert TransferTimeRestriction();
}
// Set timestamp
lastTransactionTimestamp[from] = block.timestamp;
}
if (isUniswap(from) && !isExcluded[to]) {
// Max transaction size validation
if (value > maxTransactionSize()) {
revert MaxTransactionSizeExceeded();
}
// Time-based restriction validation
uint256 timestamp = lastTransactionTimestamp[to];
uint256 restriction = timestamp + cooldownTime;
if (block.timestamp < restriction) {
revert TransferTimeRestriction();
}
// Set timestamp
lastTransactionTimestamp[to] = block.timestamp;
}
if (!isExcluded[to]) {
// Max wallet size validation
if ((balanceOf(to) + value) > maxWalletSize()) {
revert MaxWalletSizeExceeded();
}
}
// Cooldown transfer
if (!isExcluded[from] && !isExcluded[to]) {
lastTransactionTimestamp[to] = lastTransactionTimestamp[from];
}
_;
}
/**
* @dev Overrides transfer function to add custom logic for trading protections and taxes.
* @notice This function is used to transfer tokens with additional features such as trading protections and taxes.
* @param to The address to which tokens are transferred.
* @param value The amount of tokens to be transferred.
* @return A boolean that indicates whether the operation succeeded.
*/
function transfer(
address to,
uint256 value
) public override validateTransfer(_msgSender(), to, value) returns (bool) {
// Parameters
uint256 amountAfterTax = value;
uint256 taxedAmount = 0;
bool deductTax = false;
// Swap Token to ETH
if (_msgSender() == uniswapV2Pair) {
// Verification
if (!isExcluded[to]) {
deductTax = true;
}
if (deductTax) {
// Taxation
(amountAfterTax, taxedAmount) = calculateTax(value, buyTax);
// Collect tax
if (taxedAmount > 0) {
// Update
super._update(_msgSender(), address(this), taxedAmount);
// Event
emit Taxed(_msgSender(), taxedAmount);
}
return super.transfer(to, amountAfterTax);
} else {
return super.transfer(to, value);
}
}
return super.transfer(to, value);
}
/**
* @dev Overrides transferFrom function to add custom logic for trading protections and taxes.
* @notice This function is used to transfer tokens from one address to another with additional features such as trading protections and taxes.
* @param from The address from which tokens are transferred.
* @param to The address to which tokens are transferred.
* @param value The amount of tokens to be transferred.
* @return A boolean that indicates whether the operation succeeded.
*/
function transferFrom(
address from,
address to,
uint256 value
) public override validateTransfer(from, to, value) returns (bool) {
// Parameters
uint256 amountAfterTax = value;
uint256 taxedAmount = 0;
bool deductTax = false;
// Swap ETH to Token
if (from == uniswapV2Pair) {
// Verification
if (!isExcluded[to]) {
deductTax = true;
}
if (deductTax) {
// Taxation
(amountAfterTax, taxedAmount) = calculateTax(value, buyTax);
// Collect tax
if (taxedAmount > 0) {
// Update
super._update(from, address(this), taxedAmount);
// Event
emit Taxed(to, taxedAmount);
}
return super.transferFrom(from, to, amountAfterTax);
} else {
return super.transferFrom(from, to, value);
}
}
// Swap Token to ETH
if (to == uniswapV2Pair) {
// Verification
if (!isExcluded[from]) {
deductTax = true;
}
if (deductTax) {
// Taxation
(amountAfterTax, taxedAmount) = calculateTax(value, sellTax);
// Collect tax
if (taxedAmount > 0) {
// Update
super._update(from, address(this), taxedAmount);
if (autoLiquidityProviding) {
// Tax
uint256 amountTax = 0;
uint256 amountLiquidity = 0;
uint256 amountSwap = balanceOf(address(this));
// Distribution
(amountTax, amountLiquidity) = calculateTax(
balanceOf(address(this)),
liquidityFee
);
// Validation
if (amountLiquidity >= 2) {
amountSwap = amountTax + amountLiquidity / 2;
}
// Swap
swapTokensForEth(amountSwap);
if (autoLiquidityProviding) {
// Distribution
uint amountToken = balanceOf(address(this));
uint amountETH = quote(amountToken);
emit Quote(
amountToken,
amountETH,
address(this).balance
);
// Add Liquidity
if (address(this).balance > amountETH) {
addLiquidity(amountToken, amountETH);
}
}
// Distribute
transferTax();
} else {
// Swap
swapTokensForEth(balanceOf(address(this)));
// Distribute
transferTax();
}
// Event
emit Taxed(from, taxedAmount);
}
return super.transferFrom(from, to, amountAfterTax);
} else {
return super.transferFrom(from, to, value);
}
}
return super.transferFrom(from, to, value);
}
/**
* @dev Checks if the given address is either the Uniswap V2 Router or the Uniswap V2 Pair.
* @param sender The address to be checked.
* @return Whether the address is associated with Uniswap.
*/
function isUniswap(address sender) private view returns (bool) {
return sender == address(uniswapV2Router) || sender == uniswapV2Pair;
}
/**
* @notice Returns the max wallet size per address.
* @dev Returns a number calculated based on supply divided by the factor.
*/
function maxWalletSize() public view returns (uint256) {
return totalSupply() / _maxWalletFactor;
}
/**
* @notice Returns the max transaction size per transfer.
* @dev Returns a number calculated based on supply divided by the factor.
*/
function maxTransactionSize() public view returns (uint256) {
return totalSupply() / _maxTransactionFactor;
}
/**
* @dev Calculates the amount after applying a tax to the given amount.
* @param amount The original amount on which tax is to be applied.
* @param tax The tax rate to be applied, represented as a percentage (e.g., 5 for 5%).
* @return amountAfterTax The amount after applying the tax.
* @return taxedAmount The calculated tax amount.
*
* @notice This function is a view function, meaning it does not modify the state of the contract.
* @notice If the tax is set to 0, the original amount is returned with no tax applied.
* @notice If the product of amount and tax is less than a predefined factor (_taxFactor),
* the tax is considered negligible and the amount is returned with no tax applied.
* @notice If the original amount is less than 2, no tax is applied, and the original amount is returned.
* @notice If none of the above conditions are met, the tax is calculated and subtracted from the original amount.
*/
function calculateTax(
uint256 amount,
uint32 tax
) public view returns (uint256 amountAfterTax, uint256 taxedAmount) {
// Validation Zero Tax
if (tax == 0) return (amount, 0);
// Validation Small Amount
if ((amount * tax) < _taxFactor) {
if (amount < 2) {
return (amount, 0);
} else {
taxedAmount = amount / 2;
amountAfterTax = amount - taxedAmount;
return (amountAfterTax, taxedAmount);
}
}
taxedAmount = (amount * tax) / _taxFactor;
amountAfterTax = amount - taxedAmount;
return (amountAfterTax, taxedAmount);
}
/**
* @dev Sets a new tax collector for the contract.
* @param newTaxCollector The address of the new tax collector.
*
* @notice This function is external and can be called by anyone, but it is restricted to only the current tax collector.
* @notice Only the current tax collector has the authority to set a new tax collector.
* @notice The new tax collector's address is stored, and the old tax collector is replaced with the new one.
* @notice The new tax collector is marked as excluded to prevent taxation on themselves.
* @notice Emits a TaxCollectorModified event with details about the modification, including the old and new tax collector's addresses.
*/
function setTaxCollector(
address newTaxCollector
) external onlyTaxCollector {
// Set
address oldTaxCollector = taxCollector;
taxCollector = payable(newTaxCollector);
// Exclude
isExcluded[newTaxCollector] = true;
// Event
emit TaxCollectorModified(oldTaxCollector, newTaxCollector);
}
/**
* @dev Sets the exclusion status for a given account from tax calculations.
* @param account The address of the account to be excluded or included.
* @param exclude A boolean flag indicating whether the account should be excluded (true) or included (false).
*
* @notice This function is external, meaning it can only be called from outside the contract.
* @notice Only the owner of the contract has the authority to exclude or include accounts.
* @notice The exclusion status is updated for the specified account, affecting tax calculations.
* @notice Emits an Excluded event with details about the modification, including the account address and exclusion status.
*/
function setExclude(address account, bool exclude) external onlyOwner {
// Set
isExcluded[account] = exclude;
// Event
emit Excluded(account, exclude);
}
/**
* @dev Sets the maximum wallet factor for the contract, which is used as a threshold for wallet balance validation.
* @param newFactor The new maximum wallet factor to be set.
*
* @notice This function is external, meaning it can only be called from outside the contract.
* @notice Only the owner of the contract has the authority to set the maximum wallet factor.
* @notice The new maximum wallet factor must not exceed the total supply of the contract's token.
* @notice If the new maximum wallet factor is invalid, the function reverts and emits an error message.
* @notice Emits a FactorModified event with details about the modification, including the factor type, old factor, and new factor.
*/
function setMaxWalletFactor(uint32 newFactor) external onlyOwner {
// Validation
if (newFactor > totalSupply()) {
revert InvalidInput(
"Max wallet factor",
"Max wallet factor cannot exceed total supply"
);
}
// Set
uint32 oldFactor = _maxWalletFactor;
_maxWalletFactor = newFactor;
// Event
emit FactorModified("Max Wallet Factor", oldFactor, newFactor);
}
/**
* @dev Sets the maximum transaction factor for the contract, which is used as a threshold for transaction validation.
* @param newFactor The new maximum transaction factor to be set.
*
* @notice This function is external, meaning it can only be called from outside the contract.
* @notice Only the owner of the contract has the authority to set the maximum transaction factor.
* @notice The new maximum transaction factor must not exceed the total supply of the contract's token.
* @notice If the new maximum transaction factor is invalid, the function reverts and emits an error message.
* @notice Emits a FactorModified event with details about the modification, including the factor type, old factor, and new factor.
*/
function setMaxTransactionFactor(uint32 newFactor) external onlyOwner {
// Validation
if (newFactor > totalSupply()) {
revert InvalidInput(
"Max transaction factor",
"Max transaction factor cannot exceed total supply"
);
}
// Set
uint32 oldFactor = _maxTransactionFactor;
_maxTransactionFactor = newFactor;
// Event
emit FactorModified("Max Transaction Factor", oldFactor, newFactor);
}
/**
* @dev Sets the cooldown time for transactions in the contract.
* @param newCooldownTime The new cooldown time, representing the duration in seconds.
*
* @notice This function is external, meaning it can only be called from outside the contract.
* @notice Only the owner of the contract has the authority to set the cooldown time.
* @notice The new cooldown time is stored, affecting the time duration between transactions.
* @notice Emits a CooldownTimeModified event with details about the modification, including the old and new cooldown times.
*/
function setCooldownTime(uint256 newCooldownTime) external onlyOwner {
// Set
uint256 oldCooldownTime = cooldownTime;
cooldownTime = newCooldownTime;
// Event
emit CooldownTimeModified(oldCooldownTime, newCooldownTime);
}
/**
* @dev Toggles the automatic liquidity provision feature of the contract. This feature, when enabled, allows the contract to automatically provide liquidity to a paired liquidity pool.
*
* @notice This function is external, meaning it can only be called from outside the contract.
* @notice Only the owner of the contract has the authority to toggle the automatic liquidity provision feature.
* @notice Toggling this feature inverses the current state of the autoLiquidityProviding variable.
* @notice Emits an AutoLiquiditySwitch event indicating the new state of the automatic liquidity provision feature.
*/
function switchAutoLiquidity() external onlyOwner {
// Set
autoLiquidityProviding = !autoLiquidityProviding;
// Event
emit AutoLiquiditySwitch(autoLiquidityProviding);
}
/**
* @dev Sets the tax factor for the contract, which is used as a threshold for tax division.
* @param newTaxFactor The new tax factor to be set.
*
* @notice This function is external, meaning it can only be called from outside the contract.
* @notice Only the owner of the contract has the authority to set the tax factor.
* @notice The new tax factor must not exceed the total supply of the contract's token.
* @notice If the new tax factor is invalid, the function reverts and emits an error message.
* @notice Emits a FactorModified event with details about the modification, including the factor type, old factor, and new factor.
*/
function setTaxFactor(uint32 newTaxFactor) external onlyOwner {
// Validation
if (_taxFactor > totalSupply()) {
revert InvalidInput(
"Tax Factor",
"Tax factor cannot exceed total supply"
);
}
// Set
uint32 oldTaxFactor = newTaxFactor;
_taxFactor = newTaxFactor;
// Event
emit FactorModified("Tax Factor", oldTaxFactor, newTaxFactor);
}
/**
* @dev Sets the buying tax rate for the contract.
* @param newTax The new tax rate to be set, represented as a percentage (e.g., 5 for 5%).
*
* @notice This function is external, meaning it can only be called from outside the contract.
* @notice Only the owner of the contract has the authority to set the buying tax rate.
* @notice The new tax rate must not exceed a predefined factor (_taxFactor) to prevent excessive taxation.
* @notice If the new tax rate is invalid, the function reverts and emits an error message.
* @notice Emits a TaxModified event with details about the modification, including the tax type, old tax rate, and new tax rate.
*/
function setBuyTax(uint32 newTax) external onlyOwner {
// Validation
if (newTax > _taxFactor) {
revert InvalidInput("Buy Tax", "Buy tax cannot exceed tax factor");
}
// Set
uint32 oldTax = buyTax;
buyTax = newTax;
// Event
emit TaxModified("Buy Tax", oldTax, newTax);
}
/**
* @dev Sets the selling tax rate for the contract.
* @param newTax The new tax rate to be set, represented as a percentage.
*
* @notice This function is external, meaning it can only be called from outside the contract.
* @notice Only the owner of the contract has the authority to set the selling tax rate.
* @notice The new tax rate must not exceed a predefined factor (_taxFactor) to prevent excessive taxation.
* @notice If the new tax rate is invalid, the function reverts and emits an error message.
* @notice Emits a TaxModified event with details about the modification, including the tax type, old tax rate, and new tax rate.
*/
function setSellTax(uint32 newTax) external onlyOwner {
// Validation
if (newTax > _taxFactor) {
revert InvalidInput(
"Sell Tax",
"Sell tax cannot exceed tax factor"
);
}
// Set
uint32 oldTax = sellTax;
sellTax = newTax;
// Event
emit TaxModified("Sell Tax", oldTax, newTax);
}
/**
* @dev Sets a new liquidity fee for the contract, which is applied to transactions for liquidity provision.
* @param newTax The new liquidity fee to be set, expressed in basis points (bps). For example, a value of 50 represents a 0.5% fee.
*
* @notice This function is external, meaning it can only be called from outside the contract.
* @notice Only the owner of the contract has the authority to set the liquidity fee.
* @notice The new liquidity fee must not exceed the predefined tax factor limit. If it does, the function reverts with an "InvalidInput" error.
* @notice Emits a `TaxModified` event with details about the modification, including the tax type ("LP Tax"), old tax rate, and new tax rate.
*/
function setliquidityFee(uint32 newTax) external onlyOwner {
// Validation
if (newTax > _taxFactor) {
revert InvalidInput("LP Tax", "LP tax cannot exceed tax factor");
}
// Set
uint32 oldTax = liquidityFee;
liquidityFee = newTax;
// Event
emit TaxModified("LP Tax", oldTax, newTax);
}
/**
* @dev Adds liquidity to the Uniswap V2 liquidity pool using a specified amount of tokens and ETH.
* The function first verifies the Uniswap V2 Router's address, then approves the router to spend the tokens,
* and finally attempts to add liquidity to the pool. It handles success or failure of liquidity addition.
* @param amountToken The amount of tokens to add to the pool.
* @param amountETH The amount of ETH to add to the pool, sent along with the transaction.
*
* @notice This function is private, meaning it can only be called from within the contract itself.
* @notice Before calling this function, ensure that the Uniswap V2 Router is set and valid.
* @notice The function approves the Uniswap V2 Router to spend the specified `amountToken`.
* @notice Attempts to add `amountToken` tokens and `amountETH` ETH to the Uniswap V2 liquidity pool.
* If successful, emits a `LiquidityAdded` event with the amounts used and liquidity tokens received.
* @notice If the attempt to add liquidity fails due to a revert with a reason, emits a `LiquidityAdditionFailed` event with the reason.
* @notice If the attempt fails without a revert reason, emits a `LiquidityAdditionFailedBytes` event with the low-level data.
*/
function addLiquidity(uint amountToken, uint amountETH) private {
// Verification
if (address(uniswapV2Router) == address(0)) {
revert UniswapV2InvalidRouter(address(0));
}
// Approve the Uniswap V2 router to spend the token amount
_approve(address(this), address(uniswapV2Router), amountToken);
// Add tokens and ETH to the liquidity pool
try
uniswapV2Router.addLiquidityETH{value: amountETH}(
address(this),
amountToken,
0, // Consider setting non-zero slippage limits for production
0, // Consider setting non-zero slippage limits for production
address(taxCollector),
block.timestamp + 600
)
returns (uint amountTokenUsed, uint amountETHUsed, uint liquidity) {
// Handle successful liquidity addition
// e.g., Emit an event or execute further logic as needed
emit LiquidityAdded(amountTokenUsed, amountETHUsed, liquidity);
} catch Error(string memory reason) {
// Handle a revert with a reason from the Uniswap V2 Router
// e.g., Emit an event or revert the transaction
emit LiquidityAdditionFailed(reason);
} catch (bytes memory lowLevelData) {
// Handle a failure without a revert reason from the Uniswap V2 Router
// e.g., Emit an event or revert the transaction
emit LiquidityAdditionFailedBytes(lowLevelData);
}
}
/**
* @dev Initiates the swap of Tokens for ETH and distributes the resulting ETH.
* @dev Accessible only by the contract owner.
*/
function swap() external onlyOwner {
// Swap
swapTokensForEth(balanceOf(address(this)));
// Distribute
transferTax();
// Event
emit Swap();
}
/**
* @dev Internal function to swap Tokens for ETH using the Uniswap V2 Router.
* @param amount The amount of tokens to be swapped.
*/
function swapTokensForEth(uint256 amount) private {
// Verification
if (address(uniswapV2Router) == address(0)) {
revert UniswapV2InvalidRouter(address(0));
}
// Approve the Uniswap V2 router to spend the token amount
_approve(address(this), address(uniswapV2Router), amount);
// Parameters
address[] memory path = new address[](2);
// Configuration
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
// Swap tokens for ETH
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
amount,
0,
path,
address(this),
block.timestamp + 600
);
}
/**
* @dev Internal function to transfer collected tax to the designated tax collector address.
*/
function transferTax() private {
// Parameter
uint256 tax = address(this).balance;
if (tax > 0) {
taxCollector.transfer(tax);
}
}
/**
* @dev Fallback function to receive ETH.
*/
receive() external payable {}
/**
* @dev Fallback function to receive ETH.
*/
fallback() external payable {}
}
// SPDX-License-Identifier: MIT
// Author: A.P
// Organization: Rare Art
// Development: Kibernacia
// Product: R4RE
// Version: 1.0.0
// Link: https://linktr.ee/rareuniverse
pragma solidity >=0.8.23 <0.9.0;
/**
* @dev R4RE Errors
*/
interface R4REErrors {
/**
* @dev Error indicating that the provided UniswapV2Router address is invalid.
* @param newUniswapV2Router The address of the invalid UniswapV2Router.
*/
error UniswapV2InvalidRouter(address newUniswapV2Router);
/**
* @dev Error indicating that the provided UniswapV2Pair address is invalid.
* @param newUniswapV2Pair The address of the invalid UniswapV2Pair.
*/
error UniswapV2InvalidPool(address newUniswapV2Pair);
/**
* @dev Error indicating that an operation failed because the provided amount is insufficient.
*/
error UniswapV2InsufficientAmount();
/**
* @dev Error indicating that an operation failed due to insufficient liquidity in the Uniswap V2 pool.
*/
error UniswapV2InsufficientLiquidity();
/**
* @dev Error indicating that a transfer from the zero address is not allowed.
*/
error TransferFromZeroAddress();
/**
* @dev Error indicating that a transfer to the zero address is not allowed.
*/
error TransferToZeroAddress();
/**
* @dev Error indicating that the maximum wallet size has been exceeded.
*/
error MaxWalletSizeExceeded();
/**
* @dev Error indicating that the maximum transaction size has been exceeded.
*/
error MaxTransactionSizeExceeded();
/**
* @dev Error indicating that a transfer is not allowed due to transfer time restrictions.
*/
error TransferTimeRestriction();
/**
* @dev Error indicating that a withdrawal operation is invalid.
*/
error WidthdrawInvalid();
/**
* @dev Error indicating that an input parameter is invalid.
* @param index The index or identifier of the invalid input.
* @param message A message describing the reason for the invalid input.
*/
error InvalidInput(string index, string message);
}
// SPDX-License-Identifier: MIT
// Author: A.P
// Organization: Rare Art
// Development: Kibernacia
// Product: R4RE
// Version: 1.0.0
// Link: https://linktr.ee/rareuniverse
pragma solidity >=0.8.23 <0.9.0;
/**
* @dev R4RE Events
*/
interface R4REEvents {
/**
* @dev Emitted when an account is excluded or included from tax calculations.
* @param account The address of the account being excluded or included.
* @param exclude A boolean flag indicating whether the account is excluded (true) or included (false).
*/
event Excluded(address indexed account, bool exclude);
/**
* @dev Emitted when the tax collector address is modified.
* @param oldTaxCollector The old tax collector address before modification.
* @param newTaxCollector The new tax collector address after modification.
*/
event TaxCollectorModified(
address indexed oldTaxCollector,
address indexed newTaxCollector
);
/**
* @dev Emitted when a factor (e.g., tax factor, max transaction factor, max wallet factor) is modified.
* @param factor The type of factor being modified.
* @param oldFactor The old value of the factor before modification.
* @param newFactor The new value of the factor after modification.
*/
event FactorModified(
string indexed factor,
uint32 oldFactor,
uint32 newFactor
);
/**
* @dev Emitted when a tax rate is modified.
* @param tax The type of tax being modified.
* @param oldTax The old tax rate before modification.
* @param newTax The new tax rate after modification.
*/
event TaxModified(string indexed tax, uint32 oldTax, uint32 newTax);
/**
* @dev Emitted when a swap operation occurs (e.g., in the Uniswap decentralized exchange).
*/
event Swap();
/**
* @dev Emitted when a recipient address is taxed.
* @param receiver The address of the recipient being taxed.
* @param amount The amount of the tax applied.
*/
event Taxed(address indexed receiver, uint256 amount);
/**
* @dev Emitted when the UniswapV2Router address is modified.
* @param oldUniswapV2Router The old UniswapV2Router address before modification.
* @param newUniswapV2Router The new UniswapV2Router address after modification.
*/
event UniswapV2RouterModified(
address indexed oldUniswapV2Router,
address indexed newUniswapV2Router
);
/**
* @dev Emitted when the UniswapV2Pair address is modified.
* @param oldUniswapV2Pair The old UniswapV2Pair address before modification.
* @param newUniswapV2Pair The new UniswapV2Pair address after modification.
*/
event UniswapV2PairModified(
address indexed oldUniswapV2Pair,
address indexed newUniswapV2Pair
);
/**
* @dev Emitted when the cooldown time for transactions is modified.
* @param oldCooldownTime The old cooldown time before modification.
* @param newCooldownTime The new cooldown time after modification.
*/
event CooldownTimeModified(
uint256 oldCooldownTime,
uint256 newCooldownTime
);
/**
* @dev Emitted when the automatic liquidity provision setting is toggled.
* @param autoLiquidityProviding Indicates whether automatic liquidity providing is enabled (true) or disabled (false).
*/
event AutoLiquiditySwitch(bool indexed autoLiquidityProviding);
/**
* @dev Emitted when liquidity is successfully added to the liquidity pool.
* @param amountTokenUsed The amount of tokens used to add liquidity.
* @param amountETHUsed The amount of ETH used to add liquidity.
* @param liquidity The amount of liquidity tokens received in return for adding liquidity.
*/
event LiquidityAdded(
uint256 amountTokenUsed,
uint256 amountETHUsed,
uint256 liquidity
);
/**
* @dev Emitted when adding liquidity to the liquidity pool fails due to a reason that can be expressed in a string.
* @param reason The reason why adding liquidity failed, described as a string.
*/
event LiquidityAdditionFailed(string reason);
/**
* @dev Emitted when adding liquidity to the liquidity pool fails due to a reason that is captured in low-level bytes data.
* @param lowLevelData The low-level bytes data representing the reason for the liquidity addition failure.
*/
event LiquidityAdditionFailedBytes(bytes lowLevelData);
/**
* @dev Emitted after calculating the equivalent amount of ETH for a given amount of tokens.
* This event helps in tracking the outcomes of quote operations, providing insights into the value conversions and the state of balances after the operation.
* @param amountToken The amount of tokens for which the quote was calculated.
* @param amountETH The equivalent amount of ETH for the given amount of tokens as per the current conversion rate.
* @param balance The balance after the operation, potentially reflecting changes in reserves or liquidity.
*/
event Quote(uint amountToken, uint amountETH, uint balance);
}
// SPDX-License-Identifier: MIT
// Author: A.P
// Organization: Rare Art
// Development: Kibernacia
// Product: R4RE
// Version: 1.0.0
// Link: https://linktr.ee/rareuniverse
pragma solidity >=0.8.23 <0.9.0;
// OpenZeppelin
import {Context} from "@openzeppelin/contracts/utils/Context.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
// Uniswap V2
import {IUniswapV2Pair} from "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol";
import {IUniswapV2Router02} from "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol";
// R4RE
import {R4REEvents} from "./R4REEvents.sol";
import {R4REErrors} from "./R4REErrors.sol";
/**
* @dev R4RE Pool
*/
abstract contract R4REPool is Context, Ownable, R4REEvents, R4REErrors {
/// @notice Stores Uniswap V2 router interface.
/// @dev Stores IUniswapV2Router02 interface.
IUniswapV2Router02 public uniswapV2Router;
/// @notice Stores Uniswap V2 pair address.
/// @dev Stores address.
address public uniswapV2Pair;
/**
* @dev Sets the UniswapV2Router for the contract to enable interactions with the Uniswap decentralized exchange.
* @param newUniswapV2Router The address of the new UniswapV2Router contract.
*
* @notice This function is external, meaning it can only be called from outside the contract.
* @notice Only the owner of the contract has the authority to set the UniswapV2Router.
* @notice The new UniswapV2Router address must be a valid address and not equal to address(0).
* @notice If the new UniswapV2Router address is invalid, the function reverts and emits an error message.
* @notice Emits a UniswapV2RouterModified event with details about the modification, including the old and new UniswapV2Router addresses.
*/
function setUniswapV2Router(address newUniswapV2Router) external onlyOwner {
// Verification
if (newUniswapV2Router == address(0)) {
revert UniswapV2InvalidRouter(address(0));
}
// Parameter
address oldUniswapV2Router = address(uniswapV2Router);
// Configuration
uniswapV2Router = IUniswapV2Router02(newUniswapV2Router);
// Event
emit UniswapV2RouterModified(oldUniswapV2Router, newUniswapV2Router);
}
/**
* @dev Sets the UniswapV2Pair for the contract to define the trading pair with the Uniswap decentralized exchange.
* @param newUniswapV2Pair The address of the new UniswapV2Pair contract representing the trading pair.
*
* @notice This function is external, meaning it can only be called from outside the contract.
* @notice Only the owner of the contract has the authority to set the UniswapV2Pair.
* @notice The new UniswapV2Pair address must be a valid address and not equal to address(0).
* @notice If the new UniswapV2Pair address is invalid, the function reverts and emits an error message.
* @notice Emits a UniswapV2PairModified event with details about the modification, including the old and new UniswapV2Pair addresses.
*/
function setUniswapV2Pair(address newUniswapV2Pair) external onlyOwner {
// Verification
if (newUniswapV2Pair == address(0)) {
revert UniswapV2InvalidPool(address(0));
}
// Parameter
address oldUniswapV2Pair = uniswapV2Pair;
// Configuration
uniswapV2Pair = newUniswapV2Pair;
// Event
emit UniswapV2PairModified(oldUniswapV2Pair, uniswapV2Pair);
}
/**
* @dev Retrieves the reserve amounts of the two tokens in the Uniswap V2 pair, along with the last block timestamp when these reserves were updated.
* This function interfaces with the Uniswap V2 pair contract to fetch its current state, which is essential for calculating accurate trading prices, understanding liquidity depth, and more.
* The reserves and timestamp can be used by external contracts or callers to make informed decisions in DeFi operations such as swaps, liquidity provision, or arbitrage.
*
* @return _reserve0 The reserve amount of the first token in the Uniswap V2 pair. Token pairs in Uniswap are ordered by their contract addresses.
* @return _reserve1 The reserve amount of the second token in the Uniswap V2 pair.
* @return _blockTimestampLast The last block timestamp when the reserves were recorded by the pair contract. This can be used to assess the freshness of the data.
*/
function getReserves()
public
view
returns (uint _reserve0, uint _reserve1, uint32 _blockTimestampLast)
{
// Parameter
IUniswapV2Pair iPair = IUniswapV2Pair(uniswapV2Pair);
return iPair.getReserves();
}
/**
* @dev Calculates the equivalent amount of ETH for a given amount of tokens based on the reserves in the liquidity pool.
* @param amountToken The amount of tokens to convert to an equivalent amount of ETH.
* @return amountETH The equivalent amount of ETH based on the current reserves.
*/
function quote(uint amountToken) internal view returns (uint amountETH) {
// Get the reserves from the liquidity pool
(uint reserveA, uint reserveB, ) = getReserves();
if (amountToken <= 0) revert UniswapV2InsufficientAmount();
if (reserveA <= 0 || reserveB <= 0) {
revert UniswapV2InsufficientLiquidity();
}
// Parameter
IUniswapV2Pair iPair = IUniswapV2Pair(uniswapV2Pair);
if (address(this) == iPair.token0()) {
// Calculate the equivalent amount of ETH based on the reserves and the amount of tokens
amountETH = (amountToken * reserveB) / reserveA;
} else {
// Calculate the equivalent amount of ETH based on the reserves and the amount of tokens
amountETH = (amountToken * reserveA) / reserveB;
}
}
/**
* @dev Allows the owner of the contract to withdraw the contract's balance.
*
* @notice This function is external, meaning it can only be called from outside the contract.
* @notice Only the owner of the contract has the authority to withdraw funds.
* @notice The entire balance of the contract is transferred to the owner's address.
* @notice If the withdrawal is unsuccessful, the function reverts and emits an error message.
*/
function withdraw() external onlyOwner {
// Withdraw
(bool success, ) = msg.sender.call{value: address(this).balance}("");
// Verification
if (!success) {
revert WidthdrawInvalid();
}
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard ERC20 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 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 ERC721 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.
*/
interface IERC721Errors {
/**
* @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-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 ERC1155 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 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);
}
{
"compilationTarget": {
"contracts/R4RE.sol": "R4RE"
},
"evmVersion": "paris",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 1000
},
"remappings": [],
"viaIR": true
}
[{"inputs":[{"internalType":"uint256","name":"initialSupply","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"allowance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientAllowance","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC20InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC20InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC20InvalidSender","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"}],"name":"ERC20InvalidSpender","type":"error"},{"inputs":[{"internalType":"string","name":"index","type":"string"},{"internalType":"string","name":"message","type":"string"}],"name":"InvalidInput","type":"error"},{"inputs":[],"name":"MaxTransactionSizeExceeded","type":"error"},{"inputs":[],"name":"MaxWalletSizeExceeded","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"TransferFromZeroAddress","type":"error"},{"inputs":[],"name":"TransferTimeRestriction","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"UniswapV2InsufficientAmount","type":"error"},{"inputs":[],"name":"UniswapV2InsufficientLiquidity","type":"error"},{"inputs":[{"internalType":"address","name":"newUniswapV2Pair","type":"address"}],"name":"UniswapV2InvalidPool","type":"error"},{"inputs":[{"internalType":"address","name":"newUniswapV2Router","type":"address"}],"name":"UniswapV2InvalidRouter","type":"error"},{"inputs":[],"name":"WidthdrawInvalid","type":"error"},{"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":"bool","name":"autoLiquidityProviding","type":"bool"}],"name":"AutoLiquiditySwitch","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldCooldownTime","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newCooldownTime","type":"uint256"}],"name":"CooldownTimeModified","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"bool","name":"exclude","type":"bool"}],"name":"Excluded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"string","name":"factor","type":"string"},{"indexed":false,"internalType":"uint32","name":"oldFactor","type":"uint32"},{"indexed":false,"internalType":"uint32","name":"newFactor","type":"uint32"}],"name":"FactorModified","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amountTokenUsed","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountETHUsed","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"liquidity","type":"uint256"}],"name":"LiquidityAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"reason","type":"string"}],"name":"LiquidityAdditionFailed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes","name":"lowLevelData","type":"bytes"}],"name":"LiquidityAdditionFailedBytes","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amountToken","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountETH","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"balance","type":"uint256"}],"name":"Quote","type":"event"},{"anonymous":false,"inputs":[],"name":"Swap","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldTaxCollector","type":"address"},{"indexed":true,"internalType":"address","name":"newTaxCollector","type":"address"}],"name":"TaxCollectorModified","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"string","name":"tax","type":"string"},{"indexed":false,"internalType":"uint32","name":"oldTax","type":"uint32"},{"indexed":false,"internalType":"uint32","name":"newTax","type":"uint32"}],"name":"TaxModified","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Taxed","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"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldUniswapV2Pair","type":"address"},{"indexed":true,"internalType":"address","name":"newUniswapV2Pair","type":"address"}],"name":"UniswapV2PairModified","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldUniswapV2Router","type":"address"},{"indexed":true,"internalType":"address","name":"newUniswapV2Router","type":"address"}],"name":"UniswapV2RouterModified","type":"event"},{"stateMutability":"payable","type":"fallback"},{"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":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"autoLiquidityProviding","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"buyTax","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint32","name":"tax","type":"uint32"}],"name":"calculateTax","outputs":[{"internalType":"uint256","name":"amountAfterTax","type":"uint256"},{"internalType":"uint256","name":"taxedAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cooldownTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getReserves","outputs":[{"internalType":"uint256","name":"_reserve0","type":"uint256"},{"internalType":"uint256","name":"_reserve1","type":"uint256"},{"internalType":"uint32","name":"_blockTimestampLast","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isExcluded","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"lastTransactionTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"liquidityFee","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxTransactionSize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxWalletSize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sellTax","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"newTax","type":"uint32"}],"name":"setBuyTax","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newCooldownTime","type":"uint256"}],"name":"setCooldownTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bool","name":"exclude","type":"bool"}],"name":"setExclude","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"newFactor","type":"uint32"}],"name":"setMaxTransactionFactor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"newFactor","type":"uint32"}],"name":"setMaxWalletFactor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"newTax","type":"uint32"}],"name":"setSellTax","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newTaxCollector","type":"address"}],"name":"setTaxCollector","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"newTaxFactor","type":"uint32"}],"name":"setTaxFactor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newUniswapV2Pair","type":"address"}],"name":"setUniswapV2Pair","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newUniswapV2Router","type":"address"}],"name":"setUniswapV2Router","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"newTax","type":"uint32"}],"name":"setliquidityFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"swap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"switchAutoLiquidity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"taxCollector","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","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":"uniswapV2Pair","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"uniswapV2Router","outputs":[{"internalType":"contract IUniswapV2Router02","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]