Overview
S Balance
S Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 146 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Zap In Token | 16079712 | 1 hr ago | IN | 0 S | 0.01590616 | ||||
Zap In Token | 16066907 | 2 hrs ago | IN | 0 S | 0.01564836 | ||||
Zap In Token | 16055092 | 3 hrs ago | IN | 12 S | 0.02214146 | ||||
Zap In Token | 16044837 | 4 hrs ago | IN | 110 S | 0.01754269 | ||||
Zap In Token | 16043797 | 5 hrs ago | IN | 0 S | 0.01605448 | ||||
Zap In Token | 16042497 | 5 hrs ago | IN | 0 S | 0.01562146 | ||||
Zap In Token | 16012863 | 8 hrs ago | IN | 0 S | 0.01475534 | ||||
Zap Out To Token | 15983101 | 12 hrs ago | IN | 0 S | 0.01546705 | ||||
Zap In Token | 15977539 | 12 hrs ago | IN | 0 S | 0.01965799 | ||||
Zap In Token | 15953231 | 15 hrs ago | IN | 0 S | 0.0166118 | ||||
Zap Out To Token | 15921687 | 18 hrs ago | IN | 0 S | 0.01238312 | ||||
Zap In Token | 15911470 | 19 hrs ago | IN | 0 S | 0.01463922 | ||||
Zap In Token | 15911080 | 19 hrs ago | IN | 0 S | 0.01661252 | ||||
Zap In Token | 15908924 | 19 hrs ago | IN | 0 S | 0.01660813 | ||||
Zap In Token | 15899137 | 20 hrs ago | IN | 0 S | 0.01381616 | ||||
Zap In Token | 15898467 | 21 hrs ago | IN | 0 S | 0.01437005 | ||||
Zap In Token | 15892430 | 21 hrs ago | IN | 0 S | 0.01256137 | ||||
Zap In Token | 15889421 | 21 hrs ago | IN | 0 S | 0.01366837 | ||||
Zap In Token | 15882559 | 22 hrs ago | IN | 0 S | 0.01256077 | ||||
Zap In Token | 15881205 | 22 hrs ago | IN | 0 S | 0.01704362 | ||||
Zap In Token | 15856695 | 25 hrs ago | IN | 0 S | 0.01341577 | ||||
Zap In Token | 15835690 | 27 hrs ago | IN | 0 S | 0.01562355 | ||||
Zap In Token | 15827094 | 28 hrs ago | IN | 0 S | 0.01427092 | ||||
Zap In Token | 15818597 | 29 hrs ago | IN | 0 S | 0.01463922 | ||||
Zap In Token | 15796759 | 32 hrs ago | IN | 0 S | 0.01965733 |
Latest 25 internal transactions (View All)
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
16055092 | 3 hrs ago | 12 S | ||||
16044837 | 4 hrs ago | 110 S | ||||
15983101 | 12 hrs ago | 16.42865262 S | ||||
15983101 | 12 hrs ago | 16.42865262 S | ||||
15921687 | 18 hrs ago | 147.04204359 S | ||||
15921687 | 18 hrs ago | 147.04204359 S | ||||
15710745 | 42 hrs ago | 20 S | ||||
15703204 | 42 hrs ago | 13.21113933 S | ||||
15703204 | 42 hrs ago | 13.21113933 S | ||||
15648367 | 2 days ago | 185 S | ||||
15612225 | 2 days ago | 7,682.96051256 S | ||||
15612225 | 2 days ago | 7,682.96051256 S | ||||
15607007 | 2 days ago | 846.29031871 S | ||||
15607007 | 2 days ago | 846.29031871 S | ||||
15445457 | 2 days ago | 1.2768 S | ||||
15385838 | 3 days ago | 62.74470021 S | ||||
15383443 | 3 days ago | 87.83018973 S | ||||
15380715 | 3 days ago | 88.17503709 S | ||||
15378885 | 3 days ago | 88.15186893 S | ||||
15376538 | 3 days ago | 87.43192662 S | ||||
15373257 | 3 days ago | 88.51791665 S | ||||
15370887 | 3 days ago | 88.29714846 S | ||||
15356385 | 3 days ago | 20.7485 S | ||||
15349164 | 3 days ago | 77.28518441 S | ||||
15349164 | 3 days ago | 77.28518441 S |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
ZapperGSnake
Compiler Version
v0.8.26+commit.8a97fa7a
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; import "./interfaces/IWSONIC.sol"; import "./interfaces/IUniswapV2Pair.sol"; import "./interfaces/IShadowRouter.sol"; import "./lib/TransferHelper.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; /************************************************************************************************************************************************** #### ▄████████ ███▄▄▄▄ ▄████████ ▄█ ▄█▄ ▄████████ ▄████████ ▄█ ███▄▄▄▄ ▄████████ ███▄▄▄▄ ▄████████ ▄████████ #### ███ ███ ███▀▀▀██▄ ███ ███ ███ ▄███▀ ███ ███ ███ ███ ███ ███▀▀▀██▄ ███ ███ ███▀▀▀██▄ ███ ███ ███ ███ #### ███ █▀ ███ ███ ███ ███ ███▐██▀ ███ █▀ ███ █▀ ███▌ ███ ███ ███ ███ ███ ███ ███ █▀ ███ █▀ #### ███ ███ ███ ███ ███ ▄█████▀ ▄███▄▄▄ ▄███▄▄▄ ███▌ ███ ███ ███ ███ ███ ███ ███ ▄███▄▄▄ #### ▀███████████ ███ ███ ▀███████████ ▀▀█████▄ ▀▀███▀▀▀ ▀▀███▀▀▀ ███▌ ███ ███ ▀███████████ ███ ███ ███ ▀▀███▀▀▀ #### ███ ███ ███ ███ ███ ███▐██▄ ███ █▄ ███ ███ ███ ███ ███ ███ ███ ███ ███ █▄ ███ █▄ #### ▄█ ███ ███ ███ ███ ███ ███ ▀███▄ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ #### ▄████████▀ ▀█ █▀ ███ █▀ ███ ▀█▀ ██████████ ███ █▀ ▀█ █▀ ███ █▀ ▀█ █▀ ████████▀ ██████████ #### ▀ #### Website: https://snake.finance/ **************************************************************************************************************************************************/ contract ZapperGSnake is Ownable { using SafeMath for uint256; using SafeERC20 for IERC20; /* ========== STATE VARIABLES ========== */ address public constant SHADOW_ROUTER = 0x1D368773735ee1E678950B7A97bcA2CafB330CDc; address public constant WSONIC_TOKEN = 0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38; address public constant GSNAKE_TOKEN = 0x674a430f531847a6f8976A900f8ace765f896a1b; address public constant GSNAKE_LP_TOKEN = 0xb901D7316447C84f4417b8a8268E2822095051E6; struct LiquidityPair { address _token0; address _token1; uint256 _amountToken0; uint256 _amountToken1; uint256 _liqTokenAmt; } struct FunctionArgs { address _LP; address _in; address _out; address _recipient; address _routerAddr; address _token; uint256 _amount; uint256 _otherAmt; uint256 _swapAmt; } constructor() Ownable() {} /* ========== External Functions ========== */ // @_in - Token we want to throw in // @amount - amount of our _in // @minAmountOfLp - will be calculated on UI including slippage set by user function zapInToken(address _in, uint256 amount, address _recipient, uint256 minAmountOfLp) external payable { // From an ERC20 to an LP token, through specified router, going through base asset if necessary // 1. check if its authorized token require(_in == WSONIC_TOKEN || _in == GSNAKE_TOKEN || _in == address(0), "Only S, wS or GSnake tokens accepted"); // 2. transfer tokens from sender to this contract if (_in != address(0)) { IERC20(_in).safeTransferFrom(msg.sender, address(this), amount); } else { require(msg.value == amount, "Incorrect amount of S sent"); IWSONIC(WSONIC_TOKEN).deposit{value: amount}(); _in = WSONIC_TOKEN; } // 3. approve router to spend tokens _approveTokenIfNeeded(_in, SHADOW_ROUTER); // 4. swap part of _in for other token address other = (_in == WSONIC_TOKEN || _in == address(0)) ? GSNAKE_TOKEN : WSONIC_TOKEN; (uint256 amountOfTokenIn, uint256 amountToSwapForOtherToken, uint256 amountOtherForLiquidityEstimate) = getTokenAmountsForLiquidity(_in, amount); // 4.3 approve router to spend other token (done) _approveTokenIfNeeded(other, SHADOW_ROUTER); // 4.4 swap _in for other token uint256 otherAmount = _swap(_in, amountToSwapForOtherToken, other, address(this)); require(otherAmount >= amountOtherForLiquidityEstimate, "amount smaller than estimate"); // get quoteaddliquidity (uint256 amountInToAdd, uint256 amountOtherToAdd, ) = IShadowRouter(SHADOW_ROUTER).quoteAddLiquidity(_in, other, false, amountOfTokenIn, amountOtherForLiquidityEstimate); // require(liquidity >= minAmountOfLp, "lp amount too small"); address recipient = _recipient; // 5. add liquidity ( , , uint liquidity) = IShadowRouter(SHADOW_ROUTER).addLiquidity( _in, other, false, amountInToAdd, amountOtherToAdd, 0, // can be 0 because we already have a require for minAmountOfLp 0, // can be 0 because we already have a require for minAmountOfLp recipient, block.timestamp ); require(liquidity >= minAmountOfLp, "lp amount too small"); // 6. distribute dust retrieveDust(_in, recipient); retrieveDust(other, recipient); } // from an LP token to desired token // @in - LP we want to throw in // @amount - amount of our LP // @out - token we want to get function zapOutToToken(uint256 amount, address out, address recipient, uint256 minAmountToken) external { require(out == WSONIC_TOKEN || out == GSNAKE_TOKEN || out == address(0), "Only S, wS or GSnake tokens accepted"); FunctionArgs memory args; LiquidityPair memory pair; args._amount = amount; args._out = out == address(0) ? WSONIC_TOKEN : out; args._recipient = recipient; args._in = GSNAKE_LP_TOKEN; IERC20(args._in).safeTransferFrom(msg.sender, address(this), args._amount); _approveTokenIfNeeded(args._in, SHADOW_ROUTER); pair._token0 = IUniswapV2Pair(args._in).token0(); pair._token1 = IUniswapV2Pair(args._in).token1(); _approveTokenIfNeeded(pair._token0, SHADOW_ROUTER); _approveTokenIfNeeded(pair._token1, SHADOW_ROUTER); (pair._amountToken0, pair._amountToken1) = IShadowRouter(SHADOW_ROUTER).removeLiquidity(pair._token0, pair._token1, false, args._amount, 0, 0, address(this), block.timestamp); if (pair._token0 != args._out) { pair._amountToken0 = _swap(pair._token0, pair._amountToken0, args._out, address(this)); } if (pair._token1 != args._out) { pair._amountToken1 = _swap(pair._token1, pair._amountToken1, args._out, address(this)); } require (pair._amountToken0.add(pair._amountToken1) >= minAmountToken, "amt < minAmountToken"); if (out == address(0)) { IWSONIC(WSONIC_TOKEN).withdraw(pair._amountToken0.add(pair._amountToken1)); payable(recipient).transfer(pair._amountToken0.add(pair._amountToken1)); } else { IERC20(args._out).safeTransfer(args._recipient, pair._amountToken0.add(pair._amountToken1)); } } function _swap(address _from, uint amount, address _to, address recipient) private returns (uint) { IShadowRouter.route[] memory routes = new IShadowRouter.route[](1); routes[0] = IShadowRouter.route({ from: _from, to: _to, stable: false }); uint256 minAmountOut = _estimateSwap(_from, amount, _to); uint[] memory amounts = IShadowRouter(SHADOW_ROUTER).swapExactTokensForTokens( amount, minAmountOut, // Use calculated minimum amount instead of 0 routes, recipient, block.timestamp ); require(amounts[amounts.length-1] >= minAmountOut, "amount smaller than estimate"); return amounts[amounts.length - 1]; } // @_in - Token we want to throw in // @amount - amount of our _in // @out - address of LP we are going to get function estimateZapIn(address _in, uint256 amount) public view returns (uint256, uint256, uint256, uint256) { address other = (_in == WSONIC_TOKEN || _in == address(0)) ? GSNAKE_TOKEN : WSONIC_TOKEN; (uint256 amountOfTokenIn, uint256 amountToSwapForOtherToken, uint256 amountOtherForLiquidityEstimate) = getTokenAmountsForLiquidity(_in, amount); if (_in == IUniswapV2Pair(GSNAKE_LP_TOKEN).token0()) { (uint256 amountIn, uint256 amountOther, uint256 liquidity) = IShadowRouter(SHADOW_ROUTER).quoteAddLiquidity(_in, other, false, amountOfTokenIn, amountOtherForLiquidityEstimate); return (amountIn, amountOther, amountToSwapForOtherToken, liquidity); } else { (uint256 amountOther, uint256 amountIn, uint256 liquidity) = IShadowRouter(SHADOW_ROUTER).quoteAddLiquidity(other, _in, false, amountOtherForLiquidityEstimate, amountOfTokenIn); return (amountOther, amountIn, amountToSwapForOtherToken, liquidity); } } function getTokenAmountsForLiquidity(address _in, uint256 amount) public view returns(uint256, uint256, uint256) { uint256 amountOfTokenIn = amount.div(2); uint256 amountToSwapForOtherToken = amount.sub(amountOfTokenIn); uint256 amountOfOtherTokenForLiquidity = _estimateSwap(_in, amountToSwapForOtherToken, _in == WSONIC_TOKEN ? GSNAKE_TOKEN : WSONIC_TOKEN); return (amountOfTokenIn, amountToSwapForOtherToken, amountOfOtherTokenForLiquidity); } // @ _fromLP - LP we want to throw in // @ _to - token we want to get out of our LP // @ minAmountToken0, minAmountToken1 - coming from UI (min amount of tokens coming from breaking our LP) function estimateZapOut(address _out, uint256 _amount) public view returns (uint256) { address token0 = IUniswapV2Pair(GSNAKE_LP_TOKEN).token0(); address token1 = IUniswapV2Pair(GSNAKE_LP_TOKEN).token1(); (uint256 _amountToken0, uint256 _amountToken1) = IShadowRouter(SHADOW_ROUTER).quoteRemoveLiquidity(token0, token1, false, _amount); if(token0 == _out) { // if sonic, need to swap token1 return _estimateSwap(token1, _amountToken1, _out).add(_amountToken0); } else { return _estimateSwap(token0, _amountToken0, _out).add(_amountToken1); } } // @_in - token we want to throw in // @amount - amount of our _in // @out - token we want to get out function _estimateSwap(address _in, uint256 amount, address out) public view returns (uint256) { IShadowRouter router = IShadowRouter(SHADOW_ROUTER); IShadowRouter.route[] memory routes = new IShadowRouter.route[](1); routes[0] = IShadowRouter.route({ from: _in, to: out, stable: false }); uint256[] memory amounts = router.getAmountsOut(amount, routes); return amounts[amounts.length - 1]; } /* ========== Private Functions ========== */ function _approveTokenIfNeeded(address token, address router) private { if (IERC20(token).allowance(address(this), router) == 0) { IERC20(token).safeApprove(router, type(uint256).max); } } function retrieveDust(address token, address recipient) private { if (token == address(0)) { payable(recipient).transfer(address(this).balance); return; } IERC20(token).transfer(recipient, IERC20(token).balanceOf(address(this))); } /* ========== RESTRICTED FUNCTIONS ========== */ function withdraw(address token) external onlyOwner { if (token == address(0)) { payable(owner()).transfer(address(this).balance); return; } IERC20(token).transfer(owner(), IERC20(token).balanceOf(address(this))); } // add receive function receive() external payable {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../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. * * By default, the owner account will be the one that deploys the contract. 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; 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. 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 { 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); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. * * CAUTION: See Security Considerations above. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @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 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`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ 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}. 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 `amount` 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 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. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 amount) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value)); } /** * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value)); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, approvalCall); } } /** * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. * Revert on invalid signature. */ function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @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.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ 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"); } /** * @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, it is bubbled up by this * function (like regular Solidity function calls). * * 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. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @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`. * * _Available since v3.1._ */ 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"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ 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); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ 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); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ 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); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ 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 { // 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 /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol) pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.26; interface IShadowRouter { error EXPIRED(); error IDENTICAL(); error ZERO_ADDRESS(); error INSUFFICIENT_AMOUNT(); error INSUFFICIENT_LIQUIDITY(); error INSUFFICIENT_OUTPUT_AMOUNT(); error INVALID_PATH(); error INSUFFICIENT_B_AMOUNT(); error INSUFFICIENT_A_AMOUNT(); error EXCESSIVE_INPUT_AMOUNT(); error ETH_TRANSFER_FAILED(); error INVALID_RESERVES(); struct route { /// @dev token from address from; /// @dev token to address to; /// @dev is stable route bool stable; } /// @notice sorts the tokens to see what the expected LP output would be for token0 and token1 (A/B) /// @param tokenA the address of tokenA /// @param tokenB the address of tokenB /// @return token0 address of which becomes token0 /// @return token1 address of which becomes token1 function sortTokens( address tokenA, address tokenB ) external pure returns (address token0, address token1); /// @notice calculates the CREATE2 address for a pair without making any external calls /// @param tokenA the address of tokenA /// @param tokenB the address of tokenB /// @param stable if the pair is using the stable curve /// @return pair address of the pair function pairFor( address tokenA, address tokenB, bool stable ) external view returns (address pair); /// @notice fetches and sorts the reserves for a pair /// @param tokenA the address of tokenA /// @param tokenB the address of tokenB /// @param stable if the pair is using the stable curve /// @return reserveA get the reserves for tokenA /// @return reserveB get the reserves for tokenB function getReserves( address tokenA, address tokenB, bool stable ) external view returns (uint256 reserveA, uint256 reserveB); /// @notice performs chained getAmountOut calculations on any number of pairs /// @param amountIn the amount of tokens of routes[0] to swap /// @param routes the struct of the hops the swap should take /// @return amounts uint array of the amounts out function getAmountsOut( uint256 amountIn, route[] memory routes ) external view returns (uint256[] memory amounts); /// @notice performs chained getAmountOut calculations on any number of pairs /// @param amountIn amount of tokenIn /// @param tokenIn address of the token going in /// @param tokenOut address of the token coming out /// @return amount uint amount out /// @return stable if the curve used is stable or not function getAmountOut( uint256 amountIn, address tokenIn, address tokenOut ) external view returns (uint256 amount, bool stable); /// @notice performs calculations to determine the expected state when adding liquidity /// @param tokenA the address of tokenA /// @param tokenB the address of tokenB /// @param stable if the pair is using the stable curve /// @param amountADesired amount of tokenA desired to be added /// @param amountBDesired amount of tokenB desired to be added /// @return amountA amount of tokenA added /// @return amountB amount of tokenB added /// @return liquidity liquidity value added function quoteAddLiquidity( address tokenA, address tokenB, bool stable, uint256 amountADesired, uint256 amountBDesired ) external view returns (uint256 amountA, uint256 amountB, uint256 liquidity); /// @param tokenA the address of tokenA /// @param tokenB the address of tokenB /// @param stable if the pair is using the stable curve /// @param liquidity liquidity value to remove /// @return amountA amount of tokenA removed /// @return amountB amount of tokenB removed function quoteRemoveLiquidity( address tokenA, address tokenB, bool stable, uint256 liquidity ) external view returns (uint256 amountA, uint256 amountB); /// @param tokenA the address of tokenA /// @param tokenB the address of tokenB /// @param stable if the pair is using the stable curve /// @param amountADesired amount of tokenA desired to be added /// @param amountBDesired amount of tokenB desired to be added /// @param amountAMin slippage for tokenA calculated from this param /// @param amountBMin slippage for tokenB calculated from this param /// @param to the address the liquidity tokens should be minted to /// @param deadline timestamp deadline /// @return amountA amount of tokenA used /// @return amountB amount of tokenB used /// @return liquidity amount of liquidity minted function addLiquidity( address tokenA, address tokenB, bool stable, uint256 amountADesired, uint256 amountBDesired, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns (uint256 amountA, uint256 amountB, uint256 liquidity); /// @param token the address of token /// @param stable if the pair is using the stable curve /// @param amountTokenDesired desired amount for token /// @param amountTokenMin slippage for token /// @param amountETHMin minimum amount of ETH added (slippage) /// @param to the address the liquidity tokens should be minted to /// @param deadline timestamp deadline /// @return amountToken amount of the token used /// @return amountETH amount of ETH used /// @return liquidity amount of liquidity minted function addLiquidityETH( address token, bool stable, uint256 amountTokenDesired, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external payable returns (uint256 amountToken, uint256 amountETH, uint256 liquidity); /// @param tokenA the address of tokenA /// @param tokenB the address of tokenB /// @param stable if the pair is using the stable curve /// @param amountADesired amount of tokenA desired to be added /// @param amountBDesired amount of tokenB desired to be added /// @param amountAMin slippage for tokenA calculated from this param /// @param amountBMin slippage for tokenB calculated from this param /// @param to the address the liquidity tokens should be minted to /// @param deadline timestamp deadline /// @return amountA amount of tokenA used /// @return amountB amount of tokenB used /// @return liquidity amount of liquidity minted function addLiquidityAndStake( address tokenA, address tokenB, bool stable, uint256 amountADesired, uint256 amountBDesired, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns (uint256 amountA, uint256 amountB, uint256 liquidity); /// @notice adds liquidity to a legacy pair using ETH, and stakes it into a gauge on "to's" behalf /// @param token the address of token /// @param stable if the pair is using the stable curve /// @param amountTokenDesired amount of token to be used /// @param amountTokenMin slippage of token /// @param amountETHMin slippage of ETH /// @param to the address the liquidity tokens should be minted to /// @param deadline timestamp deadline /// @return amountA amount of tokenA used /// @return amountB amount of tokenB used /// @return liquidity amount of liquidity minted function addLiquidityETHAndStake( address token, bool stable, uint256 amountTokenDesired, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external payable returns (uint256 amountA, uint256 amountB, uint256 liquidity); /// @param tokenA the address of tokenA /// @param tokenB the address of tokenB /// @param stable if the pair is using the stable curve /// @param liquidity amount of LP tokens to remove /// @param amountAMin slippage of tokenA /// @param amountBMin slippage of tokenB /// @param to the address the liquidity tokens should be minted to /// @param deadline timestamp deadline /// @return amountA amount of tokenA used /// @return amountB amount of tokenB used function removeLiquidity( address tokenA, address tokenB, bool stable, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns (uint256 amountA, uint256 amountB); /// @param token address of the token /// @param stable if the pair is using the stable curve /// @param liquidity liquidity tokens to remove /// @param amountTokenMin slippage of token /// @param amountETHMin slippage of ETH /// @param to the address the liquidity tokens should be minted to /// @param deadline timestamp deadline /// @return amountToken amount of token used /// @return amountETH amount of ETH used function removeLiquidityETH( address token, bool stable, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external returns (uint256 amountToken, uint256 amountETH); /// @param amountIn amount to send ideally /// @param amountOutMin slippage of amount out /// @param routes the hops the swap should take /// @param to the address the liquidity tokens should be minted to /// @param deadline timestamp deadline /// @return amounts amounts returned function swapExactTokensForTokens( uint256 amountIn, uint256 amountOutMin, route[] calldata routes, address to, uint256 deadline ) external returns (uint256[] memory amounts); /// @param routes the hops the swap should take /// @param to the address the liquidity tokens should be minted to /// @param deadline timestamp deadline /// @return amounts amounts returned function swapTokensForExactTokens( uint amountOut, uint amountInMax, route[] memory routes, address to, uint deadline ) external returns (uint256[] memory amounts); /// @param amountOutMin slippage of token /// @param routes the hops the swap should take /// @param to the address the liquidity tokens should be minted to /// @param deadline timestamp deadline /// @return amounts amounts returned function swapExactETHForTokens( uint256 amountOutMin, route[] calldata routes, address to, uint256 deadline ) external payable returns (uint256[] memory amounts); /// @param amountOut amount of tokens to get out /// @param amountInMax max amount of tokens to put in to achieve amountOut (slippage) /// @param routes the hops the swap should take /// @param to the address the liquidity tokens should be minted to /// @param deadline timestamp deadline /// @return amounts amounts returned function swapTokensForExactETH( uint amountOut, uint amountInMax, route[] calldata routes, address to, uint deadline ) external returns (uint256[] memory amounts); /// @param amountIn amount of tokens to swap /// @param amountOutMin slippage of token /// @param routes the hops the swap should take /// @param to the address the liquidity tokens should be minted to /// @param deadline timestamp deadline /// @return amounts amounts returned function swapExactTokensForETH( uint256 amountIn, uint256 amountOutMin, route[] calldata routes, address to, uint256 deadline ) external returns (uint256[] memory amounts); /// @param amountOut exact amount out or revert /// @param routes the hops the swap should take /// @param to the address the liquidity tokens should be minted to /// @param deadline timestamp deadline /// @return amounts amounts returned function swapETHForExactTokens( uint amountOut, route[] calldata routes, address to, uint deadline ) external payable returns (uint256[] memory amounts); /// @param amountIn token amount to swap /// @param amountOutMin slippage of token /// @param routes the hops the swap should take /// @param to the address the liquidity tokens should be minted to /// @param deadline timestamp deadline function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, route[] calldata routes, address to, uint256 deadline ) external; /// @param amountOutMin slippage of token /// @param routes the hops the swap should take /// @param to the address the liquidity tokens should be minted to /// @param deadline timestamp deadline function swapExactETHForTokensSupportingFeeOnTransferTokens( uint256 amountOutMin, route[] calldata routes, address to, uint256 deadline ) external payable; /// @param amountIn token amount to swap /// @param amountOutMin slippage of token /// @param routes the hops the swap should take /// @param to the address the liquidity tokens should be minted to /// @param deadline timestamp deadline function swapExactTokensForETHSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, route[] calldata routes, address to, uint256 deadline ) external; /// @notice **** REMOVE LIQUIDITY (supporting fee-on-transfer tokens)**** /// @param token address of the token /// @param stable if the swap curve is stable /// @param liquidity liquidity value (lp tokens) /// @param amountTokenMin slippage of token /// @param amountETHMin slippage of ETH /// @param to address to send to /// @param deadline timestamp deadline /// @return amountToken amount of token received /// @return amountETH amount of ETH received function removeLiquidityETHSupportingFeeOnTransferTokens( address token, bool stable, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external returns (uint256 amountToken, uint256 amountETH); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint256 value); event Transfer(address indexed from, address indexed to, uint256 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 (uint256); function balanceOf(address owner) external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 value) external returns (bool); function transfer(address to, uint256 value) external returns (bool); function transferFrom( address from, address to, uint256 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 (uint256); function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; event Mint(address indexed sender, uint256 amount0, uint256 amount1); event Burn(address indexed sender, uint256 amount0, uint256 amount1, address indexed to); event Swap(address indexed sender, uint256 amount0In, uint256 amount1In, uint256 amount0Out, uint256 amount1Out, address indexed to); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint256); 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 (uint256); function price1CumulativeLast() external view returns (uint256); function kLast() external view returns (uint256); function mint(address to) external returns (uint256 liquidity); function burn(address to) external returns (uint256 amount0, uint256 amount1); function swap( uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data ) external; function skim(address to) external; function sync() external; function initialize(address, address) external; }
pragma solidity >=0.5.0; interface IWSONIC { function deposit() external payable; function transfer(address to, uint value) external returns (bool); function withdraw(uint) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; library TransferHelper { function safeApprove(address token, address to, uint value) internal { // bytes4(keccak256(bytes('approve(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: APPROVE_FAILED'); } function safeTransfer(address token, address to, uint value) internal { // bytes4(keccak256(bytes('transfer(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FAILED'); } function safeTransferFrom(address token, address from, address to, uint value) internal { // bytes4(keccak256(bytes('transferFrom(address,address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM_FAILED'); } function safeTransferETH(address to, uint value) internal { (bool success,) = to.call{value:value}(new bytes(0)); require(success, 'TransferHelper: ETH_TRANSFER_FAILED'); } }
{ "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"GSNAKE_LP_TOKEN","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GSNAKE_TOKEN","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SHADOW_ROUTER","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WSONIC_TOKEN","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_in","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"out","type":"address"}],"name":"_estimateSwap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_in","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"estimateZapIn","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_out","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"estimateZapOut","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_in","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"getTokenAmountsForLiquidity","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_in","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"uint256","name":"minAmountOfLp","type":"uint256"}],"name":"zapInToken","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"out","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"minAmountToken","type":"uint256"}],"name":"zapOutToToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
6080604052348015600f57600080fd5b50601733601b565b606b565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6121208061007a6000396000f3fe6080604052600436106100e15760003560e01c80637c7526341161007f5780639c0c98ba116100595780639c0c98ba14610267578063a8df5eb4146102a7578063d23af68a146102cf578063f2fde38b146102ef57600080fd5b80637c7526341461020e57806387e3f21c146102365780638da5cb5b1461024957600080fd5b8063531d90a9116100bb578063531d90a9146101895780635b7ff11e146101b75780636814ebc5146101d9578063715018a6146101f957600080fd5b806303879bf5146100ed578063367497da1461012d57806351cff8d91461016757600080fd5b366100e857005b600080fd5b3480156100f957600080fd5b5061010d610108366004611bfc565b61030f565b604080519384526020840192909252908201526060015b60405180910390f35b34801561013957600080fd5b5061014f6000805160206120ab83398151915281565b6040516001600160a01b039091168152602001610124565b34801561017357600080fd5b50610187610182366004611c28565b610391565b005b34801561019557600080fd5b506101a96101a4366004611c45565b6104e0565b604051908152602001610124565b3480156101c357600080fd5b5061014f6000805160206120cb83398151915281565b3480156101e557600080fd5b506101876101f4366004611c87565b610630565b34801561020557600080fd5b50610187610b76565b34801561021a57600080fd5b5061014f73b901d7316447c84f4417b8a8268e2822095051e681565b610187610244366004611ccf565b610b8a565b34801561025557600080fd5b506000546001600160a01b031661014f565b34801561027357600080fd5b50610287610282366004611bfc565b610f94565b604080519485526020850193909352918301526060820152608001610124565b3480156102b357600080fd5b5061014f73674a430f531847a6f8976a900f8ace765f896a1b81565b3480156102db57600080fd5b506101a96102ea366004611bfc565b61118a565b3480156102fb57600080fd5b5061018761030a366004611c28565b611361565b600080808061031f8560026113d7565b9050600061032d86836113ea565b9050600061038288836001600160a01b0382166000805160206120ab83398151915214610368576000805160206120ab8339815191526104e0565b73674a430f531847a6f8976a900f8ace765f896a1b6104e0565b92989197509195509350505050565b6103996113f6565b6001600160a01b0381166103e557600080546040516001600160a01b03909116914780156108fc02929091818181858888f193505050501580156103e1573d6000803e3d6000fd5b5050565b806001600160a01b031663a9059cbb6104066000546001600160a01b031690565b6040516370a0823160e01b81523060048201526001600160a01b038516906370a0823190602401602060405180830381865afa15801561044a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061046e9190611d07565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af11580156104b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103e19190611d20565b50565b6040805160018082528183019092526000916000805160206120cb833981519152918391816020015b60408051606081018252600080825260208083018290529282015282526000199092019101816105095790505090506040518060600160405280876001600160a01b03168152602001856001600160a01b03168152602001600015158152508160008151811061057b5761057b611d58565b60200260200101819052506000826001600160a01b0316639881fcb487846040518363ffffffff1660e01b81526004016105b6929190611dd3565b600060405180830381865afa1580156105d3573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526105fb9190810190611dec565b9050806001825161060c9190611ecf565b8151811061061c5761061c611d58565b602002602001015193505050509392505050565b6001600160a01b0383166000805160206120ab833981519152148061067157506001600160a01b03831673674a430f531847a6f8976a900f8ace765f896a1b145b8061068357506001600160a01b038316155b6106a85760405162461bcd60e51b815260040161069f90611ee2565b60405180910390fd5b6040805161012081018252600080825260208083018290528284018290526060808401839052608080850184905260a080860185905260c0860185905260e086018590526101008601859052865190810187528481529283018490529482018390528101829052928301529060c082018690526001600160a01b038516156107305784610740565b6000805160206120ab8339815191525b6001600160a01b0390811660408401528416606083015273b901d7316447c84f4417b8a8268e2822095051e66020830181905260c0830151610786919033903090611450565b6107a282602001516000805160206120cb8339815191526114c1565b81602001516001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108089190611f26565b6001600160a01b0390811682526020808401516040805163d21220a760e01b81529051919093169263d21220a79260048083019391928290030181865afa158015610857573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061087b9190611f26565b6001600160a01b0316602082015280516108a3906000805160206120cb8339815191526114c1565b6108bf81602001516000805160206120cb8339815191526114c1565b8051602082015160c084015160405163037b79b160e21b81526001600160a01b03938416600482015292909116602483015260006044830181905260648301919091526084820181905260a48201523060c48201524260e48201526000805160206120cb83398151915290630dede6c4906101040160408051808303816000875af1158015610952573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109769190611f43565b606083015260408083019190915282015181516001600160a01b039081169116146109b9576109b38160000151826040015184604001513061154e565b60408201525b81604001516001600160a01b031681602001516001600160a01b0316146109f8576109f28160200151826060015184604001513061154e565b60608201525b82610a148260600151836040015161172590919063ffffffff16565b1015610a595760405162461bcd60e51b815260206004820152601460248201527330b6ba101e1036b4b720b6b7bab73a2a37b5b2b760611b604482015260640161069f565b6001600160a01b038516610b3657606081015160408201516000805160206120ab83398151915291632e1a7d4d91610a9091611725565b6040518263ffffffff1660e01b8152600401610aae91815260200190565b600060405180830381600087803b158015610ac857600080fd5b505af1158015610adc573d6000803e3d6000fd5b50505050836001600160a01b03166108fc610b088360600151846040015161172590919063ffffffff16565b6040518115909202916000818181858888f19350505050158015610b30573d6000803e3d6000fd5b50610b6e565b610b6e8260600151610b598360600151846040015161172590919063ffffffff16565b60408501516001600160a01b03169190611731565b505050505050565b610b7e6113f6565b610b886000611766565b565b6001600160a01b0384166000805160206120ab8339815191521480610bcb57506001600160a01b03841673674a430f531847a6f8976a900f8ace765f896a1b145b80610bdd57506001600160a01b038416155b610bf95760405162461bcd60e51b815260040161069f90611ee2565b6001600160a01b03841615610c2257610c1d6001600160a01b038516333086611450565b610ce5565b823414610c715760405162461bcd60e51b815260206004820152601a60248201527f496e636f727265637420616d6f756e74206f6620532073656e74000000000000604482015260640161069f565b6000805160206120ab8339815191526001600160a01b031663d0e30db0846040518263ffffffff1660e01b81526004016000604051808303818588803b158015610cba57600080fd5b505af1158015610cce573d6000803e3d6000fd5b50505050506000805160206120ab83398151915293505b610cfd846000805160206120cb8339815191526114c1565b60006001600160a01b0385166000805160206120ab8339815191521480610d2b57506001600160a01b038516155b610d43576000805160206120ab833981519152610d59565b73674a430f531847a6f8976a900f8ace765f896a1b5b90506000806000610d6a888861030f565b925092509250610d88846000805160206120cb8339815191526114c1565b6000610d968984873061154e565b905081811015610de85760405162461bcd60e51b815260206004820152601c60248201527f616d6f756e7420736d616c6c6572207468616e20657374696d61746500000000604482015260640161069f565b6040516326283ecf60e21b815260009081906000805160206120cb833981519152906398a0fb3c90610e26908e908b9086908c908b90600401611f67565b606060405180830381865afa158015610e43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e679190611f98565b50604051635a47ddc360e01b81526001600160a01b038e811660048301528a81166024830152600060448301819052606483018590526084830184905260a4830181905260c48301819052908d1660e4830152426101048301529294509092508a91906000805160206120cb83398151915290635a47ddc390610124016060604051808303816000875af1158015610f03573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f279190611f98565b9250505089811015610f715760405162461bcd60e51b81526020600482015260136024820152721b1c08185b5bdd5b9d081d1bdbc81cdb585b1b606a1b604482015260640161069f565b610f7b8d836117b6565b610f8589836117b6565b50505050505050505050505050565b6000808080806001600160a01b0387166000805160206120ab8339815191521480610fc657506001600160a01b038716155b610fde576000805160206120ab833981519152610ff4565b73674a430f531847a6f8976a900f8ace765f896a1b5b905060008060006110058a8a61030f565b92509250925073b901d7316447c84f4417b8a8268e2822095051e66001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa15801561105d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110819190611f26565b6001600160a01b03168a6001600160a01b0316036111395760008060006000805160206120cb8339815191526001600160a01b03166398a0fb3c8e8960008a896040518663ffffffff1660e01b81526004016110e1959493929190611f67565b606060405180830381865afa1580156110fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111229190611f98565b919c509a5094985093965061118195505050505050565b60008060006000805160206120cb8339815191526001600160a01b03166398a0fb3c888f6000888b6040518663ffffffff1660e01b81526004016110e1959493929190611f67565b92959194509250565b60008073b901d7316447c84f4417b8a8268e2822095051e66001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa1580156111df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112039190611f26565b9050600073b901d7316447c84f4417b8a8268e2822095051e66001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015611259573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061127d9190611f26565b6040516310e1b98f60e21b81526001600160a01b038085166004830152821660248201526000604482018190526064820187905291925081906000805160206120cb83398151915290634386e63c906084016040805180830381865afa1580156112eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061130f9190611f43565b91509150866001600160a01b0316846001600160a01b03160361134c576113418261133b85848b6104e0565b90611725565b94505050505061135b565b6113418161133b86858b6104e0565b92915050565b6113696113f6565b6001600160a01b0381166113ce5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161069f565b6104dd81611766565b60006113e38284611fc6565b9392505050565b60006113e38284611ecf565b6000546001600160a01b03163314610b885760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161069f565b6040516001600160a01b03808516602483015283166044820152606481018290526114bb9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526118da565b50505050565b604051636eb1769f60e11b81523060048201526001600160a01b03828116602483015283169063dd62ed3e90604401602060405180830381865afa15801561150d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115319190611d07565b6000036103e1576103e16001600160a01b038316826000196119af565b604080516001808252818301909252600091829190816020015b60408051606081018252600080825260208083018290529282015282526000199092019101816115685790505090506040518060600160405280876001600160a01b03168152602001856001600160a01b0316815260200160001515815250816000815181106115da576115da611d58565b602002602001018190525060006115f28787876104e0565b604051631e82ecdb60e31b81529091506000906000805160206120cb8339815191529063f41766d890611631908a90869088908b904290600401611fe8565b6000604051808303816000875af1158015611650573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526116789190810190611dec565b905081816001835161168a9190611ecf565b8151811061169a5761169a611d58565b602002602001015110156116f05760405162461bcd60e51b815260206004820152601c60248201527f616d6f756e7420736d616c6c6572207468616e20657374696d61746500000000604482015260640161069f565b80600182516116ff9190611ecf565b8151811061170f5761170f611d58565b602002602001015193505050505b949350505050565b60006113e38284612024565b6040516001600160a01b03831660248201526044810182905261176190849063a9059cbb60e01b90606401611484565b505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0382166117f9576040516001600160a01b038216904780156108fc02916000818181858888f19350505050158015611761573d6000803e3d6000fd5b6040516370a0823160e01b81523060048201526001600160a01b0383169063a9059cbb90839083906370a0823190602401602060405180830381865afa158015611847573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061186b9190611d07565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af11580156118b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117619190611d20565b600061192f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611ac49092919063ffffffff16565b90508051600014806119505750808060200190518101906119509190611d20565b6117615760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161069f565b801580611a295750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015611a03573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a279190611d07565b155b611a945760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b606482015260840161069f565b6040516001600160a01b03831660248201526044810182905261176190849063095ea7b360e01b90606401611484565b606061171d848460008585600080866001600160a01b03168587604051611aeb919061205b565b60006040518083038185875af1925050503d8060008114611b28576040519150601f19603f3d011682016040523d82523d6000602084013e611b2d565b606091505b5091509150611b3e87838387611b49565b979650505050505050565b60608315611bb8578251600003611bb1576001600160a01b0385163b611bb15760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161069f565b508161171d565b61171d8383815115611bcd5781518083602001fd5b8060405162461bcd60e51b815260040161069f9190612077565b6001600160a01b03811681146104dd57600080fd5b60008060408385031215611c0f57600080fd5b8235611c1a81611be7565b946020939093013593505050565b600060208284031215611c3a57600080fd5b81356113e381611be7565b600080600060608486031215611c5a57600080fd5b8335611c6581611be7565b9250602084013591506040840135611c7c81611be7565b809150509250925092565b60008060008060808587031215611c9d57600080fd5b843593506020850135611caf81611be7565b92506040850135611cbf81611be7565b9396929550929360600135925050565b60008060008060808587031215611ce557600080fd5b8435611cf081611be7565b9350602085013592506040850135611cbf81611be7565b600060208284031215611d1957600080fd5b5051919050565b600060208284031215611d3257600080fd5b815180151581146113e357600080fd5b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600081518084526020840193506020830160005b82811015611dc957815180516001600160a01b0390811688526020808301519091168189015260409182015115159188019190915260609096019590910190600101611d82565b5093949350505050565b82815260406020820152600061171d6040830184611d6e565b600060208284031215611dfe57600080fd5b815167ffffffffffffffff811115611e1557600080fd5b8201601f81018413611e2657600080fd5b805167ffffffffffffffff811115611e4057611e40611d42565b8060051b604051601f19603f830116810181811067ffffffffffffffff82111715611e6d57611e6d611d42565b604052918252602081840181019290810187841115611e8b57600080fd5b6020850194505b83851015611eae57845180825260209586019590935001611e92565b509695505050505050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561135b5761135b611eb9565b60208082526024908201527f4f6e6c7920532c207753206f722047536e616b6520746f6b656e7320616363656040820152631c1d195960e21b606082015260800190565b600060208284031215611f3857600080fd5b81516113e381611be7565b60008060408385031215611f5657600080fd5b505080516020909101519092909150565b6001600160a01b03958616815293909416602084015290151560408301526060820152608081019190915260a00190565b600080600060608486031215611fad57600080fd5b5050815160208301516040909301519094929350919050565b600082611fe357634e487b7160e01b600052601260045260246000fd5b500490565b85815284602082015260a06040820152600061200760a0830186611d6e565b6001600160a01b0394909416606083015250608001529392505050565b8082018082111561135b5761135b611eb9565b60005b8381101561205257818101518382015260200161203a565b50506000910152565b6000825161206d818460208701612037565b9190910192915050565b6020815260008251806020840152612096816040850160208701612037565b601f01601f1916919091016040019291505056fe000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad380000000000000000000000001d368773735ee1e678950b7a97bca2cafb330cdca26469706673582212206f5361c369ce7781d69860bdbe6262e9a2b1fc6e3e9c5b391b2292358841e06964736f6c634300081a0033
Deployed Bytecode
0x6080604052600436106100e15760003560e01c80637c7526341161007f5780639c0c98ba116100595780639c0c98ba14610267578063a8df5eb4146102a7578063d23af68a146102cf578063f2fde38b146102ef57600080fd5b80637c7526341461020e57806387e3f21c146102365780638da5cb5b1461024957600080fd5b8063531d90a9116100bb578063531d90a9146101895780635b7ff11e146101b75780636814ebc5146101d9578063715018a6146101f957600080fd5b806303879bf5146100ed578063367497da1461012d57806351cff8d91461016757600080fd5b366100e857005b600080fd5b3480156100f957600080fd5b5061010d610108366004611bfc565b61030f565b604080519384526020840192909252908201526060015b60405180910390f35b34801561013957600080fd5b5061014f6000805160206120ab83398151915281565b6040516001600160a01b039091168152602001610124565b34801561017357600080fd5b50610187610182366004611c28565b610391565b005b34801561019557600080fd5b506101a96101a4366004611c45565b6104e0565b604051908152602001610124565b3480156101c357600080fd5b5061014f6000805160206120cb83398151915281565b3480156101e557600080fd5b506101876101f4366004611c87565b610630565b34801561020557600080fd5b50610187610b76565b34801561021a57600080fd5b5061014f73b901d7316447c84f4417b8a8268e2822095051e681565b610187610244366004611ccf565b610b8a565b34801561025557600080fd5b506000546001600160a01b031661014f565b34801561027357600080fd5b50610287610282366004611bfc565b610f94565b604080519485526020850193909352918301526060820152608001610124565b3480156102b357600080fd5b5061014f73674a430f531847a6f8976a900f8ace765f896a1b81565b3480156102db57600080fd5b506101a96102ea366004611bfc565b61118a565b3480156102fb57600080fd5b5061018761030a366004611c28565b611361565b600080808061031f8560026113d7565b9050600061032d86836113ea565b9050600061038288836001600160a01b0382166000805160206120ab83398151915214610368576000805160206120ab8339815191526104e0565b73674a430f531847a6f8976a900f8ace765f896a1b6104e0565b92989197509195509350505050565b6103996113f6565b6001600160a01b0381166103e557600080546040516001600160a01b03909116914780156108fc02929091818181858888f193505050501580156103e1573d6000803e3d6000fd5b5050565b806001600160a01b031663a9059cbb6104066000546001600160a01b031690565b6040516370a0823160e01b81523060048201526001600160a01b038516906370a0823190602401602060405180830381865afa15801561044a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061046e9190611d07565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af11580156104b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103e19190611d20565b50565b6040805160018082528183019092526000916000805160206120cb833981519152918391816020015b60408051606081018252600080825260208083018290529282015282526000199092019101816105095790505090506040518060600160405280876001600160a01b03168152602001856001600160a01b03168152602001600015158152508160008151811061057b5761057b611d58565b60200260200101819052506000826001600160a01b0316639881fcb487846040518363ffffffff1660e01b81526004016105b6929190611dd3565b600060405180830381865afa1580156105d3573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526105fb9190810190611dec565b9050806001825161060c9190611ecf565b8151811061061c5761061c611d58565b602002602001015193505050509392505050565b6001600160a01b0383166000805160206120ab833981519152148061067157506001600160a01b03831673674a430f531847a6f8976a900f8ace765f896a1b145b8061068357506001600160a01b038316155b6106a85760405162461bcd60e51b815260040161069f90611ee2565b60405180910390fd5b6040805161012081018252600080825260208083018290528284018290526060808401839052608080850184905260a080860185905260c0860185905260e086018590526101008601859052865190810187528481529283018490529482018390528101829052928301529060c082018690526001600160a01b038516156107305784610740565b6000805160206120ab8339815191525b6001600160a01b0390811660408401528416606083015273b901d7316447c84f4417b8a8268e2822095051e66020830181905260c0830151610786919033903090611450565b6107a282602001516000805160206120cb8339815191526114c1565b81602001516001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108089190611f26565b6001600160a01b0390811682526020808401516040805163d21220a760e01b81529051919093169263d21220a79260048083019391928290030181865afa158015610857573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061087b9190611f26565b6001600160a01b0316602082015280516108a3906000805160206120cb8339815191526114c1565b6108bf81602001516000805160206120cb8339815191526114c1565b8051602082015160c084015160405163037b79b160e21b81526001600160a01b03938416600482015292909116602483015260006044830181905260648301919091526084820181905260a48201523060c48201524260e48201526000805160206120cb83398151915290630dede6c4906101040160408051808303816000875af1158015610952573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109769190611f43565b606083015260408083019190915282015181516001600160a01b039081169116146109b9576109b38160000151826040015184604001513061154e565b60408201525b81604001516001600160a01b031681602001516001600160a01b0316146109f8576109f28160200151826060015184604001513061154e565b60608201525b82610a148260600151836040015161172590919063ffffffff16565b1015610a595760405162461bcd60e51b815260206004820152601460248201527330b6ba101e1036b4b720b6b7bab73a2a37b5b2b760611b604482015260640161069f565b6001600160a01b038516610b3657606081015160408201516000805160206120ab83398151915291632e1a7d4d91610a9091611725565b6040518263ffffffff1660e01b8152600401610aae91815260200190565b600060405180830381600087803b158015610ac857600080fd5b505af1158015610adc573d6000803e3d6000fd5b50505050836001600160a01b03166108fc610b088360600151846040015161172590919063ffffffff16565b6040518115909202916000818181858888f19350505050158015610b30573d6000803e3d6000fd5b50610b6e565b610b6e8260600151610b598360600151846040015161172590919063ffffffff16565b60408501516001600160a01b03169190611731565b505050505050565b610b7e6113f6565b610b886000611766565b565b6001600160a01b0384166000805160206120ab8339815191521480610bcb57506001600160a01b03841673674a430f531847a6f8976a900f8ace765f896a1b145b80610bdd57506001600160a01b038416155b610bf95760405162461bcd60e51b815260040161069f90611ee2565b6001600160a01b03841615610c2257610c1d6001600160a01b038516333086611450565b610ce5565b823414610c715760405162461bcd60e51b815260206004820152601a60248201527f496e636f727265637420616d6f756e74206f6620532073656e74000000000000604482015260640161069f565b6000805160206120ab8339815191526001600160a01b031663d0e30db0846040518263ffffffff1660e01b81526004016000604051808303818588803b158015610cba57600080fd5b505af1158015610cce573d6000803e3d6000fd5b50505050506000805160206120ab83398151915293505b610cfd846000805160206120cb8339815191526114c1565b60006001600160a01b0385166000805160206120ab8339815191521480610d2b57506001600160a01b038516155b610d43576000805160206120ab833981519152610d59565b73674a430f531847a6f8976a900f8ace765f896a1b5b90506000806000610d6a888861030f565b925092509250610d88846000805160206120cb8339815191526114c1565b6000610d968984873061154e565b905081811015610de85760405162461bcd60e51b815260206004820152601c60248201527f616d6f756e7420736d616c6c6572207468616e20657374696d61746500000000604482015260640161069f565b6040516326283ecf60e21b815260009081906000805160206120cb833981519152906398a0fb3c90610e26908e908b9086908c908b90600401611f67565b606060405180830381865afa158015610e43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e679190611f98565b50604051635a47ddc360e01b81526001600160a01b038e811660048301528a81166024830152600060448301819052606483018590526084830184905260a4830181905260c48301819052908d1660e4830152426101048301529294509092508a91906000805160206120cb83398151915290635a47ddc390610124016060604051808303816000875af1158015610f03573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f279190611f98565b9250505089811015610f715760405162461bcd60e51b81526020600482015260136024820152721b1c08185b5bdd5b9d081d1bdbc81cdb585b1b606a1b604482015260640161069f565b610f7b8d836117b6565b610f8589836117b6565b50505050505050505050505050565b6000808080806001600160a01b0387166000805160206120ab8339815191521480610fc657506001600160a01b038716155b610fde576000805160206120ab833981519152610ff4565b73674a430f531847a6f8976a900f8ace765f896a1b5b905060008060006110058a8a61030f565b92509250925073b901d7316447c84f4417b8a8268e2822095051e66001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa15801561105d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110819190611f26565b6001600160a01b03168a6001600160a01b0316036111395760008060006000805160206120cb8339815191526001600160a01b03166398a0fb3c8e8960008a896040518663ffffffff1660e01b81526004016110e1959493929190611f67565b606060405180830381865afa1580156110fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111229190611f98565b919c509a5094985093965061118195505050505050565b60008060006000805160206120cb8339815191526001600160a01b03166398a0fb3c888f6000888b6040518663ffffffff1660e01b81526004016110e1959493929190611f67565b92959194509250565b60008073b901d7316447c84f4417b8a8268e2822095051e66001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa1580156111df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112039190611f26565b9050600073b901d7316447c84f4417b8a8268e2822095051e66001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015611259573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061127d9190611f26565b6040516310e1b98f60e21b81526001600160a01b038085166004830152821660248201526000604482018190526064820187905291925081906000805160206120cb83398151915290634386e63c906084016040805180830381865afa1580156112eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061130f9190611f43565b91509150866001600160a01b0316846001600160a01b03160361134c576113418261133b85848b6104e0565b90611725565b94505050505061135b565b6113418161133b86858b6104e0565b92915050565b6113696113f6565b6001600160a01b0381166113ce5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161069f565b6104dd81611766565b60006113e38284611fc6565b9392505050565b60006113e38284611ecf565b6000546001600160a01b03163314610b885760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161069f565b6040516001600160a01b03808516602483015283166044820152606481018290526114bb9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526118da565b50505050565b604051636eb1769f60e11b81523060048201526001600160a01b03828116602483015283169063dd62ed3e90604401602060405180830381865afa15801561150d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115319190611d07565b6000036103e1576103e16001600160a01b038316826000196119af565b604080516001808252818301909252600091829190816020015b60408051606081018252600080825260208083018290529282015282526000199092019101816115685790505090506040518060600160405280876001600160a01b03168152602001856001600160a01b0316815260200160001515815250816000815181106115da576115da611d58565b602002602001018190525060006115f28787876104e0565b604051631e82ecdb60e31b81529091506000906000805160206120cb8339815191529063f41766d890611631908a90869088908b904290600401611fe8565b6000604051808303816000875af1158015611650573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526116789190810190611dec565b905081816001835161168a9190611ecf565b8151811061169a5761169a611d58565b602002602001015110156116f05760405162461bcd60e51b815260206004820152601c60248201527f616d6f756e7420736d616c6c6572207468616e20657374696d61746500000000604482015260640161069f565b80600182516116ff9190611ecf565b8151811061170f5761170f611d58565b602002602001015193505050505b949350505050565b60006113e38284612024565b6040516001600160a01b03831660248201526044810182905261176190849063a9059cbb60e01b90606401611484565b505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0382166117f9576040516001600160a01b038216904780156108fc02916000818181858888f19350505050158015611761573d6000803e3d6000fd5b6040516370a0823160e01b81523060048201526001600160a01b0383169063a9059cbb90839083906370a0823190602401602060405180830381865afa158015611847573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061186b9190611d07565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af11580156118b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117619190611d20565b600061192f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611ac49092919063ffffffff16565b90508051600014806119505750808060200190518101906119509190611d20565b6117615760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161069f565b801580611a295750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015611a03573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a279190611d07565b155b611a945760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b606482015260840161069f565b6040516001600160a01b03831660248201526044810182905261176190849063095ea7b360e01b90606401611484565b606061171d848460008585600080866001600160a01b03168587604051611aeb919061205b565b60006040518083038185875af1925050503d8060008114611b28576040519150601f19603f3d011682016040523d82523d6000602084013e611b2d565b606091505b5091509150611b3e87838387611b49565b979650505050505050565b60608315611bb8578251600003611bb1576001600160a01b0385163b611bb15760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161069f565b508161171d565b61171d8383815115611bcd5781518083602001fd5b8060405162461bcd60e51b815260040161069f9190612077565b6001600160a01b03811681146104dd57600080fd5b60008060408385031215611c0f57600080fd5b8235611c1a81611be7565b946020939093013593505050565b600060208284031215611c3a57600080fd5b81356113e381611be7565b600080600060608486031215611c5a57600080fd5b8335611c6581611be7565b9250602084013591506040840135611c7c81611be7565b809150509250925092565b60008060008060808587031215611c9d57600080fd5b843593506020850135611caf81611be7565b92506040850135611cbf81611be7565b9396929550929360600135925050565b60008060008060808587031215611ce557600080fd5b8435611cf081611be7565b9350602085013592506040850135611cbf81611be7565b600060208284031215611d1957600080fd5b5051919050565b600060208284031215611d3257600080fd5b815180151581146113e357600080fd5b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600081518084526020840193506020830160005b82811015611dc957815180516001600160a01b0390811688526020808301519091168189015260409182015115159188019190915260609096019590910190600101611d82565b5093949350505050565b82815260406020820152600061171d6040830184611d6e565b600060208284031215611dfe57600080fd5b815167ffffffffffffffff811115611e1557600080fd5b8201601f81018413611e2657600080fd5b805167ffffffffffffffff811115611e4057611e40611d42565b8060051b604051601f19603f830116810181811067ffffffffffffffff82111715611e6d57611e6d611d42565b604052918252602081840181019290810187841115611e8b57600080fd5b6020850194505b83851015611eae57845180825260209586019590935001611e92565b509695505050505050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561135b5761135b611eb9565b60208082526024908201527f4f6e6c7920532c207753206f722047536e616b6520746f6b656e7320616363656040820152631c1d195960e21b606082015260800190565b600060208284031215611f3857600080fd5b81516113e381611be7565b60008060408385031215611f5657600080fd5b505080516020909101519092909150565b6001600160a01b03958616815293909416602084015290151560408301526060820152608081019190915260a00190565b600080600060608486031215611fad57600080fd5b5050815160208301516040909301519094929350919050565b600082611fe357634e487b7160e01b600052601260045260246000fd5b500490565b85815284602082015260a06040820152600061200760a0830186611d6e565b6001600160a01b0394909416606083015250608001529392505050565b8082018082111561135b5761135b611eb9565b60005b8381101561205257818101518382015260200161203a565b50506000910152565b6000825161206d818460208701612037565b9190910192915050565b6020815260008251806020840152612096816040850160208701612037565b601f01601f1916919091016040019291505056fe000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad380000000000000000000000001d368773735ee1e678950b7a97bca2cafb330cdca26469706673582212206f5361c369ce7781d69860bdbe6262e9a2b1fc6e3e9c5b391b2292358841e06964736f6c634300081a0033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 35 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.