More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 2,039 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Beef In | 38382144 | 384 days ago | IN | 0 AVAX | 0.01880911 | ||||
Beef In | 38381333 | 384 days ago | IN | 0 AVAX | 0.03151901 | ||||
Beef Out And Swa... | 38381018 | 384 days ago | IN | 0 AVAX | 0.01736479 | ||||
Beef Out And Swa... | 38381004 | 384 days ago | IN | 0 AVAX | 0.02144263 | ||||
Beef Out And Swa... | 38369193 | 384 days ago | IN | 0 AVAX | 0.0258504 | ||||
Beef Out And Swa... | 38368338 | 384 days ago | IN | 0 AVAX | 0.01561021 | ||||
Beef Out And Swa... | 38365343 | 384 days ago | IN | 0 AVAX | 0.01557956 | ||||
Beef In | 38361665 | 384 days ago | IN | 0 AVAX | 0.01557195 | ||||
Beef Out And Swa... | 38345404 | 385 days ago | IN | 0 AVAX | 0.01732855 | ||||
Beef In | 38325598 | 385 days ago | IN | 0 AVAX | 0.0207376 | ||||
Beef In | 38314879 | 385 days ago | IN | 0 AVAX | 0.01868828 | ||||
Beef Out And Swa... | 38314798 | 385 days ago | IN | 0 AVAX | 0.0151046 | ||||
Beef Out And Swa... | 38308159 | 386 days ago | IN | 0 AVAX | 0.01486872 | ||||
Beef In | 38300901 | 386 days ago | IN | 0 AVAX | 0.02291289 | ||||
Beef In | 38291169 | 386 days ago | IN | 0 AVAX | 0.01954911 | ||||
Beef In | 38290739 | 386 days ago | IN | 0 AVAX | 0.01935944 | ||||
Beef In | 38284324 | 386 days ago | IN | 0 AVAX | 0.02061703 | ||||
Beef In | 38282761 | 386 days ago | IN | 0 AVAX | 0.02942218 | ||||
Beef Out And Swa... | 38278785 | 386 days ago | IN | 0 AVAX | 0.01690556 | ||||
Beef Out And Swa... | 38272851 | 386 days ago | IN | 0 AVAX | 0.02409052 | ||||
Beef Out And Swa... | 38267451 | 387 days ago | IN | 0 AVAX | 0.02505201 | ||||
Beef Out And Swa... | 38267332 | 387 days ago | IN | 0 AVAX | 0.02551377 | ||||
Beef Out And Swa... | 38260341 | 387 days ago | IN | 0 AVAX | 0.01575483 | ||||
Beef Out And Swa... | 38260316 | 387 days ago | IN | 0 AVAX | 0.01200004 | ||||
Beef Out And Swa... | 38259484 | 387 days ago | IN | 0 AVAX | 0.01528729 |
Latest 25 internal transactions (View All)
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
38369193 | 384 days ago | 58.18420705 AVAX | ||||
38369193 | 384 days ago | 58.18420705 AVAX | ||||
38365343 | 384 days ago | 19.19875076 AVAX | ||||
38365343 | 384 days ago | 19.19875076 AVAX | ||||
38361665 | 384 days ago | 0.00023004 AVAX | ||||
38361665 | 384 days ago | 0.00023004 AVAX | ||||
38345404 | 385 days ago | 79.78526485 AVAX | ||||
38345404 | 385 days ago | 79.78526485 AVAX | ||||
38325598 | 385 days ago | 0.00192695 AVAX | ||||
38325598 | 385 days ago | 0.00192695 AVAX | ||||
38308159 | 386 days ago | 3.14788573 AVAX | ||||
38308159 | 386 days ago | 3.14788573 AVAX | ||||
38291169 | 386 days ago | 0.0000425 AVAX | ||||
38291169 | 386 days ago | 0.0000425 AVAX | ||||
38290739 | 386 days ago | 0.00035595 AVAX | ||||
38290739 | 386 days ago | 0.00035595 AVAX | ||||
38284324 | 386 days ago | 0.00991282 AVAX | ||||
38284324 | 386 days ago | 0.00991282 AVAX | ||||
38278785 | 386 days ago | 72.15443486 AVAX | ||||
38278785 | 386 days ago | 72.15443486 AVAX | ||||
38267451 | 387 days ago | 2.67702463 AVAX | ||||
38267451 | 387 days ago | 2.67702463 AVAX | ||||
38267332 | 387 days ago | 64.33950879 AVAX | ||||
38267332 | 387 days ago | 64.33950879 AVAX | ||||
38260341 | 387 days ago | 14.77387114 AVAX |
Loading...
Loading
Contract Name:
BeefyZapOneInch
Compiler Version
v0.8.15+commit.e14f2714
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.0; import "@openzeppelin-4/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin-4/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin-4/contracts/utils/math/Math.sol"; import "../interfaces/common/IUniswapRouterETH.sol"; import "../interfaces/common/IUniswapV2Pair.sol"; import "../interfaces/common/ISolidlyPair.sol"; import "../interfaces/common/ISolidlyRouter.sol"; import "./zapInterfaces/IWETH.sol"; import "./zapInterfaces/IBeefyVault.sol"; import "./zapInterfaces/IStrategy.sol"; import "./zapInterfaces/IERC20Extended.sol"; // Aggregator Zap compatible with all single asset, uniswapv2, and solidly router Beefy Vaults. contract BeefyZapOneInch { using SafeERC20 for IERC20; using SafeERC20 for IBeefyVault; // needed addresses for zap address public immutable oneInchRouter; address public immutable WETH; uint256 public constant minimumAmount = 1000; enum WantType { WANT_TYPE_SINGLE, WANT_TYPE_UNISWAP_V2, WANT_TYPE_SOLIDLY_STABLE, WANT_TYPE_SOLIDLY_VOLATILE } event TokenReturned(address token, uint256 amount); event ZapIn(address vault, address tokenIn, uint256 amountIn); event ZapOut(address vault, address desiredToken, uint256 mooTokenIn); constructor(address _oneInchRouter, address _WETH) { // Safety checks to ensure WETH token address IWETH(_WETH).deposit{value: 0}(); IWETH(_WETH).withdraw(0); WETH = _WETH; oneInchRouter = _oneInchRouter; } // Zap's main functions external and public functions function beefInETH (address _beefyVault, bytes calldata _token0, bytes calldata _token1, WantType _type) external payable { require(msg.value >= minimumAmount, 'Beefy: Insignificant input amount'); IWETH(WETH).deposit{value: msg.value}(); _swapAndStake(_beefyVault, WETH, WETH, _token0, _token1, _type); emit ZapIn(_beefyVault, WETH, msg.value); } function beefIn (address _beefyVault, address _inputToken, uint256 _tokenInAmount, bytes calldata _token0, bytes calldata _token1, WantType _type) public { require(_tokenInAmount >= minimumAmount, 'Beefy: Insignificant input amount'); IERC20(_inputToken).safeTransferFrom(msg.sender, address(this), _tokenInAmount); _swapAndStake(_beefyVault, _inputToken, _inputToken, _token0, _token1, _type); emit ZapIn(_beefyVault, _inputToken, _tokenInAmount); } function beefOut (address _beefyVault, uint256 _withdrawAmount) external { address[] memory tokens = _beefOut(_beefyVault, _withdrawAmount); _returnAssets(tokens); } function beefOutAndSwap(address _beefyVault, uint256 _withdrawAmount, address _desiredToken, bytes calldata _dataToken0, bytes calldata _dataToken1, WantType _type) external { (IBeefyVault vault, IUniswapV2Pair pair) = _getVaultPair(_beefyVault); vault.safeTransferFrom(msg.sender, address(this), _withdrawAmount); vault.withdraw(_withdrawAmount); emit ZapOut(_beefyVault, _desiredToken, _withdrawAmount); if (_type != WantType.WANT_TYPE_SINGLE) { _removeLiquidity(address(pair), address(this)); address[] memory path = new address[](3); path[0] = pair.token0(); path[1] = pair.token1(); path[2] = _desiredToken; _approveTokenIfNeeded(path[0], address(oneInchRouter)); _approveTokenIfNeeded(path[1], address(oneInchRouter)); if (_desiredToken != path[0]) { _swapViaOneInch(path[0], _dataToken0); } if (_desiredToken != path[1]) { _swapViaOneInch(path[1], _dataToken1); } _returnAssets(path); } else { address[] memory path = new address[](2); path[0] = vault.want(); path[1] = _desiredToken; _approveTokenIfNeeded(path[0], address(oneInchRouter)); _swapViaOneInch(path[0], _dataToken0); _returnAssets(path); } } // Zap out funds from the 'fromMooVault', swap whats needed to swap and reinvest into the 'toMooVault'. function beefOutAndReInvest( address _fromMooVault, address _toMooVault, uint256 _mooTokenAmount, bytes calldata _token0ToFrom, bytes calldata _token1ToFrom, WantType _fromType, WantType _toType ) external { (IBeefyVault vault, IUniswapV2Pair pair) = _getVaultPair(_fromMooVault); address token0; address token1; if (_fromType != WantType.WANT_TYPE_SINGLE) { _beefOut(_fromMooVault, _mooTokenAmount); token0 = pair.token0(); token1 = pair.token1(); if (_toType != WantType.WANT_TYPE_SINGLE) { _swapAndStake(_toMooVault, token0, token1, _token0ToFrom, _token1ToFrom, _toType); } else { _swapAndStake(_toMooVault, token0, _token0ToFrom); _swapAndStake(_toMooVault, token1, _token1ToFrom); } } else { vault.safeTransferFrom(msg.sender, address(this), _mooTokenAmount); vault.withdraw(_mooTokenAmount); token0 = vault.want(); token1 = token0; _toType == WantType.WANT_TYPE_SINGLE ? _swapAndStake(_toMooVault, token0, _token0ToFrom) : _swapAndStake(_toMooVault, token0, token1, _token0ToFrom, _token1ToFrom, _toType); } } // View function helpers for the app // Since solidly stable pairs can be inbalanced we need the proper ratio for our swap, we need to accound both for price of the assets and the ratio of the pair. function quoteStableAddLiquidityRatio(address _beefyVault) external view returns (uint256 ratio1to0) { (IBeefyVault vault, IUniswapV2Pair pairAddress) = _getVaultPair(_beefyVault); ISolidlyPair pair = ISolidlyPair(address(pairAddress)); address tokenA = pair.token0(); address tokenB = pair.token1(); uint256 investment = IERC20(tokenA).balanceOf(address(pair)) * 10 / 10000; uint out = pair.getAmountOut(investment, tokenA); ISolidlyRouter router = ISolidlyRouter(IStrategy(vault.strategy()).unirouter()); (uint amountA, uint amountB,) = router.quoteAddLiquidity(tokenA, tokenB, pair.stable(), investment, out); amountA = amountA * 1e18 / 10**IERC20Extended(tokenA).decimals(); amountB = amountB * 1e18 / 10**IERC20Extended(tokenB).decimals(); out = out * 1e18 / 10**IERC20Extended(tokenB).decimals(); investment = investment * 1e18 / 10**IERC20Extended(tokenA).decimals(); uint ratio = out * 1e18 / investment * amountA / amountB; return 1e18 * 1e18 / (ratio + 1e18); } // Internal functions function _beefOut (address _beefyVault, uint256 _withdrawAmount) private returns (address[] memory tokens) { (IBeefyVault vault, IUniswapV2Pair pair) = _getVaultPair(_beefyVault); IERC20(_beefyVault).safeTransferFrom(msg.sender, address(this), _withdrawAmount); vault.withdraw(_withdrawAmount); _removeLiquidity(address(pair), address(this)); tokens = new address[](2); tokens[0] = pair.token0(); tokens[1] = pair.token1(); emit ZapOut(_beefyVault, address(pair), _withdrawAmount); } function _removeLiquidity(address _pair, address _to) private { IERC20(_pair).safeTransfer(_pair, IERC20(_pair).balanceOf(address(this))); (uint256 amount0, uint256 amount1) = IUniswapV2Pair(_pair).burn(_to); require(amount0 >= minimumAmount, 'UniswapV2Router: INSUFFICIENT_A_AMOUNT'); require(amount1 >= minimumAmount, 'UniswapV2Router: INSUFFICIENT_B_AMOUNT'); } function _getVaultPair (address _beefyVault) private pure returns (IBeefyVault vault, IUniswapV2Pair pair) { vault = IBeefyVault(_beefyVault); try vault.want() returns (address pairAddress) { pair = IUniswapV2Pair(pairAddress); // Vault V6 } catch { pair = IUniswapV2Pair(vault.token()); // Vault V5 } } function _swapAndStake(address _vault, address _inputToken, bytes calldata _token0) private { IBeefyVault vault = IBeefyVault(_vault); address[] memory path; path = new address[](2); path[0] = vault.want(); path[1] = _inputToken; _swapViaOneInch(_inputToken, _token0); uint256 bal = IERC20(path[0]).balanceOf(address(this)); _approveTokenIfNeeded(path[0], address(vault)); vault.deposit(bal); vault.safeTransfer(msg.sender, vault.balanceOf(address(this))); _returnAssets(path); } function _swapAndStake(address _beefyVault, address _inputToken0, address _inputToken1, bytes calldata _token0, bytes calldata _token1, WantType _type) private { (IBeefyVault vault, IUniswapV2Pair pair) = _getVaultPair(_beefyVault); if (_type != WantType.WANT_TYPE_SINGLE) { address[] memory path; if (_inputToken0 == _inputToken1) { path = new address[](3); path[0] = pair.token0(); path[1] = pair.token1(); path[2] = _inputToken0; } else { path = new address[](4); path[0] = pair.token0(); path[1] = pair.token1(); path[2] = _inputToken0; path[3] = _inputToken1; } if (_inputToken0 != path[0]) { _swapViaOneInch(_inputToken0, _token0); } if (_inputToken1 != path[1]) { _swapViaOneInch(_inputToken1, _token1); } address router = IStrategy(vault.strategy()).unirouter(); _approveTokenIfNeeded(path[0], address(router)); _approveTokenIfNeeded(path[1], address(router)); uint256 lp0Amt = IERC20(path[0]).balanceOf(address(this)); uint256 lp1Amt = IERC20(path[1]).balanceOf(address(this)); uint256 amountLiquidity; uint256 actual0; uint256 actual1; if (_type == WantType.WANT_TYPE_SOLIDLY_STABLE || _type == WantType.WANT_TYPE_SOLIDLY_VOLATILE) { bool stable = _type == WantType.WANT_TYPE_SOLIDLY_STABLE ? true : false; (actual0, actual1, amountLiquidity) = ISolidlyRouter(router) .addLiquidity(path[0], path[1], stable, lp0Amt, lp1Amt, 1, 1, address(this), block.timestamp); } else { (actual0, actual1, amountLiquidity) = IUniswapRouterETH(router) .addLiquidity(path[0], path[1], lp0Amt, lp1Amt, 1, 1, address(this), block.timestamp); } _checkDeviation(lp0Amt, lp1Amt, actual0, actual1); _approveTokenIfNeeded(address(pair), address(vault)); vault.deposit(amountLiquidity); vault.safeTransfer(msg.sender, vault.balanceOf(address(this))); _returnAssets(path); } else { _swapAndStake(_beefyVault, _inputToken0, _token0); } } function _checkDeviation(uint256 _input0, uint256 _input1, uint256 _actual0, uint256 _actual1) private pure { uint256 allowed0 = _input0 * .99 ether / 1 ether; uint256 allowed1 = _input1 * .99 ether / 1 ether; require( _actual0 >= allowed0 && _actual1 >= allowed1, "too much deviation" ); } // our main swap function call. we call the aggregator contract with our fed data. if we get an error we revert and return the error result. function _swapViaOneInch(address _inputToken, bytes memory _callData) private { _approveTokenIfNeeded(_inputToken, address(oneInchRouter)); (bool success, bytes memory retData) = oneInchRouter.call(_callData); propagateError(success, retData, "1inch"); require(success == true, "calling 1inch got an error"); } 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)); require(success, 'Beefy: ETH transfer failed'); emit TokenReturned(_tokens[i], balance); } else { IERC20(_tokens[i]).safeTransfer(msg.sender, balance); emit TokenReturned(_tokens[i], balance); } } } } function _approveTokenIfNeeded(address _token, address _spender) private { if (IERC20(_token).allowance(address(this), _spender) == 0) { IERC20(_token).safeApprove(_spender, type(uint).max); } } // Error reporting from our call to the aggrator contract when we try to swap. function propagateError( bool success, bytes memory data, string memory errorMessage ) public pure { // Forward error message from call/delegatecall if (!success) { if (data.length == 0) revert(errorMessage); assembly { revert(add(32, data), mload(data)) } } } receive() external payable { assert(msg.sender == WETH); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.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.openzeppelin.com/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; // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by // decrementing then incrementing. _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; unchecked { // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above. _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; // Overflow not possible: amount <= accountBalance <= totalSupply. _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.8.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.8.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 functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts 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 // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10**64) { value /= 10**64; result += 64; } if (value >= 10**32) { value /= 10**32; result += 32; } if (value >= 10**16) { value /= 10**16; result += 16; } if (value >= 10**8) { value /= 10**8; result += 8; } if (value >= 10**4) { value /= 10**4; result += 4; } if (value >= 10**2) { value /= 10**2; result += 2; } if (value >= 10**1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.9.0; interface ISolidlyPair { function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function burn(address to) external returns (uint amount0, uint amount1); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function stable() external view returns (bool); function getAmountOut(uint256 amountIn, address tokenIn) external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.9.0; pragma experimental ABIEncoderV2; interface ISolidlyRouter { // Routes struct Routes { address from; address to; bool stable; } function addLiquidity( address tokenA, address tokenB, bool stable, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB, uint liquidity); function addLiquidityETH( address token, bool stable, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); function removeLiquidity( address tokenA, address tokenB, bool stable, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB); function removeLiquidityETH( address token, bool stable, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountToken, uint amountETH); function swapExactTokensForTokensSimple( uint amountIn, uint amountOutMin, address tokenFrom, address tokenTo, bool stable, address to, uint deadline ) external returns (uint[] memory amounts); function swapExactTokensForTokens( uint amountIn, uint amountOutMin, Routes[] memory route, address to, uint deadline ) external returns (uint[] memory amounts); function getAmountOut(uint amountIn, address tokenIn, address tokenOut) external view returns (uint amount, bool stable); function getAmountsOut(uint amountIn, Routes[] memory routes) external view returns (uint[] memory amounts); function quoteAddLiquidity( address tokenA, address tokenB, bool stable, uint amountADesired, uint amountBDesired ) external view returns (uint amountA, uint amountB, uint liquidity); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.9.0; interface IUniswapRouterETH { function addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB, uint liquidity); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); function removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB); function removeLiquidityETH( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountToken, uint amountETH); function swapExactTokensForTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.9.0; interface IUniswapV2Pair { function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function burn(address to) external returns (uint amount0, uint amount1); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function totalSupply() external view returns (uint256); function kLast() external view returns (uint256); }
// 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; interface IERC20Extended { function decimals() external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IStrategy { function withdrawalFee() external view returns (uint256); function unirouter() external view 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":"_oneInchRouter","type":"address"},{"internalType":"address","name":"_WETH","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TokenReturned","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"vault","type":"address"},{"indexed":false,"internalType":"address","name":"tokenIn","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"}],"name":"ZapIn","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"vault","type":"address"},{"indexed":false,"internalType":"address","name":"desiredToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"mooTokenIn","type":"uint256"}],"name":"ZapOut","type":"event"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_beefyVault","type":"address"},{"internalType":"address","name":"_inputToken","type":"address"},{"internalType":"uint256","name":"_tokenInAmount","type":"uint256"},{"internalType":"bytes","name":"_token0","type":"bytes"},{"internalType":"bytes","name":"_token1","type":"bytes"},{"internalType":"enum BeefyZapOneInch.WantType","name":"_type","type":"uint8"}],"name":"beefIn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_beefyVault","type":"address"},{"internalType":"bytes","name":"_token0","type":"bytes"},{"internalType":"bytes","name":"_token1","type":"bytes"},{"internalType":"enum BeefyZapOneInch.WantType","name":"_type","type":"uint8"}],"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":"_fromMooVault","type":"address"},{"internalType":"address","name":"_toMooVault","type":"address"},{"internalType":"uint256","name":"_mooTokenAmount","type":"uint256"},{"internalType":"bytes","name":"_token0ToFrom","type":"bytes"},{"internalType":"bytes","name":"_token1ToFrom","type":"bytes"},{"internalType":"enum BeefyZapOneInch.WantType","name":"_fromType","type":"uint8"},{"internalType":"enum BeefyZapOneInch.WantType","name":"_toType","type":"uint8"}],"name":"beefOutAndReInvest","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":"bytes","name":"_dataToken0","type":"bytes"},{"internalType":"bytes","name":"_dataToken1","type":"bytes"},{"internalType":"enum BeefyZapOneInch.WantType","name":"_type","type":"uint8"}],"name":"beefOutAndSwap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"minimumAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oneInchRouter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"string","name":"errorMessage","type":"string"}],"name":"propagateError","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_beefyVault","type":"address"}],"name":"quoteStableAddLiquidityRatio","outputs":[{"internalType":"uint256","name":"ratio1to0","type":"uint256"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60c06040523480156200001157600080fd5b50604051620036943803806200369483398101604081905262000034916200011d565b806001600160a01b031663d0e30db060006040518263ffffffff1660e01b81526004016000604051808303818588803b1580156200007157600080fd5b505af115801562000086573d6000803e3d6000fd5b5050604051632e1a7d4d60e01b8152600060048201526001600160a01b0385169350632e1a7d4d92506024019050600060405180830381600087803b158015620000cf57600080fd5b505af1158015620000e4573d6000803e3d6000fd5b5050506001600160a01b0391821660a052501660805262000155565b80516001600160a01b03811681146200011857600080fd5b919050565b600080604083850312156200013157600080fd5b6200013c8362000100565b91506200014c6020840162000100565b90509250929050565b60805160a0516134d4620001c06000396000818160a5015281816101dd01528181610b2c01528181610ba401528181610bc501528181610c12015281816122ab015261231101526000818161019101528181610f1c0152818161279001526127b901526134d46000f3fe6080604052600436106100955760003560e01c8063ac3af20811610059578063ac3af2081461017f578063ad5c4648146101cb578063bb0c8298146101ff578063d2e7795b14610215578063e4fd396e1461023557600080fd5b806337d9c96a146100d957806366a8a8d31461010c57806389a2af821461012c57806393cf97f81461013f578063a28c361b1461015f57600080fd5b366100d457336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146100d2576100d2612d02565b005b600080fd5b3480156100e557600080fd5b506100f96100f4366004612d30565b610255565b6040519081526020015b60405180910390f35b34801561011857600080fd5b506100d2610127366004612db1565b6108a0565b6100d261013a366004612e70565b610aff565b34801561014b57600080fd5b506100d261015a366004612f9c565b610c51565b34801561016b57600080fd5b506100d261017a36600461303d565b610c86565b34801561018b57600080fd5b506101b37f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610103565b3480156101d757600080fd5b506101b37f000000000000000000000000000000000000000000000000000000000000000081565b34801561020b57600080fd5b506100f96103e881565b34801561022157600080fd5b506100d2610230366004613069565b610c9d565b34801561024157600080fd5b506100d2610250366004613118565b6111ac565b600080600061026384611238565b9150915060008190506000816001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102d09190613173565b90506000826001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610312573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103369190613173565b6040516370a0823160e01b81526001600160a01b03858116600483015291925060009161271091908516906370a0823190602401602060405180830381865afa158015610387573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ab9190613190565b6103b690600a6131bf565b6103c091906131de565b6040516378a051ad60e11b8152600481018290526001600160a01b03858116602483015291925060009186169063f140a35a90604401602060405180830381865afa158015610413573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104379190613190565b90506000876001600160a01b031663a8c62e766040518163ffffffff1660e01b8152600401602060405180830381865afa158015610479573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061049d9190613173565b6001600160a01b031663257ae0de6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104fe9190613173565b9050600080826001600160a01b03166398a0fb3c88888b6001600160a01b03166322be3de16040518163ffffffff1660e01b8152600401602060405180830381865afa158015610552573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105769190613200565b6040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015215156044820152606481018890526084810187905260a401606060405180830381865afa1580156105d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105fc919061321d565b5091509150866001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801561063f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106639190613190565b61066e90600a613331565b61068083670de0b6b3a76400006131bf565b61068a91906131de565b9150856001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ee9190613190565b6106f990600a613331565b61070b82670de0b6b3a76400006131bf565b61071591906131de565b9050856001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610755573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107799190613190565b61078490600a613331565b61079685670de0b6b3a76400006131bf565b6107a091906131de565b9350866001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107e0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108049190613190565b61080f90600a613331565b61082186670de0b6b3a76400006131bf565b61082b91906131de565b9450600081838761084488670de0b6b3a76400006131bf565b61084e91906131de565b61085891906131bf565b61086291906131de565b905061087681670de0b6b3a764000061333d565b61088f906ec097ce7bc90715b34b9f10000000006131de565b9d9c50505050505050505050505050565b6000806108ac8b611238565b9092509050600080808660038111156108c7576108c7613355565b146109e5576108d68d8c611305565b50826001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015610915573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109399190613173565b9150826001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610979573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061099d9190613173565b905060008560038111156109b3576109b3613355565b146109cd576109c88c83838d8d8d8d8c61151e565b610af0565b6109d98c838c8c611ee8565b6109c88c828a8a611ee8565b6109fa6001600160a01b03851633308e6121b0565b604051632e1a7d4d60e01b8152600481018c90526001600160a01b03851690632e1a7d4d90602401600060405180830381600087803b158015610a3c57600080fd5b505af1158015610a50573d6000803e3d6000fd5b50505050836001600160a01b0316631f1fcd516040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ab69190613173565b91508190506000856003811115610acf57610acf613355565b14610ae4576109c88c83838d8d8d8d8c61151e565b610af08c838c8c611ee8565b50505050505050505050505050565b6103e8341015610b2a5760405162461bcd60e51b8152600401610b219061336b565b60405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015610b8557600080fd5b505af1158015610b99573d6000803e3d6000fd5b5050505050610bee867f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000888888888861151e565b7f4fd86e42fdf9189d86bda34d3e693c24264ea2b54ff7796d9e1d40f5e29f4f59867f000000000000000000000000000000000000000000000000000000000000000034604051610c41939291906133ac565b60405180910390a1505050505050565b82610c81578151600003610c79578060405162461bcd60e51b8152600401610b2191906133fc565b815182602001fd5b505050565b6000610c928383611305565b9050610c818161220e565b600080610ca98a611238565b9092509050610cc36001600160a01b03831633308c6121b0565b604051632e1a7d4d60e01b8152600481018a90526001600160a01b03831690632e1a7d4d90602401600060405180830381600087803b158015610d0557600080fd5b505af1158015610d19573d6000803e3d6000fd5b505050507fde160ef457e2842f9b597ec662dc8b390d699ba99300cfe5429f960b4bffd2f08a898b604051610d50939291906133ac565b60405180910390a16000836003811115610d6c57610d6c613355565b1461107f57610d7b8130612544565b6040805160038082526080820190925260009160208201606080368337019050509050816001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ddc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e009190613173565b81600081518110610e1357610e1361342f565b60200260200101906001600160a01b031690816001600160a01b031681525050816001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e71573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e959190613173565b81600181518110610ea857610ea861342f565b60200260200101906001600160a01b031690816001600160a01b0316815250508881600281518110610edc57610edc61342f565b60200260200101906001600160a01b031690816001600160a01b031681525050610f4081600081518110610f1257610f1261342f565b60200260200101517f00000000000000000000000000000000000000000000000000000000000000006126f9565b610f5681600181518110610f1257610f1261342f565b80600081518110610f6957610f6961342f565b60200260200101516001600160a01b0316896001600160a01b031614610fe357610fe381600081518110610f9f57610f9f61342f565b602002602001015189898080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061278a92505050565b80600181518110610ff657610ff661342f565b60200260200101516001600160a01b0316896001600160a01b031614611070576110708160018151811061102c5761102c61342f565b602002602001015187878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061278a92505050565b6110798161220e565b506111a0565b604080516002808252606082018352600092602083019080368337019050509050826001600160a01b0316631f1fcd516040518163ffffffff1660e01b8152600401602060405180830381865afa1580156110de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111029190613173565b816000815181106111155761111561342f565b60200260200101906001600160a01b031690816001600160a01b03168152505088816001815181106111495761114961342f565b60200260200101906001600160a01b031690816001600160a01b03168152505061117f81600081518110610f1257610f1261342f565b61119581600081518110610f9f57610f9f61342f565b61119e8161220e565b505b50505050505050505050565b6103e88610156111ce5760405162461bcd60e51b8152600401610b219061336b565b6111e36001600160a01b0388163330896121b0565b6111f3888889888888888861151e565b7f4fd86e42fdf9189d86bda34d3e693c24264ea2b54ff7796d9e1d40f5e29f4f59888888604051611226939291906133ac565b60405180910390a15050505050505050565b600080829150816001600160a01b0316631f1fcd516040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015611298575060408051601f3d908101601f1916820190925261129591810190613173565b60015b6112fe57816001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156112da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112fe9190613173565b9050915091565b606060008061131385611238565b909250905061132d6001600160a01b0386163330876121b0565b604051632e1a7d4d60e01b8152600481018590526001600160a01b03831690632e1a7d4d90602401600060405180830381600087803b15801561136f57600080fd5b505af1158015611383573d6000803e3d6000fd5b505050506113918130612544565b6040805160028082526060820183529091602083019080368337019050509250806001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa1580156113ef573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114139190613173565b836000815181106114265761142661342f565b60200260200101906001600160a01b031690816001600160a01b031681525050806001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015611484573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114a89190613173565b836001815181106114bb576114bb61342f565b60200260200101906001600160a01b031690816001600160a01b0316815250507fde160ef457e2842f9b597ec662dc8b390d699ba99300cfe5429f960b4bffd2f085828660405161150e939291906133ac565b60405180910390a1505092915050565b60008061152a8a611238565b9092509050600083600381111561154357611543613355565b14611ee0576060886001600160a01b03168a6001600160a01b0316036116e757604080516003808252608082019092529060208201606080368337019050509050816001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa1580156115c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115e69190613173565b816000815181106115f9576115f961342f565b60200260200101906001600160a01b031690816001600160a01b031681525050816001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015611657573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061167b9190613173565b8160018151811061168e5761168e61342f565b60200260200101906001600160a01b031690816001600160a01b03168152505089816002815181106116c2576116c261342f565b60200260200101906001600160a01b031690816001600160a01b03168152505061189b565b60408051600480825260a082019092529060208201608080368337019050509050816001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015611746573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061176a9190613173565b8160008151811061177d5761177d61342f565b60200260200101906001600160a01b031690816001600160a01b031681525050816001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa1580156117db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117ff9190613173565b816001815181106118125761181261342f565b60200260200101906001600160a01b031690816001600160a01b03168152505089816002815181106118465761184661342f565b60200260200101906001600160a01b031690816001600160a01b031681525050888160038151811061187a5761187a61342f565b60200260200101906001600160a01b031690816001600160a01b0316815250505b806000815181106118ae576118ae61342f565b60200260200101516001600160a01b03168a6001600160a01b03161461190e5761190e8a89898080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061278a92505050565b806001815181106119215761192161342f565b60200260200101516001600160a01b0316896001600160a01b031614611981576119818987878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061278a92505050565b6000836001600160a01b031663a8c62e766040518163ffffffff1660e01b8152600401602060405180830381865afa1580156119c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119e59190613173565b6001600160a01b031663257ae0de6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611a22573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a469190613173565b9050611a6c82600081518110611a5e57611a5e61342f565b6020026020010151826126f9565b611a8282600181518110611a5e57611a5e61342f565b600082600081518110611a9757611a9761342f565b60209081029190910101516040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015611ae7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b0b9190613190565b9050600083600181518110611b2257611b2261342f565b60209081029190910101516040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015611b72573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b969190613190565b90506000808060028a6003811115611bb057611bb0613355565b1480611bcd575060038a6003811115611bcb57611bcb613355565b145b15611cf257600060028b6003811115611be857611be8613355565b14611bf4576000611bf7565b60015b9050866001600160a01b0316635a47ddc389600081518110611c1b57611c1b61342f565b60200260200101518a600181518110611c3657611c3661342f565b60209081029190910101516040516001600160e01b031960e085901b1681526001600160a01b0392831660048201529116602482015283151560448201526064810189905260848101889052600160a4820181905260c48201523060e482015242610104820152610124016060604051808303816000875af1158015611cc0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ce4919061321d565b95509093509150611ddc9050565b856001600160a01b031663e8e3370088600081518110611d1457611d1461342f565b602002602001015189600181518110611d2f57611d2f61342f565b60209081029190910101516040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604481018890526064810187905260016084820181905260a48201523060c48201524260e4820152610104016060604051808303816000875af1158015611db0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dd4919061321d565b945090925090505b611de8858584846128b0565b611df2888a6126f9565b60405163b6b55f2560e01b8152600481018490526001600160a01b038a169063b6b55f2590602401600060405180830381600087803b158015611e3457600080fd5b505af1158015611e48573d6000803e3d6000fd5b50506040516370a0823160e01b8152306004820152611ecb92503391506001600160a01b038c16906370a0823190602401602060405180830381865afa158015611e96573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611eba9190613190565b6001600160a01b038c16919061295b565b611ed48761220e565b505050505050506111a0565b6111a08a8a89895b60408051600280825260608083018452879390929190602083019080368337019050509050816001600160a01b0316631f1fcd516040518163ffffffff1660e01b8152600401602060405180830381865afa158015611f4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f6f9190613173565b81600081518110611f8257611f8261342f565b60200260200101906001600160a01b031690816001600160a01b0316815250508481600181518110611fb657611fb661342f565b60200260200101906001600160a01b031690816001600160a01b0316815250506120168585858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061278a92505050565b60008160008151811061202b5761202b61342f565b60209081029190910101516040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa15801561207b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061209f9190613190565b90506120c5826000815181106120b7576120b761342f565b6020026020010151846126f9565b60405163b6b55f2560e01b8152600481018290526001600160a01b0384169063b6b55f2590602401600060405180830381600087803b15801561210757600080fd5b505af115801561211b573d6000803e3d6000fd5b50506040516370a0823160e01b815230600482015261219e92503391506001600160a01b038616906370a0823190602401602060405180830381865afa158015612169573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061218d9190613190565b6001600160a01b038616919061295b565b6121a78261220e565b50505050505050565b612208846323b872dd60e01b8585856040516024016121d1939291906133ac565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261298b565b50505050565b6000805b8251811015610c815782818151811061222d5761222d61342f565b60209081029190910101516040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa15801561227d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122a19190613190565b91508115612532577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168382815181106122e5576122e561342f565b60200260200101516001600160a01b03160361249457604051632e1a7d4d60e01b8152600481018390527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632e1a7d4d90602401600060405180830381600087803b15801561235d57600080fd5b505af1158015612371573d6000803e3d6000fd5b50506040805160008082526020820192839052935033925085916123959190613445565b60006040518083038185875af1925050503d80600081146123d2576040519150601f19603f3d011682016040523d82523d6000602084013e6123d7565b606091505b50509050806124285760405162461bcd60e51b815260206004820152601a60248201527f42656566793a20455448207472616e73666572206661696c65640000000000006044820152606401610b21565b7feaf449319c042c9ba3474fa0c5329eb58cd1f23be110cdbf9d697b8d303dac1584838151811061245b5761245b61342f565b6020026020010151846040516124869291906001600160a01b03929092168252602082015260400190565b60405180910390a150612532565b6124cb33838584815181106124ab576124ab61342f565b60200260200101516001600160a01b031661295b9092919063ffffffff16565b7feaf449319c042c9ba3474fa0c5329eb58cd1f23be110cdbf9d697b8d303dac158382815181106124fe576124fe61342f565b6020026020010151836040516125299291906001600160a01b03929092168252602082015260400190565b60405180910390a15b8061253c81613461565b915050612212565b6040516370a0823160e01b81523060048201526125c39083906001600160a01b038216906370a0823190602401602060405180830381865afa15801561258e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125b29190613190565b6001600160a01b038516919061295b565b60405163226bf2d160e21b81526001600160a01b03828116600483015260009182918516906389afcb449060240160408051808303816000875af115801561260f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612633919061347a565b915091506103e88210156126985760405162461bcd60e51b815260206004820152602660248201527f556e69737761705632526f757465723a20494e53554646494349454e545f415f604482015265105353d5539560d21b6064820152608401610b21565b6103e88110156122085760405162461bcd60e51b815260206004820152602660248201527f556e69737761705632526f757465723a20494e53554646494349454e545f425f604482015265105353d5539560d21b6064820152608401610b21565b604051636eb1769f60e11b81523060048201526001600160a01b03828116602483015283169063dd62ed3e90604401602060405180830381865afa158015612745573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127699190613190565b600003612786576127866001600160a01b03831682600019612a5d565b5050565b6127b4827f00000000000000000000000000000000000000000000000000000000000000006126f9565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836040516127ef9190613445565b6000604051808303816000865af19150503d806000811461282c576040519150601f19603f3d011682016040523d82523d6000602084013e612831565b606091505b509150915061285e828260405180604001604052806005815260200164062d2dcc6d60db1b815250610c51565b6001821515146122085760405162461bcd60e51b815260206004820152601a60248201527f63616c6c696e672031696e636820676f7420616e206572726f720000000000006044820152606401610b21565b6000670de0b6b3a76400006128cd86670dbd2fc137a300006131bf565b6128d791906131de565b90506000670de0b6b3a76400006128f686670dbd2fc137a300006131bf565b61290091906131de565b90508184101580156129125750808310155b6129535760405162461bcd60e51b81526020600482015260126024820152713a37b79036bab1b4103232bb34b0ba34b7b760711b6044820152606401610b21565b505050505050565b6040516001600160a01b038316602482015260448101829052610c8190849063a9059cbb60e01b906064016121d1565b60006129e0826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612b729092919063ffffffff16565b805190915015610c8157808060200190518101906129fe9190613200565b610c815760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610b21565b801580612ad75750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015612ab1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ad59190613190565b155b612b425760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610b21565b6040516001600160a01b038316602482015260448101829052610c8190849063095ea7b360e01b906064016121d1565b6060612b818484600085612b89565b949350505050565b606082471015612bea5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610b21565b600080866001600160a01b03168587604051612c069190613445565b60006040518083038185875af1925050503d8060008114612c43576040519150601f19603f3d011682016040523d82523d6000602084013e612c48565b606091505b5091509150612c5987838387612c64565b979650505050505050565b60608315612cd3578251600003612ccc576001600160a01b0385163b612ccc5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610b21565b5081612b81565b612b818383815115612ce85781518083602001fd5b8060405162461bcd60e51b8152600401610b2191906133fc565b634e487b7160e01b600052600160045260246000fd5b6001600160a01b0381168114612d2d57600080fd5b50565b600060208284031215612d4257600080fd5b8135612d4d81612d18565b9392505050565b60008083601f840112612d6657600080fd5b50813567ffffffffffffffff811115612d7e57600080fd5b602083019150836020828501011115612d9657600080fd5b9250929050565b803560048110612dac57600080fd5b919050565b600080600080600080600080600060e08a8c031215612dcf57600080fd5b8935612dda81612d18565b985060208a0135612dea81612d18565b975060408a0135965060608a013567ffffffffffffffff80821115612e0e57600080fd5b612e1a8d838e01612d54565b909850965060808c0135915080821115612e3357600080fd5b50612e408c828d01612d54565b9095509350612e53905060a08b01612d9d565b9150612e6160c08b01612d9d565b90509295985092959850929598565b60008060008060008060808789031215612e8957600080fd5b8635612e9481612d18565b9550602087013567ffffffffffffffff80821115612eb157600080fd5b612ebd8a838b01612d54565b90975095506040890135915080821115612ed657600080fd5b50612ee389828a01612d54565b9094509250612ef6905060608801612d9d565b90509295509295509295565b8015158114612d2d57600080fd5b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff80841115612f4157612f41612f10565b604051601f8501601f19908116603f01168101908282118183101715612f6957612f69612f10565b81604052809350858152868686011115612f8257600080fd5b858560208301376000602087830101525050509392505050565b600080600060608486031215612fb157600080fd5b8335612fbc81612f02565b9250602084013567ffffffffffffffff80821115612fd957600080fd5b818601915086601f830112612fed57600080fd5b612ffc87833560208501612f26565b9350604086013591508082111561301257600080fd5b508401601f8101861361302457600080fd5b61303386823560208401612f26565b9150509250925092565b6000806040838503121561305057600080fd5b823561305b81612d18565b946020939093013593505050565b60008060008060008060008060c0898b03121561308557600080fd5b883561309081612d18565b97506020890135965060408901356130a781612d18565b9550606089013567ffffffffffffffff808211156130c457600080fd5b6130d08c838d01612d54565b909750955060808b01359150808211156130e957600080fd5b506130f68b828c01612d54565b9094509250613109905060a08a01612d9d565b90509295985092959890939650565b60008060008060008060008060c0898b03121561313457600080fd5b883561313f81612d18565b9750602089013561314f81612d18565b965060408901359550606089013567ffffffffffffffff808211156130c457600080fd5b60006020828403121561318557600080fd5b8151612d4d81612d18565b6000602082840312156131a257600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b60008160001904831182151516156131d9576131d96131a9565b500290565b6000826131fb57634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561321257600080fd5b8151612d4d81612f02565b60008060006060848603121561323257600080fd5b8351925060208401519150604084015190509250925092565b600181815b8085111561328657816000190482111561326c5761326c6131a9565b8085161561327957918102915b93841c9390800290613250565b509250929050565b60008261329d5750600161332b565b816132aa5750600061332b565b81600181146132c057600281146132ca576132e6565b600191505061332b565b60ff8411156132db576132db6131a9565b50506001821b61332b565b5060208310610133831016604e8410600b8410161715613309575081810a61332b565b613313838361324b565b8060001904821115613327576133276131a9565b0290505b92915050565b6000612d4d838361328e565b60008219821115613350576133506131a9565b500190565b634e487b7160e01b600052602160045260246000fd5b60208082526021908201527f42656566793a20496e7369676e69666963616e7420696e70757420616d6f756e6040820152601d60fa1b606082015260800190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b60005b838110156133eb5781810151838201526020016133d3565b838111156122085750506000910152565b602081526000825180602084015261341b8160408501602087016133d0565b601f01601f19169190910160400192915050565b634e487b7160e01b600052603260045260246000fd5b600082516134578184602087016133d0565b9190910192915050565b600060018201613473576134736131a9565b5060010190565b6000806040838503121561348d57600080fd5b50508051602090910151909290915056fea2646970667358221220eed264b199f8e88fea9afa45d8757f6c2973772c95da46ab018601c42ed56b9064736f6c634300080f00330000000000000000000000001111111254eeb25477b68fb85ed929f73a960582000000000000000000000000b31f66aa3c1e785363f0875a1b74e27b85fd66c7
Deployed Bytecode
0x6080604052600436106100955760003560e01c8063ac3af20811610059578063ac3af2081461017f578063ad5c4648146101cb578063bb0c8298146101ff578063d2e7795b14610215578063e4fd396e1461023557600080fd5b806337d9c96a146100d957806366a8a8d31461010c57806389a2af821461012c57806393cf97f81461013f578063a28c361b1461015f57600080fd5b366100d457336001600160a01b037f000000000000000000000000b31f66aa3c1e785363f0875a1b74e27b85fd66c716146100d2576100d2612d02565b005b600080fd5b3480156100e557600080fd5b506100f96100f4366004612d30565b610255565b6040519081526020015b60405180910390f35b34801561011857600080fd5b506100d2610127366004612db1565b6108a0565b6100d261013a366004612e70565b610aff565b34801561014b57600080fd5b506100d261015a366004612f9c565b610c51565b34801561016b57600080fd5b506100d261017a36600461303d565b610c86565b34801561018b57600080fd5b506101b37f0000000000000000000000001111111254eeb25477b68fb85ed929f73a96058281565b6040516001600160a01b039091168152602001610103565b3480156101d757600080fd5b506101b37f000000000000000000000000b31f66aa3c1e785363f0875a1b74e27b85fd66c781565b34801561020b57600080fd5b506100f96103e881565b34801561022157600080fd5b506100d2610230366004613069565b610c9d565b34801561024157600080fd5b506100d2610250366004613118565b6111ac565b600080600061026384611238565b9150915060008190506000816001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102d09190613173565b90506000826001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610312573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103369190613173565b6040516370a0823160e01b81526001600160a01b03858116600483015291925060009161271091908516906370a0823190602401602060405180830381865afa158015610387573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ab9190613190565b6103b690600a6131bf565b6103c091906131de565b6040516378a051ad60e11b8152600481018290526001600160a01b03858116602483015291925060009186169063f140a35a90604401602060405180830381865afa158015610413573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104379190613190565b90506000876001600160a01b031663a8c62e766040518163ffffffff1660e01b8152600401602060405180830381865afa158015610479573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061049d9190613173565b6001600160a01b031663257ae0de6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104fe9190613173565b9050600080826001600160a01b03166398a0fb3c88888b6001600160a01b03166322be3de16040518163ffffffff1660e01b8152600401602060405180830381865afa158015610552573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105769190613200565b6040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015215156044820152606481018890526084810187905260a401606060405180830381865afa1580156105d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105fc919061321d565b5091509150866001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801561063f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106639190613190565b61066e90600a613331565b61068083670de0b6b3a76400006131bf565b61068a91906131de565b9150856001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ee9190613190565b6106f990600a613331565b61070b82670de0b6b3a76400006131bf565b61071591906131de565b9050856001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610755573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107799190613190565b61078490600a613331565b61079685670de0b6b3a76400006131bf565b6107a091906131de565b9350866001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107e0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108049190613190565b61080f90600a613331565b61082186670de0b6b3a76400006131bf565b61082b91906131de565b9450600081838761084488670de0b6b3a76400006131bf565b61084e91906131de565b61085891906131bf565b61086291906131de565b905061087681670de0b6b3a764000061333d565b61088f906ec097ce7bc90715b34b9f10000000006131de565b9d9c50505050505050505050505050565b6000806108ac8b611238565b9092509050600080808660038111156108c7576108c7613355565b146109e5576108d68d8c611305565b50826001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015610915573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109399190613173565b9150826001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610979573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061099d9190613173565b905060008560038111156109b3576109b3613355565b146109cd576109c88c83838d8d8d8d8c61151e565b610af0565b6109d98c838c8c611ee8565b6109c88c828a8a611ee8565b6109fa6001600160a01b03851633308e6121b0565b604051632e1a7d4d60e01b8152600481018c90526001600160a01b03851690632e1a7d4d90602401600060405180830381600087803b158015610a3c57600080fd5b505af1158015610a50573d6000803e3d6000fd5b50505050836001600160a01b0316631f1fcd516040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ab69190613173565b91508190506000856003811115610acf57610acf613355565b14610ae4576109c88c83838d8d8d8d8c61151e565b610af08c838c8c611ee8565b50505050505050505050505050565b6103e8341015610b2a5760405162461bcd60e51b8152600401610b219061336b565b60405180910390fd5b7f000000000000000000000000b31f66aa3c1e785363f0875a1b74e27b85fd66c76001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015610b8557600080fd5b505af1158015610b99573d6000803e3d6000fd5b5050505050610bee867f000000000000000000000000b31f66aa3c1e785363f0875a1b74e27b85fd66c77f000000000000000000000000b31f66aa3c1e785363f0875a1b74e27b85fd66c7888888888861151e565b7f4fd86e42fdf9189d86bda34d3e693c24264ea2b54ff7796d9e1d40f5e29f4f59867f000000000000000000000000b31f66aa3c1e785363f0875a1b74e27b85fd66c734604051610c41939291906133ac565b60405180910390a1505050505050565b82610c81578151600003610c79578060405162461bcd60e51b8152600401610b2191906133fc565b815182602001fd5b505050565b6000610c928383611305565b9050610c818161220e565b600080610ca98a611238565b9092509050610cc36001600160a01b03831633308c6121b0565b604051632e1a7d4d60e01b8152600481018a90526001600160a01b03831690632e1a7d4d90602401600060405180830381600087803b158015610d0557600080fd5b505af1158015610d19573d6000803e3d6000fd5b505050507fde160ef457e2842f9b597ec662dc8b390d699ba99300cfe5429f960b4bffd2f08a898b604051610d50939291906133ac565b60405180910390a16000836003811115610d6c57610d6c613355565b1461107f57610d7b8130612544565b6040805160038082526080820190925260009160208201606080368337019050509050816001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ddc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e009190613173565b81600081518110610e1357610e1361342f565b60200260200101906001600160a01b031690816001600160a01b031681525050816001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e71573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e959190613173565b81600181518110610ea857610ea861342f565b60200260200101906001600160a01b031690816001600160a01b0316815250508881600281518110610edc57610edc61342f565b60200260200101906001600160a01b031690816001600160a01b031681525050610f4081600081518110610f1257610f1261342f565b60200260200101517f0000000000000000000000001111111254eeb25477b68fb85ed929f73a9605826126f9565b610f5681600181518110610f1257610f1261342f565b80600081518110610f6957610f6961342f565b60200260200101516001600160a01b0316896001600160a01b031614610fe357610fe381600081518110610f9f57610f9f61342f565b602002602001015189898080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061278a92505050565b80600181518110610ff657610ff661342f565b60200260200101516001600160a01b0316896001600160a01b031614611070576110708160018151811061102c5761102c61342f565b602002602001015187878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061278a92505050565b6110798161220e565b506111a0565b604080516002808252606082018352600092602083019080368337019050509050826001600160a01b0316631f1fcd516040518163ffffffff1660e01b8152600401602060405180830381865afa1580156110de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111029190613173565b816000815181106111155761111561342f565b60200260200101906001600160a01b031690816001600160a01b03168152505088816001815181106111495761114961342f565b60200260200101906001600160a01b031690816001600160a01b03168152505061117f81600081518110610f1257610f1261342f565b61119581600081518110610f9f57610f9f61342f565b61119e8161220e565b505b50505050505050505050565b6103e88610156111ce5760405162461bcd60e51b8152600401610b219061336b565b6111e36001600160a01b0388163330896121b0565b6111f3888889888888888861151e565b7f4fd86e42fdf9189d86bda34d3e693c24264ea2b54ff7796d9e1d40f5e29f4f59888888604051611226939291906133ac565b60405180910390a15050505050505050565b600080829150816001600160a01b0316631f1fcd516040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015611298575060408051601f3d908101601f1916820190925261129591810190613173565b60015b6112fe57816001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156112da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112fe9190613173565b9050915091565b606060008061131385611238565b909250905061132d6001600160a01b0386163330876121b0565b604051632e1a7d4d60e01b8152600481018590526001600160a01b03831690632e1a7d4d90602401600060405180830381600087803b15801561136f57600080fd5b505af1158015611383573d6000803e3d6000fd5b505050506113918130612544565b6040805160028082526060820183529091602083019080368337019050509250806001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa1580156113ef573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114139190613173565b836000815181106114265761142661342f565b60200260200101906001600160a01b031690816001600160a01b031681525050806001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015611484573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114a89190613173565b836001815181106114bb576114bb61342f565b60200260200101906001600160a01b031690816001600160a01b0316815250507fde160ef457e2842f9b597ec662dc8b390d699ba99300cfe5429f960b4bffd2f085828660405161150e939291906133ac565b60405180910390a1505092915050565b60008061152a8a611238565b9092509050600083600381111561154357611543613355565b14611ee0576060886001600160a01b03168a6001600160a01b0316036116e757604080516003808252608082019092529060208201606080368337019050509050816001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa1580156115c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115e69190613173565b816000815181106115f9576115f961342f565b60200260200101906001600160a01b031690816001600160a01b031681525050816001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015611657573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061167b9190613173565b8160018151811061168e5761168e61342f565b60200260200101906001600160a01b031690816001600160a01b03168152505089816002815181106116c2576116c261342f565b60200260200101906001600160a01b031690816001600160a01b03168152505061189b565b60408051600480825260a082019092529060208201608080368337019050509050816001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015611746573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061176a9190613173565b8160008151811061177d5761177d61342f565b60200260200101906001600160a01b031690816001600160a01b031681525050816001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa1580156117db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117ff9190613173565b816001815181106118125761181261342f565b60200260200101906001600160a01b031690816001600160a01b03168152505089816002815181106118465761184661342f565b60200260200101906001600160a01b031690816001600160a01b031681525050888160038151811061187a5761187a61342f565b60200260200101906001600160a01b031690816001600160a01b0316815250505b806000815181106118ae576118ae61342f565b60200260200101516001600160a01b03168a6001600160a01b03161461190e5761190e8a89898080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061278a92505050565b806001815181106119215761192161342f565b60200260200101516001600160a01b0316896001600160a01b031614611981576119818987878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061278a92505050565b6000836001600160a01b031663a8c62e766040518163ffffffff1660e01b8152600401602060405180830381865afa1580156119c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119e59190613173565b6001600160a01b031663257ae0de6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611a22573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a469190613173565b9050611a6c82600081518110611a5e57611a5e61342f565b6020026020010151826126f9565b611a8282600181518110611a5e57611a5e61342f565b600082600081518110611a9757611a9761342f565b60209081029190910101516040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015611ae7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b0b9190613190565b9050600083600181518110611b2257611b2261342f565b60209081029190910101516040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015611b72573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b969190613190565b90506000808060028a6003811115611bb057611bb0613355565b1480611bcd575060038a6003811115611bcb57611bcb613355565b145b15611cf257600060028b6003811115611be857611be8613355565b14611bf4576000611bf7565b60015b9050866001600160a01b0316635a47ddc389600081518110611c1b57611c1b61342f565b60200260200101518a600181518110611c3657611c3661342f565b60209081029190910101516040516001600160e01b031960e085901b1681526001600160a01b0392831660048201529116602482015283151560448201526064810189905260848101889052600160a4820181905260c48201523060e482015242610104820152610124016060604051808303816000875af1158015611cc0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ce4919061321d565b95509093509150611ddc9050565b856001600160a01b031663e8e3370088600081518110611d1457611d1461342f565b602002602001015189600181518110611d2f57611d2f61342f565b60209081029190910101516040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604481018890526064810187905260016084820181905260a48201523060c48201524260e4820152610104016060604051808303816000875af1158015611db0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dd4919061321d565b945090925090505b611de8858584846128b0565b611df2888a6126f9565b60405163b6b55f2560e01b8152600481018490526001600160a01b038a169063b6b55f2590602401600060405180830381600087803b158015611e3457600080fd5b505af1158015611e48573d6000803e3d6000fd5b50506040516370a0823160e01b8152306004820152611ecb92503391506001600160a01b038c16906370a0823190602401602060405180830381865afa158015611e96573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611eba9190613190565b6001600160a01b038c16919061295b565b611ed48761220e565b505050505050506111a0565b6111a08a8a89895b60408051600280825260608083018452879390929190602083019080368337019050509050816001600160a01b0316631f1fcd516040518163ffffffff1660e01b8152600401602060405180830381865afa158015611f4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f6f9190613173565b81600081518110611f8257611f8261342f565b60200260200101906001600160a01b031690816001600160a01b0316815250508481600181518110611fb657611fb661342f565b60200260200101906001600160a01b031690816001600160a01b0316815250506120168585858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061278a92505050565b60008160008151811061202b5761202b61342f565b60209081029190910101516040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa15801561207b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061209f9190613190565b90506120c5826000815181106120b7576120b761342f565b6020026020010151846126f9565b60405163b6b55f2560e01b8152600481018290526001600160a01b0384169063b6b55f2590602401600060405180830381600087803b15801561210757600080fd5b505af115801561211b573d6000803e3d6000fd5b50506040516370a0823160e01b815230600482015261219e92503391506001600160a01b038616906370a0823190602401602060405180830381865afa158015612169573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061218d9190613190565b6001600160a01b038616919061295b565b6121a78261220e565b50505050505050565b612208846323b872dd60e01b8585856040516024016121d1939291906133ac565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261298b565b50505050565b6000805b8251811015610c815782818151811061222d5761222d61342f565b60209081029190910101516040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa15801561227d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122a19190613190565b91508115612532577f000000000000000000000000b31f66aa3c1e785363f0875a1b74e27b85fd66c76001600160a01b03168382815181106122e5576122e561342f565b60200260200101516001600160a01b03160361249457604051632e1a7d4d60e01b8152600481018390527f000000000000000000000000b31f66aa3c1e785363f0875a1b74e27b85fd66c76001600160a01b031690632e1a7d4d90602401600060405180830381600087803b15801561235d57600080fd5b505af1158015612371573d6000803e3d6000fd5b50506040805160008082526020820192839052935033925085916123959190613445565b60006040518083038185875af1925050503d80600081146123d2576040519150601f19603f3d011682016040523d82523d6000602084013e6123d7565b606091505b50509050806124285760405162461bcd60e51b815260206004820152601a60248201527f42656566793a20455448207472616e73666572206661696c65640000000000006044820152606401610b21565b7feaf449319c042c9ba3474fa0c5329eb58cd1f23be110cdbf9d697b8d303dac1584838151811061245b5761245b61342f565b6020026020010151846040516124869291906001600160a01b03929092168252602082015260400190565b60405180910390a150612532565b6124cb33838584815181106124ab576124ab61342f565b60200260200101516001600160a01b031661295b9092919063ffffffff16565b7feaf449319c042c9ba3474fa0c5329eb58cd1f23be110cdbf9d697b8d303dac158382815181106124fe576124fe61342f565b6020026020010151836040516125299291906001600160a01b03929092168252602082015260400190565b60405180910390a15b8061253c81613461565b915050612212565b6040516370a0823160e01b81523060048201526125c39083906001600160a01b038216906370a0823190602401602060405180830381865afa15801561258e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125b29190613190565b6001600160a01b038516919061295b565b60405163226bf2d160e21b81526001600160a01b03828116600483015260009182918516906389afcb449060240160408051808303816000875af115801561260f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612633919061347a565b915091506103e88210156126985760405162461bcd60e51b815260206004820152602660248201527f556e69737761705632526f757465723a20494e53554646494349454e545f415f604482015265105353d5539560d21b6064820152608401610b21565b6103e88110156122085760405162461bcd60e51b815260206004820152602660248201527f556e69737761705632526f757465723a20494e53554646494349454e545f425f604482015265105353d5539560d21b6064820152608401610b21565b604051636eb1769f60e11b81523060048201526001600160a01b03828116602483015283169063dd62ed3e90604401602060405180830381865afa158015612745573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127699190613190565b600003612786576127866001600160a01b03831682600019612a5d565b5050565b6127b4827f0000000000000000000000001111111254eeb25477b68fb85ed929f73a9605826126f9565b6000807f0000000000000000000000001111111254eeb25477b68fb85ed929f73a9605826001600160a01b0316836040516127ef9190613445565b6000604051808303816000865af19150503d806000811461282c576040519150601f19603f3d011682016040523d82523d6000602084013e612831565b606091505b509150915061285e828260405180604001604052806005815260200164062d2dcc6d60db1b815250610c51565b6001821515146122085760405162461bcd60e51b815260206004820152601a60248201527f63616c6c696e672031696e636820676f7420616e206572726f720000000000006044820152606401610b21565b6000670de0b6b3a76400006128cd86670dbd2fc137a300006131bf565b6128d791906131de565b90506000670de0b6b3a76400006128f686670dbd2fc137a300006131bf565b61290091906131de565b90508184101580156129125750808310155b6129535760405162461bcd60e51b81526020600482015260126024820152713a37b79036bab1b4103232bb34b0ba34b7b760711b6044820152606401610b21565b505050505050565b6040516001600160a01b038316602482015260448101829052610c8190849063a9059cbb60e01b906064016121d1565b60006129e0826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612b729092919063ffffffff16565b805190915015610c8157808060200190518101906129fe9190613200565b610c815760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610b21565b801580612ad75750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015612ab1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ad59190613190565b155b612b425760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610b21565b6040516001600160a01b038316602482015260448101829052610c8190849063095ea7b360e01b906064016121d1565b6060612b818484600085612b89565b949350505050565b606082471015612bea5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610b21565b600080866001600160a01b03168587604051612c069190613445565b60006040518083038185875af1925050503d8060008114612c43576040519150601f19603f3d011682016040523d82523d6000602084013e612c48565b606091505b5091509150612c5987838387612c64565b979650505050505050565b60608315612cd3578251600003612ccc576001600160a01b0385163b612ccc5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610b21565b5081612b81565b612b818383815115612ce85781518083602001fd5b8060405162461bcd60e51b8152600401610b2191906133fc565b634e487b7160e01b600052600160045260246000fd5b6001600160a01b0381168114612d2d57600080fd5b50565b600060208284031215612d4257600080fd5b8135612d4d81612d18565b9392505050565b60008083601f840112612d6657600080fd5b50813567ffffffffffffffff811115612d7e57600080fd5b602083019150836020828501011115612d9657600080fd5b9250929050565b803560048110612dac57600080fd5b919050565b600080600080600080600080600060e08a8c031215612dcf57600080fd5b8935612dda81612d18565b985060208a0135612dea81612d18565b975060408a0135965060608a013567ffffffffffffffff80821115612e0e57600080fd5b612e1a8d838e01612d54565b909850965060808c0135915080821115612e3357600080fd5b50612e408c828d01612d54565b9095509350612e53905060a08b01612d9d565b9150612e6160c08b01612d9d565b90509295985092959850929598565b60008060008060008060808789031215612e8957600080fd5b8635612e9481612d18565b9550602087013567ffffffffffffffff80821115612eb157600080fd5b612ebd8a838b01612d54565b90975095506040890135915080821115612ed657600080fd5b50612ee389828a01612d54565b9094509250612ef6905060608801612d9d565b90509295509295509295565b8015158114612d2d57600080fd5b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff80841115612f4157612f41612f10565b604051601f8501601f19908116603f01168101908282118183101715612f6957612f69612f10565b81604052809350858152868686011115612f8257600080fd5b858560208301376000602087830101525050509392505050565b600080600060608486031215612fb157600080fd5b8335612fbc81612f02565b9250602084013567ffffffffffffffff80821115612fd957600080fd5b818601915086601f830112612fed57600080fd5b612ffc87833560208501612f26565b9350604086013591508082111561301257600080fd5b508401601f8101861361302457600080fd5b61303386823560208401612f26565b9150509250925092565b6000806040838503121561305057600080fd5b823561305b81612d18565b946020939093013593505050565b60008060008060008060008060c0898b03121561308557600080fd5b883561309081612d18565b97506020890135965060408901356130a781612d18565b9550606089013567ffffffffffffffff808211156130c457600080fd5b6130d08c838d01612d54565b909750955060808b01359150808211156130e957600080fd5b506130f68b828c01612d54565b9094509250613109905060a08a01612d9d565b90509295985092959890939650565b60008060008060008060008060c0898b03121561313457600080fd5b883561313f81612d18565b9750602089013561314f81612d18565b965060408901359550606089013567ffffffffffffffff808211156130c457600080fd5b60006020828403121561318557600080fd5b8151612d4d81612d18565b6000602082840312156131a257600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b60008160001904831182151516156131d9576131d96131a9565b500290565b6000826131fb57634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561321257600080fd5b8151612d4d81612f02565b60008060006060848603121561323257600080fd5b8351925060208401519150604084015190509250925092565b600181815b8085111561328657816000190482111561326c5761326c6131a9565b8085161561327957918102915b93841c9390800290613250565b509250929050565b60008261329d5750600161332b565b816132aa5750600061332b565b81600181146132c057600281146132ca576132e6565b600191505061332b565b60ff8411156132db576132db6131a9565b50506001821b61332b565b5060208310610133831016604e8410600b8410161715613309575081810a61332b565b613313838361324b565b8060001904821115613327576133276131a9565b0290505b92915050565b6000612d4d838361328e565b60008219821115613350576133506131a9565b500190565b634e487b7160e01b600052602160045260246000fd5b60208082526021908201527f42656566793a20496e7369676e69666963616e7420696e70757420616d6f756e6040820152601d60fa1b606082015260800190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b60005b838110156133eb5781810151838201526020016133d3565b838111156122085750506000910152565b602081526000825180602084015261341b8160408501602087016133d0565b601f01601f19169190910160400192915050565b634e487b7160e01b600052603260045260246000fd5b600082516134578184602087016133d0565b9190910192915050565b600060018201613473576134736131a9565b5060010190565b6000806040838503121561348d57600080fd5b50508051602090910151909290915056fea2646970667358221220eed264b199f8e88fea9afa45d8757f6c2973772c95da46ab018601c42ed56b9064736f6c634300080f0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000001111111254eeb25477b68fb85ed929f73a960582000000000000000000000000b31f66aa3c1e785363f0875a1b74e27b85fd66c7
-----Decoded View---------------
Arg [0] : _oneInchRouter (address): 0x1111111254EEB25477B68fb85Ed929f73A960582
Arg [1] : _WETH (address): 0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000001111111254eeb25477b68fb85ed929f73a960582
Arg [1] : 000000000000000000000000b31f66aa3c1e785363f0875a1b74e27b85fd66c7
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.