ETH Price: $3,356.22 (+0.29%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x1cbC119f...21F0425df
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
BalancerPoolHelper

Compiler Version
v0.8.12+commit.f00d7308

Optimization Enabled:
Yes with 999999 runs

Other Settings:
london EvmVersion, MIT license
File 1 of 17 : BalancerPoolHelper.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.12;

import {DustRefunder} from "./DustRefunder.sol";
import {BNum} from "../../../dependencies/math/BNum.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";

import {IBalancerPoolHelper} from "../../../interfaces/IPoolHelper.sol";
import {IWETH} from "../../../interfaces/IWETH.sol";
import {IWeightedPoolFactory, IWeightedPool, IAsset, IVault, IBalancerQueries} from "../../../interfaces/balancer/IWeightedPoolFactory.sol";
import {VaultReentrancyLib} from "../../libraries/balancer-reentrancy/VaultReentrancyLib.sol";

/// @title Balance Pool Helper Contract
/// @author Radiant
contract BalancerPoolHelper is IBalancerPoolHelper, Initializable, OwnableUpgradeable, BNum, DustRefunder {
	using SafeERC20 for IERC20;

	error AddressZero();
	error PoolExists();
	error InsufficientPermission();
	error IdenticalAddresses();
	error ZeroAmount();
	error QuoteFail();

	address public inTokenAddr;
	address public outTokenAddr;
	address public wethAddr;
	address public lpTokenAddr;
	address public vaultAddr;
	bytes32 public poolId;
	address public lockZap;
	IWeightedPoolFactory public poolFactory;
	uint256 public constant RDNT_WEIGHT = 800000000000000000;
	uint256 public constant WETH_WEIGHT = 200000000000000000;
	uint256 public constant INITIAL_SWAP_FEE_PERCENTAGE = 5000000000000000;

	/// @notice In 80/20 pool, RDNT Weight is 4x of WETH weight
	uint256 public constant POOL_WEIGHT = 4;

	bytes32 public constant WBTC_WETH_USDC_POOL_ID = 0x64541216bafffeec8ea535bb71fbc927831d0595000100000000000000000002;
	bytes32 public constant DAI_USDT_USDC_POOL_ID = 0x1533a3278f3f9141d5f820a184ea4b017fce2382000000000000000000000016;
	address public constant REAL_WETH_ADDR = address(0x82aF49447D8a07e3bd95BD0d56f35241523fBab1);

	address public constant BALANCER_QUERIES = 0xE39B5e3B6D74016b2F6A9673D7d7493B6DF549d5;

	address public constant USDT_ADDRESS = address(0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9);
	address public constant DAI_ADDRESS = address(0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1);
	address public constant USDC_ADDRESS = address(0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8);

	constructor() {
		_disableInitializers();
	}

	/**
	 * @notice Initializer
	 * @param _inTokenAddr input token of the pool
	 * @param _outTokenAddr output token of the pool
	 * @param _wethAddr WETH address
	 * @param _vault Balancer Vault
	 * @param _poolFactory Balancer pool factory address
	 */
	function initialize(
		address _inTokenAddr,
		address _outTokenAddr,
		address _wethAddr,
		address _vault,
		IWeightedPoolFactory _poolFactory
	) external initializer {
		if (_inTokenAddr == address(0)) revert AddressZero();
		if (_outTokenAddr == address(0)) revert AddressZero();
		if (_wethAddr == address(0)) revert AddressZero();
		if (_vault == address(0)) revert AddressZero();
		if (address(_poolFactory) == address(0)) revert AddressZero();

		__Ownable_init();
		inTokenAddr = _inTokenAddr;
		outTokenAddr = _outTokenAddr;
		wethAddr = _wethAddr;
		vaultAddr = _vault;
		poolFactory = _poolFactory;
	}

	/**
	 * @notice Initialize a new pool.
	 * @param _tokenName Token name of lp token
	 * @param _tokenSymbol Token symbol of lp token
	 */
	function initializePool(string calldata _tokenName, string calldata _tokenSymbol) public onlyOwner {
		if (lpTokenAddr != address(0)) revert PoolExists();

		(address token0, address token1) = _sortTokens(inTokenAddr, outTokenAddr);

		IERC20[] memory tokens = new IERC20[](2);
		tokens[0] = IERC20(token0);
		tokens[1] = IERC20(token1);

		address[] memory rateProviders = new address[](2);
		rateProviders[0] = 0x0000000000000000000000000000000000000000;
		rateProviders[1] = 0x0000000000000000000000000000000000000000;

		uint256[] memory weights = new uint256[](2);

		if (token0 == outTokenAddr) {
			weights[0] = RDNT_WEIGHT;
			weights[1] = WETH_WEIGHT;
		} else {
			weights[0] = WETH_WEIGHT;
			weights[1] = RDNT_WEIGHT;
		}

		lpTokenAddr = poolFactory.create(
			_tokenName,
			_tokenSymbol,
			tokens,
			weights,
			rateProviders,
			INITIAL_SWAP_FEE_PERCENTAGE,
			address(this),
			"UwU"
		);

		poolId = IWeightedPool(lpTokenAddr).getPoolId();

		IERC20 outToken = IERC20(outTokenAddr);
		IERC20 inToken = IERC20(inTokenAddr);
		IERC20 lp = IERC20(lpTokenAddr);
		IERC20 weth = IERC20(wethAddr);

		outToken.forceApprove(vaultAddr, type(uint256).max);
		inToken.forceApprove(vaultAddr, type(uint256).max);
		weth.approve(vaultAddr, type(uint256).max);

		IAsset[] memory assets = new IAsset[](2);
		assets[0] = IAsset(token0);
		assets[1] = IAsset(token1);

		uint256 inTokenAmt = inToken.balanceOf(address(this));
		uint256 outTokenAmt = outToken.balanceOf(address(this));

		uint256[] memory maxAmountsIn = new uint256[](2);
		if (token0 == inTokenAddr) {
			maxAmountsIn[0] = inTokenAmt;
			maxAmountsIn[1] = outTokenAmt;
		} else {
			maxAmountsIn[0] = outTokenAmt;
			maxAmountsIn[1] = inTokenAmt;
		}

		IVault.JoinPoolRequest memory inRequest = IVault.JoinPoolRequest(
			assets,
			maxAmountsIn,
			abi.encode(0, maxAmountsIn),
			false
		);
		IVault(vaultAddr).joinPool(poolId, address(this), address(this), inRequest);
		uint256 liquidity = lp.balanceOf(address(this));
		lp.safeTransfer(msg.sender, liquidity);
	}

	/// @dev Return fair reserve amounts given spot reserves, weights, and fair prices.
	/// @param resA Reserve of the first asset
	/// @param resB Reserve of the second asset
	/// @param wA Weight of the first asset
	/// @param wB Weight of the second asset
	/// @param pxA Fair price of the first asset
	/// @param pxB Fair price of the second asset
	function _computeFairReserves(
		uint256 resA,
		uint256 resB,
		uint256 wA,
		uint256 wB,
		uint256 pxA,
		uint256 pxB
	) internal pure returns (uint256 fairResA, uint256 fairResB) {
		// NOTE: wA + wB = 1 (normalize weights)
		// constant product = resA^wA * resB^wB
		// constraints:
		// - fairResA^wA * fairResB^wB = constant product
		// - fairResA * pxA / wA = fairResB * pxB / wB
		// Solving equations:
		// --> fairResA^wA * (fairResA * (pxA * wB) / (wA * pxB))^wB = constant product
		// --> fairResA / r1^wB = constant product
		// --> fairResA = resA^wA * resB^wB * r1^wB
		// --> fairResA = resA * (resB/resA)^wB * r1^wB = resA * (r1/r0)^wB
		uint256 r0 = bdiv(resA, resB);
		uint256 r1 = bdiv(bmul(wA, pxB), bmul(wB, pxA));
		// fairResA = resA * (r1 / r0) ^ wB
		// fairResB = resB * (r0 / r1) ^ wA
		if (r0 > r1) {
			uint256 ratio = bdiv(r1, r0);
			fairResA = bmul(resA, bpow(ratio, wB));
			fairResB = bdiv(resB, bpow(ratio, wA));
		} else {
			uint256 ratio = bdiv(r0, r1);
			fairResA = bdiv(resA, bpow(ratio, wB));
			fairResB = bmul(resB, bpow(ratio, wA));
		}
	}

	/**
	 * @notice Calculates LP price
	 * @dev Return value decimal is 8
	 * @param rdntPriceInEth RDNT price in ETH
	 * @return priceInEth LP price in ETH
	 */
	function getLpPrice(uint256 rdntPriceInEth) public view returns (uint256 priceInEth) {
		IWeightedPool pool = IWeightedPool(lpTokenAddr);
		(address token0, ) = _sortTokens(inTokenAddr, outTokenAddr);
		(uint256 rdntBalance, uint256 wethBalance, ) = getReserves();
		uint256[] memory weights = pool.getNormalizedWeights();

		uint256 rdntWeight;
		uint256 wethWeight;

		if (token0 == outTokenAddr) {
			rdntWeight = weights[0];
			wethWeight = weights[1];
		} else {
			rdntWeight = weights[1];
			wethWeight = weights[0];
		}

		// RDNT in eth, 8 decis
		uint256 pxA = rdntPriceInEth;
		// ETH in eth, 8 decis
		uint256 pxB = 100000000;

		(uint256 fairResA, uint256 fairResB) = _computeFairReserves(
			rdntBalance,
			wethBalance,
			rdntWeight,
			wethWeight,
			pxA,
			pxB
		);
		// use fairReserveA and fairReserveB to compute LP token price
		// LP price = (fairResA * pxA + fairResB * pxB) / totalLPSupply
		priceInEth = (fairResA * pxA + fairResB * pxB) / pool.totalSupply();
	}

	/**
	 * @notice Returns RDNT price in WETH
	 * @return RDNT price
	 */
	function getPrice() public view returns (uint256) {
		address vaultAddress = vaultAddr;
		VaultReentrancyLib.ensureNotInVaultContext(IVault(vaultAddress));
		(IERC20[] memory tokens, uint256[] memory balances, ) = IVault(vaultAddress).getPoolTokens(poolId);
		uint256 rdntBalance = address(tokens[0]) == outTokenAddr ? balances[0] : balances[1];
		uint256 wethBalance = address(tokens[0]) == outTokenAddr ? balances[1] : balances[0];

		return (wethBalance * 1e8) / (rdntBalance / POOL_WEIGHT);
	}

	/**
	 * @notice Returns reserve information.
	 * @return rdnt RDNT amount
	 * @return weth WETH amount
	 * @return lpTokenSupply LP token supply
	 */
	function getReserves() public view returns (uint256 rdnt, uint256 weth, uint256 lpTokenSupply) {
		IERC20 lpToken = IERC20(lpTokenAddr);

		address vaultAddress = vaultAddr;
		VaultReentrancyLib.ensureNotInVaultContext(IVault(vaultAddress));
		(IERC20[] memory tokens, uint256[] memory balances, ) = IVault(vaultAddress).getPoolTokens(poolId);

		rdnt = address(tokens[0]) == outTokenAddr ? balances[0] : balances[1];
		weth = address(tokens[0]) == outTokenAddr ? balances[1] : balances[0];

		lpTokenSupply = lpToken.totalSupply();
	}

	/**
	 * @notice Add liquidity
	 * @param _wethAmt WETH amount
	 * @param _rdntAmt RDNT amount
	 * @return liquidity amount of LP token
	 */
	function _joinPool(uint256 _wethAmt, uint256 _rdntAmt) internal returns (uint256 liquidity) {
		(address token0, address token1) = _sortTokens(outTokenAddr, inTokenAddr);
		IAsset[] memory assets = new IAsset[](2);
		assets[0] = IAsset(token0);
		assets[1] = IAsset(token1);

		uint256[] memory maxAmountsIn = new uint256[](2);
		if (token0 == inTokenAddr) {
			maxAmountsIn[0] = _wethAmt;
			maxAmountsIn[1] = _rdntAmt;
		} else {
			maxAmountsIn[0] = _rdntAmt;
			maxAmountsIn[1] = _wethAmt;
		}

		bytes memory userDataEncoded = abi.encode(IWeightedPool.JoinKind.EXACT_TOKENS_IN_FOR_BPT_OUT, maxAmountsIn, 0);
		IVault.JoinPoolRequest memory inRequest = IVault.JoinPoolRequest(assets, maxAmountsIn, userDataEncoded, false);
		IVault(vaultAddr).joinPool(poolId, address(this), address(this), inRequest);

		IERC20 lp = IERC20(lpTokenAddr);
		liquidity = lp.balanceOf(address(this));
	}

	/**
	 * @notice Gets needed WETH for adding LP
	 * @param lpAmount LP amount
	 * @return wethAmount WETH amount
	 */
	function quoteWETH(uint256 lpAmount) public view override returns (uint256 wethAmount) {
		(address token0, address token1) = _sortTokens(outTokenAddr, inTokenAddr);
		IAsset[] memory assets = new IAsset[](2);
		assets[0] = IAsset(token0);
		assets[1] = IAsset(token1);

		uint256[] memory maxAmountsIn = new uint256[](2);
		uint256 enterTokenIndex;
		if (token0 == inTokenAddr) {
			enterTokenIndex = 0;
			maxAmountsIn[0] = type(uint256).max;
			maxAmountsIn[1] = 0;
		} else {
			enterTokenIndex = 1;
			maxAmountsIn[0] = 0;
			maxAmountsIn[1] = type(uint256).max;
		}

		bytes memory userDataEncoded = abi.encode(
			IWeightedPool.JoinKind.TOKEN_IN_FOR_EXACT_BPT_OUT,
			lpAmount,
			enterTokenIndex
		);
		IVault.JoinPoolRequest memory inRequest = IVault.JoinPoolRequest(assets, maxAmountsIn, userDataEncoded, false);

		(bool success, bytes memory data) = BALANCER_QUERIES.staticcall(
			abi.encodeCall(IBalancerQueries.queryJoin, (poolId, address(this), address(this), inRequest))
		);
		if (!success) revert QuoteFail();
		(, uint256[] memory amountsIn) = abi.decode(data, (uint256, uint256[]));
		return amountsIn[enterTokenIndex];
	}

	/**
	 * @notice Zap WETH
	 * @param amount to zap
	 * @return liquidity token amount
	 */
	function zapWETH(uint256 amount) public returns (uint256 liquidity) {
		if (msg.sender != lockZap) revert InsufficientPermission();
		IWETH(wethAddr).transferFrom(msg.sender, address(this), amount);
		liquidity = _joinPool(amount, 0);
		IERC20 lp = IERC20(lpTokenAddr);
		lp.safeTransfer(msg.sender, liquidity);
		_refundDust(outTokenAddr, wethAddr, msg.sender);
	}

	/**
	 * @notice Zap WETH and RDNT
	 * @param _wethAmt WETH amount
	 * @param _rdntAmt RDNT amount
	 * @return liquidity token amount
	 */
	function zapTokens(uint256 _wethAmt, uint256 _rdntAmt) public returns (uint256 liquidity) {
		if (msg.sender != lockZap) revert InsufficientPermission();
		IWETH(wethAddr).transferFrom(msg.sender, address(this), _wethAmt);
		IERC20(outTokenAddr).safeTransferFrom(msg.sender, address(this), _rdntAmt);

		liquidity = _joinPool(_wethAmt, _rdntAmt);
		IERC20 lp = IERC20(lpTokenAddr);
		lp.safeTransfer(msg.sender, liquidity);

		_refundDust(outTokenAddr, wethAddr, msg.sender);
	}

	/**
	 * @notice Sort tokens
	 */
	function _sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) {
		if (tokenA == tokenB) revert IdenticalAddresses();
		(token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
		if (token0 == address(0)) revert AddressZero();
	}

	/**
	 * @notice Calculate quote in WETH from token
	 * @param tokenAmount RDNT amount
	 * @return optimalWETHAmount WETH amount
	 */
	function quoteFromToken(uint256 tokenAmount) public view returns (uint256 optimalWETHAmount) {
		uint256 rdntPriceInEth = getPrice();
		uint256 p1 = rdntPriceInEth * 1e10;
		uint256 ethRequiredBeforeWeight = (tokenAmount * p1) / 1e18;
		optimalWETHAmount = ethRequiredBeforeWeight / POOL_WEIGHT;
	}

	/**
	 * @notice Set lockzap contract
	 */
	function setLockZap(address _lockZap) external onlyOwner {
		if (_lockZap == address(0)) revert AddressZero();
		lockZap = _lockZap;
	}

	/**
	 * @notice Calculate tokenAmount from WETH
	 * @param _inToken input token
	 * @param _wethAmount WETH amount
	 * @return tokenAmount token amount
	 */
	function quoteSwap(address _inToken, uint256 _wethAmount) public view override returns (uint256 tokenAmount) {
		IVault.SingleSwap memory singleSwap;
		singleSwap.poolId = poolId;
		singleSwap.kind = IVault.SwapKind.GIVEN_OUT;
		singleSwap.assetIn = IAsset(_inToken);
		singleSwap.assetOut = IAsset(wethAddr);
		singleSwap.amount = _wethAmount;
		singleSwap.userData = abi.encode(0);

		IVault.FundManagement memory funds;
		funds.sender = address(this);
		funds.fromInternalBalance = false;
		funds.recipient = payable(address(this));
		funds.toInternalBalance = false;

		(bool success, bytes memory data) = BALANCER_QUERIES.staticcall(
			abi.encodeCall(IBalancerQueries.querySwap, (singleSwap, funds))
		);
		if (!success) revert QuoteFail();
		uint256 amountIn = abi.decode(data, (uint256));
		return amountIn;
	}

	/**
	 * @notice Swaps tokens like USDC, DAI, USDT, WBTC to WETH
	 * @param _inToken address of the asset to swap
	 * @param _amount the amount of asset to swap
	 * @param _minAmountOut the minimum WETH amount to accept without reverting
	 */
	function swapToWeth(address _inToken, uint256 _amount, uint256 _minAmountOut) external {
		if (msg.sender != lockZap) revert InsufficientPermission();
		if (_inToken == address(0)) revert AddressZero();
		if (_amount == 0) revert ZeroAmount();
		bool isSingleSwap = true;
		if (_inToken == USDT_ADDRESS || _inToken == DAI_ADDRESS) {
			isSingleSwap = false;
		}

		if (!isSingleSwap) {
			uint256 usdcBalanceBefore = IERC20(USDC_ADDRESS).balanceOf(address(this));
			_swap(_inToken, USDC_ADDRESS, _amount, 0, DAI_USDT_USDC_POOL_ID, address(this));
			uint256 usdcBalanceAfter = IERC20(USDC_ADDRESS).balanceOf(address(this));
			_inToken = USDC_ADDRESS;
			_amount = usdcBalanceAfter - usdcBalanceBefore;
		}

		_swap(_inToken, REAL_WETH_ADDR, _amount, _minAmountOut, WBTC_WETH_USDC_POOL_ID, msg.sender);
	}

	/**
	 * @notice Swaps tokens using the Balancer swap function
	 * @param _inToken address of the asset to swap
	 * @param _outToken address of the asset to receieve
	 * @param _amount the amount of asset to swap
	 * @param _minAmountOut the minimum WETH amount to accept without reverting
	 * @param _poolId The ID of the pool to use for swapping
	 * @param _recipient the receiver of the outToken
	 */
	function _swap(
		address _inToken,
		address _outToken,
		uint256 _amount,
		uint256 _minAmountOut,
		bytes32 _poolId,
		address _recipient
	) internal {
		IVault.SingleSwap memory singleSwap;
		singleSwap.poolId = _poolId;
		singleSwap.kind = IVault.SwapKind.GIVEN_IN;
		singleSwap.assetIn = IAsset(_inToken);
		singleSwap.assetOut = IAsset(_outToken);
		singleSwap.amount = _amount;
		singleSwap.userData = abi.encode(0);

		IVault.FundManagement memory funds;
		funds.sender = address(this);
		funds.fromInternalBalance = false;
		funds.recipient = payable(address(_recipient));
		funds.toInternalBalance = false;

		uint256 currentAllowance = IERC20(_inToken).allowance(address(this), vaultAddr);
		if (_amount > currentAllowance) {
			IERC20(_inToken).forceApprove(vaultAddr, _amount);
		}
		IVault(vaultAddr).swap(singleSwap, funds, _minAmountOut, block.timestamp);
	}

	/**
	 * @notice Get swap fee percentage
	 */
	function getSwapFeePercentage() external view returns (uint256 fee) {
		IWeightedPool pool = IWeightedPool(lpTokenAddr);
		fee = pool.getSwapFeePercentage();
	}

	/**
	 * @notice Set swap fee percentage
	 */
	function setSwapFeePercentage(uint256 _fee) external onlyOwner {
		IWeightedPool pool = IWeightedPool(lpTokenAddr);
		pool.setSwapFeePercentage(_fee);
	}
}

File 2 of 17 : BalancerErrors.sol
// SPDX-License-Identifier: GPL-3.0-or-later
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

pragma solidity >=0.7.0 <0.9.0;

// solhint-disable

/**
 * @dev Reverts if `condition` is false, with a revert reason containing `errorCode`. Only codes up to 999 are
 * supported.
 * Uses the default 'BAL' prefix for the error code
 */
function _require(bool condition, uint256 errorCode) pure {
    if (!condition) _revert(errorCode);
}

/**
 * @dev Reverts if `condition` is false, with a revert reason containing `errorCode`. Only codes up to 999 are
 * supported.
 */
function _require(
    bool condition,
    uint256 errorCode,
    bytes3 prefix
) pure {
    if (!condition) _revert(errorCode, prefix);
}

/**
 * @dev Reverts with a revert reason containing `errorCode`. Only codes up to 999 are supported.
 * Uses the default 'BAL' prefix for the error code
 */
function _revert(uint256 errorCode) pure {
    _revert(errorCode, 0x42414c); // This is the raw byte representation of "BAL"
}

/**
 * @dev Reverts with a revert reason containing `errorCode`. Only codes up to 999 are supported.
 */
function _revert(uint256 errorCode, bytes3 prefix) pure {
    uint256 prefixUint = uint256(uint24(prefix));
    // We're going to dynamically create a revert string based on the error code, with the following format:
    // 'BAL#{errorCode}'
    // where the code is left-padded with zeroes to three digits (so they range from 000 to 999).
    //
    // We don't have revert strings embedded in the contract to save bytecode size: it takes much less space to store a
    // number (8 to 16 bits) than the individual string characters.
    //
    // The dynamic string creation algorithm that follows could be implemented in Solidity, but assembly allows for a
    // much denser implementation, again saving bytecode size. Given this function unconditionally reverts, this is a
    // safe place to rely on it without worrying about how its usage might affect e.g. memory contents.
    assembly {
        // First, we need to compute the ASCII representation of the error code. We assume that it is in the 0-999
        // range, so we only need to convert three digits. To convert the digits to ASCII, we add 0x30, the value for
        // the '0' character.

        let units := add(mod(errorCode, 10), 0x30)

        errorCode := div(errorCode, 10)
        let tenths := add(mod(errorCode, 10), 0x30)

        errorCode := div(errorCode, 10)
        let hundreds := add(mod(errorCode, 10), 0x30)

        // With the individual characters, we can now construct the full string.
        // We first append the '#' character (0x23) to the prefix. In the case of 'BAL', it results in 0x42414c23 ('BAL#')
        // Then, we shift this by 24 (to provide space for the 3 bytes of the error code), and add the
        // characters to it, each shifted by a multiple of 8.
        // The revert reason is then shifted left by 200 bits (256 minus the length of the string, 7 characters * 8 bits
        // per character = 56) to locate it in the most significant part of the 256 slot (the beginning of a byte
        // array).
        let formattedPrefix := shl(24, add(0x23, shl(8, prefixUint)))

        let revertReason := shl(200, add(formattedPrefix, add(add(units, shl(8, tenths)), shl(16, hundreds))))

        // We can now encode the reason in memory, which can be safely overwritten as we're about to revert. The encoded
        // message will have the following layout:
        // [ revert reason identifier ] [ string location offset ] [ string length ] [ string contents ]

        // The Solidity revert reason identifier is 0x08c739a0, the function selector of the Error(string) function. We
        // also write zeroes to the next 28 bytes of memory, but those are about to be overwritten.
        mstore(0x0, 0x08c379a000000000000000000000000000000000000000000000000000000000)
        // Next is the offset to the location of the string, which will be placed immediately after (20 bytes away).
        mstore(0x04, 0x0000000000000000000000000000000000000000000000000000000000000020)
        // The string length is fixed: 7 characters.
        mstore(0x24, 7)
        // Finally, the string itself is stored.
        mstore(0x44, revertReason)

        // Even if the string is only 7 bytes long, we need to return a full 32 byte slot containing it. The length of
        // the encoded message is therefore 4 + 32 + 32 + 32 = 100.
        revert(0, 100)
    }
}

library Errors {
    // Math
    uint256 internal constant ADD_OVERFLOW = 0;
    uint256 internal constant SUB_OVERFLOW = 1;
    uint256 internal constant SUB_UNDERFLOW = 2;
    uint256 internal constant MUL_OVERFLOW = 3;
    uint256 internal constant ZERO_DIVISION = 4;
    uint256 internal constant DIV_INTERNAL = 5;
    uint256 internal constant X_OUT_OF_BOUNDS = 6;
    uint256 internal constant Y_OUT_OF_BOUNDS = 7;
    uint256 internal constant PRODUCT_OUT_OF_BOUNDS = 8;
    uint256 internal constant INVALID_EXPONENT = 9;

    // Input
    uint256 internal constant OUT_OF_BOUNDS = 100;
    uint256 internal constant UNSORTED_ARRAY = 101;
    uint256 internal constant UNSORTED_TOKENS = 102;
    uint256 internal constant INPUT_LENGTH_MISMATCH = 103;
    uint256 internal constant ZERO_TOKEN = 104;
    uint256 internal constant INSUFFICIENT_DATA = 105;

    // Shared pools
    uint256 internal constant MIN_TOKENS = 200;
    uint256 internal constant MAX_TOKENS = 201;
    uint256 internal constant MAX_SWAP_FEE_PERCENTAGE = 202;
    uint256 internal constant MIN_SWAP_FEE_PERCENTAGE = 203;
    uint256 internal constant MINIMUM_BPT = 204;
    uint256 internal constant CALLER_NOT_VAULT = 205;
    uint256 internal constant UNINITIALIZED = 206;
    uint256 internal constant BPT_IN_MAX_AMOUNT = 207;
    uint256 internal constant BPT_OUT_MIN_AMOUNT = 208;
    uint256 internal constant EXPIRED_PERMIT = 209;
    uint256 internal constant NOT_TWO_TOKENS = 210;
    uint256 internal constant DISABLED = 211;

    // Pools
    uint256 internal constant MIN_AMP = 300;
    uint256 internal constant MAX_AMP = 301;
    uint256 internal constant MIN_WEIGHT = 302;
    uint256 internal constant MAX_STABLE_TOKENS = 303;
    uint256 internal constant MAX_IN_RATIO = 304;
    uint256 internal constant MAX_OUT_RATIO = 305;
    uint256 internal constant MIN_BPT_IN_FOR_TOKEN_OUT = 306;
    uint256 internal constant MAX_OUT_BPT_FOR_TOKEN_IN = 307;
    uint256 internal constant NORMALIZED_WEIGHT_INVARIANT = 308;
    uint256 internal constant INVALID_TOKEN = 309;
    uint256 internal constant UNHANDLED_JOIN_KIND = 310;
    uint256 internal constant ZERO_INVARIANT = 311;
    uint256 internal constant ORACLE_INVALID_SECONDS_QUERY = 312;
    uint256 internal constant ORACLE_NOT_INITIALIZED = 313;
    uint256 internal constant ORACLE_QUERY_TOO_OLD = 314;
    uint256 internal constant ORACLE_INVALID_INDEX = 315;
    uint256 internal constant ORACLE_BAD_SECS = 316;
    uint256 internal constant AMP_END_TIME_TOO_CLOSE = 317;
    uint256 internal constant AMP_ONGOING_UPDATE = 318;
    uint256 internal constant AMP_RATE_TOO_HIGH = 319;
    uint256 internal constant AMP_NO_ONGOING_UPDATE = 320;
    uint256 internal constant STABLE_INVARIANT_DIDNT_CONVERGE = 321;
    uint256 internal constant STABLE_GET_BALANCE_DIDNT_CONVERGE = 322;
    uint256 internal constant RELAYER_NOT_CONTRACT = 323;
    uint256 internal constant BASE_POOL_RELAYER_NOT_CALLED = 324;
    uint256 internal constant REBALANCING_RELAYER_REENTERED = 325;
    uint256 internal constant GRADUAL_UPDATE_TIME_TRAVEL = 326;
    uint256 internal constant SWAPS_DISABLED = 327;
    uint256 internal constant CALLER_IS_NOT_LBP_OWNER = 328;
    uint256 internal constant PRICE_RATE_OVERFLOW = 329;
    uint256 internal constant INVALID_JOIN_EXIT_KIND_WHILE_SWAPS_DISABLED = 330;
    uint256 internal constant WEIGHT_CHANGE_TOO_FAST = 331;
    uint256 internal constant LOWER_GREATER_THAN_UPPER_TARGET = 332;
    uint256 internal constant UPPER_TARGET_TOO_HIGH = 333;
    uint256 internal constant UNHANDLED_BY_LINEAR_POOL = 334;
    uint256 internal constant OUT_OF_TARGET_RANGE = 335;
    uint256 internal constant UNHANDLED_EXIT_KIND = 336;
    uint256 internal constant UNAUTHORIZED_EXIT = 337;
    uint256 internal constant MAX_MANAGEMENT_SWAP_FEE_PERCENTAGE = 338;
    uint256 internal constant UNHANDLED_BY_MANAGED_POOL = 339;
    uint256 internal constant UNHANDLED_BY_PHANTOM_POOL = 340;
    uint256 internal constant TOKEN_DOES_NOT_HAVE_RATE_PROVIDER = 341;
    uint256 internal constant INVALID_INITIALIZATION = 342;
    uint256 internal constant OUT_OF_NEW_TARGET_RANGE = 343;
    uint256 internal constant FEATURE_DISABLED = 344;
    uint256 internal constant UNINITIALIZED_POOL_CONTROLLER = 345;
    uint256 internal constant SET_SWAP_FEE_DURING_FEE_CHANGE = 346;
    uint256 internal constant SET_SWAP_FEE_PENDING_FEE_CHANGE = 347;
    uint256 internal constant CHANGE_TOKENS_DURING_WEIGHT_CHANGE = 348;
    uint256 internal constant CHANGE_TOKENS_PENDING_WEIGHT_CHANGE = 349;
    uint256 internal constant MAX_WEIGHT = 350;
    uint256 internal constant UNAUTHORIZED_JOIN = 351;
    uint256 internal constant MAX_MANAGEMENT_AUM_FEE_PERCENTAGE = 352;
    uint256 internal constant FRACTIONAL_TARGET = 353;
    uint256 internal constant ADD_OR_REMOVE_BPT = 354;
    uint256 internal constant INVALID_CIRCUIT_BREAKER_BOUNDS = 355;
    uint256 internal constant CIRCUIT_BREAKER_TRIPPED = 356;
    uint256 internal constant MALICIOUS_QUERY_REVERT = 357;
    uint256 internal constant JOINS_EXITS_DISABLED = 358;

    // Lib
    uint256 internal constant REENTRANCY = 400;
    uint256 internal constant SENDER_NOT_ALLOWED = 401;
    uint256 internal constant PAUSED = 402;
    uint256 internal constant PAUSE_WINDOW_EXPIRED = 403;
    uint256 internal constant MAX_PAUSE_WINDOW_DURATION = 404;
    uint256 internal constant MAX_BUFFER_PERIOD_DURATION = 405;
    uint256 internal constant INSUFFICIENT_BALANCE = 406;
    uint256 internal constant INSUFFICIENT_ALLOWANCE = 407;
    uint256 internal constant ERC20_TRANSFER_FROM_ZERO_ADDRESS = 408;
    uint256 internal constant ERC20_TRANSFER_TO_ZERO_ADDRESS = 409;
    uint256 internal constant ERC20_MINT_TO_ZERO_ADDRESS = 410;
    uint256 internal constant ERC20_BURN_FROM_ZERO_ADDRESS = 411;
    uint256 internal constant ERC20_APPROVE_FROM_ZERO_ADDRESS = 412;
    uint256 internal constant ERC20_APPROVE_TO_ZERO_ADDRESS = 413;
    uint256 internal constant ERC20_TRANSFER_EXCEEDS_ALLOWANCE = 414;
    uint256 internal constant ERC20_DECREASED_ALLOWANCE_BELOW_ZERO = 415;
    uint256 internal constant ERC20_TRANSFER_EXCEEDS_BALANCE = 416;
    uint256 internal constant ERC20_BURN_EXCEEDS_ALLOWANCE = 417;
    uint256 internal constant SAFE_ERC20_CALL_FAILED = 418;
    uint256 internal constant ADDRESS_INSUFFICIENT_BALANCE = 419;
    uint256 internal constant ADDRESS_CANNOT_SEND_VALUE = 420;
    uint256 internal constant SAFE_CAST_VALUE_CANT_FIT_INT256 = 421;
    uint256 internal constant GRANT_SENDER_NOT_ADMIN = 422;
    uint256 internal constant REVOKE_SENDER_NOT_ADMIN = 423;
    uint256 internal constant RENOUNCE_SENDER_NOT_ALLOWED = 424;
    uint256 internal constant BUFFER_PERIOD_EXPIRED = 425;
    uint256 internal constant CALLER_IS_NOT_OWNER = 426;
    uint256 internal constant NEW_OWNER_IS_ZERO = 427;
    uint256 internal constant CODE_DEPLOYMENT_FAILED = 428;
    uint256 internal constant CALL_TO_NON_CONTRACT = 429;
    uint256 internal constant LOW_LEVEL_CALL_FAILED = 430;
    uint256 internal constant NOT_PAUSED = 431;
    uint256 internal constant ADDRESS_ALREADY_ALLOWLISTED = 432;
    uint256 internal constant ADDRESS_NOT_ALLOWLISTED = 433;
    uint256 internal constant ERC20_BURN_EXCEEDS_BALANCE = 434;
    uint256 internal constant INVALID_OPERATION = 435;
    uint256 internal constant CODEC_OVERFLOW = 436;
    uint256 internal constant IN_RECOVERY_MODE = 437;
    uint256 internal constant NOT_IN_RECOVERY_MODE = 438;
    uint256 internal constant INDUCED_FAILURE = 439;
    uint256 internal constant EXPIRED_SIGNATURE = 440;
    uint256 internal constant MALFORMED_SIGNATURE = 441;
    uint256 internal constant SAFE_CAST_VALUE_CANT_FIT_UINT64 = 442;
    uint256 internal constant UNHANDLED_FEE_TYPE = 443;
    uint256 internal constant BURN_FROM_ZERO = 444;

    // Vault
    uint256 internal constant INVALID_POOL_ID = 500;
    uint256 internal constant CALLER_NOT_POOL = 501;
    uint256 internal constant SENDER_NOT_ASSET_MANAGER = 502;
    uint256 internal constant USER_DOESNT_ALLOW_RELAYER = 503;
    uint256 internal constant INVALID_SIGNATURE = 504;
    uint256 internal constant EXIT_BELOW_MIN = 505;
    uint256 internal constant JOIN_ABOVE_MAX = 506;
    uint256 internal constant SWAP_LIMIT = 507;
    uint256 internal constant SWAP_DEADLINE = 508;
    uint256 internal constant CANNOT_SWAP_SAME_TOKEN = 509;
    uint256 internal constant UNKNOWN_AMOUNT_IN_FIRST_SWAP = 510;
    uint256 internal constant MALCONSTRUCTED_MULTIHOP_SWAP = 511;
    uint256 internal constant INTERNAL_BALANCE_OVERFLOW = 512;
    uint256 internal constant INSUFFICIENT_INTERNAL_BALANCE = 513;
    uint256 internal constant INVALID_ETH_INTERNAL_BALANCE = 514;
    uint256 internal constant INVALID_POST_LOAN_BALANCE = 515;
    uint256 internal constant INSUFFICIENT_ETH = 516;
    uint256 internal constant UNALLOCATED_ETH = 517;
    uint256 internal constant ETH_TRANSFER = 518;
    uint256 internal constant CANNOT_USE_ETH_SENTINEL = 519;
    uint256 internal constant TOKENS_MISMATCH = 520;
    uint256 internal constant TOKEN_NOT_REGISTERED = 521;
    uint256 internal constant TOKEN_ALREADY_REGISTERED = 522;
    uint256 internal constant TOKENS_ALREADY_SET = 523;
    uint256 internal constant TOKENS_LENGTH_MUST_BE_2 = 524;
    uint256 internal constant NONZERO_TOKEN_BALANCE = 525;
    uint256 internal constant BALANCE_TOTAL_OVERFLOW = 526;
    uint256 internal constant POOL_NO_TOKENS = 527;
    uint256 internal constant INSUFFICIENT_FLASH_LOAN_BALANCE = 528;

    // Fees
    uint256 internal constant SWAP_FEE_PERCENTAGE_TOO_HIGH = 600;
    uint256 internal constant FLASH_LOAN_FEE_PERCENTAGE_TOO_HIGH = 601;
    uint256 internal constant INSUFFICIENT_FLASH_LOAN_FEE_AMOUNT = 602;
    uint256 internal constant AUM_FEE_PERCENTAGE_TOO_HIGH = 603;

    // FeeSplitter
    uint256 internal constant SPLITTER_FEE_PERCENTAGE_TOO_HIGH = 700;

    // Misc
    uint256 internal constant UNIMPLEMENTED = 998;
    uint256 internal constant SHOULD_NOT_HAPPEN = 999;
}

File 3 of 17 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    function __Ownable_init() internal onlyInitializing {
        __Ownable_init_unchained();
    }

    function __Ownable_init_unchained() internal onlyInitializing {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 4 of 17 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

import "../../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```solidity
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 *
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint8 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
     * constructor.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        bool isTopLevelCall = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _initialized = 1;
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: setting the version to 255 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized != type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }

    /**
     * @dev Returns the highest version that has been initialized. See {reinitializer}.
     */
    function _getInitializedVersion() internal view returns (uint8) {
        return _initialized;
    }

    /**
     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
     */
    function _isInitializing() internal view returns (bool) {
        return _initializing;
    }
}

