Description:
Multi-signature wallet contract requiring multiple confirmations for transaction execution.
Blockchain: Ethereum
Source Code: View Code On The Blockchain
Solidity Source Code:
{{
"language": "Solidity",
"sources": {
"contracts/access/Ownable.sol": {
"content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import "../libraries/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.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @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 {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current 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 {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_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);
}
}"
},
"contracts/Doge404.sol": {
"content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import "./token/ERC20.sol";
import "./access/Ownable.sol";
import "./security/ReentrancyGuard.sol";
import "./interfaces/IUniswap.sol";
/**
* https://blog.ethereum.org/404doge
* https://x.com/404doge
*/
contract Doge404 is ERC20, Ownable, ReentrancyGuard {
// ============ IMMUTABLE VARIABLES ============
IUniswapV2Router02 public immutable woofRouter;
address public immutable dogePair;
// ============ STATE VARIABLES ============
mapping(address => bool) private _isExcludedFromFees;
mapping(address => bool) public automatedMarketMakerPairs;
uint256 public buyWoofTax = 1400; // 14% (in basis points)
uint256 public sellWoofTax = 2400; // 24% (in basis points)
uint256 public maxWoofWallet; // Maximum tokens per wallet
uint256 public maxWoofTx; // Maximum tokens per transaction
address public treasuryWallet; // Wallet that receives tax revenue
bool public tradingEnabled = false; // Trading must be manually enabled
bool public limitsInEffect = true; // Anti-whale limits active
bool private swapping; // Flag to prevent recursive swaps
uint256 public swapTokensAtAmount; // Threshold for automatic tax swaps
// ============ CONSTANTS ============
uint256 private constant MAX_TAX_RATE = 2500; // 25% maximum tax
uint256 private constant TAX_DENOMINATOR = 10000; // For basis point calculations
// ============ EVENTS ============
event WoofTradeEnabled();
event WoofLimitsRemoved();
event WoofTaxUpdated(uint256 buyTax, uint256 sellTax);
event WoofWalletUpdated(address indexed newWallet);
event WoofSwapAndLiquify(uint256 tokensSwapped, uint256 ethReceived);
event WoofExclusionUpdated(address indexed account, bool excluded);
event WoofPairUpdated(address indexed pair, bool indexed value);
// ============ CONSTRUCTOR ============
constructor() ERC20("Doge404", "DOGE404") {
// Initialize Uniswap V2 Router (mainnet/testnet address)
IUniswapV2Router02 _woofRouter = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
woofRouter = _woofRouter;
// Create Uniswap pair for this token
dogePair = IUniswapV2Factory(_woofRouter.factory()).createPair(
address(this),
_woofRouter.WETH()
);
_setAutomatedMarketMakerPair(address(dogePair), true);
uint256 totalSupply = 1_000_000_000 * 1e18; // 1 billion tokens
// Set initial limits
maxWoofWallet = totalSupply * 404 / 10000; // 4.04% of total supply
maxWoofTx = totalSupply * 404 / 100000; // 0.404% of total supply
swapTokensAtAmount = totalSupply * 5 / 10000; // 0.05% swap threshold
treasuryWallet = owner();
// Exclude important addresses from fees and limits
excludeFromFees(owner(), true);
excludeFromFees(address(this), true);
excludeFromFees(address(0xdead), true);
excludeFromFees(treasuryWallet, true);
// Mint entire supply to owner
_mint(owner(), totalSupply);
}
// ============ RECEIVE FUNCTION ============
receive() external payable {}
// ============ OWNER FUNCTIONS ============
/**
* @dev Enable trading - can only be called once by owner
*/
function enableWoofTrading() external onlyOwner {
require(!tradingEnabled, "Trading already enabled");
tradingEnabled = true;
emit WoofTradeEnabled();
}
/**
* @dev Remove anti-whale limits - irreversible
*/
function removeWoofLimits() external onlyOwner returns (bool) {
limitsInEffect = false;
emit WoofLimitsRemoved();
return true;
}
/**
* @dev Update buy and sell tax rates
* @param _buyTax New buy tax rate (in basis points, max 2500 = 25%)
* @param _sellTax New sell tax rate (in basis points, max 2500 = 25%)
*/
function updateWoofTaxes(uint256 _buyTax, uint256 _sellTax) external onlyOwner {
require(_buyTax <= MAX_TAX_RATE, "Buy tax too high");
require(_sellTax <= MAX_TAX_RATE, "Sell tax too high");
buyWoofTax = _buyTax;
sellWoofTax = _sellTax;
emit WoofTaxUpdated(_buyTax, _sellTax);
}
/**
* @dev Update wallet and transaction limits
* @param _maxWallet New maximum wallet size (minimum 0.5% of supply)
* @param _maxTx New maximum transaction size (minimum 0.1% of supply)
*/
function updateWoofLimits(uint256 _maxWallet, uint256 _maxTx) external onlyOwner {
require(_maxWallet >= totalSupply() * 5 / 1000, "Max wallet too low");
require(_maxTx >= totalSupply() * 1 / 1000, "Max tx too low");
maxWoofWallet = _maxWallet;
maxWoofTx = _maxTx;
}
/**
* @dev Update the treasury wallet address
* @param _treasuryWallet New treasury wallet address
*/
function updateWoofWallet(address _treasuryWallet) external onlyOwner {
require(_treasuryWallet != address(0), "Treasury cannot be zero address");
treasuryWallet = _treasuryWallet;
emit WoofWalletUpdated(_treasuryWallet);
}
/**
* @dev Exclude or include an address from fees
* @param account Address to update
* @param excluded True to exclude from fees, false to include
*/
function excludeFromFees(address account, bool excluded) public onlyOwner {
_isExcludedFromFees[account] = excluded;
emit WoofExclusionUpdated(account, excluded);
}
/**
* @dev Set an address as an automated market maker pair
* @param pair Address of the pair
* @param value True to set as AMM pair, false to remove
*/
function setAutomatedMarketMakerPair(address pair, bool value) public onlyOwner {
require(pair != dogePair, "Cannot remove main pair");
_setAutomatedMarketMakerPair(pair, value);
}
/**
* @dev Manual swap of contract tokens for ETH
*/
function manualWoofSwap() external onlyOwner {
uint256 contractBalance = balanceOf(address(this));
require(contractBalance > 0, "No tokens to swap");
swapTokensForEth(contractBalance);
}
/**
* @dev Emergency function to rescue ETH from contract
*/
function rescueWoofETH() external onlyOwner {
uint256 ethBalance = address(this).balance;
require(ethBalance > 0, "No ETH to rescue");
(bool success, ) = payable(owner()).call{value: ethBalance}("");
require(success, "ETH rescue failed");
}
/**
* @dev Emergency function to rescue ERC20 tokens from contract
* @param tokenAddress Address of the token to rescue
*/
function rescueWoofTokens(address tokenAddress) external onlyOwner {
require(tokenAddress != address(this), "Cannot rescue own tokens");
IERC20 token = IERC20(tokenAddress);
uint256 balance = token.balanceOf(address(this));
require(balance > 0, "No tokens to rescue");
require(token.transfer(owner(), balance), "Token rescue failed");
}
// ============ PUBLIC VIEW FUNCTIONS ============
/**
* @dev Check if an address is excluded from fees
* @param account Address to check
* @return bool True if excluded from fees
*/
function isExcludedFromFees(address account) public view returns (bool) {
return _isExcludedFromFees[account];
}
/**
* @dev Get current tax rates
* @return buyTax Current buy tax rate in basis points
* @return sellTax Current sell tax rate in basis points
*/
function getWoofTaxRates() external view returns (uint256 buyTax, uint256 sellTax) {
return (buyWoofTax, sellWoofTax);
}
/**
* @dev Get current limits
* @return maxWallet Current maximum wallet size
* @return maxTx Current maximum transaction size
* @return swapThreshold Current swap threshold
*/
function getWoofLimits() external view returns (uint256 maxWallet, uint256 maxTx, uint256 swapThreshold) {
return (maxWoofWallet, maxWoofTx, swapTokensAtAmount);
}
// ============ INTERNAL FUNCTIONS ============
/**
* @dev Internal function to set automated market maker pair
*/
function _setAutomatedMarketMakerPair(address pair, bool value) private {
automatedMarketMakerPairs[pair] = value;
emit WoofPairUpdated(pair, value);
}
/**
* @dev Override transfer function to implement taxes and limits
*/
function _transfer(address from, address to, uint256 amount) internal override {
require(from != address(0), "ERC20: transfer from zero address");
require(to != address(0), "ERC20: transfer to zero address");
if (amount == 0) {
super._transfer(from, to, 0);
return;
}
// Apply limits if they're in effect
if (limitsInEffect) {
if (from != owner() && to != owner() && to != address(0) && to != address(0xdead) && !swapping) {
if (!tradingEnabled) {
require(_isExcludedFromFees[from] || _isExcludedFromFees[to], "Trading not active");
}
// On buy
if (automatedMarketMakerPairs[from] && !_isExcludedFromFees[to]) {
require(amount <= maxWoofTx, "Buy transfer amount exceeds the maxWoofTx");
require(amount + balanceOf(to) <= maxWoofWallet, "Max wallet exceeded");
}
// On sell
else if (automatedMarketMakerPairs[to] && !_isExcludedFromFees[from]) {
require(amount <= maxWoofTx, "Sell transfer amount exceeds the maxWoofTx");
}
// On normal transfer
else if (!_isExcludedFromFees[to]) {
require(amount + balanceOf(to) <= maxWoofWallet, "Max wallet exceeded");
}
}
}
// Check if we should swap accumulated taxes
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= swapTokensAtAmount;
if (canSwap && !swapping && !automatedMarketMakerPairs[from] &&
!_isExcludedFromFees[from] && !_isExcludedFromFees[to]) {
swapping = true;
swapBack();
swapping = false;
}
bool takeFee = !swapping;
// If any account belongs to _isExcludedFromFees then remove the fee
if (_isExcludedFromFees[from] || _isExcludedFromFees[to]) {
takeFee = false;
}
uint256 fees = 0;
// Only take fees on buys/sells, do not take on wallet transfers
if (takeFee) {
// On sell
if (automatedMarketMakerPairs[to] && sellWoofTax > 0) {
fees = amount * sellWoofTax / TAX_DENOMINATOR;
}
// On buy
else if (automatedMarketMakerPairs[from] && buyWoofTax > 0) {
fees = amount * buyWoofTax / TAX_DENOMINATOR;
}
if (fees > 0) {
super._transfer(from, address(this), fees);
}
amount -= fees;
}
super._transfer(from, to, amount);
}
/**
* @dev Swap accumulated tax tokens for ETH
*/
function swapTokensForEth(uint256 tokenAmount) private {
// Generate the uniswap pair path of token -> weth
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = woofRouter.WETH();
_approve(address(this), address(woofRouter), tokenAmount);
// Make the swap
woofRouter.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // Accept any amount of ETH
path,
treasuryWallet,
block.timestamp
);
emit WoofSwapAndLiquify(tokenAmount, address(this).balance);
}
/**
* @dev Swap back function called during transfers
*/
function swapBack() private {
uint256 contractBalance = balanceOf(address(this));
if (contractBalance == 0) return;
// Cap the swap to prevent huge price impact
if (contractBalance > swapTokensAtAmount * 20) {
contractBalance = swapTokensAtAmount * 20;
}
swapTokensForEth(contractBalance);
}
}"
},
"contracts/interfaces/IERC20.sol": {
"content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
/**
* @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`).
*/
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 amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}"
},
"contracts/interfaces/IUniswap.sol": {
"content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function 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;
}"
},
"contracts/libraries/Context.sol": {
"content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
/**
* @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).
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}"
},
"contracts/security/ReentrancyGuard.sol": {
"content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
}"
},
"contracts/token/ERC20.sol": {
"content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import "../interfaces/IERC20.sol";
import "../libraries/Context.sol";
/**
* @dev Implementation of the {IERC20} interface.
*/
contract ERC20 is Context, IERC20 {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*/
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.
*/
function symbol() public view virtual returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
*/
function decimals() public view virtual returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*/
function transfer(address to, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_transfer(owner, to, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_approve(owner, spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*/
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;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, allowance(owner, spender) + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
address owner = _msgSender();
uint256 currentAllowance = allowance(owner, spender);
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(owner, spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `from` to `to`.
*/
function _transfer(address from, address to, uint256 amount) internal virtual {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(from, to, amount);
uint256 fromBalance = _balances[from];
require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[from] = fromBalance - amount;
_balances[to] += amount;
}
emit Transfer(from, to, amount);
_afterTokenTransfer(from, to, amount);
}
/**
* @dev Creates `amount` tokens and assigns them to `account`.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
unchecked {
_balances[account] += amount;
}
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the total supply.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
_totalSupply -= amount;
}
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*/
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Updates `owner` s allowance for `spender` based on spent `amount`.
*/
function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
require(currentAllowance >= amount, "ERC20: insufficient allowance");
unchecked {
_approve(owner, spender, currentAllowance - amount);
}
}
}
/**
* @dev Hook that is called before any transfer of tokens.
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens.
*/
function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}
}"
}
},
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"evmVersion": "paris",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}
}}
Submitted on: 2025-09-17 19:52:24
Comments
Log in to comment.
No comments yet.