More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 9,084 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Beef In | 127041957 | 82 days ago | IN | 0 ETH | 0.000000046051 | ||||
Beef In | 127033595 | 82 days ago | IN | 0 ETH | 0.0000000482 | ||||
Beef In | 117993526 | 291 days ago | IN | 0 ETH | 0.000047378806 | ||||
Beef In | 117939532 | 292 days ago | IN | 0 ETH | 0.000020818601 | ||||
Beef In | 117885528 | 294 days ago | IN | 0 ETH | 0.000042240079 | ||||
Beef In | 117831539 | 295 days ago | IN | 0 ETH | 0.000008760527 | ||||
Beef In | 117831527 | 295 days ago | IN | 0 ETH | 0.000008679513 | ||||
Beef In | 117777528 | 296 days ago | IN | 0 ETH | 0.000008950546 | ||||
Beef In | 117669526 | 299 days ago | IN | 0 ETH | 0.000009491073 | ||||
Beef In | 117615528 | 300 days ago | IN | 0 ETH | 0.000008644767 | ||||
Beef In | 117561526 | 301 days ago | IN | 0 ETH | 0.000010200117 | ||||
Beef In | 117507529 | 302 days ago | IN | 0 ETH | 0.000014446708 | ||||
Beef In | 117453530 | 304 days ago | IN | 0 ETH | 0.000011193313 | ||||
Beef In | 117399532 | 305 days ago | IN | 0 ETH | 0.000006661424 | ||||
Beef In | 117356332 | 306 days ago | IN | 0 ETH | 0.000085503539 | ||||
Beef In | 117345531 | 306 days ago | IN | 0 ETH | 0.000104393431 | ||||
Beef In | 117302329 | 307 days ago | IN | 0 ETH | 0.000159161053 | ||||
Beef In | 117248327 | 308 days ago | IN | 0 ETH | 0.000133711301 | ||||
Beef In | 117194334 | 310 days ago | IN | 0 ETH | 0.000102298868 | ||||
Beef In | 117194331 | 310 days ago | IN | 0 ETH | 0.000102856509 | ||||
Beef In | 117086329 | 312 days ago | IN | 0 ETH | 0.000136739324 | ||||
Beef In | 116816342 | 318 days ago | IN | 0 ETH | 0.000290058604 | ||||
Beef In | 116654328 | 322 days ago | IN | 0 ETH | 0.000064543926 | ||||
Beef In | 116632731 | 323 days ago | IN | 0 ETH | 0.00006230749 | ||||
Beef In | 116632728 | 323 days ago | IN | 0 ETH | 0.000063780286 |
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
125268586 | 123 days ago | 0.000000023567275 ETH | ||||
125268586 | 123 days ago | 0.000000023567275 ETH | ||||
125268438 | 123 days ago | 0.000000007552191 ETH | ||||
125268438 | 123 days ago | 0.000000007552191 ETH | ||||
125268438 | 123 days ago | 0.000000008916831 ETH | ||||
125268438 | 123 days ago | 0.000000008916831 ETH | ||||
125225386 | 124 days ago | 0.000000023318985 ETH | ||||
125225386 | 124 days ago | 0.000000023318985 ETH | ||||
125225238 | 124 days ago | 0.000000007551599 ETH | ||||
125225238 | 124 days ago | 0.000000007551599 ETH | ||||
125225238 | 124 days ago | 0.000000008822912 ETH | ||||
125225238 | 124 days ago | 0.000000008822912 ETH | ||||
125182189 | 125 days ago | 0.000000022435497 ETH | ||||
125182189 | 125 days ago | 0.000000022435497 ETH | ||||
125182038 | 125 days ago | 0.000000007978687 ETH | ||||
125182038 | 125 days ago | 0.000000007978687 ETH | ||||
125182038 | 125 days ago | 0.000000008488638 ETH | ||||
125182038 | 125 days ago | 0.000000008488638 ETH | ||||
125138987 | 126 days ago | 0.000000022136952 ETH | ||||
125138987 | 126 days ago | 0.000000022136952 ETH | ||||
125138838 | 126 days ago | 0.000000007445009 ETH | ||||
125138838 | 126 days ago | 0.000000007445009 ETH | ||||
125138838 | 126 days ago | 0.000000008375681 ETH | ||||
125138838 | 126 days ago | 0.000000008375681 ETH | ||||
125095788 | 127 days ago | 0.000000023967272 ETH |
Loading...
Loading
Contract Name:
BeefyVelodromeV2Zap
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.19; import {IERC20} from "@openzeppelin-4/contracts/interfaces/IERC20.sol"; import {IERC20Metadata} from "@openzeppelin-4/contracts/interfaces/IERC20Metadata.sol"; import {SafeERC20} from "@openzeppelin-4/contracts/token/ERC20/utils/SafeERC20.sol"; import {IRouter} from "../interfaces/velodrome-v2/IRouter.sol"; import {IPool} from "../interfaces/velodrome-v2/IPool.sol"; import {IBeefyVault} from "./zapInterfaces/IBeefyVault.sol"; import {IWETH} from "./zapInterfaces/IWETH.sol"; import {Babylonian} from "./libs/Babylonian.sol"; import {ZapErrors} from "./errors/ZapErrors.sol"; contract BeefyVelodromeV2Zap is ZapErrors { using SafeERC20 for IERC20; using SafeERC20 for IBeefyVault; IRouter public immutable router; address public immutable WETH; uint256 private constant minimumAmount = 1000; constructor(address _router, address _WETH) { router = IRouter(_router); WETH = _WETH; if(WETH != router.weth()) revert NotWETH(); } receive() external payable { assert(msg.sender == WETH); } function beefInETH(address beefyVault, uint256 tokenAmountOutMin) external payable { if(msg.value < minimumAmount) revert InsignificantAmount(); IWETH(WETH).deposit{value: msg.value}(); _swapAndStake(beefyVault, tokenAmountOutMin, WETH); } function beefIn(address beefyVault, uint256 tokenAmountOutMin, address tokenIn, uint256 tokenInAmount) external { if(tokenInAmount < minimumAmount) revert InsignificantAmount(); IERC20(tokenIn).safeTransferFrom(msg.sender, address(this), tokenInAmount); _swapAndStake(beefyVault, tokenAmountOutMin, tokenIn); } function beefOut(address beefyVault, uint256 withdrawAmount) external { (IBeefyVault vault, IPool pair) = _getVaultPair(beefyVault); IERC20(beefyVault).safeTransferFrom(msg.sender, address(this), withdrawAmount); vault.withdraw(withdrawAmount); if (pair.token0() != WETH && pair.token1() != WETH) { return _removeLiquidity(address(pair), msg.sender); } _removeLiquidity(address(pair), address(this)); address[] memory tokens = new address[](2); tokens[0] = pair.token0(); tokens[1] = pair.token1(); _returnAssets(tokens); } function beefOutAndSwap(address beefyVault, uint256 withdrawAmount, address desiredToken, uint256 desiredTokenOutMin) external { (IBeefyVault vault, IPool pair) = _getVaultPair(beefyVault); address token0 = pair.token0(); address token1 = pair.token1(); if(token0 != desiredToken && token1 != desiredToken) revert WrongToken(); vault.safeTransferFrom(msg.sender, address(this), withdrawAmount); vault.withdraw(withdrawAmount); _removeLiquidity(address(pair), address(this)); address swapToken = token1 == desiredToken ? token0 : token1; address[] memory path = new address[](2); path[0] = swapToken; path[1] = desiredToken; _approveTokenIfNeeded(path[0], address(router)); _swapExactTokensForTokensSimple(IERC20(swapToken).balanceOf(address(this)), desiredTokenOutMin, path[0], path[1], pair.stable(), pair.factory(), address(this), block.timestamp); _returnAssets(path); } function _swapExactTokensForTokensSimple( uint amountIn, uint amountOutMin, address tokenFrom, address tokenTo, bool stable, address factory, address to, uint deadline ) private returns (uint256[] memory amounts) { IRouter.Route[] memory routes = new IRouter.Route[](1); routes[0] = IRouter.Route({ from: tokenFrom, to: tokenTo, stable: stable, factory: factory }); amounts = router.swapExactTokensForTokens(amountIn, amountOutMin, routes, to, deadline); } function _removeLiquidity(address pair, address to) private { IERC20(pair).safeTransfer(pair, IERC20(pair).balanceOf(address(this))); (uint256 amount0, uint256 amount1) = IPool(pair).burn(to); if (amount0 < minimumAmount) revert InsufficientAmount(); if (amount1 < minimumAmount) revert InsufficientAmount(); } function _getVaultPair(address beefyVault) private pure returns (IBeefyVault vault, IPool pair) { vault = IBeefyVault(beefyVault); pair = IPool(vault.want()); } function _swapAndStake(address beefyVault, uint256 tokenAmountOutMin, address tokenIn) private { (IBeefyVault vault, IPool pair) = _getVaultPair(beefyVault); if(pair.factory() != router.defaultFactory()) revert IncompatiblePair(); // router.addLiquidity adds to pair from router.defaultFactory() (uint256 reserveA, uint256 reserveB,) = pair.getReserves(); if (reserveA < minimumAmount || reserveB < minimumAmount) revert ReservesTooLow(); bool isInputA = pair.token0() == tokenIn; if(!isInputA && pair.token1() != tokenIn) revert WrongToken(); address[] memory path = new address[](2); path[0] = tokenIn; path[1] = isInputA ? pair.token1() : pair.token0(); uint256 fullInvestment = IERC20(tokenIn).balanceOf(address(this)); uint256 swapAmountIn; if (isInputA) { swapAmountIn = _getSwapAmount(pair, fullInvestment, reserveA, reserveB, path[0], path[1]); } else { swapAmountIn = _getSwapAmount(pair, fullInvestment, reserveB, reserveA, path[0], path[1]); } _approveTokenIfNeeded(path[0], address(router)); uint256[] memory swappedAmounts = _swapExactTokensForTokensSimple(swapAmountIn, tokenAmountOutMin, path[0], path[1], pair.stable(), pair.factory(), address(this), block.timestamp); _approveTokenIfNeeded(path[1], address(router)); (,, uint256 amountLiquidity) = router .addLiquidity(path[0], path[1], pair.stable(), fullInvestment - swappedAmounts[0], swappedAmounts[1], 1, 1, address(this), block.timestamp); _approveTokenIfNeeded(address(pair), address(vault)); vault.deposit(amountLiquidity); vault.safeTransfer(msg.sender, vault.balanceOf(address(this))); _returnAssets(path); } function _returnAssets(address[] memory tokens) private { uint256 balance; for (uint256 i; i < tokens.length; ++i) { balance = IERC20(tokens[i]).balanceOf(address(this)); if (balance > 0) { if (tokens[i] == WETH) { IWETH(WETH).withdraw(balance); (bool success,) = msg.sender.call{value: balance}(new bytes(0)); if(!success) revert TransferFail(); } else { IERC20(tokens[i]).safeTransfer(msg.sender, balance); } } } } function _getSwapAmount(IPool pair, uint256 investmentA, uint256 reserveA, uint256 reserveB, address tokenA, address tokenB) private view returns (uint256 swapAmount) { uint256 halfInvestment = investmentA / 2; if (pair.stable()) { swapAmount = _getStableSwap(pair, investmentA, halfInvestment, tokenA, tokenB); } else { uint256 nominator = pair.getAmountOut(halfInvestment, tokenA); uint256 denominator = halfInvestment * (reserveB - nominator) / (reserveA + halfInvestment); swapAmount = investmentA - (Babylonian.sqrt(halfInvestment * halfInvestment * nominator / denominator)); } } function _getStableSwap(IPool pair, uint256 investmentA, uint256 halfInvestment, address tokenA, address tokenB) private view returns (uint256 swapAmount) { uint out = pair.getAmountOut(halfInvestment, tokenA); (uint amountA, uint amountB,) = router.quoteAddLiquidity(tokenA, tokenB, pair.stable(), pair.factory(), halfInvestment, out); amountA = amountA * 1e18 / 10**IERC20Metadata(tokenA).decimals(); amountB = amountB * 1e18 / 10**IERC20Metadata(tokenB).decimals(); out = out * 1e18 / 10**IERC20Metadata(tokenB).decimals(); halfInvestment = halfInvestment * 1e18 / 10**IERC20Metadata(tokenA).decimals(); uint ratio = out * 1e18 / halfInvestment * amountA / amountB; return investmentA * 1e18 / (ratio + 1e18); } function estimateSwap(address beefyVault, address tokenIn, uint256 fullInvestmentIn) external view returns (uint256 swapAmountIn, uint256 swapAmountOut, address swapTokenOut) { (, IPool pair) = _getVaultPair(beefyVault); if(pair.factory() != router.defaultFactory()) revert IncompatiblePair(); // router.addLiquidity adds to pair from router.defaultFactory() bool isInputA = pair.token0() == tokenIn; if(!isInputA && pair.token1() != tokenIn) revert WrongToken(); // 'Beefy: Input token not present in liquidity pair'; (uint256 reserveA, uint256 reserveB,) = pair.getReserves(); (reserveA, reserveB) = isInputA ? (reserveA, reserveB) : (reserveB, reserveA); swapTokenOut = isInputA ? pair.token1() : pair.token0(); swapAmountIn = _getSwapAmount(pair, fullInvestmentIn, reserveA, reserveB, tokenIn, swapTokenOut); swapAmountOut = pair.getAmountOut(swapAmountIn, tokenIn); } function _approveTokenIfNeeded(address token, address spender) private { if (IERC20(token).allowance(address(this), spender) == 0) { IERC20(token).safeApprove(spender, type(uint256).max); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol) pragma solidity ^0.8.0; import "../token/ERC20/IERC20.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../token/ERC20/extensions/IERC20Metadata.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; } _balances[to] += amount; emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-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. */ 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]. */ 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 v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.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.7.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/draft-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; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } 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)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } 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"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } 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"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.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 * ==== * * [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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, "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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(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) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(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) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason 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 { // 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 v4.4.1 (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; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IPool { error DepositsNotEqual(); error BelowMinimumK(); error FactoryAlreadySet(); error InsufficientLiquidity(); error InsufficientLiquidityMinted(); error InsufficientLiquidityBurned(); error InsufficientOutputAmount(); error InsufficientInputAmount(); error IsPaused(); error InvalidTo(); error K(); error NotEmergencyCouncil(); event Fees(address indexed sender, uint256 amount0, uint256 amount1); event Mint(address indexed sender, uint256 amount0, uint256 amount1); event Burn(address indexed sender, address indexed to, uint256 amount0, uint256 amount1); event Swap( address indexed sender, address indexed to, uint256 amount0In, uint256 amount1In, uint256 amount0Out, uint256 amount1Out ); event Sync(uint256 reserve0, uint256 reserve1); event Claim(address indexed sender, address indexed recipient, uint256 amount0, uint256 amount1); function metadata() external view returns (uint256 dec0, uint256 dec1, uint256 r0, uint256 r1, bool st, address t0, address t1); function claimFees() external returns (uint256, uint256); function factory() external view returns (address); function tokens() external view returns (address, address); function token0() external view returns (address); function token1() external view returns (address); function stable() external view returns (bool); function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data) external; function burn(address to) external returns (uint256 amount0, uint256 amount1); function mint(address to) external returns (uint256 liquidity); function getReserves() external view returns (uint256 _reserve0, uint256 _reserve1, uint256 _blockTimestampLast); function getAmountOut(uint256, address) external view returns (uint256); function skim(address to) external; function initialize(address _token0, address _token1, bool _stable) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IRouter { struct Route { address from; address to; bool stable; address factory; } error ConversionFromV2ToV1VeloProhibited(); error ETHTransferFailed(); error Expired(); error InsufficientAmount(); error InsufficientAmountA(); error InsufficientAmountB(); error InsufficientAmountADesired(); error InsufficientAmountBDesired(); error InsufficientAmountAOptimal(); error InsufficientLiquidity(); error InsufficientOutputAmount(); error InvalidAmountInForETHDeposit(); error InvalidTokenInForETHDeposit(); error InvalidPath(); error InvalidRouteA(); error InvalidRouteB(); error OnlyWETH(); error PoolDoesNotExist(); error PoolFactoryDoesNotExist(); error SameAddresses(); error ZeroAddress(); /// @dev Struct containing information necessary to zap in and out of pools /// @param tokenA . /// @param tokenB . /// @param stable Stable or volatile pool /// @param factory factory of pool /// @param amountOutMinA Minimum amount expected from swap leg of zap via routesA /// @param amountOutMinB Minimum amount expected from swap leg of zap via routesB /// @param amountAMin Minimum amount of tokenA expected from liquidity leg of zap /// @param amountBMin Minimum amount of tokenB expected from liquidity leg of zap struct Zap { address tokenA; address tokenB; bool stable; address factory; uint256 amountOutMinA; uint256 amountOutMinB; uint256 amountAMin; uint256 amountBMin; } /// @notice Sort two tokens by which address value is less than the other /// @param tokenA Address of token to sort /// @param tokenB Address of token to sort /// @return token0 Lower address value between tokenA and tokenB /// @return token1 Higher address value between tokenA and tokenB function sortTokens(address tokenA, address tokenB) external pure returns (address token0, address token1); /// @notice Calculate the address of a pool by its' factory. /// Used by all Router functions containing a `Route[]` or `_factory` argument. /// Reverts if _factory is not approved by the FactoryRegistry /// @dev Returns a randomly generated address for a nonexistent pool /// @param tokenA Address of token to query /// @param tokenB Address of token to query /// @param stable True if pool is stable, false if volatile /// @param _factory Address of factory which created the pool function poolFor( address tokenA, address tokenB, bool stable, address _factory ) external view returns (address pool); /// @notice Wraps around poolFor(tokenA,tokenB,stable,_factory) for backwards compatibility to Velodrome v1 function pairFor( address tokenA, address tokenB, bool stable, address _factory ) external view returns (address pool); /// @notice Fetch and sort the reserves for a pool /// @param tokenA . /// @param tokenB . /// @param stable True if pool is stable, false if volatile /// @param _factory Address of PoolFactory for tokenA and tokenB /// @return reserveA Amount of reserves of the sorted token A /// @return reserveB Amount of reserves of the sorted token B function getReserves( address tokenA, address tokenB, bool stable, address _factory ) external view returns (uint256 reserveA, uint256 reserveB); /// @notice Perform chained getAmountOut calculations on any number of pools function getAmountsOut(uint256 amountIn, Route[] memory routes) external view returns (uint256[] memory amounts); // **** ADD LIQUIDITY **** /// @notice Quote the amount deposited into a Pool /// @param tokenA . /// @param tokenB . /// @param stable True if pool is stable, false if volatile /// @param _factory Address of PoolFactory for tokenA and tokenB /// @param amountADesired Amount of tokenA desired to deposit /// @param amountBDesired Amount of tokenB desired to deposit /// @return amountA Amount of tokenA to actually deposit /// @return amountB Amount of tokenB to actually deposit /// @return liquidity Amount of liquidity token returned from deposit function quoteAddLiquidity( address tokenA, address tokenB, bool stable, address _factory, uint256 amountADesired, uint256 amountBDesired ) external view returns (uint256 amountA, uint256 amountB, uint256 liquidity); /// @notice Quote the amount of liquidity removed from a Pool /// @param tokenA . /// @param tokenB . /// @param stable True if pool is stable, false if volatile /// @param _factory Address of PoolFactory for tokenA and tokenB /// @param liquidity Amount of liquidity to remove /// @return amountA Amount of tokenA received /// @return amountB Amount of tokenB received function quoteRemoveLiquidity( address tokenA, address tokenB, bool stable, address _factory, uint256 liquidity ) external view returns (uint256 amountA, uint256 amountB); /// @notice Add liquidity of two tokens to a Pool /// @param tokenA . /// @param tokenB . /// @param stable True if pool is stable, false if volatile /// @param amountADesired Amount of tokenA desired to deposit /// @param amountBDesired Amount of tokenB desired to deposit /// @param amountAMin Minimum amount of tokenA to deposit /// @param amountBMin Minimum amount of tokenB to deposit /// @param to Recipient of liquidity token /// @param deadline Deadline to receive liquidity /// @return amountA Amount of tokenA to actually deposit /// @return amountB Amount of tokenB to actually deposit /// @return liquidity Amount of liquidity token returned from deposit 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); /// @notice Add liquidity of a token and WETH (transferred as ETH) to a Pool /// @param token . /// @param stable True if pool is stable, false if volatile /// @param amountTokenDesired Amount of token desired to deposit /// @param amountTokenMin Minimum amount of token to deposit /// @param amountETHMin Minimum amount of ETH to deposit /// @param to Recipient of liquidity token /// @param deadline Deadline to add liquidity /// @return amountToken Amount of token to actually deposit /// @return amountETH Amount of tokenETH to actually deposit /// @return liquidity Amount of liquidity token returned from deposit 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); // **** REMOVE LIQUIDITY **** /// @notice Remove liquidity of two tokens from a Pool /// @param tokenA . /// @param tokenB . /// @param stable True if pool is stable, false if volatile /// @param liquidity Amount of liquidity to remove /// @param amountAMin Minimum amount of tokenA to receive /// @param amountBMin Minimum amount of tokenB to receive /// @param to Recipient of tokens received /// @param deadline Deadline to remove liquidity /// @return amountA Amount of tokenA received /// @return amountB Amount of tokenB received function removeLiquidity( address tokenA, address tokenB, bool stable, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns (uint256 amountA, uint256 amountB); /// @notice Remove liquidity of a token and WETH (returned as ETH) from a Pool /// @param token . /// @param stable True if pool is stable, false if volatile /// @param liquidity Amount of liquidity to remove /// @param amountTokenMin Minimum amount of token to receive /// @param amountETHMin Minimum amount of ETH to receive /// @param to Recipient of liquidity token /// @param deadline Deadline to receive liquidity /// @return amountToken Amount of token received /// @return amountETH Amount of ETH received function removeLiquidityETH( address token, bool stable, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external returns (uint256 amountToken, uint256 amountETH); /// @notice Remove liquidity of a fee-on-transfer token and WETH (returned as ETH) from a Pool /// @param token . /// @param stable True if pool is stable, false if volatile /// @param liquidity Amount of liquidity to remove /// @param amountTokenMin Minimum amount of token to receive /// @param amountETHMin Minimum amount of ETH to receive /// @param to Recipient of liquidity token /// @param deadline Deadline to receive liquidity /// @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 amountETH); // **** SWAP **** /// @notice Swap one token for another /// @param amountIn Amount of token in /// @param amountOutMin Minimum amount of desired token received /// @param routes Array of trade routes used in the swap /// @param to Recipient of the tokens received /// @param deadline Deadline to receive tokens /// @return amounts Array of amounts returned per route function swapExactTokensForTokens( uint256 amountIn, uint256 amountOutMin, Route[] calldata routes, address to, uint256 deadline ) external returns (uint256[] memory amounts); /// @notice Swap ETH for a token /// @param amountOutMin Minimum amount of desired token received /// @param routes Array of trade routes used in the swap /// @param to Recipient of the tokens received /// @param deadline Deadline to receive tokens /// @return amounts Array of amounts returned per route function swapExactETHForTokens( uint256 amountOutMin, Route[] calldata routes, address to, uint256 deadline ) external payable returns (uint256[] memory amounts); /// @notice Swap a token for WETH (returned as ETH) /// @param amountIn Amount of token in /// @param amountOutMin Minimum amount of desired ETH /// @param routes Array of trade routes used in the swap /// @param to Recipient of the tokens received /// @param deadline Deadline to receive tokens /// @return amounts Array of amounts returned per route function swapExactTokensForETH( uint256 amountIn, uint256 amountOutMin, Route[] calldata routes, address to, uint256 deadline ) external returns (uint256[] memory amounts); /// @notice Swap one token for another without slippage protection /// @return amounts Array of amounts to swap per route /// @param routes Array of trade routes used in the swap /// @param to Recipient of the tokens received /// @param deadline Deadline to receive tokens function UNSAFE_swapExactTokensForTokens( uint256[] memory amounts, Route[] calldata routes, address to, uint256 deadline ) external returns (uint256[] memory); // **** SWAP (supporting fee-on-transfer tokens) **** /// @notice Swap one token for another supporting fee-on-transfer tokens /// @param amountIn Amount of token in /// @param amountOutMin Minimum amount of desired token received /// @param routes Array of trade routes used in the swap /// @param to Recipient of the tokens received /// @param deadline Deadline to receive tokens function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, Route[] calldata routes, address to, uint256 deadline ) external; /// @notice Swap ETH for a token supporting fee-on-transfer tokens /// @param amountOutMin Minimum amount of desired token received /// @param routes Array of trade routes used in the swap /// @param to Recipient of the tokens received /// @param deadline Deadline to receive tokens function swapExactETHForTokensSupportingFeeOnTransferTokens( uint256 amountOutMin, Route[] calldata routes, address to, uint256 deadline ) external payable; /// @notice Swap a token for WETH (returned as ETH) supporting fee-on-transfer tokens /// @param amountIn Amount of token in /// @param amountOutMin Minimum amount of desired ETH /// @param routes Array of trade routes used in the swap /// @param to Recipient of the tokens received /// @param deadline Deadline to receive tokens function swapExactTokensForETHSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, Route[] calldata routes, address to, uint256 deadline ) external; /// @notice Zap a token A into a pool (B, C). (A can be equal to B or C). /// Supports standard ERC20 tokens only (i.e. not fee-on-transfer tokens etc). /// Slippage is required for the initial swap. /// Additional slippage may be required when adding liquidity as the /// price of the token may have changed. /// @param tokenIn Token you are zapping in from (i.e. input token). /// @param amountInA Amount of input token you wish to send down routesA /// @param amountInB Amount of input token you wish to send down routesB /// @param zapInPool Contains zap struct information. See Zap struct. /// @param routesA Route used to convert input token to tokenA /// @param routesB Route used to convert input token to tokenB /// @param to Address you wish to mint liquidity to. /// @param stake Auto-stake liquidity in corresponding gauge. /// @return liquidity Amount of LP tokens created from zapping in. function zapIn( address tokenIn, uint256 amountInA, uint256 amountInB, Zap calldata zapInPool, Route[] calldata routesA, Route[] calldata routesB, address to, bool stake ) external payable returns (uint256 liquidity); /// @notice Zap out a pool (B, C) into A. /// Supports standard ERC20 tokens only (i.e. not fee-on-transfer tokens etc). /// Slippage is required for the removal of liquidity. /// Additional slippage may be required on the swap as the /// price of the token may have changed. /// @param tokenOut Token you are zapping out to (i.e. output token). /// @param liquidity Amount of liquidity you wish to remove. /// @param zapOutPool Contains zap struct information. See Zap struct. /// @param routesA Route used to convert tokenA into output token. /// @param routesB Route used to convert tokenB into output token. function zapOut( address tokenOut, uint256 liquidity, Zap calldata zapOutPool, Route[] calldata routesA, Route[] calldata routesB ) external; /// @notice Used to generate params required for zapping in. /// Zap in => remove liquidity then swap. /// Apply slippage to expected swap values to account for changes in reserves in between. /// @dev Output token refers to the token you want to zap in from. /// @param tokenA . /// @param tokenB . /// @param stable . /// @param _factory . /// @param amountInA Amount of input token you wish to send down routesA /// @param amountInB Amount of input token you wish to send down routesB /// @param routesA Route used to convert input token to tokenA /// @param routesB Route used to convert input token to tokenB /// @return amountOutMinA Minimum output expected from swapping input token to tokenA. /// @return amountOutMinB Minimum output expected from swapping input token to tokenB. /// @return amountAMin Minimum amount of tokenA expected from depositing liquidity. /// @return amountBMin Minimum amount of tokenB expected from depositing liquidity. function generateZapInParams( address tokenA, address tokenB, bool stable, address _factory, uint256 amountInA, uint256 amountInB, Route[] calldata routesA, Route[] calldata routesB ) external view returns (uint256 amountOutMinA, uint256 amountOutMinB, uint256 amountAMin, uint256 amountBMin); /// @notice Used to generate params required for zapping out. /// Zap out => swap then add liquidity. /// Apply slippage to expected liquidity values to account for changes in reserves in between. /// @dev Output token refers to the token you want to zap out of. /// @param tokenA . /// @param tokenB . /// @param stable . /// @param _factory . /// @param liquidity Amount of liquidity being zapped out of into a given output token. /// @param routesA Route used to convert tokenA into output token. /// @param routesB Route used to convert tokenB into output token. /// @return amountOutMinA Minimum output expected from swapping tokenA into output token. /// @return amountOutMinB Minimum output expected from swapping tokenB into output token. /// @return amountAMin Minimum amount of tokenA expected from withdrawing liquidity. /// @return amountBMin Minimum amount of tokenB expected from withdrawing liquidity. function generateZapOutParams( address tokenA, address tokenB, bool stable, address _factory, uint256 liquidity, Route[] calldata routesA, Route[] calldata routesB ) external view returns (uint256 amountOutMinA, uint256 amountOutMinB, uint256 amountAMin, uint256 amountBMin); /// @notice Used by zapper to determine appropriate ratio of A to B to deposit liquidity. Assumes stable pool. /// @dev Returns stable liquidity ratio of B to (A + B). /// E.g. if ratio is 0.4, it means there is more of A than there is of B. /// Therefore you should deposit more of token A than B. /// @param tokenA tokenA of stable pool you are zapping into. /// @param tokenB tokenB of stable pool you are zapping into. /// @param factory Factory that created stable pool. /// @return ratio Ratio of token0 to token1 required to deposit into zap. function quoteStableLiquidityRatio( address tokenA, address tokenB, address factory ) external view returns (uint256 ratio); function weth() external view returns (address); function defaultFactory() external view returns (address); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.19; contract ZapErrors { error InsignificantAmount(); error NotWETH(); error WrongToken(); // Beefy: desired token not present in liquidity pair. error InsufficientAmount(); error IncompatiblePair(); error ReservesTooLow(); error TransferFail(); }
// SPDX-License-Identifier: BSD-4-Clause pragma solidity >=0.8.0; // computes square roots using the babylonian method // https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method library Babylonian { // credit for this implementation goes to // https://github.com/abdk-consulting/abdk-libraries-solidity/blob/5e1e7c11b35f8313d3f7ce11c1b86320d7c0b554/ABDKMath64x64.sol#L725 function sqrt(uint256 x) internal pure returns (uint256) { unchecked { if (x == 0) return 0; else { uint256 xx = x; uint256 r = 1; if (xx >= 0x100000000000000000000000000000000) { xx >>= 128; r <<= 64; } if (xx >= 0x10000000000000000) { xx >>= 64; r <<= 32; } if (xx >= 0x100000000) { xx >>= 32; r <<= 16; } if (xx >= 0x10000) { xx >>= 16; r <<= 8; } if (xx >= 0x100) { xx >>= 8; r <<= 4; } if (xx >= 0x10) { xx >>= 4; r <<= 2; } if (xx >= 0x4) { r <<= 1; } r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; // Seven iterations should be enough uint256 r1 = x / r; return (r < r1 ? r : r1); } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin-4/contracts/token/ERC20/ERC20.sol"; interface IBeefyVault is IERC20 { function deposit(uint256 amount) external; function withdraw(uint256 shares) external; function want() external pure returns (address); // Beefy Vault V6 function token() external pure returns (address); // Beefy Vault V5 function balance() external pure returns (uint256); function totalSupply() external pure returns (uint256); function strategy() external pure returns (address); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin-4/contracts/token/ERC20/ERC20.sol"; interface IWETH is IERC20 { function deposit() external payable; function withdraw(uint256 wad) external; }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_router","type":"address"},{"internalType":"address","name":"_WETH","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"IncompatiblePair","type":"error"},{"inputs":[],"name":"InsignificantAmount","type":"error"},{"inputs":[],"name":"InsufficientAmount","type":"error"},{"inputs":[],"name":"NotWETH","type":"error"},{"inputs":[],"name":"ReservesTooLow","type":"error"},{"inputs":[],"name":"TransferFail","type":"error"},{"inputs":[],"name":"WrongToken","type":"error"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"beefyVault","type":"address"},{"internalType":"uint256","name":"tokenAmountOutMin","type":"uint256"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"tokenInAmount","type":"uint256"}],"name":"beefIn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"beefyVault","type":"address"},{"internalType":"uint256","name":"tokenAmountOutMin","type":"uint256"}],"name":"beefInETH","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"beefyVault","type":"address"},{"internalType":"uint256","name":"withdrawAmount","type":"uint256"}],"name":"beefOut","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"beefyVault","type":"address"},{"internalType":"uint256","name":"withdrawAmount","type":"uint256"},{"internalType":"address","name":"desiredToken","type":"address"},{"internalType":"uint256","name":"desiredTokenOutMin","type":"uint256"}],"name":"beefOutAndSwap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"beefyVault","type":"address"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"fullInvestmentIn","type":"uint256"}],"name":"estimateSwap","outputs":[{"internalType":"uint256","name":"swapAmountIn","type":"uint256"},{"internalType":"uint256","name":"swapAmountOut","type":"uint256"},{"internalType":"address","name":"swapTokenOut","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"router","outputs":[{"internalType":"contract IRouter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60c06040523480156200001157600080fd5b5060405162002fca38038062002fca833981016040819052620000349162000105565b6001600160a01b03808316608081905290821660a05260408051633fc8cef360e01b81529051633fc8cef3916004808201926020929091908290030181865afa15801562000086573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000ac91906200013d565b6001600160a01b031660a0516001600160a01b031614620000e057604051635724f38560e01b815260040160405180910390fd5b505062000162565b80516001600160a01b03811681146200010057600080fd5b919050565b600080604083850312156200011957600080fd5b6200012483620000e8565b91506200013460208401620000e8565b90509250929050565b6000602082840312156200015057600080fd5b6200015b82620000e8565b9392505050565b60805160a051612de8620001e26000396000818160840152818161016601528181610a5701528181610ad001528181610b7a01528181610c180152818161146e01526114d40152600081816101d2015281816102080152818161088a0152818161133f0152818161162001528181611c110152611f370152612de86000f3fe6080604052600436106100745760003560e01c8063a28c361b1161004e578063a28c361b14610134578063ad5c464814610154578063f5d07b60146101a0578063f887ea40146101c057600080fd5b80633f2f869a146100b857806351c9cf911461010157806370fae20d1461012157600080fd5b366100b357336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146100b1576100b1612866565b005b600080fd5b3480156100c457600080fd5b506100d86100d3366004612894565b6101f4565b6040805193845260208401929092526001600160a01b0316908201526060015b60405180910390f35b34801561010d57600080fd5b506100b161011c3660046128d5565b610612565b6100b161012f36600461291d565b610a32565b34801561014057600080fd5b506100b161014f36600461291d565b610af8565b34801561016057600080fd5b506101887f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100f8565b3480156101ac57600080fd5b506100b16101bb3660046128d5565b610e28565b3480156101cc57600080fd5b506101887f000000000000000000000000000000000000000000000000000000000000000081565b60008060008061020387610e6b565b9150507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d4b6846d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610264573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102889190612949565b6001600160a01b0316816001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102f39190612949565b6001600160a01b03161461031a57604051633ec90a3f60e11b815260040160405180910390fd5b6000866001600160a01b0316826001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015610364573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103889190612949565b6001600160a01b03161490508015816104145750866001600160a01b0316826001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa1580156103e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104089190612949565b6001600160a01b031614155b1561043257604051635079ff7560e11b815260040160405180910390fd5b600080836001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa158015610473573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104979190612966565b5091509150826104a85780826104ab565b81815b90925090508261051c57836001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105179190612949565b61057e565b836001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa15801561055a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061057e9190612949565b945061058e848984848d8a610eda565b6040516378a051ad60e11b8152600481018290526001600160a01b038b811660248301529198509085169063f140a35a90604401602060405180830381865afa1580156105df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106039190612994565b95505050505093509350939050565b60008061061e86610e6b565b915091506000816001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015610662573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106869190612949565b90506000826001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ec9190612949565b9050856001600160a01b0316826001600160a01b0316141580156107225750856001600160a01b0316816001600160a01b031614155b1561074057604051635079ff7560e11b815260040160405180910390fd5b6107556001600160a01b03851633308a61104a565b604051632e1a7d4d60e01b8152600481018890526001600160a01b03851690632e1a7d4d90602401600060405180830381600087803b15801561079757600080fd5b505af11580156107ab573d6000803e3d6000fd5b505050506107b983306110b5565b6000866001600160a01b0316826001600160a01b0316146107da57816107dc565b825b60408051600280825260608201835292935060009290916020830190803683370190505090508181600081518110610816576108166129c3565b60200260200101906001600160a01b031690816001600160a01b031681525050878160018151811061084a5761084a6129c3565b60200260200101906001600160a01b031690816001600160a01b0316815250506108ae81600081518110610880576108806129c3565b60200260200101517f00000000000000000000000000000000000000000000000000000000000000006111ee565b6040516370a0823160e01b8152306004820152610a1c906001600160a01b038416906370a0823190602401602060405180830381865afa1580156108f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061091a9190612994565b888360008151811061092e5761092e6129c3565b602002602001015184600181518110610949576109496129c3565b6020026020010151896001600160a01b03166322be3de16040518163ffffffff1660e01b8152600401602060405180830381865afa15801561098f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b391906129d9565b8a6001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109f1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a159190612949565b304261127b565b50610a26816113d1565b50505050505050505050565b6103e8341015610a555760405163af5e173360e01b815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015610ab057600080fd5b505af1158015610ac4573d6000803e3d6000fd5b5050505050610af482827f000000000000000000000000000000000000000000000000000000000000000061160e565b5050565b600080610b0484610e6b565b9092509050610b1e6001600160a01b03851633308661104a565b604051632e1a7d4d60e01b8152600481018490526001600160a01b03831690632e1a7d4d90602401600060405180830381600087803b158015610b6057600080fd5b505af1158015610b74573d6000803e3d6000fd5b505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015610be0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c049190612949565b6001600160a01b031614158015610cae57507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c7e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ca29190612949565b6001600160a01b031614155b15610cc357610cbd81336110b5565b50505050565b610ccd81306110b5565b604080516002808252606082018352600092602083019080368337019050509050816001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d509190612949565b81600081518110610d6357610d636129c3565b60200260200101906001600160a01b031690816001600160a01b031681525050816001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610dc1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de59190612949565b81600181518110610df857610df86129c3565b60200260200101906001600160a01b031690816001600160a01b031681525050610e21816113d1565b5050505050565b6103e8811015610e4b5760405163af5e173360e01b815260040160405180910390fd5b610e606001600160a01b03831633308461104a565b610cbd84848461160e565b600080829150816001600160a01b0316631f1fcd516040518163ffffffff1660e01b8152600401602060405180830381865afa158015610eaf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed39190612949565b9050915091565b600080610ee8600288612a27565b9050876001600160a01b03166322be3de16040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f28573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f4c91906129d9565b15610f6557610f5e8888838787611eba565b915061103f565b6040516378a051ad60e11b8152600481018290526001600160a01b038581166024830152600091908a169063f140a35a90604401602060405180830381865afa158015610fb6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fda9190612994565b90506000610fe88389612a49565b610ff28389612a62565b610ffc9085612a75565b6110069190612a27565b905061103081836110178680612a75565b6110219190612a75565b61102b9190612a27565b61234e565b61103a908a612a62565b935050505b509695505050505050565b6040516001600160a01b0380851660248301528316604482015260648101829052610cbd9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526124c7565b6040516370a0823160e01b81523060048201526111349083906001600160a01b038216906370a0823190602401602060405180830381865afa1580156110ff573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111239190612994565b6001600160a01b038516919061259e565b60405163226bf2d160e21b81526001600160a01b03828116600483015260009182918516906389afcb449060240160408051808303816000875af1158015611180573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111a49190612a8c565b915091506103e88210156111cb57604051632ca2f52b60e11b815260040160405180910390fd5b6103e8811015610cbd57604051632ca2f52b60e11b815260040160405180910390fd5b604051636eb1769f60e11b81523060048201526001600160a01b03828116602483015283169063dd62ed3e90604401602060405180830381865afa15801561123a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061125e9190612994565b600003610af457610af46001600160a01b038316826000196125ce565b60408051600180825281830190925260609160009190816020015b6040805160808101825260008082526020808301829052928201819052606082015282526000199092019101816112965790505090506040518060800160405280896001600160a01b03168152602001886001600160a01b031681526020018715158152602001866001600160a01b03168152508160008151811061131d5761131d6129c3565b602090810291909101015260405163cac88ea960e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063cac88ea99061137c908d908d9086908a908a90600401612ab0565b6000604051808303816000875af115801561139b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526113c39190810190612b52565b9a9950505050505050505050565b6000805b8251811015611609578281815181106113f0576113f06129c3565b60209081029190910101516040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015611440573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114649190612994565b915081156115f9577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168382815181106114a8576114a86129c3565b60200260200101516001600160a01b0316036115c257604051632e1a7d4d60e01b8152600481018390527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632e1a7d4d90602401600060405180830381600087803b15801561152057600080fd5b505af1158015611534573d6000803e3d6000fd5b50506040805160008082526020820192839052935033925085916115589190612c34565b60006040518083038185875af1925050503d8060008114611595576040519150601f19603f3d011682016040523d82523d6000602084013e61159a565b606091505b50509050806115bc57604051632727990760e21b815260040160405180910390fd5b506115f9565b6115f933838584815181106115d9576115d96129c3565b60200260200101516001600160a01b031661259e9092919063ffffffff16565b61160281612c50565b90506113d5565b505050565b60008061161a85610e6b565b915091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d4b6846d6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561167c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116a09190612949565b6001600160a01b0316816001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156116e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061170b9190612949565b6001600160a01b03161461173257604051633ec90a3f60e11b815260040160405180910390fd5b600080826001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa158015611773573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117979190612966565b50915091506103e88210806117ad57506103e881105b156117cb5760405163104eee4360e11b815260040160405180910390fd5b6000856001600160a01b0316846001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015611815573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118399190612949565b6001600160a01b03161490508015816118c55750856001600160a01b0316846001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015611895573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118b99190612949565b6001600160a01b031614155b156118e357604051635079ff7560e11b815260040160405180910390fd5b6040805160028082526060820183526000926020830190803683370190505090508681600081518110611918576119186129c3565b60200260200101906001600160a01b031690816001600160a01b031681525050816119a457846001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa15801561197b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061199f9190612949565b611a06565b846001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa1580156119e2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a069190612949565b81600181518110611a1957611a196129c3565b6001600160a01b0392831660209182029290920101526040516370a0823160e01b81523060048201526000918916906370a0823190602401602060405180830381865afa158015611a6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a929190612994565b905060008315611ae557611ade8783888887600081518110611ab657611ab66129c3565b602002602001015188600181518110611ad157611ad16129c3565b6020026020010151610eda565b9050611b02565b611aff8783878987600081518110611ab657611ab66129c3565b90505b611b1883600081518110610880576108806129c3565b6000611bf5828c86600081518110611b3257611b326129c3565b602002602001015187600181518110611b4d57611b4d6129c3565b60200260200101518c6001600160a01b03166322be3de16040518163ffffffff1660e01b8152600401602060405180830381865afa158015611b93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bb791906129d9565b8d6001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109f1573d6000803e3d6000fd5b9050611c0d84600181518110610880576108806129c3565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635a47ddc386600081518110611c5157611c516129c3565b602002602001015187600181518110611c6c57611c6c6129c3565b60200260200101518c6001600160a01b03166322be3de16040518163ffffffff1660e01b8152600401602060405180830381865afa158015611cb2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cd691906129d9565b86600081518110611ce957611ce96129c3565b602002602001015189611cfc9190612a62565b87600181518110611d0f57611d0f6129c3565b60209081029190910101516040516001600160e01b031960e088901b1681526001600160a01b039586166004820152949093166024850152901515604484015260648301526084820152600160a4820181905260c48201523060e482015242610104820152610124016060604051808303816000875af1158015611d97573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dbb9190612966565b92505050611dc9898b6111ee565b60405163b6b55f2560e01b8152600481018290526001600160a01b038b169063b6b55f2590602401600060405180830381600087803b158015611e0b57600080fd5b505af1158015611e1f573d6000803e3d6000fd5b50506040516370a0823160e01b8152306004820152611ea292503391506001600160a01b038d16906370a0823190602401602060405180830381865afa158015611e6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e919190612994565b6001600160a01b038d16919061259e565b611eab856113d1565b50505050505050505050505050565b6040516378a051ad60e11b8152600481018490526001600160a01b038381166024830152600091829188169063f140a35a90604401602060405180830381865afa158015611f0c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f309190612994565b90506000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663ce700c2987878c6001600160a01b03166322be3de16040518163ffffffff1660e01b8152600401602060405180830381865afa158015611fa4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fc891906129d9565b8d6001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015612006573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061202a9190612949565b60405160e086901b6001600160e01b03191681526001600160a01b039485166004820152928416602484015290151560448301529091166064820152608481018a905260a4810186905260c401606060405180830381865afa158015612094573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120b89190612966565b5091509150856001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156120fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061211f9190612c69565b61212a90600a612d70565b61213c83670de0b6b3a7640000612a75565b6121469190612a27565b9150846001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015612186573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121aa9190612c69565b6121b590600a612d70565b6121c782670de0b6b3a7640000612a75565b6121d19190612a27565b9050846001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015612211573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122359190612c69565b61224090600a612d70565b61225284670de0b6b3a7640000612a75565b61225c9190612a27565b9250856001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801561229c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122c09190612c69565b6122cb90600a612d70565b6122dd88670de0b6b3a7640000612a75565b6122e79190612a27565b9650600081838961230087670de0b6b3a7640000612a75565b61230a9190612a27565b6123149190612a75565b61231e9190612a27565b905061233281670de0b6b3a7640000612a49565b6123448a670de0b6b3a7640000612a75565b6113c39190612a27565b60008160000361236057506000919050565b816001600160801b82106123795760809190911c9060401b5b6801000000000000000082106123945760409190911c9060201b5b64010000000082106123ab5760209190911c9060101b5b6201000082106123c05760109190911c9060081b5b61010082106123d45760089190911c9060041b5b601082106123e75760049190911c9060021b5b600482106123f35760011b5b6001818581612404576124046129fb565b048201901c9050600181858161241c5761241c6129fb565b048201901c90506001818581612434576124346129fb565b048201901c9050600181858161244c5761244c6129fb565b048201901c90506001818581612464576124646129fb565b048201901c9050600181858161247c5761247c6129fb565b048201901c90506001818581612494576124946129fb565b048201901c905060008185816124ac576124ac6129fb565b0490508082106124bc57806124be565b815b95945050505050565b600061251c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166126e39092919063ffffffff16565b805190915015611609578080602001905181019061253a91906129d9565b6116095760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084015b60405180910390fd5b6040516001600160a01b03831660248201526044810182905261160990849063a9059cbb60e01b9060640161107e565b8015806126485750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015612622573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126469190612994565b155b6126b35760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401612595565b6040516001600160a01b03831660248201526044810182905261160990849063095ea7b360e01b9060640161107e565b60606126f284846000856126fc565b90505b9392505050565b60608247101561275d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401612595565b6001600160a01b0385163b6127b45760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401612595565b600080866001600160a01b031685876040516127d09190612c34565b60006040518083038185875af1925050503d806000811461280d576040519150601f19603f3d011682016040523d82523d6000602084013e612812565b606091505b509150915061282282828661282d565b979650505050505050565b6060831561283c5750816126f5565b82511561284c5782518084602001fd5b8160405162461bcd60e51b81526004016125959190612d7f565b634e487b7160e01b600052600160045260246000fd5b6001600160a01b038116811461289157600080fd5b50565b6000806000606084860312156128a957600080fd5b83356128b48161287c565b925060208401356128c48161287c565b929592945050506040919091013590565b600080600080608085870312156128eb57600080fd5b84356128f68161287c565b935060208501359250604085013561290d8161287c565b9396929550929360600135925050565b6000806040838503121561293057600080fd5b823561293b8161287c565b946020939093013593505050565b60006020828403121561295b57600080fd5b81516126f58161287c565b60008060006060848603121561297b57600080fd5b8351925060208401519150604084015190509250925092565b6000602082840312156129a657600080fd5b5051919050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6000602082840312156129eb57600080fd5b815180151581146126f557600080fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600082612a4457634e487b7160e01b600052601260045260246000fd5b500490565b80820180821115612a5c57612a5c612a11565b92915050565b81810381811115612a5c57612a5c612a11565b8082028115828204841417612a5c57612a5c612a11565b60008060408385031215612a9f57600080fd5b505080516020909101519092909150565b600060a0820187835260208781850152604060a08186015282885180855260c087019150838a01945060005b81811015612b2657855180516001600160a01b0390811685528682015181168786015285820151151586860152606091820151169084015294840194608090920191600101612adc565b50506001600160a01b03881660608701529350612b4292505050565b8260808301529695505050505050565b60006020808385031215612b6557600080fd5b825167ffffffffffffffff80821115612b7d57600080fd5b818501915085601f830112612b9157600080fd5b815181811115612ba357612ba36129ad565b8060051b604051601f19603f83011681018181108582111715612bc857612bc86129ad565b604052918252848201925083810185019188831115612be657600080fd5b938501935b82851015612c0457845184529385019392850192612beb565b98975050505050505050565b60005b83811015612c2b578181015183820152602001612c13565b50506000910152565b60008251612c46818460208701612c10565b9190910192915050565b600060018201612c6257612c62612a11565b5060010190565b600060208284031215612c7b57600080fd5b815160ff811681146126f557600080fd5b600181815b80851115612cc7578160001904821115612cad57612cad612a11565b80851615612cba57918102915b93841c9390800290612c91565b509250929050565b600082612cde57506001612a5c565b81612ceb57506000612a5c565b8160018114612d015760028114612d0b57612d27565b6001915050612a5c565b60ff841115612d1c57612d1c612a11565b50506001821b612a5c565b5060208310610133831016604e8410600b8410161715612d4a575081810a612a5c565b612d548383612c8c565b8060001904821115612d6857612d68612a11565b029392505050565b60006126f560ff841683612ccf565b6020815260008251806020840152612d9e816040850160208701612c10565b601f01601f1916919091016040019291505056fea26469706673582212202a9a5aa45459c2ceadb87aa0dc508c754c3e01cd1c5c01a927d73555bc0ab9bf64736f6c63430008130033000000000000000000000000a062ae8a9c5e11aaa026fc2670b0d65ccc8b28580000000000000000000000004200000000000000000000000000000000000006
Deployed Bytecode
0x6080604052600436106100745760003560e01c8063a28c361b1161004e578063a28c361b14610134578063ad5c464814610154578063f5d07b60146101a0578063f887ea40146101c057600080fd5b80633f2f869a146100b857806351c9cf911461010157806370fae20d1461012157600080fd5b366100b357336001600160a01b037f000000000000000000000000420000000000000000000000000000000000000616146100b1576100b1612866565b005b600080fd5b3480156100c457600080fd5b506100d86100d3366004612894565b6101f4565b6040805193845260208401929092526001600160a01b0316908201526060015b60405180910390f35b34801561010d57600080fd5b506100b161011c3660046128d5565b610612565b6100b161012f36600461291d565b610a32565b34801561014057600080fd5b506100b161014f36600461291d565b610af8565b34801561016057600080fd5b506101887f000000000000000000000000420000000000000000000000000000000000000681565b6040516001600160a01b0390911681526020016100f8565b3480156101ac57600080fd5b506100b16101bb3660046128d5565b610e28565b3480156101cc57600080fd5b506101887f000000000000000000000000a062ae8a9c5e11aaa026fc2670b0d65ccc8b285881565b60008060008061020387610e6b565b9150507f000000000000000000000000a062ae8a9c5e11aaa026fc2670b0d65ccc8b28586001600160a01b031663d4b6846d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610264573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102889190612949565b6001600160a01b0316816001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102f39190612949565b6001600160a01b03161461031a57604051633ec90a3f60e11b815260040160405180910390fd5b6000866001600160a01b0316826001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015610364573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103889190612949565b6001600160a01b03161490508015816104145750866001600160a01b0316826001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa1580156103e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104089190612949565b6001600160a01b031614155b1561043257604051635079ff7560e11b815260040160405180910390fd5b600080836001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa158015610473573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104979190612966565b5091509150826104a85780826104ab565b81815b90925090508261051c57836001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105179190612949565b61057e565b836001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa15801561055a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061057e9190612949565b945061058e848984848d8a610eda565b6040516378a051ad60e11b8152600481018290526001600160a01b038b811660248301529198509085169063f140a35a90604401602060405180830381865afa1580156105df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106039190612994565b95505050505093509350939050565b60008061061e86610e6b565b915091506000816001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015610662573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106869190612949565b90506000826001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ec9190612949565b9050856001600160a01b0316826001600160a01b0316141580156107225750856001600160a01b0316816001600160a01b031614155b1561074057604051635079ff7560e11b815260040160405180910390fd5b6107556001600160a01b03851633308a61104a565b604051632e1a7d4d60e01b8152600481018890526001600160a01b03851690632e1a7d4d90602401600060405180830381600087803b15801561079757600080fd5b505af11580156107ab573d6000803e3d6000fd5b505050506107b983306110b5565b6000866001600160a01b0316826001600160a01b0316146107da57816107dc565b825b60408051600280825260608201835292935060009290916020830190803683370190505090508181600081518110610816576108166129c3565b60200260200101906001600160a01b031690816001600160a01b031681525050878160018151811061084a5761084a6129c3565b60200260200101906001600160a01b031690816001600160a01b0316815250506108ae81600081518110610880576108806129c3565b60200260200101517f000000000000000000000000a062ae8a9c5e11aaa026fc2670b0d65ccc8b28586111ee565b6040516370a0823160e01b8152306004820152610a1c906001600160a01b038416906370a0823190602401602060405180830381865afa1580156108f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061091a9190612994565b888360008151811061092e5761092e6129c3565b602002602001015184600181518110610949576109496129c3565b6020026020010151896001600160a01b03166322be3de16040518163ffffffff1660e01b8152600401602060405180830381865afa15801561098f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b391906129d9565b8a6001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109f1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a159190612949565b304261127b565b50610a26816113d1565b50505050505050505050565b6103e8341015610a555760405163af5e173360e01b815260040160405180910390fd5b7f00000000000000000000000042000000000000000000000000000000000000066001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015610ab057600080fd5b505af1158015610ac4573d6000803e3d6000fd5b5050505050610af482827f000000000000000000000000420000000000000000000000000000000000000661160e565b5050565b600080610b0484610e6b565b9092509050610b1e6001600160a01b03851633308661104a565b604051632e1a7d4d60e01b8152600481018490526001600160a01b03831690632e1a7d4d90602401600060405180830381600087803b158015610b6057600080fd5b505af1158015610b74573d6000803e3d6000fd5b505050507f00000000000000000000000042000000000000000000000000000000000000066001600160a01b0316816001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015610be0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c049190612949565b6001600160a01b031614158015610cae57507f00000000000000000000000042000000000000000000000000000000000000066001600160a01b0316816001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c7e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ca29190612949565b6001600160a01b031614155b15610cc357610cbd81336110b5565b50505050565b610ccd81306110b5565b604080516002808252606082018352600092602083019080368337019050509050816001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d509190612949565b81600081518110610d6357610d636129c3565b60200260200101906001600160a01b031690816001600160a01b031681525050816001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610dc1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de59190612949565b81600181518110610df857610df86129c3565b60200260200101906001600160a01b031690816001600160a01b031681525050610e21816113d1565b5050505050565b6103e8811015610e4b5760405163af5e173360e01b815260040160405180910390fd5b610e606001600160a01b03831633308461104a565b610cbd84848461160e565b600080829150816001600160a01b0316631f1fcd516040518163ffffffff1660e01b8152600401602060405180830381865afa158015610eaf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed39190612949565b9050915091565b600080610ee8600288612a27565b9050876001600160a01b03166322be3de16040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f28573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f4c91906129d9565b15610f6557610f5e8888838787611eba565b915061103f565b6040516378a051ad60e11b8152600481018290526001600160a01b038581166024830152600091908a169063f140a35a90604401602060405180830381865afa158015610fb6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fda9190612994565b90506000610fe88389612a49565b610ff28389612a62565b610ffc9085612a75565b6110069190612a27565b905061103081836110178680612a75565b6110219190612a75565b61102b9190612a27565b61234e565b61103a908a612a62565b935050505b509695505050505050565b6040516001600160a01b0380851660248301528316604482015260648101829052610cbd9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526124c7565b6040516370a0823160e01b81523060048201526111349083906001600160a01b038216906370a0823190602401602060405180830381865afa1580156110ff573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111239190612994565b6001600160a01b038516919061259e565b60405163226bf2d160e21b81526001600160a01b03828116600483015260009182918516906389afcb449060240160408051808303816000875af1158015611180573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111a49190612a8c565b915091506103e88210156111cb57604051632ca2f52b60e11b815260040160405180910390fd5b6103e8811015610cbd57604051632ca2f52b60e11b815260040160405180910390fd5b604051636eb1769f60e11b81523060048201526001600160a01b03828116602483015283169063dd62ed3e90604401602060405180830381865afa15801561123a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061125e9190612994565b600003610af457610af46001600160a01b038316826000196125ce565b60408051600180825281830190925260609160009190816020015b6040805160808101825260008082526020808301829052928201819052606082015282526000199092019101816112965790505090506040518060800160405280896001600160a01b03168152602001886001600160a01b031681526020018715158152602001866001600160a01b03168152508160008151811061131d5761131d6129c3565b602090810291909101015260405163cac88ea960e01b81526001600160a01b037f000000000000000000000000a062ae8a9c5e11aaa026fc2670b0d65ccc8b2858169063cac88ea99061137c908d908d9086908a908a90600401612ab0565b6000604051808303816000875af115801561139b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526113c39190810190612b52565b9a9950505050505050505050565b6000805b8251811015611609578281815181106113f0576113f06129c3565b60209081029190910101516040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015611440573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114649190612994565b915081156115f9577f00000000000000000000000042000000000000000000000000000000000000066001600160a01b03168382815181106114a8576114a86129c3565b60200260200101516001600160a01b0316036115c257604051632e1a7d4d60e01b8152600481018390527f00000000000000000000000042000000000000000000000000000000000000066001600160a01b031690632e1a7d4d90602401600060405180830381600087803b15801561152057600080fd5b505af1158015611534573d6000803e3d6000fd5b50506040805160008082526020820192839052935033925085916115589190612c34565b60006040518083038185875af1925050503d8060008114611595576040519150601f19603f3d011682016040523d82523d6000602084013e61159a565b606091505b50509050806115bc57604051632727990760e21b815260040160405180910390fd5b506115f9565b6115f933838584815181106115d9576115d96129c3565b60200260200101516001600160a01b031661259e9092919063ffffffff16565b61160281612c50565b90506113d5565b505050565b60008061161a85610e6b565b915091507f000000000000000000000000a062ae8a9c5e11aaa026fc2670b0d65ccc8b28586001600160a01b031663d4b6846d6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561167c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116a09190612949565b6001600160a01b0316816001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156116e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061170b9190612949565b6001600160a01b03161461173257604051633ec90a3f60e11b815260040160405180910390fd5b600080826001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa158015611773573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117979190612966565b50915091506103e88210806117ad57506103e881105b156117cb5760405163104eee4360e11b815260040160405180910390fd5b6000856001600160a01b0316846001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015611815573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118399190612949565b6001600160a01b03161490508015816118c55750856001600160a01b0316846001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015611895573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118b99190612949565b6001600160a01b031614155b156118e357604051635079ff7560e11b815260040160405180910390fd5b6040805160028082526060820183526000926020830190803683370190505090508681600081518110611918576119186129c3565b60200260200101906001600160a01b031690816001600160a01b031681525050816119a457846001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa15801561197b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061199f9190612949565b611a06565b846001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa1580156119e2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a069190612949565b81600181518110611a1957611a196129c3565b6001600160a01b0392831660209182029290920101526040516370a0823160e01b81523060048201526000918916906370a0823190602401602060405180830381865afa158015611a6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a929190612994565b905060008315611ae557611ade8783888887600081518110611ab657611ab66129c3565b602002602001015188600181518110611ad157611ad16129c3565b6020026020010151610eda565b9050611b02565b611aff8783878987600081518110611ab657611ab66129c3565b90505b611b1883600081518110610880576108806129c3565b6000611bf5828c86600081518110611b3257611b326129c3565b602002602001015187600181518110611b4d57611b4d6129c3565b60200260200101518c6001600160a01b03166322be3de16040518163ffffffff1660e01b8152600401602060405180830381865afa158015611b93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bb791906129d9565b8d6001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109f1573d6000803e3d6000fd5b9050611c0d84600181518110610880576108806129c3565b60007f000000000000000000000000a062ae8a9c5e11aaa026fc2670b0d65ccc8b28586001600160a01b0316635a47ddc386600081518110611c5157611c516129c3565b602002602001015187600181518110611c6c57611c6c6129c3565b60200260200101518c6001600160a01b03166322be3de16040518163ffffffff1660e01b8152600401602060405180830381865afa158015611cb2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cd691906129d9565b86600081518110611ce957611ce96129c3565b602002602001015189611cfc9190612a62565b87600181518110611d0f57611d0f6129c3565b60209081029190910101516040516001600160e01b031960e088901b1681526001600160a01b039586166004820152949093166024850152901515604484015260648301526084820152600160a4820181905260c48201523060e482015242610104820152610124016060604051808303816000875af1158015611d97573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dbb9190612966565b92505050611dc9898b6111ee565b60405163b6b55f2560e01b8152600481018290526001600160a01b038b169063b6b55f2590602401600060405180830381600087803b158015611e0b57600080fd5b505af1158015611e1f573d6000803e3d6000fd5b50506040516370a0823160e01b8152306004820152611ea292503391506001600160a01b038d16906370a0823190602401602060405180830381865afa158015611e6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e919190612994565b6001600160a01b038d16919061259e565b611eab856113d1565b50505050505050505050505050565b6040516378a051ad60e11b8152600481018490526001600160a01b038381166024830152600091829188169063f140a35a90604401602060405180830381865afa158015611f0c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f309190612994565b90506000807f000000000000000000000000a062ae8a9c5e11aaa026fc2670b0d65ccc8b28586001600160a01b031663ce700c2987878c6001600160a01b03166322be3de16040518163ffffffff1660e01b8152600401602060405180830381865afa158015611fa4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fc891906129d9565b8d6001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015612006573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061202a9190612949565b60405160e086901b6001600160e01b03191681526001600160a01b039485166004820152928416602484015290151560448301529091166064820152608481018a905260a4810186905260c401606060405180830381865afa158015612094573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120b89190612966565b5091509150856001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156120fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061211f9190612c69565b61212a90600a612d70565b61213c83670de0b6b3a7640000612a75565b6121469190612a27565b9150846001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015612186573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121aa9190612c69565b6121b590600a612d70565b6121c782670de0b6b3a7640000612a75565b6121d19190612a27565b9050846001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015612211573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122359190612c69565b61224090600a612d70565b61225284670de0b6b3a7640000612a75565b61225c9190612a27565b9250856001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801561229c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122c09190612c69565b6122cb90600a612d70565b6122dd88670de0b6b3a7640000612a75565b6122e79190612a27565b9650600081838961230087670de0b6b3a7640000612a75565b61230a9190612a27565b6123149190612a75565b61231e9190612a27565b905061233281670de0b6b3a7640000612a49565b6123448a670de0b6b3a7640000612a75565b6113c39190612a27565b60008160000361236057506000919050565b816001600160801b82106123795760809190911c9060401b5b6801000000000000000082106123945760409190911c9060201b5b64010000000082106123ab5760209190911c9060101b5b6201000082106123c05760109190911c9060081b5b61010082106123d45760089190911c9060041b5b601082106123e75760049190911c9060021b5b600482106123f35760011b5b6001818581612404576124046129fb565b048201901c9050600181858161241c5761241c6129fb565b048201901c90506001818581612434576124346129fb565b048201901c9050600181858161244c5761244c6129fb565b048201901c90506001818581612464576124646129fb565b048201901c9050600181858161247c5761247c6129fb565b048201901c90506001818581612494576124946129fb565b048201901c905060008185816124ac576124ac6129fb565b0490508082106124bc57806124be565b815b95945050505050565b600061251c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166126e39092919063ffffffff16565b805190915015611609578080602001905181019061253a91906129d9565b6116095760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084015b60405180910390fd5b6040516001600160a01b03831660248201526044810182905261160990849063a9059cbb60e01b9060640161107e565b8015806126485750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015612622573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126469190612994565b155b6126b35760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401612595565b6040516001600160a01b03831660248201526044810182905261160990849063095ea7b360e01b9060640161107e565b60606126f284846000856126fc565b90505b9392505050565b60608247101561275d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401612595565b6001600160a01b0385163b6127b45760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401612595565b600080866001600160a01b031685876040516127d09190612c34565b60006040518083038185875af1925050503d806000811461280d576040519150601f19603f3d011682016040523d82523d6000602084013e612812565b606091505b509150915061282282828661282d565b979650505050505050565b6060831561283c5750816126f5565b82511561284c5782518084602001fd5b8160405162461bcd60e51b81526004016125959190612d7f565b634e487b7160e01b600052600160045260246000fd5b6001600160a01b038116811461289157600080fd5b50565b6000806000606084860312156128a957600080fd5b83356128b48161287c565b925060208401356128c48161287c565b929592945050506040919091013590565b600080600080608085870312156128eb57600080fd5b84356128f68161287c565b935060208501359250604085013561290d8161287c565b9396929550929360600135925050565b6000806040838503121561293057600080fd5b823561293b8161287c565b946020939093013593505050565b60006020828403121561295b57600080fd5b81516126f58161287c565b60008060006060848603121561297b57600080fd5b8351925060208401519150604084015190509250925092565b6000602082840312156129a657600080fd5b5051919050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6000602082840312156129eb57600080fd5b815180151581146126f557600080fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600082612a4457634e487b7160e01b600052601260045260246000fd5b500490565b80820180821115612a5c57612a5c612a11565b92915050565b81810381811115612a5c57612a5c612a11565b8082028115828204841417612a5c57612a5c612a11565b60008060408385031215612a9f57600080fd5b505080516020909101519092909150565b600060a0820187835260208781850152604060a08186015282885180855260c087019150838a01945060005b81811015612b2657855180516001600160a01b0390811685528682015181168786015285820151151586860152606091820151169084015294840194608090920191600101612adc565b50506001600160a01b03881660608701529350612b4292505050565b8260808301529695505050505050565b60006020808385031215612b6557600080fd5b825167ffffffffffffffff80821115612b7d57600080fd5b818501915085601f830112612b9157600080fd5b815181811115612ba357612ba36129ad565b8060051b604051601f19603f83011681018181108582111715612bc857612bc86129ad565b604052918252848201925083810185019188831115612be657600080fd5b938501935b82851015612c0457845184529385019392850192612beb565b98975050505050505050565b60005b83811015612c2b578181015183820152602001612c13565b50506000910152565b60008251612c46818460208701612c10565b9190910192915050565b600060018201612c6257612c62612a11565b5060010190565b600060208284031215612c7b57600080fd5b815160ff811681146126f557600080fd5b600181815b80851115612cc7578160001904821115612cad57612cad612a11565b80851615612cba57918102915b93841c9390800290612c91565b509250929050565b600082612cde57506001612a5c565b81612ceb57506000612a5c565b8160018114612d015760028114612d0b57612d27565b6001915050612a5c565b60ff841115612d1c57612d1c612a11565b50506001821b612a5c565b5060208310610133831016604e8410600b8410161715612d4a575081810a612a5c565b612d548383612c8c565b8060001904821115612d6857612d68612a11565b029392505050565b60006126f560ff841683612ccf565b6020815260008251806020840152612d9e816040850160208701612c10565b601f01601f1916919091016040019291505056fea26469706673582212202a9a5aa45459c2ceadb87aa0dc508c754c3e01cd1c5c01a927d73555bc0ab9bf64736f6c63430008130033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000a062ae8a9c5e11aaa026fc2670b0d65ccc8b28580000000000000000000000004200000000000000000000000000000000000006
-----Decoded View---------------
Arg [0] : _router (address): 0xa062aE8A9c5e11aaA026fc2670B0D65cCc8B2858
Arg [1] : _WETH (address): 0x4200000000000000000000000000000000000006
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000a062ae8a9c5e11aaa026fc2670b0d65ccc8b2858
Arg [1] : 0000000000000000000000004200000000000000000000000000000000000006
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ 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.