File 5 of 17 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

File 6 of 17 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @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 ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 7 of 17 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 amount) external returns (bool);
}

File 8 of 17 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
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);
}

File 9 of 17 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(IERC20 token, address spender, uint256 value) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return
            success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
    }
}

File 10 of 17 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

File 11 of 17 : BConst.sol
// https://github.com/balancer-labs/balancer-core/blob/master/contracts/BConst.sol

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

pragma solidity 0.8.12;

contract BConst {
	uint public constant BONE = 10 ** 18;

	uint public constant MIN_BOUND_TOKENS = 2;
	uint public constant MAX_BOUND_TOKENS = 8;

	uint public constant MIN_FEE = BONE / 10 ** 6;
	uint public constant MAX_FEE = BONE / 10;
	uint public constant EXIT_FEE = 0;

	uint public constant MIN_WEIGHT = BONE;
	uint public constant MAX_WEIGHT = BONE * 50;
	uint public constant MAX_TOTAL_WEIGHT = BONE * 50;
	uint public constant MIN_BALANCE = BONE / 10 ** 12;

	uint public constant INIT_POOL_SUPPLY = BONE * 100;

	uint public constant MIN_BPOW_BASE = 1 wei;
	uint public constant MAX_BPOW_BASE = (2 * BONE) - 1 wei;
	uint public constant BPOW_PRECISION = BONE / 10 ** 10;

	uint public constant MAX_IN_RATIO = BONE / 2;
	uint public constant MAX_OUT_RATIO = (BONE / 3) + 1 wei;
}

