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": {
"CrossChainDustCollector.sol": {
"content": "// SPDX-License-Identifier: MIT\r
pragma solidity ^0.8.20;\r
\r
// For Remix - use direct GitHub imports\r
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";\r
import "@openzeppelin/contracts/access/Ownable.sol";\r
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";\r
import "@openzeppelin/contracts/utils/Address.sol";\r
\r
interface IV2Router {\r
function WETH() external pure returns (address);\r
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);\r
function swapExactTokensForETH(\r
uint amountIn,\r
uint amountOutMin,\r
address[] calldata path,\r
address to,\r
uint deadline\r
) external returns (uint[] memory amounts);\r
function swapExactTokensForETHSupportingFeeOnTransferTokens(\r
uint amountIn,\r
uint amountOutMin,\r
address[] calldata path,\r
address to,\r
uint deadline\r
) external;\r
}\r
\r
contract CrossChainDustCollector is ReentrancyGuard, Ownable {\r
using Address for address;\r
\r
enum ChainType { ETHEREUM, BSC, POLYGON, ARBITRUM, OPTIMISM, AVALANCHE }\r
\r
struct ChainConfig {\r
address v2Router;\r
address nativeWrapper;\r
uint256 minDustThreshold;\r
uint256 gasPriceLimit;\r
}\r
\r
mapping(ChainType => ChainConfig) public chainConfigs;\r
ChainType public currentChain;\r
\r
uint256 public lastCollectionTime;\r
uint256 public collectionInterval = 5 minutes;\r
uint256 public constant SLIPPAGE_TOLERANCE = 300;\r
\r
mapping(address => bool) public blacklistedTokens;\r
mapping(address => uint256) public lastCollected;\r
uint256 public tokenCooldown = 5 minutes;\r
\r
uint256 public totalCollections;\r
uint256 public totalNativeCollected;\r
\r
event DustCollected(address indexed token, uint256 amount, uint256 nativeReceived);\r
event AutoCollectionExecuted(uint256 totalCollected, uint256 tokensProcessed, uint256 totalCollections);\r
event ChainConfigured(ChainType chain, address router, uint256 threshold);\r
event TokenBlacklisted(address indexed token);\r
event EmergencyWithdraw(address indexed token, uint256 amount);\r
\r
// FIXED CONSTRUCTOR - added initialOwner parameter\r
constructor(ChainType _chain, address initialOwner) Ownable(initialOwner) {\r
currentChain = _chain;\r
_setupDefaultChains();\r
}\r
\r
function _setupDefaultChains() internal {\r
chainConfigs[ChainType.ETHEREUM] = ChainConfig({\r
v2Router: 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D,\r
nativeWrapper: 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2,\r
minDustThreshold: 0.0001 ether,\r
gasPriceLimit: 30 gwei\r
});\r
\r
chainConfigs[ChainType.BSC] = ChainConfig({\r
v2Router: 0x10ED43C718714eb63d5aA57B78B54704E256024E,\r
nativeWrapper: 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c,\r
minDustThreshold: 0.001 ether,\r
gasPriceLimit: 3 gwei\r
});\r
\r
chainConfigs[ChainType.POLYGON] = ChainConfig({\r
v2Router: 0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff,\r
nativeWrapper: 0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270,\r
minDustThreshold: 0.1 ether,\r
gasPriceLimit: 100 gwei\r
});\r
\r
chainConfigs[ChainType.ARBITRUM] = ChainConfig({\r
v2Router: 0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506,\r
nativeWrapper: 0x82aF49447D8a07e3bd95BD0d56f35241523fBab1,\r
minDustThreshold: 0.0001 ether,\r
gasPriceLimit: 0.03 gwei\r
});\r
\r
chainConfigs[ChainType.OPTIMISM] = ChainConfig({\r
v2Router: 0x9c12939390052919aF3155f41Bf4160Fd3666A6f,\r
nativeWrapper: 0x4200000000000000000000000000000000000006,\r
minDustThreshold: 0.0001 ether,\r
gasPriceLimit: 0.03 gwei\r
});\r
\r
chainConfigs[ChainType.AVALANCHE] = ChainConfig({\r
v2Router: 0x60aE616a2155Ee3d9A68541Ba4544862310933d4,\r
nativeWrapper: 0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7,\r
minDustThreshold: 0.001 ether,\r
gasPriceLimit: 15 gwei\r
});\r
}\r
\r
function executeAutoCollection() external nonReentrant onlyOwner returns (uint256 collectedAmount) {\r
require(block.timestamp >= lastCollectionTime + collectionInterval, "Cooldown active");\r
require(tx.gasprice <= chainConfigs[currentChain].gasPriceLimit, "Gas price too high");\r
\r
lastCollectionTime = block.timestamp;\r
collectedAmount = 0;\r
uint256 tokensProcessed = 0;\r
\r
address[] memory tokens = getTokensWithBalance();\r
\r
for (uint256 i = 0; i < tokens.length; i++) {\r
if (_canCollectToken(tokens[i])) {\r
uint256 balance = IERC20(tokens[i]).balanceOf(address(this));\r
uint256 nativeReceived = _collectTokenDust(tokens[i], balance);\r
\r
if (nativeReceived > 0) {\r
collectedAmount += nativeReceived;\r
tokensProcessed++;\r
lastCollected[tokens[i]] = block.timestamp;\r
}\r
}\r
}\r
\r
if (collectedAmount > 0) {\r
(bool success, ) = owner().call{value: collectedAmount}("");\r
require(success, "Native transfer failed");\r
}\r
\r
totalCollections++;\r
totalNativeCollected += collectedAmount;\r
\r
emit AutoCollectionExecuted(collectedAmount, tokensProcessed, totalCollections);\r
return collectedAmount;\r
}\r
\r
function forceCollection() external nonReentrant onlyOwner returns (uint256 collectedAmount) {\r
collectedAmount = 0;\r
uint256 tokensProcessed = 0;\r
\r
address[] memory tokens = getTokensWithBalance();\r
\r
for (uint256 i = 0; i < tokens.length; i++) {\r
if (!blacklistedTokens[tokens[i]] && IERC20(tokens[i]).balanceOf(address(this)) > 0) {\r
uint256 balance = IERC20(tokens[i]).balanceOf(address(this));\r
uint256 nativeReceived = _collectTokenDust(tokens[i], balance);\r
\r
if (nativeReceived > 0) {\r
collectedAmount += nativeReceived;\r
tokensProcessed++;\r
lastCollected[tokens[i]] = block.timestamp;\r
}\r
}\r
}\r
\r
if (collectedAmount > 0) {\r
(bool success, ) = owner().call{value: collectedAmount}("");\r
require(success, "Native transfer failed");\r
}\r
\r
totalCollections++;\r
totalNativeCollected += collectedAmount;\r
\r
emit AutoCollectionExecuted(collectedAmount, tokensProcessed, totalCollections);\r
return collectedAmount;\r
}\r
\r
function collectTokenDust(address token, uint256 amount) external nonReentrant onlyOwner returns (uint256) {\r
require(_canCollectToken(token), "Cannot collect this token");\r
\r
uint256 nativeReceived = _collectTokenDust(token, amount);\r
require(nativeReceived > 0, "No native received");\r
\r
(bool success, ) = owner().call{value: nativeReceived}("");\r
require(success, "Native transfer failed");\r
\r
lastCollected[token] = block.timestamp;\r
return nativeReceived;\r
}\r
\r
function _collectTokenDust(address token, uint256 amount) internal returns (uint256) {\r
if (token == chainConfigs[currentChain].nativeWrapper) {\r
return amount;\r
}\r
\r
uint256 nativeBefore = address(this).balance;\r
\r
IERC20(token).approve(chainConfigs[currentChain].v2Router, amount);\r
\r
address[] memory path = new address[](2);\r
path[0] = token;\r
path[1] = chainConfigs[currentChain].nativeWrapper;\r
\r
IV2Router router = IV2Router(chainConfigs[currentChain].v2Router);\r
\r
try router.swapExactTokensForETHSupportingFeeOnTransferTokens(\r
amount,\r
_calculateMinAmountOut(token, amount),\r
path,\r
address(this),\r
block.timestamp + 120\r
) {\r
// Success\r
} catch {\r
try router.swapExactTokensForETH(\r
amount,\r
_calculateMinAmountOut(token, amount),\r
path,\r
address(this),\r
block.timestamp + 120\r
) {\r
// Success\r
} catch {\r
blacklistedTokens[token] = true;\r
emit TokenBlacklisted(token);\r
return 0;\r
}\r
}\r
\r
uint256 nativeReceived = address(this).balance - nativeBefore;\r
emit DustCollected(token, amount, nativeReceived);\r
\r
return nativeReceived;\r
}\r
\r
function _canCollectToken(address token) internal view returns (bool) {\r
return !blacklistedTokens[token] &&\r
IERC20(token).balanceOf(address(this)) > 0 &&\r
block.timestamp - lastCollected[token] >= tokenCooldown &&\r
_isProfitableDust(token, IERC20(token).balanceOf(address(this)));\r
}\r
\r
function _isProfitableDust(address token, uint256 amount) internal view returns (bool) {\r
if (token == chainConfigs[currentChain].nativeWrapper) return true;\r
\r
try this.estimateOutput(token, amount) returns (uint256 estimatedOutput) {\r
return estimatedOutput >= chainConfigs[currentChain].minDustThreshold;\r
} catch {\r
return false;\r
}\r
}\r
\r
function estimateOutput(address token, uint256 amount) external view returns (uint256) {\r
if (token == chainConfigs[currentChain].nativeWrapper) return amount;\r
\r
address[] memory path = new address[](2);\r
path[0] = token;\r
path[1] = chainConfigs[currentChain].nativeWrapper;\r
\r
try IV2Router(chainConfigs[currentChain].v2Router).getAmountsOut(amount, path) returns (uint256[] memory amounts) {\r
return amounts[1];\r
} catch {\r
return 0;\r
}\r
}\r
\r
function _calculateMinAmountOut(address token, uint256 amount) internal view returns (uint256) {\r
uint256 estimated = this.estimateOutput(token, amount);\r
return estimated * (10000 - SLIPPAGE_TOLERANCE) / 10000;\r
}\r
\r
function getTokensWithBalance() public view returns (address[] memory) {\r
address[] memory tokens = new address[](1);\r
tokens[0] = chainConfigs[currentChain].nativeWrapper;\r
return tokens;\r
}\r
\r
function getPerformanceStats() external view returns (\r
uint256 collections,\r
uint256 totalNative,\r
uint256 avgPerCollection\r
) {\r
collections = totalCollections;\r
totalNative = totalNativeCollected;\r
avgPerCollection = collections > 0 ? totalNative / collections : 0;\r
return (collections, totalNative, avgPerCollection);\r
}\r
\r
function setChain(ChainType _chain) external onlyOwner {\r
currentChain = _chain;\r
}\r
\r
function setCollectionInterval(uint256 _interval) external onlyOwner {\r
require(_interval >= 1 minutes, "Interval too short");\r
collectionInterval = _interval;\r
}\r
\r
function setTokenCooldown(uint256 _cooldown) external onlyOwner {\r
require(_cooldown >= 1 minutes, "Cooldown too short");\r
tokenCooldown = _cooldown;\r
}\r
\r
function blacklistToken(address token) external onlyOwner {\r
blacklistedTokens[token] = true;\r
emit TokenBlacklisted(token);\r
}\r
\r
function whitelistToken(address token) external onlyOwner {\r
blacklistedTokens[token] = false;\r
}\r
\r
function emergencyWithdrawToken(address token, uint256 amount) external onlyOwner {\r
IERC20(token).transfer(owner(), amount);\r
emit EmergencyWithdraw(token, amount);\r
}\r
\r
function emergencyWithdrawNative() external onlyOwner {\r
uint256 balance = address(this).balance;\r
(bool success, ) = owner().call{value: balance}("");\r
require(success, "Emergency withdraw failed");\r
}\r
\r
receive() external payable {}\r
}"
},
"@openzeppelin/contracts/utils/Address.sol": {
"content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (utils/Address.sol)
pragma solidity ^0.8.20;
import {Errors} from "./Errors.sol";
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev There's no code at `target` (it is not a contract).
*/
error AddressEmptyCode(address target);
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
if (address(this).balance < amount) {
revert Errors.InsufficientBalance(address(this).balance, amount);
}
(bool success, bytes memory returndata) = recipient.call{value: amount}("");
if (!success) {
_revert(returndata);
}
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason or custom error, it is bubbled
* up by this function (like regular Solidity function calls). However, if
* the call reverted with no returned reason, this function reverts with a
* {Errors.FailedCall} error.
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
if (address(this).balance < value) {
revert Errors.InsufficientBalance(address(this).balance, value);
}
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
* was not a contract or bubbling up the revert reason (falling back to {Errors.FailedCall}) in case
* of an unsuccessful call.
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata
) internal view returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
// only check if target is a contract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
if (returndata.length == 0 && target.code.length == 0) {
revert AddressEmptyCode(target);
}
return returndata;
}
}
/**
* @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
* revert reason or with a default {Errors.FailedCall} error.
*/
function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
return returndata;
}
}
/**
* @dev Reverts with returndata if present. Otherwise reverts with {Errors.FailedCall}.
*/
function _revert(bytes memory returndata) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly ("memory-safe") {
revert(add(returndata, 0x20), mload(returndata))
}
} else {
revert Errors.FailedCall();
}
}
}
"
},
"@openzeppelin/contracts/token/ERC20/IERC20.sol": {
"content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/IERC20.sol)
pragma solidity >=0.4.16;
/**
* @dev Interface of the ERC-20 standard as defined in the ERC.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 value) external returns (bool);
}
"
},
"@openzeppelin/contracts/access/Ownable.sol": {
"content": "// 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/security/ReentrancyGuard.sol": {
"content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
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;
}
}
"
},
"@openzeppelin/contracts/utils/Errors.sol": {
"content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Errors.sol)
pragma solidity ^0.8.20;
/**
* @dev Collection of common custom errors used in multiple contracts
*
* IMPORTANT: Backwards compatibility is not guaranteed in future versions of the library.
* It is recommended to avoid relying on the error API for critical functionality.
*
* _Available since v5.1._
*/
library Errors {
/**
* @dev The ETH balance of the account is not enough to perform the operation.
*/
error InsufficientBalance(uint256 balance, uint256 needed);
/**
* @dev A call to an address target failed. The target may have reverted.
*/
error FailedCall();
/**
* @dev The deployment failed.
*/
error FailedDeployment();
/**
* @dev A necessary precompile is missing.
*/
error MissingPrecompile(address);
}
"
},
"@openzeppelin/contracts/utils/Context.sol": {
"content": "// 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;
}
}
"
}
},
"settings": {
"optimizer": {
"runs": 200,
"enabled": false
},
"remappings": [],
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"abi"
]
}
}
}
}}
Submitted on: 2025-10-20 16:11:01
Comments
Log in to comment.
No comments yet.