File 1 of 1: InfinityBitTokenV2.sol
pragma solidity 0.8.18;
library Address {
function isContract(address account) internal view returns (bool) {
return account.code.length > 0;
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
modifier onlyOwner() {
_checkOwner();
_;
}
function owner() public view virtual returns (address) {
return _owner;
}
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
interface IERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address to, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountA, uint amountB);
function removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountToken, uint amountETH);
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
interface IUniswapV2Factory {
event PairCreated(
address indexed token0,
address indexed token1,
address pair,
uint256
);
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(uint256) external view returns (address pair);
function allPairsLength() external view returns (uint256);
function createPair(address tokenA, address tokenB)
external
returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
contract InfinityBitTokenV2 is IERC20, Ownable {
using Address for address;
event TaxesAutoswap(uint256 amount_eth);
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals = 8;
uint256 private _deployHeight;
address private _contractDeployer;
bool private _maxWalletEnabled = true;
bool public _autoSwapTokens = true;
bool public _transfersEnabled = false;
bool public _sellFromTaxWallets = true;
uint256 private immutable _maxSupply = 5_700_000_000 * (10 ** uint256(_decimals));
uint8 private immutable _maxTax = 50;
uint256 private immutable _maxWallet = 125000000 * (10 ** uint256(_decimals));
uint8 private _marketingTax = 30;
address payable private _marketingWallet = payable(0xd1CB9007D51FB812805d80618A97418Fd388B0C5);
address payable immutable private _legacyMarketingWallet = payable(0xA6e18D5F6b20dFA84d7d245bb656561f1f9aff69);
uint8 private _devTax = 18;
address payable private _devWallet = payable(0x02DAb704810C40C87374eBD85927c3D8a9815Eb0);
address payable immutable private _legacyDevWallet = payable(0x9d0D8E5e651Ab7d54Af5B0F655b3978504E67E0C);
uint8 private _lpTax = 0;
address private immutable _burnAddress = 0x000000000000000000000000000000000000D34d;
uint8 private _autoSwapDeadlineSeconds = 0;
mapping(address=>bool) TaxlessAllowList;
mapping(address=>bool) IgnoreMaxWalletAllowList;
uint8 public _swapLimit = 25;
uint8 public immutable _swapLimitMax = 50;
uint8 public _swapThreshold = 10;
uint8 public immutable _swapThresholdMax = 50;
receive() external payable {}
IUniswapV2Router02 public _uniswapV2Router;
address private _uniswapV2RouterAddress = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
address private _uniswapUniversalRouter = 0x4648a43B2C14Da09FdF82B161150d3F634f40491;
address private _uniswapV2PairAddress;
IUniswapV2Factory public _uniswapV2Factory;
constructor() payable {
_name = "InfinityBit Token";
_symbol = "IBIT";
_decimals = 8;
IUniswapV2Router02 uniswapV2Router = IUniswapV2Router02(_uniswapV2RouterAddress);
_uniswapV2Router = uniswapV2Router;
_uniswapV2Factory = IUniswapV2Factory(_uniswapV2Router.factory());
_uniswapV2PairAddress = _uniswapV2Factory.createPair(address(this), _uniswapV2Router.WETH());
_uniswapV2Router = uniswapV2Router;
_mint(msg.sender, _maxSupply);
_totalSupply = _maxSupply;
IgnoreMaxWalletAllowList[_uniswapUniversalRouter] = true;
IgnoreMaxWalletAllowList[_uniswapV2RouterAddress] = true;
IgnoreMaxWalletAllowList[_uniswapV2PairAddress] = true;
IgnoreMaxWalletAllowList[_marketingWallet] = true;
IgnoreMaxWalletAllowList[_devWallet] = true;
IgnoreMaxWalletAllowList[_legacyMarketingWallet] = true;
IgnoreMaxWalletAllowList[_legacyDevWallet] = true;
IgnoreMaxWalletAllowList[address(owner())] = true;
TaxlessAllowList[_uniswapUniversalRouter] = true;
TaxlessAllowList[_uniswapV2RouterAddress] = true;
TaxlessAllowList[_marketingWallet] = true;
TaxlessAllowList[_devWallet] = true;
TaxlessAllowList[address(owner())] = true;
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function transfer(address to, uint256 amount) public returns (bool) {
_transfer(msg.sender, to, amount);
return true;
}
function _approve(address from, address spender, uint256 amount) internal virtual {
require(from != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[from][spender] = amount;
emit Approval(from, spender, amount);
}
function _spendAllowance(address from, address spender, uint256 amount) internal virtual {
uint256 currentAllowance = allowance(from, spender);
if (currentAllowance != type(uint256).max) {
require(currentAllowance >= amount, "ERC20: insufficient allowance");
unchecked {
_approve(from, spender, currentAllowance - amount);
}
}
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_approve(owner, spender, amount);
return true;
}
function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, amount);
_transfer(from, to, amount);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(msg.sender, spender, allowance(msg.sender, spender) + addedValue);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = allowance(msg.sender, spender);
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(msg.sender, spender, currentAllowance - subtractedValue);
}
return true;
}
function _mint(address to, uint value) internal {
_totalSupply = _totalSupply+value;
_balances[to] = _balances[to] + value;
emit Transfer(address(0), to, value);
}
function enableTransfers() public onlyOwner() {
_transfersEnabled = true;
}
function setDevWallet(address devWallet) public onlyOwner {
require(devWallet != address(0), "IBIT: cannot set to the zero address");
_devWallet = payable(devWallet);
}
function setMarketingWallet(address marketingWallet) public onlyOwner {
require(marketingWallet != address(0), "IBIT: cannot set to the zero address");
_marketingWallet = payable(marketingWallet);
}
function isSell(address sender, address recipient) private view returns (bool) {
if(sender == _uniswapV2RouterAddress || sender == _uniswapV2PairAddress || sender == _uniswapUniversalRouter) {
return false;
}
if(recipient == _uniswapV2PairAddress || recipient == address(_uniswapV2Router)) {
return true;
}
return false;
}
function isBuy(address sender) private view returns (bool) {
return sender == _uniswapV2PairAddress || sender == address(_uniswapV2Router);
}
event AutoswapFailed(uint256 amount);
function _swapTokensForETH(uint256 amount) private {
if(amount == 0) {
return;
}
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _uniswapV2Router.WETH();
_approve(address(this), address(_uniswapV2Router), amount);
try _uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
amount,
0,
path,
address(this),
block.timestamp+_autoSwapDeadlineSeconds
) {
} catch {
emit AutoswapFailed(amount);
}
}
function addLiquidity(uint256 amount_tokens, uint256 amount_eth) private returns (bool) {
if(amount_tokens == 0 || amount_eth == 0) {
return true;
}
_approve(address(this), address(_uniswapV2Router), amount_tokens);
try _uniswapV2Router.addLiquidityETH{value: amount_eth}(
address(this),
amount_tokens,
0,
0,
owner(),
block.timestamp
) {
return true;
} catch {
return false;
}
}
function getDevTax() public view returns (uint8) {
return _devTax;
}
function toggleAutoSwapTokens(bool enable) public onlyOwner {
_autoSwapTokens = enable;
}
function getLpTax() public view returns (uint8) {
return _lpTax;
}
function getMarketingTax() public view returns (uint8) {
return _marketingTax;
}
function setDevTax(uint8 tax) public onlyOwner {
require(_lpTax+_marketingTax+tax <= _maxTax, "IBIT: total tax cannot exceed max tax");
_devTax = tax;
}
function setLpTax(uint8 tax) public onlyOwner {
require((_devTax+_marketingTax+tax) <= _maxTax, "IBIT: total tax cannot exceed max tax");
_lpTax = tax;
}
function setMarketingTax(uint8 tax) public onlyOwner {
require(_devTax+_lpTax+tax <= _maxTax, "IBIT: total tax cannot exceed max tax");
_marketingTax = tax;
}
function setAutoswapDeadline(uint8 deadline_seconds) public onlyOwner {
_autoSwapDeadlineSeconds = deadline_seconds;
}
function DetectMaxWalletEnabled() public view returns (bool) {
return _maxWalletEnabled;
}
function ToggleMaxWallet(bool _enable) public onlyOwner {
_maxWalletEnabled = _enable;
}
function SetUniswapV2Pair(address _w) public onlyOwner {
_uniswapV2PairAddress = _w;
}
function GetUniswapV2Pair() public view returns (address) {
return _uniswapV2PairAddress;
}
function SetTaxlessAllowList(address _w) public onlyOwner {
TaxlessAllowList[_w] = true;
}
function UnsetTaxlessAllowList(address _w) public onlyOwner {
TaxlessAllowList[_w] = false;
}
function SetMaxWalletAllowList(address _w) public onlyOwner {
IgnoreMaxWalletAllowList[_w] = true;
}
function UnsetMaxWalletAllowList(address _w) public onlyOwner {
IgnoreMaxWalletAllowList[_w] = false;
}
function isTaxExempt(address from, address to) public view returns(bool) {
if(TaxlessAllowList[from] || TaxlessAllowList[to])
{
return true;
}
if(from == owner() || to == owner())
{
return true;
}
return false;
}
function isMaxWalletExempt(address _w) public view returns (bool) {
if(_w == address(owner()))
{
return true;
}
return IgnoreMaxWalletAllowList[_w];
}
function totalTax() public view returns (uint8) {
return _lpTax+_devTax+_marketingTax;
}
function sendEther(address payable to, uint256 amount) private returns (bool) {
return to.send(amount);
}
function getLiquidityIBIT() public view returns (uint256) {
return _balances[_uniswapV2PairAddress];
}
function getMaxAutoswap() public view returns (uint256 max_autoswap_limit) {
return (_swapLimit * getLiquidityIBIT()) / 1000;
}
function getAutoswapLimit() public view returns (uint8 autoswap_limit_percent) {
return _swapLimit;
}
function setAutoswapLimit(uint8 swapLimit) public onlyOwner {
require(swapLimit < _swapLimitMax, "IBIT: swapLimit exceeds max");
_swapLimit = swapLimit;
}
function getAutoswapThreshold() public view returns (uint8 autoswap_threshold_percent) {
return _swapThreshold;
}
function setAutoswapThreshold(uint8 swapThreshold) public onlyOwner {
require(_swapThreshold < _swapThresholdMax, "IBIT: swapThreshold exceeds max");
_swapThreshold = swapThreshold;
}
event AutoLiquidityFailed(uint256 token_amount, uint256 eth_amount, uint256 tokens_collected, uint256 tokens_swapped, uint256 eth_collected);
event AutoLiquiditySuccess(uint256 token_amount, uint256 eth_amount, uint256 tokens_collected, uint256 tokens_swapped, uint256 eth_collected);
event DeductTaxes(uint256 dev_tax_amount, uint256 marketing_tax_amount, uint256 lp_tax_amount);
function autoswapTotalTokensAvailable(uint256 amount) public view returns (uint256) {
return _calcLpTaxAmount(amount)/2 + _calcDevTaxAmount(amount) + _calcMarketingTaxAmount(amount) + _balances[_devWallet] + _balances[_marketingWallet];
}
function calcAutoswapAmount(uint256 sell_amount) public view returns (uint256) {
uint256 lp_tokens = _calcLpTaxAmount(sell_amount)/2;
return lp_tokens + _calcDevTaxAmount(sell_amount) + _calcMarketingTaxAmount(sell_amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(_balances[from] >= amount, "ERC20: transfer amount exceeds balance");
if(!_transfersEnabled) {
require(from == owner() || to == owner(), "IBIT: transfers disabled until initial LP");
}
uint256 tax_amount;
if(isTaxExempt(from, to))
{
tax_amount = 0;
}
else
{
tax_amount = _calcTaxes(amount);
}
uint256 transfer_amount = amount - tax_amount;
if(!isMaxWalletExempt(to) && from != owner() && _maxWalletEnabled)
{
require((balanceOf(to) + transfer_amount) <= _maxWallet, "IBIT: maximum wallet cannot be exceeded");
}
if(tax_amount == 0)
{
_taxlessTransfer(from, to, amount);
return;
}
_takeTaxes(from, tax_amount);
emit DeductTaxes(_calcDevTaxAmount(amount), _calcMarketingTaxAmount(amount), _calcLpTaxAmount(amount));
if(autoSwapConditionCheck(from, to, amount))
{
_autoSwapTaxForEth(from, to, amount);
}
else
{
_balances[_devWallet] += _calcDevTaxAmount(amount);
_balances[_marketingWallet] += _calcMarketingTaxAmount(amount);
_balances[address(this)] += _calcLpTaxAmount(amount);
}
_taxlessTransfer(from, to, transfer_amount);
}
function _autoSwapTaxForEth(address from, address to, uint256 amount) private {
uint256 autoswap_amount = calcAutoswapAmount(amount);
if(autoswap_amount == 0)
{
return;
}
uint256 max_autoswap = getMaxAutoswap();
if(autoswap_amount < max_autoswap)
{
uint256 max_extra_autoswap = max_autoswap-autoswap_amount;
autoswap_amount += _takeTokensFromMarketingAndDevWallets(max_extra_autoswap);
}
else if(autoswap_amount > max_autoswap)
{
autoswap_amount = max_autoswap;
}
uint256 startingBalance = address(this).balance;
_swapTokensForETH(autoswap_amount);
uint256 ethCollected = address(this).balance - startingBalance;
emit TaxesAutoswap(ethCollected);
if(_lpTax > 0 && !isTaxExempt(from, to))
{
uint256 tax_amount = _calcTaxes(amount);
uint256 lp_tokens = _calcLpTaxAmount(amount)/2;
if(to == _uniswapV2PairAddress && from != _uniswapV2RouterAddress && from != _uniswapUniversalRouter)
{
uint256 lp_tax_eth = _calcTaxDistribution(ethCollected, _lpTax);
if(!addLiquidity(lp_tokens, lp_tax_eth)) {
emit AutoLiquidityFailed(lp_tokens, lp_tax_eth, tax_amount, autoswap_amount, ethCollected);
} else {
emit AutoLiquiditySuccess(lp_tokens, lp_tax_eth, tax_amount, autoswap_amount, ethCollected);
}
}
}
uint256 marketing_tax_eth = _calcTaxDistribution(ethCollected, _marketingTax);
uint256 dev_tax_eth = _calcTaxDistribution(ethCollected, _devTax);
if(marketing_tax_eth > 0) {
sendEther(_marketingWallet, marketing_tax_eth);
}
if(dev_tax_eth > 0) {
sendEther(_devWallet, dev_tax_eth);
}
}
function autoSwapConditionCheck(address from, address to, uint256 amount) public view returns (bool) {
if(!_autoSwapTokens) {
return false;
}
if(!isSell(from, to)) {
return false;
}
if(_swapThreshold == 0) {
return true;
}
uint256 swapThresholdAmountTokens = (getLiquidityIBIT() * _swapThreshold)/1000;
if(autoswapTotalTokensAvailable(amount) >= swapThresholdAmountTokens) {
return true;
}
return false;
}
function toggleSellFromTaxWallets(bool enable) public onlyOwner {
_sellFromTaxWallets = enable;
}
function takeTokensFromTaxWallets(uint256 max_amount) public onlyOwner returns (uint256 amount_taken) {
return _takeTokensFromMarketingAndDevWallets(max_amount);
}
function _takeTokensFromMarketingAndDevWallets(uint256 max_extra_autoswap) private returns (uint256 amount_taken) {
if(_sellFromTaxWallets == false) {
return 0;
}
if(_balances[_marketingWallet] + _balances[_devWallet] < 10000000000000)
{
return 0;
}
uint256 extra_amount_taken = 0;
if(_balances[_marketingWallet] >= max_extra_autoswap)
{
unchecked {
_balances[_marketingWallet] -= max_extra_autoswap;
_balances[address(this)] += max_extra_autoswap;
}
return max_extra_autoswap;
}
if(_balances[_devWallet] >= max_extra_autoswap)
{
unchecked {
_balances[_devWallet] -= max_extra_autoswap;
_balances[address(this)] += max_extra_autoswap;
}
return max_extra_autoswap;
}
extra_amount_taken = _balances[_devWallet];
unchecked {
_balances[_devWallet] = 0;
_balances[address(this)] += extra_amount_taken;
}
if(extra_amount_taken >= max_extra_autoswap)
{
return max_extra_autoswap;
}
uint256 mwBalance;
if(extra_amount_taken + _balances[_marketingWallet] <= max_extra_autoswap)
{
mwBalance = _balances[_marketingWallet];
unchecked {
_balances[address(this)] += mwBalance;
_balances[_marketingWallet] = 0;
}
return extra_amount_taken + mwBalance;
}
uint256 left_to_take = max_extra_autoswap - amount_taken;
if(_balances[_marketingWallet] >= left_to_take)
{
unchecked {
_balances[_marketingWallet] -= left_to_take;
_balances[address(this)] += left_to_take;
}
return max_extra_autoswap;
}
mwBalance = _balances[_marketingWallet];
unchecked {
_balances[_marketingWallet] = 0;
_balances[address(this)] += mwBalance;
}
return extra_amount_taken + mwBalance;
}
function _calcTaxDistribution(uint256 eth_collected, uint256 tax_rate) private view returns(uint256 distribution_eth)
{
return (eth_collected * tax_rate) / totalTax();
}
function _calcLpTaxAmount(uint256 amount) private view returns(uint256 tax)
{
return (amount * _lpTax) / 1000;
}
function _calcDevTaxAmount(uint256 amount) private view returns(uint256 tax)
{
return (amount * _devTax) / 1000;
}
function _calcMarketingTaxAmount(uint256 amount) private view returns(uint256 tax)
{
return (amount * _marketingTax) / 1000;
}
function _calcTaxes(uint256 amount) public view returns (uint256 tax_to_collect) {
return _calcDevTaxAmount(amount) + _calcMarketingTaxAmount(amount) + _calcLpTaxAmount(amount);
}
function _takeTaxes(address from, uint256 tax_amount) private {
if(tax_amount == 0 || totalTax() == 0)
{
return;
}
unchecked {
_balances[from] -= tax_amount;
}
unchecked {
_balances[address(this)] += tax_amount;
}
}
function _taxlessTransfer(address from, address to, uint256 amount) private {
unchecked {
_balances[from] -= amount;
_balances[to] += amount;
}
emit Transfer(from, to, amount);
}
address[] _legacyHolders;
mapping(address=>uint256) _legacyHoldersBalances;
bool _holdersAirdropped = false;
function setLegacyHolder(address _w, uint256 balance) private {
if(_legacyHoldersBalances[_w] != 0) {
return;
}
if(balance == 0) {
return;
}
_legacyHolders.push(_w);
_legacyHoldersBalances[_w] = balance;
}
function initialAirdrop() public onlyOwner {
require(_holdersAirdropped == false, "IBIT: Holders can only be airdropped once");
_holdersAirdropped = true;
setLegacyBalancesFromSnapshot();
for(uint i = 0; i < _legacyHolders.length; i++) {
address to = _legacyHolders[i];
uint256 balance = _legacyHoldersBalances[to];
_taxlessTransfer(owner(), to, balance);
}
}
function setLegacyBalancesFromSnapshot() private {
_taxlessTransfer(owner(), _legacyMarketingWallet, 14210000100000000);
setLegacyHolder(0x89Abd93CaBa3657919674a663D55E1C185A4CA25, 5000000000000000);
setLegacyHolder(0x2e9EdC685510F3B6B92B5aA8B14E66a18707F5aB, 5000000000000000);
setLegacyHolder(0xDB1C0B51328D40c11ebE5C9C7098477B88551e8d, 2500000000000000);
setLegacyHolder(0x52747Fd7866eF249b015bB99E95a3169B9eC4497, 10490511753749771);
setLegacyHolder(0xb2C91Cf2Fd763F2cC4558ed3cEDE401Fc1d1B675, 4000000000000000);
setLegacyHolder(0x2E64b76130819f30bE2df0A0740D990d706B9926, 9317247665468201);
setLegacyHolder(0x1E69003E5267E945962ae38578a76222CA408584, 5000000000000000);
setLegacyHolder(0x16F39f8ff59caead81bC680e6cd663069Eb978BE, 10100000000000000);
setLegacyHolder(0x6d102206CB3F043E22A62B4b7ecC83b877f85d9A, 5001685678902763);
setLegacyHolder(0xEC61A284Df18c4937B50880F70EB181d38fe86Bb, 1660752476400742);
setLegacyHolder(0x4C999827Bc4b51fbd6911f066d8b82baaC286a9b, 3500000000000000);
setLegacyHolder(0x5415672D7334F8d2798022242675829B16bf94db, 1441870099079523);
setLegacyHolder(0xdF10d9688528b5b60957D1727a70A30450cE9604, 5000000000000000);
setLegacyHolder(0x831114051c0edDe239ae672EdcC4c63371deC82b, 3869772286660397);
setLegacyHolder(0x1d9c8Ae02d75db48dF0d13424cF7fb188dfa4B6E, 2112190583266945);
setLegacyHolder(0x6e7182cFe90cC9AaD11f7082cC4c462dbFD2D73C, 1083000000000000);
setLegacyHolder(0x287044c98a99F08764d681eD898aECb68A5543BC, 2320032256026266);
setLegacyHolder(0x5159cD8087B040E3E5F95e1489ce1018E186795C, 2250000000000000);
setLegacyHolder(0x5eD277Af83D32fa421091244Fa802e90FE8e896d, 5464909136753054);
setLegacyHolder(0x7aBc57C6f67853D16a4400685d18eE53980A3F4F, 7697889041792168);
setLegacyHolder(0x09b3a9Ea542713dcC182728F9DebBdfCB1a0112F, 5000000000000000);
setLegacyHolder(0xF3598aD305Bbd8b40A480947e00a5dc3E29dC5a5, 4875000000000000);
setLegacyHolder(0x2Aeda0568E111Da6A465bb735D912899A15015c2, 10782747817992883);
setLegacyHolder(0xb578B5157Bcc9Fd2e73AcACf7E853FD9F861F55d, 2000000000000000);
setLegacyHolder(0x16C73eaFAA9c6f915d9026D3C2d1b6E9407d2F73, 5159396904718724);
setLegacyHolder(0x3140dD4B65C557Fda703B081C475CE4945EaaCa3, 5000000000000000);
setLegacyHolder(0xe632450E74165110459fEf989bc11E90Ee9029D1, 9350739929318052);
setLegacyHolder(0xF6E82162D8938D91b44EFd4C307DBa91EcBD6950, 2907543953360030);
setLegacyHolder(0x33AF2064Be09C34302C4cA8B8529A0E659243016, 660000000000000);
setLegacyHolder(0xAA9d9D742b5c915D65649C636fb2D485911ece4D, 1318142836424375);
setLegacyHolder(0x5507F5a1076742e3299cE8199fEEd98079ECeE34, 2500000000000000);
setLegacyHolder(0x5e75d35893200849889DD98a50fce78E3D5641F3, 3263084246964091);
setLegacyHolder(0x0665d03bDDFd7bA36b1bDC7aDdB26C48273111c8, 500000000000000);
setLegacyHolder(0x8A541f614A14B00366d92dCe6e927bF550f1c897, 5000000000000000);
setLegacyHolder(0xC8aFB078896B5780bD7b7174429AF2DAff61199b, 6139352996536699);
setLegacyHolder(0xffa25D69EF4909454825904904A2D876eA43E437, 2968750000000000);
setLegacyHolder(0xCd0951939b77e22e497895820Ea7BD3AeF480E1C, 121526011734471);
setLegacyHolder(0x1ca92Baf56A806527952Ebe610d06A66B54Bf5f1, 800000000000000);
setLegacyHolder(0xa51670db54Edf9Dd5D5E3570f619FF46535E3679, 9500000000000);
setLegacyHolder(0xdd30235DC68011F4de01A5c4059fC20145D5c874, 2509039665732949);
setLegacyHolder(0x9161c6B026e65Ba6B583fE8F552FA26b6D39eA89, 1425000000000000);
setLegacyHolder(0xDa85C4A66eBea97aa48a6e1741EC0E639fFe1783, 3138834219770145);
setLegacyHolder(0xCEe85e997E80B724c69a1474a9489dBFA4cF5d2C, 484424921158839);
setLegacyHolder(0x79D6F80D880f1bc1671b6fe3f88977D09eAe4DAA, 1814845856095380);
setLegacyHolder(0x6D9e1352e1F8f66F96669CC28FDCfE8e7FCF5524, 3200000000000000);
setLegacyHolder(0xA6e18D5F6b20dFA84d7d245bb656561f1f9aff69, 11246699192462885);
setLegacyHolder(0x9d0D8E5e651Ab7d54Af5B0F655b3978504E67E0C, 11031132794975236);
setLegacyHolder(0x141278EF1F894a60cBC8637871E4d19c3f2a7336, 5000000000000000);
setLegacyHolder(0x8AefCE4e323DbB2eCD5818869acF90e5415559C5, 5000000000000000);
setLegacyHolder(0x5ea0c07ADa402b67F1a9467d008EC11eD9Ca1127, 5000000000000000);
setLegacyHolder(0x2B09aCED766f8290de1F5E4E0d3B3B8915C49189, 5000000000000000);
setLegacyHolder(0xFb1BAD0Dc29a9a485F08F4FE6bFBFEdeba10ad8d, 12125000000000000);
setLegacyHolder(0x56be74F547b1c3b01E97f87461E2f3C75902374A, 1124603943161942);
setLegacyHolder(0x4A9381E176D676A07DD17A83d8BFd1287b342c77, 4810000000000000);
setLegacyHolder(0xFCe082295b4db70097c4135Ca254B13B070800E7, 10000000000000000);
setLegacyHolder(0x7ea69F87f9836FFc6797B6B2D045c11e0881b740, 5000000000000000);
setLegacyHolder(0x1cC4A2522c3847687aF45AcdA2b5d6EbB64490A9, 402527671912807);
setLegacyHolder(0x89E364598BDa1f96B6618EBE5D9879F070066358, 4750000000000000);
setLegacyHolder(0x7FF0373F706E07eE326d538f6a6B2Cf8F7397e77, uint256(uint256(1250924993795650) / 2));
setLegacyHolder(0x5F7425396747897F91b68149915826aFc2C14c16, uint256(uint256(1097767093335720) / 2));
setLegacyHolder(0xa9b809Cfe8d95EdbDD61603Ba40081Ba6da4F24b, uint256(uint256(711944117144372) / 2));
setLegacyHolder(0x817271eA29E0297D26e87c0fCae5d7086c06ae94, uint256(uint256(263389054436059) / 2));
setLegacyHolder(0x15Cd32F5e9C286FaD0c6E6F40D1fc07c2c1a8584, uint256(uint256(130033069564332) / 2));
setLegacyHolder(0x90a71A274Cf69c0AD430481241206cd8fec7a1ED, uint256(uint256(117107416670239) / 2));
setLegacyHolder(0xC5DcAdf158Dc6DE2D6Bc1dDBB40Fb03572000D32, uint256(uint256(45488054291697) / 2));
}
}