File 12 of 17 : BNum.sol
// https://github.com/balancer-labs/balancer-core/blob/master/contracts/BNum.sol

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

pragma solidity 0.8.12;

import "./BConst.sol";

contract BNum is BConst {
	function btoi(uint a) internal pure returns (uint) {
		return a / BONE;
	}

	function bfloor(uint a) internal pure returns (uint) {
		return btoi(a) * BONE;
	}

	function badd(uint a, uint b) internal pure returns (uint) {
		uint c = a + b;
		require(c >= a, "ERR_ADD_OVERFLOW");
		return c;
	}

	function bsub(uint a, uint b) internal pure returns (uint) {
		(uint c, bool flag) = bsubSign(a, b);
		require(!flag, "ERR_SUB_UNDERFLOW");
		return c;
	}

	function bsubSign(uint a, uint b) internal pure returns (uint, bool) {
		if (a >= b) {
			return (a - b, false);
		} else {
			return (b - a, true);
		}
	}

	function bmul(uint a, uint b) internal pure returns (uint) {
		uint c0 = a * b;
		require(a == 0 || c0 / a == b, "ERR_MUL_OVERFLOW");
		uint c1 = c0 + (BONE / 2);
		require(c1 >= c0, "ERR_MUL_OVERFLOW");
		uint c2 = c1 / BONE;
		return c2;
	}

	function bdiv(uint a, uint b) internal pure returns (uint) {
		require(b != 0, "ERR_DIV_ZERO");
		uint c0 = a * BONE;
		require(a == 0 || c0 / a == BONE, "ERR_DIV_INTERNAL"); // bmul overflow
		uint c1 = c0 + (b / 2);
		require(c1 >= c0, "ERR_DIV_INTERNAL"); //  badd require
		uint c2 = c1 / b;
		return c2;
	}

	// DSMath.wpow
	function bpowi(uint a, uint n) internal pure returns (uint) {
		uint z = n % 2 != 0 ? a : BONE;

		for (n /= 2; n != 0; n /= 2) {
			a = bmul(a, a);

			if (n % 2 != 0) {
				z = bmul(z, a);
			}
		}
		return z;
	}

	// Compute b^(e.w) by splitting it into (b^e)*(b^0.w).
	// Use `bpowi` for `b^e` and `bpowK` for k iterations
	// of approximation of b^0.w
	function bpow(uint base, uint exp) internal pure returns (uint) {
		require(base >= MIN_BPOW_BASE, "ERR_BPOW_BASE_TOO_LOW");
		require(base <= MAX_BPOW_BASE, "ERR_BPOW_BASE_TOO_HIGH");

		uint whole = bfloor(exp);
		uint remain = bsub(exp, whole);

		uint wholePow = bpowi(base, btoi(whole));

		if (remain == 0) {
			return wholePow;
		}

		uint partialResult = bpowApprox(base, remain, BPOW_PRECISION);
		return bmul(wholePow, partialResult);
	}

	function bpowApprox(uint base, uint exp, uint precision) internal pure returns (uint) {
		// term 0:
		uint a = exp;
		(uint x, bool xneg) = bsubSign(base, BONE);
		uint term = BONE;
		uint sum = term;
		bool negative = false;

		// term(k) = numer / denom
		//         = (product(a - i - 1, i=1-->k) * x^k) / (k!)
		// each iteration, multiply previous term by (a-(k-1)) * x / k
		// continue until term is less than precision
		for (uint i = 1; term >= precision; i++) {
			uint bigK = i * BONE;
			(uint c, bool cneg) = bsubSign(a, bsub(bigK, BONE));
			term = bmul(term, bmul(c, x));
			term = bdiv(term, bigK);
			if (term == 0) break;

			if (xneg) negative = !negative;
			if (cneg) negative = !negative;
			if (negative) {
				sum = bsub(sum, term);
			} else {
				sum = badd(sum, term);
			}
		}

		return sum;
	}
}

