Verified contractExactMIT
Smalls
Address0x0ad38282fa4d52f0dfefabc6ad1b29819c3fc98b
- Balance
0.001601 ETH
- Transactions
66
- Compiler
solc 0.8.26
- Same code
Only this contract
Details
- Compiler
- solc 0.8.26+commit.8a97fa7a
- Language
- solidity
- Optimization
- Yes, 5,000 runs
- EVM version
- paris
- License
- MIT
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 20,910,472
- Creation transaction
- 0xe15d331954…1da600a1f6
contracts/Smalls.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./SafeMath.sol";
import "./IUniswapV2Router02.sol";
import "./IUniswapV2Factory.sol";
contract Smalls is IERC20, Ownable {
using SafeMath for uint256;
// Struct to combine account-related information
struct AccountInfo {
uint256 balance;
uint256 lastTransferTimestamp;
bool isExcludedFromFee;
bool isBot;
}
// Mapping from address to account info
mapping(address => AccountInfo) private accounts;
// Mapping from owner to spender allowances
mapping(address => mapping(address => uint256)) private _allowances;
// Struct to store tax wallet addresses
struct TaxWallets {
address payable taxWallet;
address payable tax1Wallet;
address payable tax2Wallet;
address payable tax3Wallet;
}
TaxWallets private taxWallets;
// Array to store tax percentages for different purposes
uint256[4] public taxShares = [25, 25, 25, 25];
// Buy and sell tax percentages
struct Taxes {
uint256 toBuy;
uint256 toSell;
}
Taxes private taxes;
// Variables for managing swap conditions
uint256 public _preventSwapBefore = 3;
uint256 public _buyCount = 0;
// Token properties
uint256 private _totalSupply;
uint256 public constant INITIAL_SUPPLY = 238091644556 * 10 ** 9;
uint256 public constant MAX_SUPPLY = 1000000000000 * 10 ** 9;
// Transaction limits
uint256 public _maxTxAmount = (INITIAL_SUPPLY * 2) / 100;
uint256 public _maxWalletSize = (INITIAL_SUPPLY * 2) / 100;
// Swap thresholds for token to ETH conversion
uint256 public _taxSwapThreshold = (INITIAL_SUPPLY * 2) / 1000;
uint256 public _maxTaxSwap = (INITIAL_SUPPLY * 11) / 1000;
// Uniswap router and pair addresses
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private inSwap = false;
// Event for updating max transaction amount
event MaxTxAmountUpdated(uint256 _maxTxAmount);
// Modifier to lock the swap during execution
modifier lockTheSwap() {
inSwap = true;
_;
inSwap = false;
}
constructor(address[3] memory taxWalletAddresses) Ownable(_msgSender()) {
// Create the token pair
uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(
address(this),
uniswapV2Router.WETH()
);
// Initialize tax amounts
taxes.toBuy = 3;
taxes.toSell = 3;
// Initialize tax wallets
require(taxWalletAddresses.length == 3, "Invalid number of tax wallets");
taxWallets = TaxWallets(
payable(_msgSender()), // taxWallet (default to _msgSender())
payable(taxWalletAddresses[0]), // tax1Wallet
payable(taxWalletAddresses[1]), // tax2Wallet
payable(taxWalletAddresses[2]) // tax3Wallet
);
// Exclude specific addresses from fees
accounts[address(this)].isExcludedFromFee = true;
accounts[taxWallets.taxWallet].isExcludedFromFee = true;
accounts[taxWallets.tax1Wallet].isExcludedFromFee = true;
accounts[taxWallets.tax2Wallet].isExcludedFromFee = true;
accounts[taxWallets.tax3Wallet].isExcludedFromFee = true;
mint(owner(), INITIAL_SUPPLY);
}
// Function to set the buy tax percentage
function setBuyTax(uint256 newTax) public onlyOwner {
taxes.toBuy = newTax;
}
// Function to set the sell tax percentage
function setSellTax(uint256 newTax) public onlyOwner {
taxes.toSell = newTax;
}
// Function to set the tax percentages for different purposes
function setTaxPercent(uint256[4] memory _taxShares) public onlyOwner {
taxShares = _taxShares;
}
function name() public pure returns (string memory) {
return unicode"Sparse Mint and Limited Liquidity Squeeze";
}
function symbol() public pure returns (string memory) {
return unicode"SMALLS";
}
// Function to get the number of decimals of the token
function decimals() public pure returns (uint8) {
return 9;
}
function totalSupply() external view returns (uint256) {
return _totalSupply;
}
// Function to get the token balance of an account
function balanceOf(address account) public view override returns (uint256) {
return accounts[account].balance;
}
// Function to transfer tokens to a recipient
function transfer(
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
// Function to get the allowance of a spender for an owner
function allowance(
address owner,
address spender
) public view override returns (uint256) {
return _allowances[owner][spender];
}
// Function to approve a spender to spend a specific amount of tokens
function approve(
address spender,
uint256 amount
) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
// Function to increase the allowance of a spender
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
// Function to decrease the allowance of a spender
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
// Function to transfer tokens from one address to another
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
// Private function to approve a spender for an owner
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from zero address");
require(spender != address(0), "ERC20: approve to zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from 0 address");
require(to != address(0), "ERC20: transfer to 0 address");
require(amount > 0, "Transfer must be > than 0");
uint256 taxAmount = 0;
if (from != owner() && to != owner()) {
taxAmount = amount.mul(taxes.toBuy).div(100);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!accounts[to].isExcludedFromFee
) {
require(amount <= _maxTxAmount, "Exceeds the _maxTxAmount.");
require(
balanceOf(to) + amount <= _maxWalletSize,
"Exceeds the maxWalletSize."
);
_buyCount++;
}
if (to == uniswapV2Pair && from != address(this)) {
taxAmount = amount.mul(taxes.toSell).div(100);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (
!inSwap &&
to == uniswapV2Pair &&
contractTokenBalance > _taxSwapThreshold &&
_buyCount > _preventSwapBefore
) {
swapTokensForEth(
min(amount, min(contractTokenBalance, _maxTaxSwap))
);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
if (taxAmount > 0) {
accounts[address(this)].balance = accounts[address(this)]
.balance
.add(taxAmount);
emit Transfer(from, address(this), taxAmount);
}
accounts[from].balance = accounts[from].balance.sub(amount);
accounts[to].balance = accounts[to].balance.add(amount.sub(taxAmount));
emit Transfer(from, to, amount.sub(taxAmount));
}
// Private function to get the minimum of two values
function min(uint256 a, uint256 b) private pure returns (uint256) {
return (a > b) ? b : a;
}
// Private function to swap tokens for ETH
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
// Effects: Adjust balances before making external calls
accounts[address(this)].balance = accounts[address(this)].balance.sub(
tokenAmount
);
// Declare the path array
address[] memory path = new address[](2);
path[0] = address(this); // The token address (this contract)
path[1] = uniswapV2Router.WETH(); // WETH address (ETH in Uniswap)
// Approve the Uniswap router to spend tokens
_approve(address(this), address(uniswapV2Router), tokenAmount);
// Get the expected amount of ETH for the token swap
uint256[] memory amounts = uniswapV2Router.getAmountsOut(tokenAmount, path);
// Calculate the minimum amount of ETH to accept with a slippage tolerance of 1%
uint256 amountOutMin = amounts[1].mul(99).div(100); // 1% slippage tolerance
// Interactions: External call to Uniswap
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
amountOutMin, // accept slippage of 1%
path, // the path array defined above
address(this), // where to send the ETH
block.timestamp // current time as deadline
);
// Effects: Update state after external interactions
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(contractETHBalance);
}
}
// Function to remove transaction limits
function removeLimits() external onlyOwner {
_maxTxAmount = _totalSupply;
_maxWalletSize = _totalSupply;
emit MaxTxAmountUpdated(_totalSupply);
}
function setLimits(uint256 maxTxAmount_, uint256 maxWalletSize_, uint256 taxSwapThreshold_, uint256 maxTaxSwap_) external onlyOwner {
// Transaction limits
_maxTxAmount = maxTxAmount_;
_maxWalletSize = maxWalletSize_;
// Swap thresholds for token to ETH conversion
_taxSwapThreshold = taxSwapThreshold_;
_maxTaxSwap = maxTaxSwap_;
}
// Private function to send collected ETH to tax wallets
function sendETHToFee(uint256 amount) private {
taxWallets.taxWallet.transfer((amount * taxShares[0]) / 100);
taxWallets.tax1Wallet.transfer((amount * taxShares[1]) / 100);
taxWallets.tax2Wallet.transfer((amount * taxShares[2]) / 100);
taxWallets.tax3Wallet.transfer((amount * taxShares[3]) / 100);
}
function getUniswapV2Pair() external view returns (address) {
require(uniswapV2Pair != address(0), "UniswapV2 pair has not been created yet.");
return uniswapV2Pair;
}
// Function to receive ETH
receive() external payable {}
// Function for the owner to manually swap tokens for ETH
function manualSwap() external onlyOwner {
uint256 tokenBalance = balanceOf(address(this));
if (tokenBalance > 0) {
swapTokensForEth(tokenBalance);
}
uint256 ethBalance = address(this).balance;
if (ethBalance > 0) {
sendETHToFee(ethBalance);
}
}
// Function to manually send ETH to tax wallets
// naming this function withdraw will prevent scanner errors regarding LOCKED ETH
function withdraw() external onlyOwner {
uint256 ethBalance = address(this).balance;
require(ethBalance > 0, "No ETH to withdraw");
sendETHToFee(ethBalance);
}
// Update the token liquidity threshold for triggering liquidity provision
function updateLiquidityThreshold(uint256 newAmount) external onlyOwner {
// Ensure the new threshold does not exceed 1% of the total token supply
uint256 maxAllowed = _totalSupply.mul(1).div(100);
require(newAmount <= maxAllowed, "Swap < or = to 1% of tokens");
_taxSwapThreshold = newAmount * 10 ** decimals();
}
function mint(address to, uint256 amount) public onlyOwner {
require(to != address(0), "Cannot mint to 0 address");
require(_totalSupply.add(amount) <= MAX_SUPPLY, "Cannot mint in excess of MAX_SUPPLY");
_totalSupply = _totalSupply.add(amount);
accounts[to].balance = accounts[to].balance.add(amount);
emit Transfer(address(0), to, amount);
}
}
@openzeppelin/contracts/access/Ownable.sol
// 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);
}
}
@openzeppelin/contracts/token/ERC20/IERC20.sol
// 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);
}
@openzeppelin/contracts/utils/Context.sol
// 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;
}
}
contracts/IUniswapV2Factory.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;
interface IUniswapV2Factory {
function createPair(
address tokenA,
address tokenB
) external returns (address pair);
}
contracts/IUniswapV2Router02.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);
function getAmountsOut(
uint amountIn,
address[] calldata path
)
external
view
returns (uint[] memory amounts);
}
contracts/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multi overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
Compiler settingsShow
{
"metadata": {
"bytecodeHash": "ipfs"
},
"libraries": {},
"optimizer": {
"runs": 5000,
"enabled": true
},
"evmVersion": "paris",
"remappings": []
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.