File 13 of 17 : IPoolHelper.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.12;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

interface IPoolHelper {
	function lpTokenAddr() external view returns (address);

	function zapWETH(uint256 amount) external returns (uint256);

	function zapTokens(uint256 _wethAmt, uint256 _rdntAmt) external returns (uint256);

	function quoteFromToken(uint256 tokenAmount) external view returns (uint256 optimalWETHAmount);

	function quoteWETH(uint256 lpAmount) external view returns (uint256 wethAmount);

	function getLpPrice(uint256 rdntPriceInEth) external view returns (uint256 priceInEth);

	function getReserves() external view returns (uint256 rdnt, uint256 weth, uint256 lpTokenSupply);

	function getPrice() external view returns (uint256 priceInEth);

	function quoteSwap(address _inToken, uint256 _wethAmount) external view returns (uint256 tokenAmount);

	function swapToWeth(address _inToken, uint256 _amount, uint256 _minAmountOut) external;
}

interface IBalancerPoolHelper is IPoolHelper {
	function initializePool(string calldata _tokenName, string calldata _tokenSymbol) external;
}

interface IUniswapPoolHelper is IPoolHelper {
	function initializePool() external;
}

interface ITestPoolHelper is IPoolHelper {
	function sell(uint256 _amount) external returns (uint256 amountOut);
}

File 14 of 17 : IWETH.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.12;

interface IWETH {
	function balanceOf(address) external returns (uint256);

	function deposit() external payable;

	function withdraw(uint256) external;

	function approve(address guy, uint256 wad) external returns (bool);

	function transferFrom(address src, address dst, uint256 wad) external returns (bool);

	function transfer(address to, uint256 value) external returns (bool);

	function allowance(address owner, address spender) external returns (uint256);
}

File 15 of 17 : IWeightedPoolFactory.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.12;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

interface IBasePool is IERC20 {
	function getSwapFeePercentage() external view returns (uint256);

	function setSwapFeePercentage(uint256 swapFeePercentage) external;

	function setAssetManagerPoolConfig(IERC20 token, IAssetManager.PoolConfig memory poolConfig) external;

	function setPaused(bool paused) external;

	function getVault() external view returns (IVault);

	function getPoolId() external view returns (bytes32);

	function getOwner() external view returns (address);
}

interface IWeightedPoolFactory {
	function create(
		string memory name,
		string memory symbol,
		IERC20[] memory tokens,
		uint256[] memory weights,
		address[] memory rateProviders,
		uint256 swapFeePercentage,
		address owner,
		bytes32 salt
	) external returns (address);
}

interface IWeightedPool is IBasePool {
	function getSwapEnabled() external view returns (bool);

	function getNormalizedWeights() external view returns (uint256[] memory);

	function getGradualWeightUpdateParams()
		external
		view
		returns (uint256 startTime, uint256 endTime, uint256[] memory endWeights);

	function setSwapEnabled(bool swapEnabled) external;

	function updateWeightsGradually(uint256 startTime, uint256 endTime, uint256[] memory endWeights) external;

	function withdrawCollectedManagementFees(address recipient) external;

	enum JoinKind {
		INIT,
		EXACT_TOKENS_IN_FOR_BPT_OUT,
		TOKEN_IN_FOR_EXACT_BPT_OUT
	}
	enum ExitKind {
		EXACT_BPT_IN_FOR_ONE_TOKEN_OUT,
		EXACT_BPT_IN_FOR_TOKENS_OUT,
		BPT_IN_FOR_EXACT_TOKENS_OUT
	}
}

interface IAssetManager {
	struct PoolConfig {
		uint64 targetPercentage;
		uint64 criticalPercentage;
		uint64 feePercentage;
	}

	function setPoolConfig(bytes32 poolId, PoolConfig calldata config) external;
}

interface IAsset {}

interface IVault {
	function hasApprovedRelayer(address user, address relayer) external view returns (bool);

	function setRelayerApproval(address sender, address relayer, bool approved) external;

	event RelayerApprovalChanged(address indexed relayer, address indexed sender, bool approved);

	function getInternalBalance(address user, IERC20[] memory tokens) external view returns (uint256[] memory);

	function manageUserBalance(UserBalanceOp[] memory ops) external payable;

	struct UserBalanceOp {
		UserBalanceOpKind kind;
		IAsset asset;
		uint256 amount;
		address sender;
		address payable recipient;
	}

	enum UserBalanceOpKind {
		DEPOSIT_INTERNAL,
		WITHDRAW_INTERNAL,
		TRANSFER_INTERNAL,
		TRANSFER_EXTERNAL
	}
	event InternalBalanceChanged(address indexed user, IERC20 indexed token, int256 delta);
	event ExternalBalanceTransfer(IERC20 indexed token, address indexed sender, address recipient, uint256 amount);

	enum PoolSpecialization {
		GENERAL,
		MINIMAL_SWAP_INFO,
		TWO_TOKEN
	}

	function registerPool(PoolSpecialization specialization) external returns (bytes32);

	event PoolRegistered(bytes32 indexed poolId, address indexed poolAddress, PoolSpecialization specialization);

	function getPool(bytes32 poolId) external view returns (address, PoolSpecialization);

	function registerTokens(bytes32 poolId, IERC20[] memory tokens, address[] memory assetManagers) external;

	event TokensRegistered(bytes32 indexed poolId, IERC20[] tokens, address[] assetManagers);

	function deregisterTokens(bytes32 poolId, IERC20[] memory tokens) external;

	event TokensDeregistered(bytes32 indexed poolId, IERC20[] tokens);

	function getPoolTokenInfo(
		bytes32 poolId,
		IERC20 token
	) external view returns (uint256 cash, uint256 managed, uint256 lastChangeBlock, address assetManager);

	function getPoolTokens(
		bytes32 poolId
	) external view returns (IERC20[] memory tokens, uint256[] memory balances, uint256 lastChangeBlock);

	function joinPool(
		bytes32 poolId,
		address sender,
		address recipient,
		JoinPoolRequest memory request
	) external payable;

	struct JoinPoolRequest {
		IAsset[] assets;
		uint256[] maxAmountsIn;
		bytes userData;
		bool fromInternalBalance;
	}

	function exitPool(
		bytes32 poolId,
		address sender,
		address payable recipient,
		ExitPoolRequest memory request
	) external;

	struct ExitPoolRequest {
		IAsset[] assets;
		uint256[] minAmountsOut;
		bytes userData;
		bool toInternalBalance;
	}

	event PoolBalanceChanged(
		bytes32 indexed poolId,
		address indexed liquidityProvider,
		IERC20[] tokens,
		int256[] deltas,
		uint256[] protocolFeeAmounts
	);

	enum PoolBalanceChangeKind {
		JOIN,
		EXIT
	}

	enum SwapKind {
		GIVEN_IN,
		GIVEN_OUT
	}

	function swap(
		SingleSwap memory singleSwap,
		FundManagement memory funds,
		uint256 limit,
		uint256 deadline
	) external payable returns (uint256);

	struct SingleSwap {
		bytes32 poolId;
		SwapKind kind;
		IAsset assetIn;
		IAsset assetOut;
		uint256 amount;
		bytes userData;
	}

	function batchSwap(
		SwapKind kind,
		BatchSwapStep[] memory swaps,
		IAsset[] memory assets,
		FundManagement memory funds,
		int256[] memory limits,
		uint256 deadline
	) external payable returns (int256[] memory);

	struct BatchSwapStep {
		bytes32 poolId;
		uint256 assetInIndex;
		uint256 assetOutIndex;
		uint256 amount;
		bytes userData;
	}

	event Swap(
		bytes32 indexed poolId,
		IERC20 indexed tokenIn,
		IERC20 indexed tokenOut,
		uint256 amountIn,
		uint256 amountOut
	);
	struct FundManagement {
		address sender;
		bool fromInternalBalance;
		address payable recipient;
		bool toInternalBalance;
	}

	function queryBatchSwap(
		SwapKind kind,
		BatchSwapStep[] memory swaps,
		IAsset[] memory assets,
		FundManagement memory funds
	) external returns (int256[] memory assetDeltas);

	function managePoolBalance(PoolBalanceOp[] memory ops) external;

	struct PoolBalanceOp {
		PoolBalanceOpKind kind;
		bytes32 poolId;
		IERC20 token;
		uint256 amount;
	}

	enum PoolBalanceOpKind {
		WITHDRAW,
		DEPOSIT,
		UPDATE
	}
	event PoolBalanceManaged(
		bytes32 indexed poolId,
		address indexed assetManager,
		IERC20 indexed token,
		int256 cashDelta,
		int256 managedDelta
	);

	function setPaused(bool paused) external;
}

interface IBalancerQueries {
	function querySwap(
		IVault.SingleSwap memory singleSwap,
		IVault.FundManagement memory funds
	) external returns (uint256);

	function queryBatchSwap(
		IVault.SwapKind kind,
		IVault.BatchSwapStep[] memory swaps,
		IAsset[] memory assets,
		IVault.FundManagement memory funds
	) external returns (int256[] memory assetDeltas);

	function queryJoin(
		bytes32 poolId,
		address sender,
		address recipient,
		IVault.JoinPoolRequest memory request
	) external returns (uint256 bptOut, uint256[] memory amountsIn);

	function queryExit(
		bytes32 poolId,
		address sender,
		address recipient,
		IVault.ExitPoolRequest memory request
	) external returns (uint256 bptIn, uint256[] memory amountsOut);
}

File 16 of 17 : VaultReentrancyLib.sol
// SPDX-License-Identifier: AGPL-3.0
// Modified by Radiant Capital to accommodate different interface files
pragma solidity >=0.7.0 <0.9.0;

import "@balancer-labs/v2-interfaces/contracts/solidity-utils/helpers/BalancerErrors.sol";
import {IVault} from "../../../interfaces/balancer/IWeightedPoolFactory.sol";

library VaultReentrancyLib {
	/**
	 * @dev Ensure we are not in a Vault context when this function is called, by attempting a no-op internal
	 * balance operation. If we are already in a Vault transaction (e.g., a swap, join, or exit), the Vault's
	 * reentrancy protection will cause this function to revert.
	 *
	 * The exact function call doesn't really matter: we're just trying to trigger the Vault reentrancy check
	 * (and not hurt anything in case it works). An empty operation array with no specific operation at all works
	 * for that purpose, and is also the least expensive in terms of gas and bytecode size.
	 *
	 * Call this at the top of any function that can cause a state change in a pool and is either public itself,
	 * or called by a public function *outside* a Vault operation (e.g., join, exit, or swap).
	 *
	 * If this is *not* called in functions that are vulnerable to the read-only reentrancy issue described
	 * here (https://forum.balancer.fi/t/reentrancy-vulnerability-scope-expanded/4345), those functions are unsafe,
	 * and subject to manipulation that may result in loss of funds.
	 */
	function ensureNotInVaultContext(IVault vault) internal view {
		// Perform the following operation to trigger the Vault's reentrancy guard:
		//
		// IVault.UserBalanceOp[] memory noop = new IVault.UserBalanceOp[](0);
		// _vault.manageUserBalance(noop);
		//
		// However, use a static call so that it can be a view function (even though the function is non-view).
		// This allows the library to be used more widely, as some functions that need to be protected might be
		// view.
		//
		// This staticcall always reverts, but we need to make sure it doesn't fail due to a re-entrancy attack.
		// Staticcalls consume all gas forwarded to them on a revert caused by storage modification.
		// By default, almost the entire available gas is forwarded to the staticcall,
		// causing the entire call to revert with an 'out of gas' error.
		//
		// We set the gas limit to 10k for the staticcall to
		// avoid wasting gas when it reverts due to storage modification.
		// `manageUserBalance` is a non-reentrant function in the Vault, so calling it invokes `_enterNonReentrant`
		// in the `ReentrancyGuard` contract, reproduced here:
		//
		//    function _enterNonReentrant() private {
		//        // If the Vault is actually being reentered, it will revert in the first line, at the `_require` that
		//        // checks the reentrancy flag, with "BAL#400" (corresponding to Errors.REENTRANCY) in the revertData.
		//        // The full revertData will be: `abi.encodeWithSignature("Error(string)", "BAL#400")`.
		//        _require(_status != _ENTERED, Errors.REENTRANCY);
		//
		//        // If the Vault is not being reentered, the check above will pass: but it will *still* revert,
		//        // because the next line attempts to modify storage during a staticcall. However, this type of
		//        // failure results in empty revertData.
		//        _status = _ENTERED;
		//    }
		//
		// So based on this analysis, there are only two possible revertData values: empty, or abi.encoded BAL#400.
		//
		// It is of course much more bytecode and gas efficient to check for zero-length revertData than to compare it
		// to the encoded REENTRANCY revertData.
		//
		// While it should be impossible for the call to fail in any other way (especially since it reverts before
		// `manageUserBalance` even gets called), any other error would generate non-zero revertData, so checking for
		// empty data guards against this case too.

		(, bytes memory revertData) = address(vault).staticcall{gas: 10_000}(
			abi.encodeWithSelector(vault.manageUserBalance.selector, 0)
		);

		_require(revertData.length == 0, Errors.REENTRANCY);
	}
}

File 17 of 17 : DustRefunder.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.12;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

import {IWETH} from "../../../interfaces/IWETH.sol";

/// @title Dust Refunder Contract
/// @dev Refunds dust tokens remaining from zapping.
/// @author Radiant
contract DustRefunder {
	using SafeERC20 for IERC20;

	/**
	 * @notice Refunds RDNT and WETH.
	 * @param _rdnt RDNT address
	 * @param _weth WETH address
	 * @param _refundAddress Address for refund
	 */
	function _refundDust(address _rdnt, address _weth, address _refundAddress) internal {
		IERC20 rdnt = IERC20(_rdnt);
		IWETH weth = IWETH(_weth);

		uint256 dustWETH = weth.balanceOf(address(this));
		if (dustWETH > 0) {
			weth.transfer(_refundAddress, dustWETH);
		}
		uint256 dustRdnt = rdnt.balanceOf(address(this));
		if (dustRdnt > 0) {
			rdnt.safeTransfer(_refundAddress, dustRdnt);
		}
	}
}

Settings
{
  "evmVersion": "london",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 999999
  },
  "remappings": [],
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AddressZero","type":"error"},{"inputs":[],"name":"IdenticalAddresses","type":"error"},{"inputs":[],"name":"InsufficientPermission","type":"error"},{"inputs":[],"name":"PoolExists","type":"error"},{"inputs":[],"name":"QuoteFail","type":"error"},{"inputs":[],"name":"ZeroAmount","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"BALANCER_QUERIES","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BONE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BPOW_PRECISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DAI_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DAI_USDT_USDC_POOL_ID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EXIT_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"INITIAL_SWAP_FEE_PERCENTAGE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"INIT_POOL_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_BOUND_TOKENS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_BPOW_BASE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_IN_RATIO","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_OUT_RATIO","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_TOTAL_WEIGHT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_WEIGHT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_BALANCE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_BOUND_TOKENS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_BPOW_BASE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_WEIGHT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"POOL_WEIGHT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RDNT_WEIGHT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REAL_WETH_ADDR","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"USDC_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"USDT_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WBTC_WETH_USDC_POOL_ID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WETH_WEIGHT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"rdntPriceInEth","type":"uint256"}],"name":"getLpPrice","outputs":[{"internalType":"uint256","name":"priceInEth","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getReserves","outputs":[{"internalType":"uint256","name":"rdnt","type":"uint256"},{"internalType":"uint256","name":"weth","type":"uint256"},{"internalType":"uint256","name":"lpTokenSupply","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSwapFeePercentage","outputs":[{"internalType":"uint256","name":"fee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"inTokenAddr","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_inTokenAddr","type":"address"},{"internalType":"address","name":"_outTokenAddr","type":"address"},{"internalType":"address","name":"_wethAddr","type":"address"},{"internalType":"address","name":"_vault","type":"address"},{"internalType":"contract IWeightedPoolFactory","name":"_poolFactory","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_tokenName","type":"string"},{"internalType":"string","name":"_tokenSymbol","type":"string"}],"name":"initializePool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lockZap","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lpTokenAddr","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"outTokenAddr","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolFactory","outputs":[{"internalType":"contract IWeightedPoolFactory","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolId","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"quoteFromToken","outputs":[{"internalType":"uint256","name":"optimalWETHAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_inToken","type":"address"},{"internalType":"uint256","name":"_wethAmount","type":"uint256"}],"name":"quoteSwap","outputs":[{"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"lpAmount","type":"uint256"}],"name":"quoteWETH","outputs":[{"internalType":"uint256","name":"wethAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_lockZap","type":"address"}],"name":"setLockZap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setSwapFeePercentage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_inToken","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_minAmountOut","type":"uint256"}],"name":"swapToWeth","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vaultAddr","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"wethAddr","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_wethAmt","type":"uint256"},{"internalType":"uint256","name":"_rdntAmt","type":"uint256"}],"name":"zapTokens","outputs":[{"internalType":"uint256","name":"liquidity","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"zapWETH","outputs":[{"internalType":"uint256","name":"liquidity","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061034c5760003560e01c80639381cd2b116101bd578063c5fafba0116100f9578063e28861fa116100a2578063ec0930211161007c578063ec093021146106f4578063f2fde38b146106fc578063f94efa791461070f578063fd7060621461071e57600080fd5b8063e28861fa146106ce578063e4a28a52146103df578063e640aedf146106e157600080fd5b8063c98361c7116100d3578063c98361c71461067b578063d27567f21461069b578063d6e4845c146106bb57600080fd5b8063c5fafba014610658578063c6580d1214610660578063c829bfda1461066857600080fd5b8063ba019dab11610166578063bc694ea211610140578063bc694ea21461060e578063c189205814610616578063c276b9e214610631578063c36596a61461040457600080fd5b8063ba019dab146105e3578063bb09d9b7146105eb578063bc063e1a1461060657600080fd5b80639b6d6bbb116101975780639b6d6bbb146105b8578063b0e0d136146105d3578063b7b800a4146105db57600080fd5b80639381cd2b146105a057806398d5fdca146105a8578063992e2a92146105b057600080fd5b80634219dc401161028c578063753983d611610235578063867378c51161020f578063867378c514610551578063897de0ce146105595780638c9c7a5f146105675780638da5cb5b1461058257600080fd5b8063753983d61461051657806376c7a3c7146105295780637d5aa5f41461053157600080fd5b806355c676281161026657806355c67628146104f35780636fb2a1bf146104fb578063715018a61461050e57600080fd5b80634219dc40146104a0578063439e5016146104c05780635321ae32146104e057600080fd5b8063218b5382116102f95780632fe91cc7116102d35780632fe91cc71461043d57806337211c3b1461046457806338e9922e146104845780633e0dc34e1461049757600080fd5b8063218b5382146104045780632196dd33146104135780632a4c0a1a1461042257600080fd5b806309a3bbe41161032a57806309a3bbe4146103df5780631459457a146103e7578063189d00ca146103fc57600080fd5b806306346c301461035157806307fa901a1461039b5780630902f1ac146103bc575b600080fd5b606b546103719073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6103ae6103a9366004614521565b610731565b604051908152602001610392565b6103c4610902565b60408051938452602084019290925290820152606001610392565b6103ae610b73565b6103fa6103f536600461454d565b610b89565b005b6103ae610f21565b6103ae670de0b6b3a764000081565b6103ae670b1a2bc2ec50000081565b61037173da10009cbd5d07dd0cecc66161fc93d7c9000da181565b6103ae7f1533a3278f3f9141d5f820a184ea4b017fce238200000000000000000000001681565b6066546103719073ffffffffffffffffffffffffffffffffffffffff1681565b6103fa6104923660046145be565b610f38565b6103ae606a5481565b606c546103719073ffffffffffffffffffffffffffffffffffffffff1681565b6068546103719073ffffffffffffffffffffffffffffffffffffffff1681565b6103ae6104ee3660046145be565b610fc2565b6103ae611391565b6103fa6105093660046145d7565b61142e565b6103fa6114ca565b6103ae6105243660046145f4565b6114de565b6103ae61165b565b6067546103719073ffffffffffffffffffffffffffffffffffffffff1681565b6103ae611670565b6103ae6611c37937e0800081565b6103717382af49447d8a07e3bd95bd0d56f35241523fbab181565b60335473ffffffffffffffffffffffffffffffffffffffff16610371565b6103ae611687565b6103ae61169a565b6103ae6118bb565b61037173e39b5e3b6d74016b2f6a9673d7d7493b6df549d581565b6103ae600881565b6103ae600281565b6103ae600181565b61037173ff970a61a04b1ca14834a43f5de4533ebddb5cc881565b6103ae6118d9565b6103ae6118ec565b61037173fd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb981565b6103ae7f64541216bafffeec8ea535bb71fbc927831d059500010000000000000000000281565b6103ae600481565b6103ae600081565b6103ae6106763660046145be565b61190b565b6065546103719073ffffffffffffffffffffffffffffffffffffffff1681565b6069546103719073ffffffffffffffffffffffffffffffffffffffff1681565b6103fa6106c9366004614616565b611a63565b6103ae6106dc3660046145be565b611d7c565b6103fa6106ef36600461468d565b611fbf565b6103ae6129a8565b6103fa61070a3660046145d7565b6129bb565b6103ae6702c68af0bb14000081565b6103ae61072c3660046145be565b612a72565b6040805160c081018252606060a08201818152606a548352600160208085019190915273ffffffffffffffffffffffffffffffffffffffff8781168587015260675416838501526080808501879052855160008184018190528751808303850181529188018852935285519081018652908101829052918201819052308083528285015292518390819073e39b5e3b6d74016b2f6a9673d7d7493b6df549d5906107e19086908690602401614813565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fe969f6b300000000000000000000000000000000000000000000000000000000179052516108629190614874565b600060405180830381855afa9150503d806000811461089d576040519150601f19603f3d011682016040523d82523d6000602084013e6108a2565b606091505b5091509150816108de576040517f59ed39fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000818060200190518101906108f49190614890565b955050505050505b92915050565b6068546069546000918291829173ffffffffffffffffffffffffffffffffffffffff908116911661093281612ac7565b6000808273ffffffffffffffffffffffffffffffffffffffff1663f94d4668606a546040518263ffffffff1660e01b815260040161097291815260200190565b600060405180830381865afa15801561098f573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526109d591908101906149b6565b50606654825192945090925073ffffffffffffffffffffffffffffffffffffffff16908390600090610a0957610a09614a84565b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614610a4c5780600181518110610a3f57610a3f614a84565b6020026020010151610a68565b80600081518110610a5f57610a5f614a84565b60200260200101515b606654835191985073ffffffffffffffffffffffffffffffffffffffff16908390600090610a9857610a98614a84565b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614610adb5780600081518110610ace57610ace614a84565b6020026020010151610af7565b80600181518110610aee57610aee614a84565b60200260200101515b95508373ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b689190614890565b945050505050909192565b610b86670de0b6b3a76400006032614ae2565b81565b600054610100900460ff1615808015610ba95750600054600160ff909116105b80610bc35750303b158015610bc3575060005460ff166001145b610c54576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558015610cb257600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b73ffffffffffffffffffffffffffffffffffffffff8616610cff576040517f9fabe1c100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8516610d4c576040517f9fabe1c100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8416610d99576040517f9fabe1c100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8316610de6576040517f9fabe1c100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8216610e33576040517f9fabe1c100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610e3b612baf565b606580547fffffffffffffffffffffffff000000000000000000000000000000000000000090811673ffffffffffffffffffffffffffffffffffffffff89811691909117909255606680548216888416179055606780548216878416179055606980548216868416179055606c80549091169184169190911790558015610f1957600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050565b610b866402540be400670de0b6b3a7640000614b4e565b610f40612c4e565b6068546040517f38e9922e0000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff9091169081906338e9922e90602401600060405180830381600087803b158015610fae57600080fd5b505af1158015610f19573d6000803e3d6000fd5b60665460655460009182918291610ff29173ffffffffffffffffffffffffffffffffffffffff9182169116612ccf565b60408051600280825260608201835293955091935060009290602083019080368337019050509050828160008151811061102e5761102e614a84565b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050818160018151811061107c5761107c614a84565b73ffffffffffffffffffffffffffffffffffffffff9290921660209283029190910182015260408051600280825260608201835260009391929091830190803683370190505060655490915060009073ffffffffffffffffffffffffffffffffffffffff8681169116141561115557600090507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8260008151811061112357611123614a84565b60200260200101818152505060008260018151811061114457611144614a84565b6020026020010181815250506111bb565b6001905060008260008151811061116e5761116e614a84565b6020026020010181815250507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826001815181106111ae576111ae614a84565b6020026020010181815250505b6000600288836040516020016111d393929190614b76565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815260808301825286835260208301869052828201819052600060608401819052606a54925191945091829173e39b5e3b6d74016b2f6a9673d7d7493b6df549d59161125091309081908890602401614bd0565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f9ebbf05d00000000000000000000000000000000000000000000000000000000179052516112d19190614874565b600060405180830381855afa9150503d806000811461130c576040519150601f19603f3d011682016040523d82523d6000602084013e611311565b606091505b50915091508161134d576040517f59ed39fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000818060200190518101906113639190614cbb565b91505080868151811061137857611378614a84565b60200260200101519a5050505050505050505050919050565b606854604080517f55c67628000000000000000000000000000000000000000000000000000000008152905160009273ffffffffffffffffffffffffffffffffffffffff169182916355c67628916004808201926020929091908290030181865afa158015611404573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114289190614890565b91505090565b611436612c4e565b73ffffffffffffffffffffffffffffffffffffffff8116611483576040517f9fabe1c100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6114d2612c4e565b6114dc6000612dce565b565b606b5460009073ffffffffffffffffffffffffffffffffffffffff163314611532576040517fdeda903000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6067546040517f23b872dd0000000000000000000000000000000000000000000000000000000081523360048201523060248201526044810185905273ffffffffffffffffffffffffffffffffffffffff909116906323b872dd906064016020604051808303816000875af11580156115af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115d39190614d02565b506066546115f99073ffffffffffffffffffffffffffffffffffffffff16333085612e45565b6116038383612f21565b60685490915073ffffffffffffffffffffffffffffffffffffffff1661162a813384613260565b6066546067546116549173ffffffffffffffffffffffffffffffffffffffff9081169116336132bb565b5092915050565b610b86620f4240670de0b6b3a7640000614b4e565b610b8664e8d4a51000670de0b6b3a7640000614b4e565b610b86670de0b6b3a76400006064614ae2565b60695460009073ffffffffffffffffffffffffffffffffffffffff166116bf81612ac7565b6000808273ffffffffffffffffffffffffffffffffffffffff1663f94d4668606a546040518263ffffffff1660e01b81526004016116ff91815260200190565b600060405180830381865afa15801561171c573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820160405261176291908101906149b6565b50606654825192945090925060009173ffffffffffffffffffffffffffffffffffffffff909116908490839061179a5761179a614a84565b602002602001015173ffffffffffffffffffffffffffffffffffffffff16146117dd57816001815181106117d0576117d0614a84565b60200260200101516117f9565b816000815181106117f0576117f0614a84565b60200260200101515b606654845191925060009173ffffffffffffffffffffffffffffffffffffffff909116908590839061182d5761182d614a84565b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614611870578260008151811061186357611863614a84565b602002602001015161188c565b8260018151811061188357611883614a84565b60200260200101515b9050611899600483614b4e565b6118a7826305f5e100614ae2565b6118b19190614b4e565b9550505050505090565b6118ce6003670de0b6b3a7640000614b4e565b610b86906001614d24565b610b86600a670de0b6b3a7640000614b4e565b6001611901670de0b6b3a76400006002614ae2565b610b869190614d3c565b606b5460009073ffffffffffffffffffffffffffffffffffffffff16331461195f576040517fdeda903000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6067546040517f23b872dd0000000000000000000000000000000000000000000000000000000081523360048201523060248201526044810184905273ffffffffffffffffffffffffffffffffffffffff909116906323b872dd906064016020604051808303816000875af11580156119dc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a009190614d02565b50611a0c826000612f21565b60685490915073ffffffffffffffffffffffffffffffffffffffff16611a33813384613260565b606654606754611a5d9173ffffffffffffffffffffffffffffffffffffffff9081169116336132bb565b50919050565b606b5473ffffffffffffffffffffffffffffffffffffffff163314611ab4576040517fdeda903000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8316611b01576040517f9fabe1c100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b81611b38576040517f1f2a200500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600173ffffffffffffffffffffffffffffffffffffffff841673fd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb91480611b9b575073ffffffffffffffffffffffffffffffffffffffff841673da10009cbd5d07dd0cecc66161fc93d7c9000da1145b15611ba4575060005b80611d34576040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ff970a61a04b1ca14834a43f5de4533ebddb5cc8906370a0823190602401602060405180830381865afa158015611c14573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c389190614890565b9050611c7d8573ff970a61a04b1ca14834a43f5de4533ebddb5cc88660007f1533a3278f3f9141d5f820a184ea4b017fce2382000000000000000000000016306134b8565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ff970a61a04b1ca14834a43f5de4533ebddb5cc8906370a0823190602401602060405180830381865afa158015611ce8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d0c9190614890565b73ff970a61a04b1ca14834a43f5de4533ebddb5cc896509050611d2f8282614d3c565b945050505b611d76847382af49447d8a07e3bd95bd0d56f35241523fbab185857f64541216bafffeec8ea535bb71fbc927831d0595000100000000000000000002336134b8565b50505050565b60685460655460665460009273ffffffffffffffffffffffffffffffffffffffff908116928492611db1929182169116612ccf565b509050600080611dbf610902565b509150915060008473ffffffffffffffffffffffffffffffffffffffff1663f89f27ed6040518163ffffffff1660e01b8152600401600060405180830381865afa158015611e11573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052611e579190810190614d53565b606654909150600090819073ffffffffffffffffffffffffffffffffffffffff87811691161415611ec15782600081518110611e9557611e95614a84565b6020026020010151915082600181518110611eb257611eb2614a84565b60200260200101519050611efc565b82600181518110611ed457611ed4614a84565b6020026020010151915082600081518110611ef157611ef1614a84565b602002602001015190505b886305f5e100600080611f13898988888888613739565b915091508a73ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611f62573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f869190614890565b611f908483614ae2565b611f9a8685614ae2565b611fa49190614d24565b611fae9190614b4e565b9d9c50505050505050505050505050565b611fc7612c4e565b60685473ffffffffffffffffffffffffffffffffffffffff1615612017576040517ff48e3c2600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60655460665460009182916120459173ffffffffffffffffffffffffffffffffffffffff9081169116612ccf565b60408051600280825260608201835293955091935060009290602083019080368337019050509050828160008151811061208157612081614a84565b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505081816001815181106120cf576120cf614a84565b73ffffffffffffffffffffffffffffffffffffffff92909216602092830291909101820152604080516002808252606082018352600093919290918301908036833701905050905060008160008151811061212c5761212c614a84565b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505060008160018151811061217b5761217b614a84565b73ffffffffffffffffffffffffffffffffffffffff9290921660209283029190910182015260408051600280825260608201835260009391929091830190803683370190505060665490915073ffffffffffffffffffffffffffffffffffffffff8681169116141561223c57670b1a2bc2ec5000008160008151811061220357612203614a84565b6020026020010181815250506702c68af0bb1400008160018151811061222b5761222b614a84565b60200260200101818152505061228d565b6702c68af0bb1400008160008151811061225857612258614a84565b602002602001018181525050670b1a2bc2ec5000008160018151811061228057612280614a84565b6020026020010181815250505b606c546040517f2182c8fe00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90911690632182c8fe906122fa908c908c908c908c908a9089908b906611c37937e08000903090600401614e17565b6020604051808303816000875af1158015612319573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061233d9190614f0d565b606880547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff929092169182179055604080517f38fff2d000000000000000000000000000000000000000000000000000000000815290516338fff2d0916004808201926020929091908290030181865afa1580156123d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123f99190614890565b606a5560665460655460685460675460695473ffffffffffffffffffffffffffffffffffffffff9485169493841693928316929182169161245d918691167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6137e8565b6069546124a49073ffffffffffffffffffffffffffffffffffffffff85811691167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6137e8565b6069546040517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff91821660048201527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60248201529082169063095ea7b3906044016020604051808303816000875af115801561253c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125609190614d02565b50604080516002808252606082018352600092602083019080368337019050509050898160008151811061259657612596614a84565b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505088816001815181106125e4576125e4614a84565b73ffffffffffffffffffffffffffffffffffffffff92831660209182029290920101526040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000918616906370a0823190602401602060405180830381865afa15801561265f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126839190614890565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015290915060009073ffffffffffffffffffffffffffffffffffffffff8816906370a0823190602401602060405180830381865afa1580156126f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127179190614890565b60408051600280825260608201835292935060009290916020830190803683370190505060655490915073ffffffffffffffffffffffffffffffffffffffff8e8116911614156127a657828160008151811061277557612775614a84565b602002602001018181525050818160018151811061279557612795614a84565b6020026020010181815250506127e7565b81816000815181106127ba576127ba614a84565b60200260200101818152505082816001815181106127da576127da614a84565b6020026020010181815250505b60006040518060800160405280868152602001838152602001600084604051602001612814929190614f2a565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe00181529181529082526000602090920191909152606954606a5491517fb95cac2800000000000000000000000000000000000000000000000000000000815292935073ffffffffffffffffffffffffffffffffffffffff169163b95cac28916128ad91309081908790600401614bd0565b600060405180830381600087803b1580156128c757600080fd5b505af11580156128db573d6000803e3d6000fd5b50506040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000925073ffffffffffffffffffffffffffffffffffffffff8a1691506370a0823190602401602060405180830381865afa15801561294c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129709190614890565b905061299373ffffffffffffffffffffffffffffffffffffffff89163383613260565b50505050505050505050505050505050505050565b610b866002670de0b6b3a7640000614b4e565b6129c3612c4e565b73ffffffffffffffffffffffffffffffffffffffff8116612a66576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610c4b565b612a6f81612dce565b50565b600080612a7d61169a565b90506000612a90826402540be400614ae2565b90506000670de0b6b3a7640000612aa78387614ae2565b612ab19190614b4e565b9050612abe600482614b4e565b95945050505050565b604080516000602480830182905283518084039091018152604490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f0e8e3e8400000000000000000000000000000000000000000000000000000000179052915173ffffffffffffffffffffffffffffffffffffffff84169161271091612b569190614874565b6000604051808303818686fa925050503d8060008114612b92576040519150601f19603f3d011682016040523d82523d6000602084013e612b97565b606091505b50915050612bab81516000146101906138d8565b5050565b600054610100900460ff16612c46576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610c4b565b6114dc6138e6565b60335473ffffffffffffffffffffffffffffffffffffffff1633146114dc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610c4b565b6000808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415612d38576040517fbd969eb000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1610612d72578284612d75565b83835b909250905073ffffffffffffffffffffffffffffffffffffffff8216612dc7576040517f9fabe1c100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b9250929050565b6033805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60405173ffffffffffffffffffffffffffffffffffffffff80851660248301528316604482015260648101829052611d769085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152613986565b60665460655460009182918291612f519173ffffffffffffffffffffffffffffffffffffffff9182169116612ccf565b604080516002808252606082018352939550919350600092906020830190803683370190505090508281600081518110612f8d57612f8d614a84565b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508181600181518110612fdb57612fdb614a84565b73ffffffffffffffffffffffffffffffffffffffff9290921660209283029190910182015260408051600280825260608201835260009391929091830190803683370190505060655490915073ffffffffffffffffffffffffffffffffffffffff8581169116141561308c57868160008151811061305b5761305b614a84565b602002602001018181525050858160018151811061307b5761307b614a84565b6020026020010181815250506130cd565b85816000815181106130a0576130a0614a84565b60200260200101818152505086816001815181106130c0576130c0614a84565b6020026020010181815250505b600060018260006040516020016130e693929190614f46565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181526080830182528583526020830185905282820181905260006060840152606954606a5492517fb95cac2800000000000000000000000000000000000000000000000000000000815291945073ffffffffffffffffffffffffffffffffffffffff169163b95cac289161318c9190309081908790600401614bd0565b600060405180830381600087803b1580156131a657600080fd5b505af11580156131ba573d6000803e3d6000fd5b50506068546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff90911692508291506370a0823190602401602060405180830381865afa15801561322e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132529190614890565b9a9950505050505050505050565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526132b69084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401612e9f565b505050565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201528390839060009073ffffffffffffffffffffffffffffffffffffffff8316906370a08231906024016020604051808303816000875af115801561332e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133529190614890565b905080156133f5576040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85811660048301526024820183905283169063a9059cbb906044016020604051808303816000875af11580156133cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133f39190614d02565b505b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8516906370a0823190602401602060405180830381865afa158015613462573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134869190614890565b905080156134af576134af73ffffffffffffffffffffffffffffffffffffffff85168683613260565b50505050505050565b61351e6040805160c08101909152600080825260208201908152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001606081525090565b8281526000602082018190525073ffffffffffffffffffffffffffffffffffffffff87811660408381019190915290871660608301526080820186905280516000602082015201604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001815291815260a08301919091528051608081018252600060208201819052606082018190523080835273ffffffffffffffffffffffffffffffffffffffff8681168486015260695494517fdd62ed3e0000000000000000000000000000000000000000000000000000000081526004810192909252938416602482015291929091908a169063dd62ed3e90604401602060405180830381865afa158015613639573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061365d9190614890565b90508087111561368e5760695461368e9073ffffffffffffffffffffffffffffffffffffffff8b81169116896137e8565b6069546040517f52bbbe2900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff909116906352bbbe29906136ea90869086908b904290600401614f79565b6020604051808303816000875af1158015613709573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061372d9190614890565b50505050505050505050565b60008060006137488989613a95565b905060006137686137598987613c30565b6137638989613c30565b613a95565b9050808211156137ab57600061377e8284613a95565b90506137938b61378e838b613d59565b613c30565b94506137a38a613763838c613d59565b9350506137db565b60006137b78383613a95565b90506137c78b613763838b613d59565b94506137d78a61378e838c613d59565b9350505b5050965096945050505050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b3000000000000000000000000000000000000000000000000000000001790526138748482613ec8565b611d765760405173ffffffffffffffffffffffffffffffffffffffff84166024820152600060448201526138ce9085907f095ea7b30000000000000000000000000000000000000000000000000000000090606401612e9f565b611d768482613986565b81612bab57612bab81613f85565b600054610100900460ff1661397d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610c4b565b6114dc33612dce565b60006139e8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16613faf9092919063ffffffff16565b9050805160001480613a09575080806020019051810190613a099190614d02565b6132b6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610c4b565b600081613afe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f4552525f4449565f5a45524f00000000000000000000000000000000000000006044820152606401610c4b565b6000613b12670de0b6b3a764000085614ae2565b9050831580613b315750670de0b6b3a7640000613b2f8583614b4e565b145b613b97576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f4552525f4449565f494e5445524e414c000000000000000000000000000000006044820152606401610c4b565b6000613ba4600285614b4e565b613bae9083614d24565b905081811015613c1a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f4552525f4449565f494e5445524e414c000000000000000000000000000000006044820152606401610c4b565b6000613c268583614b4e565b9695505050505050565b600080613c3d8385614ae2565b9050831580613c54575082613c528583614b4e565b145b613cba576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f4552525f4d554c5f4f564552464c4f57000000000000000000000000000000006044820152606401610c4b565b6000613ccf6002670de0b6b3a7640000614b4e565b613cd99083614d24565b905081811015613d45576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f4552525f4d554c5f4f564552464c4f57000000000000000000000000000000006044820152606401610c4b565b6000613c26670de0b6b3a764000083614b4e565b60006001831015613dc6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4552525f42504f575f424153455f544f4f5f4c4f5700000000000000000000006044820152606401610c4b565b6001613ddb670de0b6b3a76400006002614ae2565b613de59190614d3c565b831115613e4e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4552525f42504f575f424153455f544f4f5f48494748000000000000000000006044820152606401610c4b565b6000613e5983613fc8565b90506000613e678483613fe6565b90506000613e7d86613e7885614069565b61407d565b905081613e8e5792506108fc915050565b6000613eb18784613eac6402540be400670de0b6b3a7640000614b4e565b6140f0565b9050613ebd8282613c30565b979650505050505050565b60008060008473ffffffffffffffffffffffffffffffffffffffff1684604051613ef29190614874565b6000604051808303816000865af19150503d8060008114613f2f576040519150601f19603f3d011682016040523d82523d6000602084013e613f34565b606091505b5091509150818015613f5e575080511580613f5e575080806020019051810190613f5e9190614d02565b8015612abe57505050505073ffffffffffffffffffffffffffffffffffffffff163b151590565b612a6f817f42414c00000000000000000000000000000000000000000000000000000000006141e0565b6060613fbe848460008561425b565b90505b9392505050565b6000670de0b6b3a7640000613fdc83614069565b6108fc9190614ae2565b6000806000613ff58585614376565b915091508015614061576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f4552525f5355425f554e444552464c4f570000000000000000000000000000006044820152606401610c4b565b509392505050565b60006108fc670de0b6b3a764000083614b4e565b60008061408b600284614fec565b61409d57670de0b6b3a764000061409f565b835b90506140ac600284614b4e565b92505b8215613fc1576140bf8485613c30565b93506140cc600284614fec565b156140de576140db8185613c30565b90505b6140e9600284614b4e565b92506140af565b600082818061410787670de0b6b3a7640000614376565b9092509050670de0b6b3a764000080600060015b8884106141d1576000614136670de0b6b3a764000083614ae2565b90506000806141568a61415185670de0b6b3a7640000613fe6565b614376565b915091506141688761378e848c613c30565b96506141748784613a95565b965086614183575050506141d1565b871561418d579315935b8015614197579315935b84156141ae576141a78688613fe6565b95506141bb565b6141b886886143aa565b95505b50505080806141c990615000565b91505061411b565b50909998505050505050505050565b7f08c379a000000000000000000000000000000000000000000000000000000000600090815260206004526007602452600a808404818106603090810160081b958390069590950190829004918206850160101b01602363ffffff0060e086901c160160181b0190930160c81b60445260e882901c90606490fd5b6060824710156142ed576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610c4b565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516143169190614874565b60006040518083038185875af1925050503d8060008114614353576040519150601f19603f3d011682016040523d82523d6000602084013e614358565b606091505b509150915061436987838387614423565b925050505b949350505050565b6000808284106143955761438a8385614d3c565b600091509150612dc7565b61439f8484614d3c565b600191509150612dc7565b6000806143b78385614d24565b905083811015613fc1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f4552525f4144445f4f564552464c4f57000000000000000000000000000000006044820152606401610c4b565b606083156144b65782516144af5773ffffffffffffffffffffffffffffffffffffffff85163b6144af576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610c4b565b508161436e565b61436e83838151156144cb5781518083602001fd5b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c4b9190615039565b73ffffffffffffffffffffffffffffffffffffffff81168114612a6f57600080fd5b6000806040838503121561453457600080fd5b823561453f816144ff565b946020939093013593505050565b600080600080600060a0868803121561456557600080fd5b8535614570816144ff565b94506020860135614580816144ff565b93506040860135614590816144ff565b925060608601356145a0816144ff565b915060808601356145b0816144ff565b809150509295509295909350565b6000602082840312156145d057600080fd5b5035919050565b6000602082840312156145e957600080fd5b8135613fc1816144ff565b6000806040838503121561460757600080fd5b50508035926020909101359150565b60008060006060848603121561462b57600080fd5b8335614636816144ff565b95602085013595506040909401359392505050565b60008083601f84011261465d57600080fd5b50813567ffffffffffffffff81111561467557600080fd5b602083019150836020828501011115612dc757600080fd5b600080600080604085870312156146a357600080fd5b843567ffffffffffffffff808211156146bb57600080fd5b6146c78883890161464b565b909650945060208701359150808211156146e057600080fd5b506146ed8782880161464b565b95989497509550505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60005b8381101561474357818101518382015260200161472b565b83811115611d765750506000910152565b6000815180845261476c816020860160208601614728565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b8051825260006020820151600281106147b9576147b96146f9565b80602085015250604082015173ffffffffffffffffffffffffffffffffffffffff808216604086015280606085015116606086015250506080820151608084015260a082015160c060a085015261436e60c0850182614754565b60a08152600061482660a083018561479e565b9050613fc1602083018473ffffffffffffffffffffffffffffffffffffffff808251168352602082015115156020840152806040830151166040840152506060810151151560608301525050565b60008251614886818460208701614728565b9190910192915050565b6000602082840312156148a257600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561491f5761491f6148a9565b604052919050565b600067ffffffffffffffff821115614941576149416148a9565b5060051b60200190565b600082601f83011261495c57600080fd5b8151602061497161496c83614927565b6148d8565b82815260059290921b8401810191818101908684111561499057600080fd5b8286015b848110156149ab5780518352918301918301614994565b509695505050505050565b6000806000606084860312156149cb57600080fd5b835167ffffffffffffffff808211156149e357600080fd5b818601915086601f8301126149f757600080fd5b81516020614a0761496c83614927565b82815260059290921b8401810191818101908a841115614a2657600080fd5b948201945b83861015614a4d578551614a3e816144ff565b82529482019490820190614a2b565b91890151919750909350505080821115614a6657600080fd5b50614a738682870161494b565b925050604084015190509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615614b1a57614b1a614ab3565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600082614b5d57614b5d614b1f565b500490565b60038110614b7257614b726146f9565b9052565b60608101614b848286614b62565b602082019390935260400152919050565b600081518084526020808501945080840160005b83811015614bc557815187529582019590820190600101614ba9565b509495945050505050565b8481526000602073ffffffffffffffffffffffffffffffffffffffff8087168285015280861660408501526080606085015261010084018551608080870152818151808452610120880191508583019350600092505b80831015614c4857835185168252928501926001929092019190850190614c26565b508488015194507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff809350838782030160a0880152614c868186614b95565b94505050506040850151818584030160c0860152614ca48382614754565b9250505060608401516149ab60e085018215159052565b60008060408385031215614cce57600080fd5b82519150602083015167ffffffffffffffff811115614cec57600080fd5b614cf88582860161494b565b9150509250929050565b600060208284031215614d1457600080fd5b81518015158114613fc157600080fd5b60008219821115614d3757614d37614ab3565b500190565b600082821015614d4e57614d4e614ab3565b500390565b600060208284031215614d6557600080fd5b815167ffffffffffffffff811115614d7c57600080fd5b61436e8482850161494b565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b600081518084526020808501945080840160005b83811015614bc557815173ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101614de5565b6000610100808352614e2c8184018c8e614d88565b9050602083820381850152614e42828b8d614d88565b84810360408601528951808252828b0193509082019060005b81811015614e8d57845173ffffffffffffffffffffffffffffffffffffffff1683529383019391830191600101614e5b565b50508481036060860152614ea1818a614b95565b925050508281036080840152614eb78187614dd1565b9150508360a0830152614ee260c083018473ffffffffffffffffffffffffffffffffffffffff169052565b7f557755000000000000000000000000000000000000000000000000000000000060e0830152613252565b600060208284031215614f1f57600080fd5b8151613fc1816144ff565b60ff83168152604060208201526000613fbe6040830184614b95565b614f508185614b62565b606060208201526000614f666060830185614b95565b905060ff83166040830152949350505050565b60e081526000614f8c60e083018761479e565b9050614fda602083018673ffffffffffffffffffffffffffffffffffffffff808251168352602082015115156020840152806040830151166040840152506060810151151560608301525050565b60a082019390935260c0015292915050565b600082614ffb57614ffb614b1f565b500690565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561503257615032614ab3565b5060010190565b602081526000613fc1602083018461475456fea26469706673582212205a8a4c6d6ae2a700604735c0555d5a5a75b28814f40dfe9d486b20c1ca2ea48664736f6c634300080c0033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

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.