More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 414 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Execute Actions | 19301459 | 1 hr ago | IN | 0 frxETH | 0.00000049 | ||||
Execute Actions | 19301438 | 1 hr ago | IN | 0 frxETH | 0.00000055 | ||||
Execute Actions | 19301409 | 1 hr ago | IN | 0 frxETH | 0.00000055 | ||||
Execute Actions | 19301368 | 1 hr ago | IN | 0 frxETH | 0.00000055 | ||||
Execute Actions | 19301344 | 1 hr ago | IN | 0 frxETH | 0.00000062 | ||||
Execute Actions | 19296947 | 3 hrs ago | IN | 0 frxETH | 0.00000066 | ||||
Micro Liquidate | 19290568 | 7 hrs ago | IN | 0 frxETH | 0 | ||||
Execute Actions | 19289909 | 7 hrs ago | IN | 0 frxETH | 0.00000049 | ||||
Execute Actions | 19289885 | 7 hrs ago | IN | 0 frxETH | 0.00000052 | ||||
Execute Actions | 19289869 | 7 hrs ago | IN | 0 frxETH | 0.00000052 | ||||
Execute Actions | 19289848 | 7 hrs ago | IN | 0 frxETH | 0.00000052 | ||||
Execute Actions | 19289782 | 7 hrs ago | IN | 0 frxETH | 0.00000052 | ||||
Execute Actions | 19289749 | 7 hrs ago | IN | 0 frxETH | 0.00000055 | ||||
Micro Liquidate | 19283861 | 10 hrs ago | IN | 0 frxETH | 0 | ||||
Execute Actions | 19283477 | 11 hrs ago | IN | 0 frxETH | 0.0000005 | ||||
Execute Actions | 19283456 | 11 hrs ago | IN | 0 frxETH | 0.00000055 | ||||
Execute Actions | 19283434 | 11 hrs ago | IN | 0 frxETH | 0.00000055 | ||||
Execute Actions | 19283416 | 11 hrs ago | IN | 0 frxETH | 0.00000056 | ||||
Execute Actions | 19283396 | 11 hrs ago | IN | 0 frxETH | 0.00000062 | ||||
Execute Actions | 19266895 | 20 hrs ago | IN | 0 frxETH | 0.00000077 | ||||
Micro Liquidate | 19255808 | 26 hrs ago | IN | 0 frxETH | 0 | ||||
Micro Liquidate | 19234978 | 38 hrs ago | IN | 0 frxETH | 0 | ||||
Micro Liquidate | 19223463 | 44 hrs ago | IN | 0 frxETH | 0 | ||||
Micro Liquidate | 19204571 | 2 days ago | IN | 0 frxETH | 0 | ||||
Micro Liquidate | 19192838 | 2 days ago | IN | 0 frxETH | 0 |
Latest 2 internal transactions
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
13480147 | 134 days ago | Contract Creation | 0 frxETH | |||
13480147 | 134 days ago | Contract Creation | 0 frxETH |
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0xD1437e14...d49BAaeC4 The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
BAMM
Compiler Version
v0.8.23+commit.f704f362
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.23; // ==================================================================== // | ______ _______ | // | / _____________ __ __ / ____(_____ ____ _____ ________ | // | / /_ / ___/ __ `| |/_/ / /_ / / __ \/ __ `/ __ \/ ___/ _ \ | // | / __/ / / / /_/ _> < / __/ / / / / / /_/ / / / / /__/ __/ | // | /_/ /_/ \__,_/_/|_| /_/ /_/_/ /_/\__,_/_/ /_/\___/\___/ | // | | // ==================================================================== // =============================== BAMM =============================== // ==================================================================== /* ** BAMM (Borrow AMM) ** - The BAMM wraps Uniswap/Fraxswap like LP tokens (#token0 * #token1 = K), giving out an ERC-20 wrapper token in return ** - Users have a personal vault where they can add / remove token0 and token1. ** - Users can rent the LP constituent token0s and token1s, the liquidity from which will be removed and stored in the users vault. ** - Rented LP constituent token0s and token1s are accounted as SQRT(#token0 * #token1) ** - The user can remove tokens from their personal vault as long as the SQRT(#token0 * #token1) is more than the rented value ** - Borrowers pay an interest rate based on the utility factor ** - Borrowers can only be liquidated due to interest rate payments, not due to price movements. ** - Liquidations will be auctioned, to be small and cheap ** - No price oracle needed! */ /* ----------------------------------------------------------- -------------------- EXAMPLE SCENARIOS -------------------- ----------------------------------------------------------- Assume Fraxswap FRAX/FXS LP @ 0x03B59Bd1c8B9F6C265bA0c3421923B93f15036Fa. token0 = FXS, token1 = FRAX Scenario 1: User wants to rent some FXS using FRAX as collateral =================================== 1) User obtains some FRAX, which will be used as collateral 2) User calls executeActionsAndSwap() with a) Positive token1Amount (add FRAX to vault) b) Negative token0Amount (withdraw FXS from vault) c) Positive rent (renting) d) The swapParams to swap SOME of the excess FRAX for FXS (they need to remain solvent at the end of the day) e) (Optional) v,r,s for a permit (token1 to this contract) for the vault add 3) The internal call flow will be: i) BAMM-owned LP is unwound into BOTH FRAX and FXS, according to the supplied rent parameter. Both tokens are added to the user's vault. ii) User supplied FRAX is added to their vault to increase their collateral iii) Some of the excess FRAX from the LP unwind is swapped for FXS (according to swapParams) iv) FXS is sent to the user v) Contract will revert if the user is insolvent or the LP utility is above MAX_UTILITY_RATE Scenario 2: User from Scenario 1 wants to repay SOME of their rented FXS and get SOME FRAX back =================================== 1) User calls executeActionsAndSwap() with a) Negative token1Amount (withdraw FRAX from vault) b) Positive token0Amount (add FXS to vault) c) Negative rent (repaying) d) token0AmountMin to prevent sandwiches from the LP add e) token1AmountMin to prevent sandwiches from the LP add f) The swapParams to swap SOME of the FXS for FRAX. LP will be added at the current ratio so this is helpful. g) (Optional) v,r,s for a permit (token0 to this contract) for the vault add 2) The internal call flow will be: i) Interest accrues so the user owes a little bit more FXS (and/or FRAX) now. ii) User-supplied FXS is added to the vault iii) Some of the FXS is swapped for FRAX (according to swapParams). iv) FRAX and FXS are added (at current LP ratio) to make the Fraxswap LP, which becomes BAMM-owned, according to the supplied rent parameter. v) Accounting updated to lower rent and vaulted tokens. vi) FRAX is sent to the user vii) Contract will revert if the user is insolvent or the LP utility is above MAX_UTILITY_RATE Scenario 3: User from Scenario 1 wants to repay the remaining rented FXS, get their FRAX back, and close the position =================================== 1) User calls executeActionsAndSwap() with a) Negative token1Amount (withdraw FRAX from vault) b) Positive token0Amount (add FXS to vault) c) closePosition as true. No need to supply rent as the function will override it anyways d) token0AmountMin to prevent sandwiches from the LP add e) token1AmountMin to prevent sandwiches from the LP add f) The swapParams to swap SOME of the FXS for FRAX. LP will be added at the current ratio so this is helpful. g) (Optional) v,r,s for a permit (token0 to this contract) for the vault add 2) The internal call flow will be: i) Interest accrues so the user owes a little bit more FXS (and/or FRAX) now. ii) User-supplied FXS is added to the vault iii) Some of the FXS is swapped for FRAX (according to swapParams). iv) Accounting updated to lower rent and vaulted tokens. v) Any remaining FRAX or FXS needed is safeTransferFrom'd the user vi) FRAX and FXS are added (at current LP ratio) to make the Fraxswap LP, which becomes BAMM-owned, according to the supplied rent parameter vii) FRAX is sent back to the user viii) Contract will revert if the user is insolvent or the LP utility is above MAX_UTILITY_RATE Scenario 4: User wants to loan some LP and earn interest =================================== 1) Approve LP to this BAMM contract 2) Call mint(), which will give you BAMM tokens as a "receipt" 3) Wait some time, and assume some other people borrow. Interest accrues 4) Call redeem(), which burns your BAMM tokens and gives you your LP back, plus some extra LP as interest. */ // Frax Finance: https://github.com/FraxFinance import { IERC20Permit } from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol"; import { ReentrancyGuard } from "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol"; import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { Strings } from "@openzeppelin/contracts/utils/Strings.sol"; import { Math } from "dev-fraxswap/src/contracts/core/libraries/Math.sol"; import "src/contracts/interfaces/IBAMM.sol"; contract BAMM is IBAMM, ReentrancyGuard { using SafeCast for *; using Strings for uint256; // ############################################ // ############## STATE VARIABLES ############# // ############################################ BAMMERC20 public immutable iBammErc20; /// @notice Token 0 in the Fraxswap LP IERC20 public immutable token0; /// @notice Token 1 in the Fraxswap LP IERC20 public immutable token1; /// @notice Address of the Fraxswap pair IFraxswapPair public immutable pair; /// @notice Address of the Fraxswap factory IFraxswapFactory public immutable pairFactory; /// @notice The Fraxswap router IFraxswapRouterMultihop public immutable routerMultihop; /// @notice Price oracle for the Fraxswap pair IFraxswapOracle public immutable fraxswapOracle; /// @notice Address of the BAMMFactory to create this contract address public immutable factory; /// @notice The variableInterestRate associated IVariableInterestRate public variableInterestRate; /// @notice Tracks the amount of rented liquidity /// @dev Will never be < 0 int256 public sqrtRented; /// @notice Multiplier used in interest rate and rent amount calculations. Never decreases and acts like an accumulator of sorts. uint256 public rentedMultiplier = PRECISION; // Initialized at PRECISION, but will change /// @notice The last time an interest payment was made uint256 public timeSinceLastInterestPayment = block.timestamp; /// @notice The `fullUtilizationRate` returned from the variable rate oracle uint256 public fullUtilizationRate; /// @notice Vault information for a given user mapping(address => Vault) public userVaults; /// @notice arrays of all BAMM users address[] public users; /// @notice mapping of all BAMM users mapping(address => bool) public isUser; /// @notice Max Oracle deviation per pair uint256 public maxOracleDiff = 250; // ####################################### // ############## CONSTANTS ############## // ####################################### /// @notice The precision to use and conform to uint256 public constant PRECISION = 1e18; /// @notice Percent above which the position is considered insolvent and can be liquidated uint256 public constant SOLVENCY_THRESHOLD_LIQUIDATION = (980 * PRECISION) / 1000; // 98% /// @notice Percent at wich the position can be liquidated with the max fee uint256 public constant SOLVENCY_THRESHOLD_FULL_LIQUIDATION = (990 * PRECISION) / 1000; // 99% /// @notice Protocol's cut of the interest rate uint256 public constant FEE_SHARE = (10 * 10_000) / 100; // 10% /// @notice The fee when a liquidation occurs uint256 public constant LIQUIDATION_FEE = 10_000; // 1% /// @notice The maximum utility rate for an LP uint256 public constant MAX_UTILITY_RATE = (PRECISION * 95) / 100; // 95% /// @notice The minimum liquidity allowed for the pool uint256 public constant MINIMUM_LIQUIDITY = 1e4; // ######################################### // ############## Constructor ############## // ######################################### constructor(bytes memory _encodedBammConstructorArgs) { ( uint256 _id, address _pair, address _fraxswapRouter, address _fraxswapOracle, address _variableInterestRateAddress, uint64 startFullUtilRate ) = abi.decode(_encodedBammConstructorArgs, (uint256, address, address, address, address, uint64)); // fill in state variables pair = IFraxswapPair(_pair); pairFactory = IFraxswapFactory(IFraxswapPair(_pair).factory()); token0 = IERC20(pair.token0()); token1 = IERC20(pair.token1()); routerMultihop = IFraxswapRouterMultihop(_fraxswapRouter); fraxswapOracle = IFraxswapOracle(_fraxswapOracle); factory = msg.sender; variableInterestRate = IVariableInterestRate(_variableInterestRateAddress); fullUtilizationRate = startFullUtilRate; // Create BAMM ERC20 iBammErc20 = new BAMMERC20(address(token0), address(token1), _id.toString()); } /// @notice Semantic version of this contract /// @return _major The major version /// @return _minor The minor version /// @return _patch The patch version function version() external pure returns (uint256 _major, uint256 _minor, uint256 _patch) { return (0, 5, 2); } // ############################################ // ############## Lender actions ############## // ############################################ /// @notice Mint BAMM wrapper tokens with LP tokens /// @param to Destination address for the wrapper tokens /// @param lpIn The amount of Fraxswap LP to wrap /// @return bammOut The amount of BAMM tokens generated /// @dev Make sure to approve first function mint(address to, uint256 lpIn) external nonReentrant returns (uint256 bammOut) { // Sync the LP, then add the interest (uint112 reserve0, uint112 reserve1, uint256 pairTotalSupply) = _addInterest(); // Calculate the LP to BAMM conversion uint256 sqrtReserve = Math.sqrt(uint256(reserve0) * reserve1); uint256 sqrtAmount = (lpIn * sqrtReserve) / pairTotalSupply; uint256 balance = pair.balanceOf(address(this)); // Take the LP from the sender and mint them BAMM wrapper tokens uint256 totalSupply_ = iBammErc20.totalSupply(); if (totalSupply_ == 0) { // At 0 supply, mint initial liquidity and lock it bammOut = sqrtAmount - MINIMUM_LIQUIDITY; iBammErc20.mint(address(1), MINIMUM_LIQUIDITY); } else { uint256 sqrtBalance = (balance * sqrtReserve) / pairTotalSupply; if ((sqrtBalance * pairTotalSupply) / sqrtReserve < balance) sqrtBalance += 1; uint256 sqrtRentedReal = (uint256(sqrtRented) * rentedMultiplier) / PRECISION; if ((sqrtRentedReal * PRECISION) / rentedMultiplier < uint256(sqrtRented)) sqrtRentedReal += 1; bammOut = (sqrtAmount * totalSupply_) / (sqrtBalance + sqrtRentedReal); } /// Revert if lpIn == 0 as sqrtAmount = 0 and in rounding down small amounts if (bammOut == 0) revert ZeroLiquidityMinted(); // Transfer LP token to bamm and give `to` the BAMM wrapper tokens SafeERC20.safeTransferFrom({ token: IERC20(address(pair)), from: msg.sender, to: address(this), value: lpIn }); iBammErc20.mint({ account: ((to == address(0)) ? msg.sender : to), value: bammOut }); emit BAMMMinted({ lender: msg.sender, recipient: to, lpIn: lpIn, bammOut: bammOut }); _emitBAMMState(reserve0, reserve1, pairTotalSupply); } /// @notice Redeem BAMM wrapper tokens for LP tokens /// @param to Destination address for the LP tokens /// @param bammIn The amount of BAMM tokens to redeem for Fraxswap LP /// @return lpOut The amount of LP tokens generated function redeem(address to, uint256 bammIn) external nonReentrant returns (uint256 lpOut) { // Sync the LP, then add the interest (uint112 reserve0, uint112 reserve1, uint256 pairTotalSupply) = _addInterest(); // Calculate the BAMM to LP conversion uint256 sqrtToRedeem; uint256 sqrtReserve; { uint256 balance = pair.balanceOf(address(this)); sqrtReserve = Math.sqrt(uint256(reserve0) * reserve1); uint256 sqrtBalance = (balance * sqrtReserve) / pairTotalSupply; uint256 sqrtRentedReal = (uint256(sqrtRented) * rentedMultiplier) / PRECISION; sqrtToRedeem = (bammIn * (sqrtBalance + sqrtRentedReal)) / iBammErc20.totalSupply(); } // Burn the BAMM wrapper tokens from the sender and give them LP if (sqrtToRedeem > 0) { lpOut = (sqrtToRedeem * pairTotalSupply) / sqrtReserve; SafeERC20.safeTransfer({ token: IERC20(address(pair)), to: (to == address(0) ? msg.sender : to), value: lpOut }); } iBammErc20.burn({ account: msg.sender, value: bammIn }); // Max sure the max utility is within acceptable range if (!_isValidUtilityRate({ reserve0: reserve0, reserve1: reserve1, pairTotalSupply: pairTotalSupply })) { revert InvalidUtilityRate(); } emit BAMMRedeemed({ lender: msg.sender, recipient: to, bammIn: bammIn, lpOut: lpOut }); _emitBAMMState(reserve0, reserve1, pairTotalSupply); } // ############################################ // ############# Borrower actions ############# // ############################################ /// @notice Execute actions /// @param action The details of the action to be executed /// @return vault Ending vault state function executeActions(Action memory action) public returns (Vault memory vault) { IFraxswapRouterMultihop.FraxswapParams memory swapParams; return executeActionsAndSwap({ action: action, swapParams: swapParams }); } /// @notice Calculate total supply adjustment due to protocol fees in the Fraxswap pair. /// @dev see: https://github.com/FraxFinance/dev-fraxswap/blob/9744c757f7e51c1deee3f5db50d3aaec495aea01/src/contracts/core/FraxswapPair.sol#L317 /// @param reserve0 The reserves for token0 of the pair /// @param reserve1 The reserves for token1 of the pair /// @param totalSupply The total supply of the pair token /// @return tsAdjustment The total supply adjustment of the lp token due to fees function _calcMintedSupplyFromPairMintFee( uint256 reserve0, uint256 reserve1, uint256 totalSupply ) internal view returns (uint256 tsAdjustment) { if (pairFactory.feeTo() != address(0)) { uint256 kLast = pair.kLast(); if (kLast != 0) { uint256 rootK = Math.sqrt(uint256(reserve0) * reserve1); uint256 rootKLast = Math.sqrt(kLast); if (rootK > rootKLast) { uint256 num = totalSupply * (rootK - rootKLast); uint256 denom = (rootK * 5) + rootKLast; tsAdjustment = num / denom; } } } } function _syncVault( Vault memory _vault, int256 _rent, uint112 _reserve0, uint112 _reserve1, uint256 _pairTotalSupply ) internal returns (int256 lpTokenAmount, int256 token0Amount, int256 token1Amount) { // Calculate the amount of LP, token0, and token1 int256 rentedMultiplierAsInt = rentedMultiplier.toInt256(); // gas int256 sqrtAmountRented = (_rent * rentedMultiplierAsInt) / 1e18; int256 sqrtReserves = int256(Math.sqrt(uint256(_reserve0) * _reserve1)); if (_rent < 0) { if (((sqrtAmountRented * 1e18) / rentedMultiplierAsInt) > _rent) sqrtAmountRented -= 1; } lpTokenAmount = (sqrtAmountRented * _pairTotalSupply.toInt256()) / sqrtReserves; if (_rent < 0) { if (((lpTokenAmount * sqrtReserves) / _pairTotalSupply.toInt256()) > sqrtAmountRented) { lpTokenAmount -= 1; } } token0Amount = (int256(uint256(_reserve0)) * lpTokenAmount) / _pairTotalSupply.toInt256(); token1Amount = (int256(uint256(_reserve1)) * lpTokenAmount) / _pairTotalSupply.toInt256(); if (_rent < 0) { if (((token0Amount * _pairTotalSupply.toInt256()) / _reserve0.toInt256()) > lpTokenAmount) { token0Amount -= 1; } if (((token1Amount * _pairTotalSupply.toInt256()) / _reserve1.toInt256()) > lpTokenAmount) { token1Amount -= 1; } } // Update the rent and credit the user some token0 and token1 _vault.rented += _rent; _vault.token0 += token0Amount; _vault.token1 += token1Amount; // Update the total rented liquidity sqrtRented += _rent; } /// @dev _rent is positive function _borrow( Vault memory _vault, int256 _rent, uint112 _reserve0, uint112 _reserve1, uint256 _pairTotalSupply ) internal { if (sqrtRented == 0 && iBammErc20.totalSupply() == 0) revert NoBAMMTokensMinted(); (int256 lpTokenAmount, int256 token0Amount, int256 token1Amount) = _syncVault({ _vault: _vault, _rent: _rent, _reserve0: _reserve0, _reserve1: _reserve1, _pairTotalSupply: _pairTotalSupply }); // Transfer LP to the LP contract, then optimistically burn it there to release token0 and token1 to this contract // The tokens will be given to the borrower later, assuming action.token0Amount and/or action.token1Amount is negative SafeERC20.safeTransfer({ token: IERC20(address(pair)), to: address(pair), value: uint256(lpTokenAmount) }); pair.burn(address(this)); emit Renting({ user: msg.sender, rent: _rent, token0Amount: token0Amount, token1Amount: token1Amount }); } /// @dev rent is negative function _repay( Vault memory _vault, int256 _rent, uint112 _reserve0, uint112 _reserve1, uint256 _pairTotalSupply, uint256 _token0AmountMin, uint256 _token1AmountMin ) internal returns (uint256 token0ToAddToLp, uint256 token1ToAddToLp) { (, int256 token0Amount, int256 token1Amount) = _syncVault({ _vault: _vault, _rent: _rent, _reserve0: _reserve0, _reserve1: _reserve1, _pairTotalSupply: _pairTotalSupply }); // token0Amount and token1Amount are negative as they subtracted balances from the vault, so we need to convert positive token0ToAddToLp = uint256(-token0Amount); token1ToAddToLp = uint256(-token1Amount); // Avoid sandwich attacks if ((token0ToAddToLp < _token0AmountMin) || (token1ToAddToLp < _token1AmountMin)) { revert InsufficientAmount(); } } /// @notice Execute actions and also do a swap /// @param action The details of the action to be executed /// @param swapParams The details of the swap to be executed /// @return vault Ending vault state function executeActionsAndSwap( Action memory action, IFraxswapRouterMultihop.FraxswapParams memory swapParams ) public nonReentrant returns (Vault memory vault) { // Get the existing vault info for the user vault = userVaults[msg.sender]; // Add to users array if needed. if (!isUser[msg.sender]) { isUser[msg.sender] = true; users.push(msg.sender); } // Sync the LP, then add the interest (uint112 reserve0, uint112 reserve1, uint256 pairTotalSupply) = _addInterest(); // Note if the user is closing the position if (action.closePosition) { if (action.rent != 0) revert InvalidRent(); action.rent = -vault.rented; } // Rent LP constituent tokens (if specified). Positive rent means borrowing if (action.rent > 0) { _borrow({ _vault: vault, _rent: action.rent, _reserve0: reserve0, _reserve1: reserve1, _pairTotalSupply: pairTotalSupply }); } // If specified in the action, add tokens to the vault (vault is modified by reference) // Positive token0Amount and/or token1Amount means add from vault if (action.token0Amount > 0 || action.token1Amount > 0) _addTokensToVault({ _vault: vault, _action: action }); // Execute the swap if there are swapParams if (swapParams.amountIn != 0) { // Do the swap _executeSwap(vault, swapParams); // Swap might have changed the reserves of the pair. (reserve0, reserve1, pairTotalSupply) = _addInterest(); } // Return rented LP constituent tokens (if specified) to this contract. // Negative rent means repaying but not closing. uint256 token0ToAddToLp; uint256 token1ToAddToLp; if (action.rent < 0) { (token0ToAddToLp, token1ToAddToLp) = _repay({ _vault: vault, _rent: action.rent, _reserve0: reserve0, _reserve1: reserve1, _pairTotalSupply: pairTotalSupply, _token0AmountMin: action.token0AmountMin, _token1AmountMin: action.token1AmountMin }); } // Close the position (if specified) if (action.closePosition) { // You might have some leftover tokens you can withdraw later if you over-collateralized action.token0Amount = -vault.token0; action.token1Amount = -vault.token1; _addTokensToVault({ _vault: vault, _action: action }); } // Return rented LP constituent tokens (continued from above) // This portion recovers the LP and gives it to this BAMM contract if (token0ToAddToLp > 0) { // Send token0 and token1 directly to the LP address SafeERC20.safeTransfer({ token: token0, to: address(pair), value: token0ToAddToLp }); SafeERC20.safeTransfer({ token: token1, to: address(pair), value: token1ToAddToLp }); // Mint repayed LP last, so we know we have enough tokens in the contract pair.mint(address(this)); emit RentRepaid({ user: msg.sender, rent: -action.rent, token0ToAddToLp: token0ToAddToLp, token1ToAddToLp: token1ToAddToLp, closePosition: action.closePosition }); } // Remove token0 from the vault and give to the user (if specified) // Negative token0Amount means remove from vault if (action.token0Amount < 0) { if (action.to == address(this)) revert CannotWithdrawToSelf(); _moveTokenForVault({ _vault: vault, _token: token0, _to: (action.to == address(0) ? msg.sender : action.to), _tokenAmount: action.token0Amount }); } // Remove token1 from the vault and give to the user (if specified) // Negative token1Amount means remove from vault if (action.token1Amount < 0) { if (action.to == address(this)) revert CannotWithdrawToSelf(); _moveTokenForVault({ _vault: vault, _token: token1, _to: (action.to == address(0) ? msg.sender : action.to), _tokenAmount: action.token1Amount }); } emit ExecuteAction({ user: msg.sender, token0: action.token0Amount, token1: action.token1Amount, rent: action.rent }); emit VaultUpdated({ user: msg.sender, token0: vault.token0, token1: vault.token1, rent: vault.rented }); _emitBAMMState(reserve0, reserve1, pairTotalSupply); // Write the final vault state to storage after all the above operations are completed userVaults[msg.sender] = vault; // Make sure the user is still solvent if (!_solvent(vault, SOLVENCY_THRESHOLD_LIQUIDATION)) { revert NotSolvent(); } // Check max utility after a rent if (action.rent > 0) { if (!_isValidUtilityRate({ reserve0: reserve0, reserve1: reserve1, pairTotalSupply: pairTotalSupply })) { revert InvalidUtilityRate(); } } } function _moveTokenForVault(Vault memory _vault, IERC20 _token, address _to, int256 _tokenAmount) internal { // NOTE: _tokenAmount is negative when withdrawing from vault and positive when depositing to vault if (_token == token0) { _vault.token0 += _tokenAmount; } else { // _token == token1 /// @dev _token will always be either token0 or token1 _vault.token1 += _tokenAmount; } if (_to == address(this)) { // deposit SafeERC20.safeTransferFrom({ token: _token, from: msg.sender, to: address(this), // for clarity value: uint256(_tokenAmount) }); } else { // withdrawal (_tokenAmount is currently negative) SafeERC20.safeTransfer({ token: _token, to: _to, value: uint256(-_tokenAmount) }); } } function _emitBAMMState(uint256 reserve0, uint256 reserve1, uint256 pairTotalSupply) internal { uint256 rentedMultiplier_ = rentedMultiplier; uint256 balance = pair.balanceOf(address(this)); uint256 sqrtReserve = Math.sqrt(uint256(reserve0) * reserve1); uint256 sqrtBalance = pairTotalSupply == 0 ? 0 : ((balance * sqrtReserve) / pairTotalSupply); uint256 sqrtRentedReal = (uint256(sqrtRented) * rentedMultiplier_) / PRECISION; uint256 utilityRate; if (sqrtBalance + sqrtRentedReal > 0) { utilityRate = (uint256(sqrtRentedReal) * PRECISION) / (sqrtBalance + sqrtRentedReal); } uint256 interestRate = _getVariableInterestRate(0, utilityRate); emit BAMMState({ sqrtRentedReal: sqrtRentedReal, sqrtBalance: sqrtBalance, rentedMultiplier: rentedMultiplier_, interestRate: interestRate }); } // ############################################ // ############ Liquidator actions ############ // ############################################ // Approximates how much of a token must be sold in a vault for the ratio in the vault to be the same as the ratio in the AMM. function getMaxSell( uint256 tokenIn, uint256 tokenOut, uint256 reserveIn, uint256 reserveOut ) public pure returns (uint256 maxSell) { // Solve x for: (reserveOut-y)/(reserveIn+x) = (tokenOut+y)/(tokenIn-x), (reserveOut-y)*(reserveIn+x)=reserveIn*reserveOut uint256 prod = Math.sqrt(reserveOut * reserveIn) * Math.sqrt((reserveOut + tokenOut) * (reserveIn + tokenIn)); uint256 minus = reserveIn * tokenOut + reserveOut * reserveIn; if (prod > minus) maxSell = (prod - minus) / (reserveOut + tokenOut); } // Calculates how much of the vault is being repayed, based on the LTV // Starts at 0.25%, goes to 20% half way and up to 100% at the end. function repayPercentage(uint256 _ltv) internal pure returns (uint256 _repayPercentage) { uint256 kink = (SOLVENCY_THRESHOLD_FULL_LIQUIDATION + SOLVENCY_THRESHOLD_LIQUIDATION) / 2; if (_ltv > SOLVENCY_THRESHOLD_FULL_LIQUIDATION) { _repayPercentage = 1e18; } else if (_ltv > kink) { _repayPercentage = 0.2e18 + (0.8e18 * (_ltv - kink)) / (SOLVENCY_THRESHOLD_FULL_LIQUIDATION - kink); } else { _repayPercentage = 0.002e18 + (0.198e18 * (_ltv - SOLVENCY_THRESHOLD_LIQUIDATION)) / (kink - SOLVENCY_THRESHOLD_LIQUIDATION); } } /// @notice Auctioned micro-liquidation by doing a small swap and paying back rented liquidity /// @param user The user to be micro-liquidated /// @return token0Fee The number of token0 received as liquidation fee /// @return token1Fee The number of token1 received as liquidation fee function microLiquidate(address user) external nonReentrant returns (uint256 token0Fee, uint256 token1Fee) { // Sync the LP, then add the interest (uint112 reserve0, uint112 reserve1, uint256 pairTotalSupply) = _addInterest(); // Compare the spot price from the reserves to the oracle price. Revert if they are off by too much. ammPriceCheck(reserve0, reserve1); // Get the existing vault info for the user Vault memory vault = userVaults[user]; // Make sure the user is NOT solvent for micro liquidations uint256 _ltv = ltv(vault); if (_ltv < SOLVENCY_THRESHOLD_LIQUIDATION) revert("User solvent"); uint256 sqrtToLiquidity; uint256 _repayPercentage = repayPercentage(_ltv); if (uint256(vault.token0) > (uint256(vault.token1) * reserve0) / reserve1) { // Excess token0, swap token0 to token1 uint256 maxSell = getMaxSell( uint256(vault.token0), uint256(vault.token1), uint256(reserve0), uint256(reserve1) ); // sellPercentage is twice the repay percentage (capped at 100%) uint256 sellPercentage = _repayPercentage > 0.498e18 ? 1e18 : 0.004e18 + _repayPercentage * 2; uint256 sellToken0 = (maxSell * sellPercentage) / PRECISION; // Cap the amount sold to 1/350 of the total liquidity, to avoid high slippage if (sellPercentage < 0.1e18 && sellToken0 > reserve0 / 350) { sellToken0 = reserve0 / 350; sellPercentage = (sellToken0 * PRECISION) / maxSell; } if (sellToken0 > 0) { uint256 token1Out = getAmountOut(reserve0, reserve1, sellToken0, pair.fee()); if (sellToken0 == reserve0 / 350) { // At most repay from swapped amount when capped _repayPercentage = Math.min( _repayPercentage, (token1Out * PRECISION) / (token1Out + uint256(vault.token1)) ); } if (token1Out > 0) { // Do the swap SafeERC20.safeTransfer(token0, address(pair), sellToken0); pair.swap(0, token1Out, address(this), ""); vault.token0 -= int256(sellToken0); vault.token1 += int256(token1Out); reserve0 += uint112(sellToken0); reserve1 -= uint112(token1Out); emit VaultSwap({ user: user, token0: -int256(sellToken0), token1: int256(token1Out) }); } } // If the pool has small reserves & the vault is not up for full liquidation // limit the repay % to 1/25th of the reserves in the pool if ( _ltv < SOLVENCY_THRESHOLD_FULL_LIQUIDATION && uint256(vault.token1) * _repayPercentage > (reserve1 * PRECISION) / 25 ) _repayPercentage = (reserve1 * PRECISION) / (25 * uint256(vault.token1)); uint256 token1ToLiquidity = (uint256(vault.token1) * _repayPercentage) / PRECISION; sqrtToLiquidity = Math.sqrt(token1ToLiquidity * ((token1ToLiquidity * reserve0) / reserve1)); } else { // Excess token1, swap token1 to token0 uint256 maxSell = getMaxSell( uint256(vault.token1), uint256(vault.token0), uint256(reserve1), uint256(reserve0) ); // sellPercentage is twice the repay percentage (capped at 100%) uint256 sellPercentage = _repayPercentage > 0.498e18 ? 1e18 : 0.004e18 + _repayPercentage * 2; uint256 sellToken1 = (maxSell * sellPercentage) / PRECISION; // Cap the amount sold to 1/350 of the total liquidity, to avoid high slippage if (sellPercentage < 0.1e18 && sellToken1 > reserve1 / 350) { sellToken1 = reserve1 / 350; sellPercentage = (sellToken1 * PRECISION) / maxSell; } if (sellToken1 > 0) { uint256 token0Out = getAmountOut(reserve1, reserve0, sellToken1, pair.fee()); if (sellToken1 == reserve1 / 350) { // At most repay from swapped amount when capped _repayPercentage = Math.min( _repayPercentage, (token0Out * PRECISION) / (token0Out + uint256(vault.token0)) ); } if (token0Out > 0) { // Do the swap SafeERC20.safeTransfer(token1, address(pair), sellToken1); pair.swap(token0Out, 0, address(this), ""); vault.token0 += int256(token0Out); vault.token1 -= int256(sellToken1); reserve0 -= uint112(token0Out); reserve1 += uint112(sellToken1); emit VaultSwap({ user: user, token0: int256(token0Out), token1: -int256(sellToken1) }); } } // If the pool has small reserves & the vault is not up for full liquidation // limit the repay % to 1/25th of the reserves in the pool if ( _ltv < SOLVENCY_THRESHOLD_FULL_LIQUIDATION && uint256(vault.token0) * _repayPercentage > (reserve0 * PRECISION) / 25 ) _repayPercentage = (reserve0 * PRECISION) / (25 * uint256(vault.token0)); uint256 token0ToLiquidity = (uint256(vault.token0) * _repayPercentage) / PRECISION; sqrtToLiquidity = Math.sqrt(token0ToLiquidity * ((token0ToLiquidity * reserve1) / reserve0)); } int256 rentToLiquidity = int256((sqrtToLiquidity * PRECISION) / rentedMultiplier); if (rentToLiquidity > 0) { int256 liquidationFee = int256( _ltv > SOLVENCY_THRESHOLD_FULL_LIQUIDATION ? LIQUIDATION_FEE : (LIQUIDATION_FEE * (_ltv - SOLVENCY_THRESHOLD_LIQUIDATION)) / (SOLVENCY_THRESHOLD_FULL_LIQUIDATION - SOLVENCY_THRESHOLD_LIQUIDATION) ); rentToLiquidity = (rentToLiquidity * (1_000_000 - liquidationFee)) / 1_000_000; if (rentToLiquidity > vault.rented) rentToLiquidity = vault.rented; (reserve0, reserve1, pairTotalSupply) = _addInterest(); (, int256 token0Amount, int256 token1Amount) = _syncVault( vault, -rentToLiquidity, reserve0, reserve1, pairTotalSupply ); if (token0Amount < 0 || token1Amount < 0) { //Mint the LP tokens SafeERC20.safeTransfer({ token: token0, to: address(pair), value: uint256(-token0Amount) }); SafeERC20.safeTransfer({ token: token1, to: address(pair), value: uint256(-token1Amount) }); pair.mint(address(this)); emit RentRepaid({ user: user, rent: rentToLiquidity, token0ToAddToLp: uint256(-token0Amount), token1ToAddToLp: uint256(-token1Amount), closePosition: false }); } // Give the liquidation fee to the liquidator as a percentage of the liquidated value token0Fee = uint256((-token0Amount * liquidationFee) / (1_000_000 - liquidationFee)); token1Fee = uint256((-token1Amount * liquidationFee) / (1_000_000 - liquidationFee)); if (int256(token0Fee) > vault.token0 || int256(token1Fee) > vault.token1) { // When there are not enough tokens for the fee, give all tokens left as fee token0Fee = uint256(vault.token0); token1Fee = uint256(vault.token1); } vault.token0 -= int256(token0Fee); vault.token1 -= int256(token1Fee); if (vault.token0 == 0 || vault.token1 == 0 || (_repayPercentage == 1e18 && ltv(vault) > PRECISION)) { // Debt restructuring token0Fee += uint256(vault.token0); token1Fee += uint256(vault.token1); vault.token0 = 0; vault.token1 = 0; sqrtRented -= vault.rented; vault.rented = 0; } // Send liquidation fee to the liquidator SafeERC20.safeTransfer(IERC20(address(token0)), msg.sender, token0Fee); SafeERC20.safeTransfer(IERC20(address(token1)), msg.sender, token1Fee); emit MicroLiquidate({ user: user, liquidator: msg.sender, token0Fee: token0Fee, token1Fee: token1Fee }); } emit VaultUpdated({ user: user, token0: vault.token0, token1: vault.token1, rent: vault.rented }); _emitBAMMState(reserve0, reserve1, pairTotalSupply); // Write the final vault state to storage if (!_isValidVault(vault)) revert InvalidVault(); userVaults[user] = vault; } function getAmountOut( uint256 reserveIn, uint256 reserveOut, uint256 amountIn, uint256 fee ) internal pure returns (uint256) { require(amountIn > 0 && reserveIn > 0 && reserveOut > 0); // INSUFFICIENT_INPUT_AMOUNT, INSUFFICIENT_LIQUIDITY uint256 amountInWithFee = amountIn * fee; uint256 numerator = amountInWithFee * reserveOut; uint256 denominator = (reserveIn * 10_000) + amountInWithFee; return numerator / denominator; } // ############################################ // ############# Factory functions ############ // ############################################ /// @notice Update the interest rate contract /// @param newVariableInterestRate the new interest rate contract function setVariableInterestRate(address newVariableInterestRate) external { if (msg.sender != factory) revert NotFactory(); emit NewVariableInterestRate(address(variableInterestRate), newVariableInterestRate); variableInterestRate = IVariableInterestRate(newVariableInterestRate); } /// @notice Update the maximum oracle deviation on the bamm /// @param newMaxDiff The new max % difference between twap and spot /// @dev percent in denomination of 1e5 function setMaxOracleDeviation(uint256 newMaxDiff) external { if (msg.sender != factory) revert NotFactory(); emit NewMaxOracleDiff(maxOracleDiff, newMaxDiff); maxOracleDiff = newMaxDiff; } // ############################################ // ############# External utility ############# // ############################################ /// @notice Accrue interest payments /// @return reserve0 The LP's reserve0 /// @return reserve1 The LP's reserve1 /// @return totalSupply The LP's totalSupply() /// @return _rentedMultiplier rentedMultiplier after interest calculation function addInterest() external nonReentrant returns (uint256 reserve0, uint256 reserve1, uint256 totalSupply, uint256 _rentedMultiplier) { (reserve0, reserve1, totalSupply) = _addInterest(); _rentedMultiplier = rentedMultiplier; _emitBAMMState(reserve0, reserve1, totalSupply); } /// @notice Get the interest rate at the specified _utilization /// @param _deltaTime The time in seconds between now and the previous interest accrual /// @param _utilization The internal Bamm Utilization represented in 1e18 w/ a max of MAX_UTILITY_RATE /// @return newRatePerSec The interest rate per second function _getVariableInterestRate( uint256 _deltaTime, uint256 _utilization ) internal returns (uint256 newRatePerSec) { uint256 utilScaled = (_utilization * 1e5) / MAX_UTILITY_RATE; (newRatePerSec, fullUtilizationRate) = variableInterestRate.getNewRate( _deltaTime, utilScaled, uint64(fullUtilizationRate) ); } /// @notice public view function to view the calculated interest rate at a given utilization /// @param _utilization The internal Bamm Utilization represented in 1e18 w/ a max of MAX_UTILITY_RATE /// @return newRatePerSec The interest rate per second function previewInterestRate(uint256 _utilization) public view returns (uint256 newRatePerSec) { uint256 utilScaled = (_utilization * 1e5) / MAX_UTILITY_RATE; uint256 period = block.timestamp - timeSinceLastInterestPayment; (newRatePerSec, ) = variableInterestRate.getNewRate(period, utilScaled, uint64(fullUtilizationRate)); } // ############################################ // ################# Internal ################# // ############################################ /// @notice Transfers LP constituent tokens from the user to this contract, and marks it as part of their vault. /// @param _vault The _vault you are modifying /// @param _action The _action /// @dev _vault is passed by reference, so it modified in the caller function _addTokensToVault(Vault memory _vault, Action memory _action) internal { // Approve via permit if (_action.v != 0 && (_action.token0Amount > 0 || _action.token1Amount > 0)) { // Determine the token of the permit IERC20 token = _action.token0Amount > 0 ? token0 : token1; // Do the permit uint256 amount = _action.approveMax ? type(uint256).max : uint256(_action.token0Amount > 0 ? _action.token0Amount : _action.token1Amount); IERC20Permit(address(token)).permit({ owner: msg.sender, spender: address(this), value: amount, deadline: _action.deadline, v: _action.v, r: _action.r, s: _action.s }); // Clear out v to prevent a potential duplicate failing permit _action.v = 0; } // Add token0 to the vault if (_action.token0Amount > 0) { _moveTokenForVault({ _vault: _vault, _token: token0, _to: address(this), _tokenAmount: _action.token0Amount }); } // Add token1 to the vault if (_action.token1Amount > 0) { _moveTokenForVault({ _vault: _vault, _token: token1, _to: address(this), _tokenAmount: _action.token1Amount }); } } /// @notice Swaps tokens in the users vault /// @param vault The vault you are modifying /// @param swapParams Info about the swap. Is modified /// @dev vault and swapParams are passed by reference, so they modified in the caller function _executeSwap(Vault memory vault, IFraxswapRouterMultihop.FraxswapParams memory swapParams) internal { // Make sure the order of the swap is one of two directions if ( !(swapParams.tokenIn == address(token0) && swapParams.tokenOut == address(token1)) && !(swapParams.tokenIn == address(token1) && swapParams.tokenOut == address(token0)) ) { revert IncorrectSwapTokens(); } // Approve the input token to the router SafeERC20.safeIncreaseAllowance({ token: IERC20(swapParams.tokenIn), spender: address(routerMultihop), value: swapParams.amountIn }); // Set the recipient to this address swapParams.recipient = address(this); // Require an amountOutMinimum to avoid bad swaps if (swapParams.amountOutMinimum == 0) revert IncorrectAmountOutMinimum(); // Router checks the minAmountOut /// @dev: ensure swapParams are correct - fat-fingered route data may result in lost funds /// @dev: we trust the output of the routerMultihop, token transfered in and out are checked in the router uint256 amountOut = routerMultihop.swap(swapParams); if (swapParams.tokenIn == address(token0)) { vault.token0 -= swapParams.amountIn.toInt256(); vault.token1 += amountOut.toInt256(); emit VaultSwap({ user: msg.sender, token0: -int256(swapParams.amountIn.toInt256()), token1: int256(amountOut.toInt256()) }); } else { vault.token1 -= swapParams.amountIn.toInt256(); vault.token0 += amountOut.toInt256(); emit VaultSwap({ user: msg.sender, token0: int256(amountOut.toInt256()), token1: -int256(swapParams.amountIn.toInt256()) }); } } /// @notice Sync the LP and accrue interest /// @return reserve0 The LP's reserve0 /// @return reserve1 The LP's reserve1 /// @return pairTotalSupply The LP's totalSupply() function _addInterest() internal returns (uint112 reserve0, uint112 reserve1, uint256 pairTotalSupply) { // We need to call sync for Fraxswap pairs first to execute TWAMMs pair.sync(); // Get the total supply and the updated reserves (reserve0, reserve1, ) = pair.getReserves(); pairTotalSupply = pair.totalSupply(); pairTotalSupply += _calcMintedSupplyFromPairMintFee(reserve0, reserve1, pairTotalSupply); // Calculate and accumulate interest if time has passed uint256 period = block.timestamp - timeSinceLastInterestPayment; uint256 sqrtRentedAsUint = sqrtRented.toUint256(); // gas uint256 rentedMultiplier_ = rentedMultiplier; // gas uint256 sqrtReserve = Math.sqrt(uint256(reserve0) * reserve1); if (period > 0) { // If there are outstanding rents, proceed if (sqrtRentedAsUint > 0) { // Do the interest calculations uint256 balance = pair.balanceOf(address(this)); uint256 sqrtBalance = (balance * sqrtReserve) / pairTotalSupply; if ((sqrtBalance * pairTotalSupply) / sqrtReserve < balance) sqrtBalance += 1; uint256 sqrtRentedReal = (sqrtRentedAsUint * rentedMultiplier_) / PRECISION; if ((sqrtRentedReal * PRECISION) / rentedMultiplier < sqrtRentedAsUint) sqrtRentedReal += 1; uint256 utilityRate = (uint256(sqrtRentedReal) * PRECISION) / (sqrtBalance + sqrtRentedReal); uint256 interestRate = _getVariableInterestRate(period, utilityRate); uint256 deltaMultiplier = (rentedMultiplier_ * interestRate * period) / PRECISION; // Update the rentedMultiplier // The original lender will get more LP back as their "earnings" when they redeem their BAMM tokens rentedMultiplier_ += deltaMultiplier; // Give the fee recipient their cut of the fee, directly as BAMM tokens { address feeTo = IBAMMFactory(factory).feeTo(); if (feeTo != address(0)) { // accrue fee 10% of the sqrtK growth uint256 feesAmount = (deltaMultiplier * sqrtRentedAsUint * FEE_SHARE) / (10_000 * PRECISION); uint256 feeMintAmount = (feesAmount * iBammErc20.totalSupply()) / (sqrtBalance + ((sqrtRentedAsUint * rentedMultiplier_) / PRECISION) - feesAmount); iBammErc20.mint(feeTo, feeMintAmount); } } // Store updated rentedMultiplier rentedMultiplier = rentedMultiplier_; } // Update the timeSinceLastInterestPayment timeSinceLastInterestPayment = block.timestamp; } } function _isValidVault(Vault memory vault) internal pure returns (bool) { if (vault.rented < 0 || vault.token0 < 0 || vault.token1 < 0) { // A vault should never end with negative balances return false; } else if (vault.rented > 0 && (vault.token0 == 0 || vault.token1 == 0)) { // If a vault has outstanding rent, both token0 and token1 must not be 0 return false; } return true; } function ltv(Vault memory vault) internal view returns (uint256) { if (vault.rented == 0) return 0; return (uint256(vault.rented) * rentedMultiplier) / Math.sqrt(uint256(vault.token0 * vault.token1)); } /// @dev Helper to return Vault struct over tuple function getUserVault(address user) external view returns (Vault memory vault) { vault = userVaults[user]; } /// @notice Is the vault solvent? /// @param vault The vault to check /// @param solvencyThreshold If vault ltv is at least this value, it is deemed insolvent /// @return bool If the vault is solvent function _solvent(Vault memory vault, uint256 solvencyThreshold) internal view returns (bool) { return _isValidVault(vault) && (vault.rented == 0 || ltv(vault) < solvencyThreshold); } function usersArray() external view returns (address[] memory) { return users; } function usersLength() external view returns (uint256) { return users.length; } /// @param reserve0 The LP's reserve0 /// @param reserve1 The LP's reserve1 /// @param pairTotalSupply The LP's totalSupply /// @return current utility rate function _currentUtilityRate( uint112 reserve0, uint112 reserve1, uint256 pairTotalSupply ) internal view returns (uint256) { uint256 sqrtRentedAsUint = sqrtRented.toUint256(); // gas if (sqrtRentedAsUint == 0) { return 0; } uint256 balance = pair.balanceOf(address(this)); uint256 sqrtBalance = Math.sqrt( ((balance * reserve0) / pairTotalSupply) * ((balance * reserve1) / pairTotalSupply) ); uint256 sqrtRentedReal = (sqrtRentedAsUint * rentedMultiplier) / PRECISION; uint256 utilityRate = (sqrtRentedReal * PRECISION) / (sqrtBalance + sqrtRentedReal); return utilityRate; } /// @dev Returns true if 0 <= {all outstanding rent} < MAX_UTILITY_RATE function _isValidUtilityRate( uint112 reserve0, uint112 reserve1, uint256 pairTotalSupply ) internal view returns (bool) { if (sqrtRented < 0) { return false; } if ( _currentUtilityRate({ reserve0: reserve0, reserve1: reserve1, pairTotalSupply: pairTotalSupply }) > MAX_UTILITY_RATE ) { return false; } return true; } /// @notice Compare the spot price from the reserves to the oracle price. Revert if they are off by too much. /// @param reserve0 The LP's reserve0 /// @param reserve1 The LP's reserve1 function ammPriceCheck(uint112 reserve0, uint112 reserve1) internal view { // 30 minutes and max 2048 blocks (uint256 result0, uint256 result1) = fraxswapOracle.getPrice({ pool: pair, period: 60 * 30, rounds: 11, maxDiffPerc: 10_000 }); result0 = 1e68 / result0; uint256 spotPrice = (uint256(reserve0) * 1e34) / reserve1; // Check the price differences and revert if they are too much uint256 diff = (spotPrice > result0 ? spotPrice - result0 : result0 - spotPrice); if ((diff * 10_000) / result0 > maxOracleDiff) { revert OraclePriceDeviated(); } diff = (spotPrice > result1 ? spotPrice - result1 : result1 - spotPrice); if ((diff * 10_000) / result1 > maxOracleDiff) { revert OraclePriceDeviated(); } } } // .,,. // ,;;<!;;;,'``<!!!!;, // =c,`<!!!!!!!!!>;``<!!!!>, // ,zcc;$$c`'!!!!!!!!!,;`<!!!!!> // . $$$;F?b`!'!!!!!!!, ;!!!!> // ;!; `",,,`"b " ;!!!!!!!! .!!!!!!; // ;!>>;; r' :<!!!!!!!''''```,,,,,,,,,,,,. // ;!>;!>; ""):!```.,,,nmMMb`'!!!!!!!!!!!!!!!!!!!!!'''`,,,,;;; // <!!;;;;;''.,,ndMr'4MMMMMMMMb,``'''''''''''''',,;;<!!!!!!!!' // !!!'''''. "TMMMMMPJ,)MMMMMMMMMMMMMMMMMnmnmdM !!!!!!!!!!!!' // `.,nMbmnm $e."MMM J$ MMMMMMMMMMMMMMMMMMMMMP `!!!!!!!'' // .MMMMMMMM>$$$b 4 c$$>4MMMMMMM?MMMMM"MMM4M",M // 4MMMMMMM>$$$P "?$>,MMMMMP,dMMM",;M",",nMM // 'MMMMMMM $$Ez$$$$$$>JMMM",MMMP .' .c nMMMMM // 4Mf4MMP $$$$$$$$P"uP",uP"",zdc,'$$F;MMMfP // "M'MM d$$",="=,cccccc$$$$$$$$$$$P MMM" // \/\"f.$$$cb ,b$$$$$$$" -."?$$$$ dP)" // `$c, $$$$$$$$$$",,,,"$$ "J$$$'J" ,c // `"$ $$$$$$P)3$ccd$,,$$$$$$$$$'',z$$F // `$$$$$$$`?$$$$$$"$$$$$$$P,c$P" // "?$$$$;=,""',c$$$$$$$" // `"??bc,,z$$$$PF"" // .,,,,,,,,. 4c,,,,, // 4$$$$$$$$$$$??$bd$$$$$P";!' ccd$$PF" c, // 4$$$$$$$$$P.d$$$$$?$P"<!! z$$$P",c$$$$$$$b. // `$$c,""??".$$$$$?4P';!!! J$$P'z$$$$$$$$$$P" // `?$$$$L z$$$$$$ C ,<!! $$$"J$$$?$$$PF""" // `?$$$".$$$$$$$F ;!!! zP" J$$$$-;;; // ,$$%z$$$$$$$";!!!' d$L`z?$?$" <!'; // ..'$$"-",nr"$" !!!!! $$$$;3L?c"? `<>`; // "C": \'MMM ";!!!!!'<$$$$$ !! <; // <`.dMMT4bn`.!';! ???$$F !!! <> // !!>;`T",;- !! emudMMb.?? <!!! <> // !<!!!!,,`''!!! `TMMMP",!!!> !!!!!.`! // !!!!!!!!!>.`'!`:MMM.<!!!! !!!!!!>`!; // !!!!!!`<!!!!!;,,`TT" <!!!, ;!'.`'!!! <> // '!''<! ,.`!!!``!!!!'`!!! '! !! <!:`'!!.`!; // ' ?",`! dc''`,r;`,- ` ;!!!`!!!;`!!:`!> // cbccc$$$$c$$$bd$$bcd `!!! <;'!;`!! !!> // <$$$$$$$$$$$$$?)$$P" `!!! <! ! !!>`!! // d$$$$$$P$$?????"" `!!> !> ,!!',!! // .$$$$$$ cccc$$$ `!!>`!!!!! !!! // "$C" ",d$$$$$$$$ `!!:`!!!! !!! // ` `,c$$$$"" <!!;,,,<!!! // `!!!!!'` // ` // ------------------------------------------------ // https://asciiart.website/index.php?art=cartoons/flintstones
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. * * CAUTION: See Security Considerations above. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol) pragma solidity ^0.8.20; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant NOT_ENTERED = 1; uint256 private constant ENTERED = 2; uint256 private _status; /** * @dev Unauthorized reentrant call. */ error ReentrancyGuardReentrantCall(); constructor() { _status = NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be NOT_ENTERED if (_status == ENTERED) { revert ReentrancyGuardReentrantCall(); } // Any calls to nonReentrant after this point will fail _status = ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SafeCast.sol) // This file was procedurally generated from scripts/generate/templates/SafeCast.js. pragma solidity ^0.8.20; /** * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow * checks. * * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can * easily result in undesired exploitation or bugs, since developers usually * assume that overflows raise errors. `SafeCast` restores this intuition by * reverting the transaction when such an operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeCast { /** * @dev Value doesn't fit in an uint of `bits` size. */ error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value); /** * @dev An int value doesn't fit in an uint of `bits` size. */ error SafeCastOverflowedIntToUint(int256 value); /** * @dev Value doesn't fit in an int of `bits` size. */ error SafeCastOverflowedIntDowncast(uint8 bits, int256 value); /** * @dev An uint value doesn't fit in an int of `bits` size. */ error SafeCastOverflowedUintToInt(uint256 value); /** * @dev Returns the downcasted uint248 from uint256, reverting on * overflow (when the input is greater than largest uint248). * * Counterpart to Solidity's `uint248` operator. * * Requirements: * * - input must fit into 248 bits */ function toUint248(uint256 value) internal pure returns (uint248) { if (value > type(uint248).max) { revert SafeCastOverflowedUintDowncast(248, value); } return uint248(value); } /** * @dev Returns the downcasted uint240 from uint256, reverting on * overflow (when the input is greater than largest uint240). * * Counterpart to Solidity's `uint240` operator. * * Requirements: * * - input must fit into 240 bits */ function toUint240(uint256 value) internal pure returns (uint240) { if (value > type(uint240).max) { revert SafeCastOverflowedUintDowncast(240, value); } return uint240(value); } /** * @dev Returns the downcasted uint232 from uint256, reverting on * overflow (when the input is greater than largest uint232). * * Counterpart to Solidity's `uint232` operator. * * Requirements: * * - input must fit into 232 bits */ function toUint232(uint256 value) internal pure returns (uint232) { if (value > type(uint232).max) { revert SafeCastOverflowedUintDowncast(232, value); } return uint232(value); } /** * @dev Returns the downcasted uint224 from uint256, reverting on * overflow (when the input is greater than largest uint224). * * Counterpart to Solidity's `uint224` operator. * * Requirements: * * - input must fit into 224 bits */ function toUint224(uint256 value) internal pure returns (uint224) { if (value > type(uint224).max) { revert SafeCastOverflowedUintDowncast(224, value); } return uint224(value); } /** * @dev Returns the downcasted uint216 from uint256, reverting on * overflow (when the input is greater than largest uint216). * * Counterpart to Solidity's `uint216` operator. * * Requirements: * * - input must fit into 216 bits */ function toUint216(uint256 value) internal pure returns (uint216) { if (value > type(uint216).max) { revert SafeCastOverflowedUintDowncast(216, value); } return uint216(value); } /** * @dev Returns the downcasted uint208 from uint256, reverting on * overflow (when the input is greater than largest uint208). * * Counterpart to Solidity's `uint208` operator. * * Requirements: * * - input must fit into 208 bits */ function toUint208(uint256 value) internal pure returns (uint208) { if (value > type(uint208).max) { revert SafeCastOverflowedUintDowncast(208, value); } return uint208(value); } /** * @dev Returns the downcasted uint200 from uint256, reverting on * overflow (when the input is greater than largest uint200). * * Counterpart to Solidity's `uint200` operator. * * Requirements: * * - input must fit into 200 bits */ function toUint200(uint256 value) internal pure returns (uint200) { if (value > type(uint200).max) { revert SafeCastOverflowedUintDowncast(200, value); } return uint200(value); } /** * @dev Returns the downcasted uint192 from uint256, reverting on * overflow (when the input is greater than largest uint192). * * Counterpart to Solidity's `uint192` operator. * * Requirements: * * - input must fit into 192 bits */ function toUint192(uint256 value) internal pure returns (uint192) { if (value > type(uint192).max) { revert SafeCastOverflowedUintDowncast(192, value); } return uint192(value); } /** * @dev Returns the downcasted uint184 from uint256, reverting on * overflow (when the input is greater than largest uint184). * * Counterpart to Solidity's `uint184` operator. * * Requirements: * * - input must fit into 184 bits */ function toUint184(uint256 value) internal pure returns (uint184) { if (value > type(uint184).max) { revert SafeCastOverflowedUintDowncast(184, value); } return uint184(value); } /** * @dev Returns the downcasted uint176 from uint256, reverting on * overflow (when the input is greater than largest uint176). * * Counterpart to Solidity's `uint176` operator. * * Requirements: * * - input must fit into 176 bits */ function toUint176(uint256 value) internal pure returns (uint176) { if (value > type(uint176).max) { revert SafeCastOverflowedUintDowncast(176, value); } return uint176(value); } /** * @dev Returns the downcasted uint168 from uint256, reverting on * overflow (when the input is greater than largest uint168). * * Counterpart to Solidity's `uint168` operator. * * Requirements: * * - input must fit into 168 bits */ function toUint168(uint256 value) internal pure returns (uint168) { if (value > type(uint168).max) { revert SafeCastOverflowedUintDowncast(168, value); } return uint168(value); } /** * @dev Returns the downcasted uint160 from uint256, reverting on * overflow (when the input is greater than largest uint160). * * Counterpart to Solidity's `uint160` operator. * * Requirements: * * - input must fit into 160 bits */ function toUint160(uint256 value) internal pure returns (uint160) { if (value > type(uint160).max) { revert SafeCastOverflowedUintDowncast(160, value); } return uint160(value); } /** * @dev Returns the downcasted uint152 from uint256, reverting on * overflow (when the input is greater than largest uint152). * * Counterpart to Solidity's `uint152` operator. * * Requirements: * * - input must fit into 152 bits */ function toUint152(uint256 value) internal pure returns (uint152) { if (value > type(uint152).max) { revert SafeCastOverflowedUintDowncast(152, value); } return uint152(value); } /** * @dev Returns the downcasted uint144 from uint256, reverting on * overflow (when the input is greater than largest uint144). * * Counterpart to Solidity's `uint144` operator. * * Requirements: * * - input must fit into 144 bits */ function toUint144(uint256 value) internal pure returns (uint144) { if (value > type(uint144).max) { revert SafeCastOverflowedUintDowncast(144, value); } return uint144(value); } /** * @dev Returns the downcasted uint136 from uint256, reverting on * overflow (when the input is greater than largest uint136). * * Counterpart to Solidity's `uint136` operator. * * Requirements: * * - input must fit into 136 bits */ function toUint136(uint256 value) internal pure returns (uint136) { if (value > type(uint136).max) { revert SafeCastOverflowedUintDowncast(136, value); } return uint136(value); } /** * @dev Returns the downcasted uint128 from uint256, reverting on * overflow (when the input is greater than largest uint128). * * Counterpart to Solidity's `uint128` operator. * * Requirements: * * - input must fit into 128 bits */ function toUint128(uint256 value) internal pure returns (uint128) { if (value > type(uint128).max) { revert SafeCastOverflowedUintDowncast(128, value); } return uint128(value); } /** * @dev Returns the downcasted uint120 from uint256, reverting on * overflow (when the input is greater than largest uint120). * * Counterpart to Solidity's `uint120` operator. * * Requirements: * * - input must fit into 120 bits */ function toUint120(uint256 value) internal pure returns (uint120) { if (value > type(uint120).max) { revert SafeCastOverflowedUintDowncast(120, value); } return uint120(value); } /** * @dev Returns the downcasted uint112 from uint256, reverting on * overflow (when the input is greater than largest uint112). * * Counterpart to Solidity's `uint112` operator. * * Requirements: * * - input must fit into 112 bits */ function toUint112(uint256 value) internal pure returns (uint112) { if (value > type(uint112).max) { revert SafeCastOverflowedUintDowncast(112, value); } return uint112(value); } /** * @dev Returns the downcasted uint104 from uint256, reverting on * overflow (when the input is greater than largest uint104). * * Counterpart to Solidity's `uint104` operator. * * Requirements: * * - input must fit into 104 bits */ function toUint104(uint256 value) internal pure returns (uint104) { if (value > type(uint104).max) { revert SafeCastOverflowedUintDowncast(104, value); } return uint104(value); } /** * @dev Returns the downcasted uint96 from uint256, reverting on * overflow (when the input is greater than largest uint96). * * Counterpart to Solidity's `uint96` operator. * * Requirements: * * - input must fit into 96 bits */ function toUint96(uint256 value) internal pure returns (uint96) { if (value > type(uint96).max) { revert SafeCastOverflowedUintDowncast(96, value); } return uint96(value); } /** * @dev Returns the downcasted uint88 from uint256, reverting on * overflow (when the input is greater than largest uint88). * * Counterpart to Solidity's `uint88` operator. * * Requirements: * * - input must fit into 88 bits */ function toUint88(uint256 value) internal pure returns (uint88) { if (value > type(uint88).max) { revert SafeCastOverflowedUintDowncast(88, value); } return uint88(value); } /** * @dev Returns the downcasted uint80 from uint256, reverting on * overflow (when the input is greater than largest uint80). * * Counterpart to Solidity's `uint80` operator. * * Requirements: * * - input must fit into 80 bits */ function toUint80(uint256 value) internal pure returns (uint80) { if (value > type(uint80).max) { revert SafeCastOverflowedUintDowncast(80, value); } return uint80(value); } /** * @dev Returns the downcasted uint72 from uint256, reverting on * overflow (when the input is greater than largest uint72). * * Counterpart to Solidity's `uint72` operator. * * Requirements: * * - input must fit into 72 bits */ function toUint72(uint256 value) internal pure returns (uint72) { if (value > type(uint72).max) { revert SafeCastOverflowedUintDowncast(72, value); } return uint72(value); } /** * @dev Returns the downcasted uint64 from uint256, reverting on * overflow (when the input is greater than largest uint64). * * Counterpart to Solidity's `uint64` operator. * * Requirements: * * - input must fit into 64 bits */ function toUint64(uint256 value) internal pure returns (uint64) { if (value > type(uint64).max) { revert SafeCastOverflowedUintDowncast(64, value); } return uint64(value); } /** * @dev Returns the downcasted uint56 from uint256, reverting on * overflow (when the input is greater than largest uint56). * * Counterpart to Solidity's `uint56` operator. * * Requirements: * * - input must fit into 56 bits */ function toUint56(uint256 value) internal pure returns (uint56) { if (value > type(uint56).max) { revert SafeCastOverflowedUintDowncast(56, value); } return uint56(value); } /** * @dev Returns the downcasted uint48 from uint256, reverting on * overflow (when the input is greater than largest uint48). * * Counterpart to Solidity's `uint48` operator. * * Requirements: * * - input must fit into 48 bits */ function toUint48(uint256 value) internal pure returns (uint48) { if (value > type(uint48).max) { revert SafeCastOverflowedUintDowncast(48, value); } return uint48(value); } /** * @dev Returns the downcasted uint40 from uint256, reverting on * overflow (when the input is greater than largest uint40). * * Counterpart to Solidity's `uint40` operator. * * Requirements: * * - input must fit into 40 bits */ function toUint40(uint256 value) internal pure returns (uint40) { if (value > type(uint40).max) { revert SafeCastOverflowedUintDowncast(40, value); } return uint40(value); } /** * @dev Returns the downcasted uint32 from uint256, reverting on * overflow (when the input is greater than largest uint32). * * Counterpart to Solidity's `uint32` operator. * * Requirements: * * - input must fit into 32 bits */ function toUint32(uint256 value) internal pure returns (uint32) { if (value > type(uint32).max) { revert SafeCastOverflowedUintDowncast(32, value); } return uint32(value); } /** * @dev Returns the downcasted uint24 from uint256, reverting on * overflow (when the input is greater than largest uint24). * * Counterpart to Solidity's `uint24` operator. * * Requirements: * * - input must fit into 24 bits */ function toUint24(uint256 value) internal pure returns (uint24) { if (value > type(uint24).max) { revert SafeCastOverflowedUintDowncast(24, value); } return uint24(value); } /** * @dev Returns the downcasted uint16 from uint256, reverting on * overflow (when the input is greater than largest uint16). * * Counterpart to Solidity's `uint16` operator. * * Requirements: * * - input must fit into 16 bits */ function toUint16(uint256 value) internal pure returns (uint16) { if (value > type(uint16).max) { revert SafeCastOverflowedUintDowncast(16, value); } return uint16(value); } /** * @dev Returns the downcasted uint8 from uint256, reverting on * overflow (when the input is greater than largest uint8). * * Counterpart to Solidity's `uint8` operator. * * Requirements: * * - input must fit into 8 bits */ function toUint8(uint256 value) internal pure returns (uint8) { if (value > type(uint8).max) { revert SafeCastOverflowedUintDowncast(8, value); } return uint8(value); } /** * @dev Converts a signed int256 into an unsigned uint256. * * Requirements: * * - input must be greater than or equal to 0. */ function toUint256(int256 value) internal pure returns (uint256) { if (value < 0) { revert SafeCastOverflowedIntToUint(value); } return uint256(value); } /** * @dev Returns the downcasted int248 from int256, reverting on * overflow (when the input is less than smallest int248 or * greater than largest int248). * * Counterpart to Solidity's `int248` operator. * * Requirements: * * - input must fit into 248 bits */ function toInt248(int256 value) internal pure returns (int248 downcasted) { downcasted = int248(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(248, value); } } /** * @dev Returns the downcasted int240 from int256, reverting on * overflow (when the input is less than smallest int240 or * greater than largest int240). * * Counterpart to Solidity's `int240` operator. * * Requirements: * * - input must fit into 240 bits */ function toInt240(int256 value) internal pure returns (int240 downcasted) { downcasted = int240(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(240, value); } } /** * @dev Returns the downcasted int232 from int256, reverting on * overflow (when the input is less than smallest int232 or * greater than largest int232). * * Counterpart to Solidity's `int232` operator. * * Requirements: * * - input must fit into 232 bits */ function toInt232(int256 value) internal pure returns (int232 downcasted) { downcasted = int232(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(232, value); } } /** * @dev Returns the downcasted int224 from int256, reverting on * overflow (when the input is less than smallest int224 or * greater than largest int224). * * Counterpart to Solidity's `int224` operator. * * Requirements: * * - input must fit into 224 bits */ function toInt224(int256 value) internal pure returns (int224 downcasted) { downcasted = int224(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(224, value); } } /** * @dev Returns the downcasted int216 from int256, reverting on * overflow (when the input is less than smallest int216 or * greater than largest int216). * * Counterpart to Solidity's `int216` operator. * * Requirements: * * - input must fit into 216 bits */ function toInt216(int256 value) internal pure returns (int216 downcasted) { downcasted = int216(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(216, value); } } /** * @dev Returns the downcasted int208 from int256, reverting on * overflow (when the input is less than smallest int208 or * greater than largest int208). * * Counterpart to Solidity's `int208` operator. * * Requirements: * * - input must fit into 208 bits */ function toInt208(int256 value) internal pure returns (int208 downcasted) { downcasted = int208(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(208, value); } } /** * @dev Returns the downcasted int200 from int256, reverting on * overflow (when the input is less than smallest int200 or * greater than largest int200). * * Counterpart to Solidity's `int200` operator. * * Requirements: * * - input must fit into 200 bits */ function toInt200(int256 value) internal pure returns (int200 downcasted) { downcasted = int200(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(200, value); } } /** * @dev Returns the downcasted int192 from int256, reverting on * overflow (when the input is less than smallest int192 or * greater than largest int192). * * Counterpart to Solidity's `int192` operator. * * Requirements: * * - input must fit into 192 bits */ function toInt192(int256 value) internal pure returns (int192 downcasted) { downcasted = int192(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(192, value); } } /** * @dev Returns the downcasted int184 from int256, reverting on * overflow (when the input is less than smallest int184 or * greater than largest int184). * * Counterpart to Solidity's `int184` operator. * * Requirements: * * - input must fit into 184 bits */ function toInt184(int256 value) internal pure returns (int184 downcasted) { downcasted = int184(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(184, value); } } /** * @dev Returns the downcasted int176 from int256, reverting on * overflow (when the input is less than smallest int176 or * greater than largest int176). * * Counterpart to Solidity's `int176` operator. * * Requirements: * * - input must fit into 176 bits */ function toInt176(int256 value) internal pure returns (int176 downcasted) { downcasted = int176(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(176, value); } } /** * @dev Returns the downcasted int168 from int256, reverting on * overflow (when the input is less than smallest int168 or * greater than largest int168). * * Counterpart to Solidity's `int168` operator. * * Requirements: * * - input must fit into 168 bits */ function toInt168(int256 value) internal pure returns (int168 downcasted) { downcasted = int168(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(168, value); } } /** * @dev Returns the downcasted int160 from int256, reverting on * overflow (when the input is less than smallest int160 or * greater than largest int160). * * Counterpart to Solidity's `int160` operator. * * Requirements: * * - input must fit into 160 bits */ function toInt160(int256 value) internal pure returns (int160 downcasted) { downcasted = int160(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(160, value); } } /** * @dev Returns the downcasted int152 from int256, reverting on * overflow (when the input is less than smallest int152 or * greater than largest int152). * * Counterpart to Solidity's `int152` operator. * * Requirements: * * - input must fit into 152 bits */ function toInt152(int256 value) internal pure returns (int152 downcasted) { downcasted = int152(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(152, value); } } /** * @dev Returns the downcasted int144 from int256, reverting on * overflow (when the input is less than smallest int144 or * greater than largest int144). * * Counterpart to Solidity's `int144` operator. * * Requirements: * * - input must fit into 144 bits */ function toInt144(int256 value) internal pure returns (int144 downcasted) { downcasted = int144(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(144, value); } } /** * @dev Returns the downcasted int136 from int256, reverting on * overflow (when the input is less than smallest int136 or * greater than largest int136). * * Counterpart to Solidity's `int136` operator. * * Requirements: * * - input must fit into 136 bits */ function toInt136(int256 value) internal pure returns (int136 downcasted) { downcasted = int136(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(136, value); } } /** * @dev Returns the downcasted int128 from int256, reverting on * overflow (when the input is less than smallest int128 or * greater than largest int128). * * Counterpart to Solidity's `int128` operator. * * Requirements: * * - input must fit into 128 bits */ function toInt128(int256 value) internal pure returns (int128 downcasted) { downcasted = int128(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(128, value); } } /** * @dev Returns the downcasted int120 from int256, reverting on * overflow (when the input is less than smallest int120 or * greater than largest int120). * * Counterpart to Solidity's `int120` operator. * * Requirements: * * - input must fit into 120 bits */ function toInt120(int256 value) internal pure returns (int120 downcasted) { downcasted = int120(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(120, value); } } /** * @dev Returns the downcasted int112 from int256, reverting on * overflow (when the input is less than smallest int112 or * greater than largest int112). * * Counterpart to Solidity's `int112` operator. * * Requirements: * * - input must fit into 112 bits */ function toInt112(int256 value) internal pure returns (int112 downcasted) { downcasted = int112(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(112, value); } } /** * @dev Returns the downcasted int104 from int256, reverting on * overflow (when the input is less than smallest int104 or * greater than largest int104). * * Counterpart to Solidity's `int104` operator. * * Requirements: * * - input must fit into 104 bits */ function toInt104(int256 value) internal pure returns (int104 downcasted) { downcasted = int104(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(104, value); } } /** * @dev Returns the downcasted int96 from int256, reverting on * overflow (when the input is less than smallest int96 or * greater than largest int96). * * Counterpart to Solidity's `int96` operator. * * Requirements: * * - input must fit into 96 bits */ function toInt96(int256 value) internal pure returns (int96 downcasted) { downcasted = int96(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(96, value); } } /** * @dev Returns the downcasted int88 from int256, reverting on * overflow (when the input is less than smallest int88 or * greater than largest int88). * * Counterpart to Solidity's `int88` operator. * * Requirements: * * - input must fit into 88 bits */ function toInt88(int256 value) internal pure returns (int88 downcasted) { downcasted = int88(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(88, value); } } /** * @dev Returns the downcasted int80 from int256, reverting on * overflow (when the input is less than smallest int80 or * greater than largest int80). * * Counterpart to Solidity's `int80` operator. * * Requirements: * * - input must fit into 80 bits */ function toInt80(int256 value) internal pure returns (int80 downcasted) { downcasted = int80(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(80, value); } } /** * @dev Returns the downcasted int72 from int256, reverting on * overflow (when the input is less than smallest int72 or * greater than largest int72). * * Counterpart to Solidity's `int72` operator. * * Requirements: * * - input must fit into 72 bits */ function toInt72(int256 value) internal pure returns (int72 downcasted) { downcasted = int72(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(72, value); } } /** * @dev Returns the downcasted int64 from int256, reverting on * overflow (when the input is less than smallest int64 or * greater than largest int64). * * Counterpart to Solidity's `int64` operator. * * Requirements: * * - input must fit into 64 bits */ function toInt64(int256 value) internal pure returns (int64 downcasted) { downcasted = int64(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(64, value); } } /** * @dev Returns the downcasted int56 from int256, reverting on * overflow (when the input is less than smallest int56 or * greater than largest int56). * * Counterpart to Solidity's `int56` operator. * * Requirements: * * - input must fit into 56 bits */ function toInt56(int256 value) internal pure returns (int56 downcasted) { downcasted = int56(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(56, value); } } /** * @dev Returns the downcasted int48 from int256, reverting on * overflow (when the input is less than smallest int48 or * greater than largest int48). * * Counterpart to Solidity's `int48` operator. * * Requirements: * * - input must fit into 48 bits */ function toInt48(int256 value) internal pure returns (int48 downcasted) { downcasted = int48(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(48, value); } } /** * @dev Returns the downcasted int40 from int256, reverting on * overflow (when the input is less than smallest int40 or * greater than largest int40). * * Counterpart to Solidity's `int40` operator. * * Requirements: * * - input must fit into 40 bits */ function toInt40(int256 value) internal pure returns (int40 downcasted) { downcasted = int40(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(40, value); } } /** * @dev Returns the downcasted int32 from int256, reverting on * overflow (when the input is less than smallest int32 or * greater than largest int32). * * Counterpart to Solidity's `int32` operator. * * Requirements: * * - input must fit into 32 bits */ function toInt32(int256 value) internal pure returns (int32 downcasted) { downcasted = int32(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(32, value); } } /** * @dev Returns the downcasted int24 from int256, reverting on * overflow (when the input is less than smallest int24 or * greater than largest int24). * * Counterpart to Solidity's `int24` operator. * * Requirements: * * - input must fit into 24 bits */ function toInt24(int256 value) internal pure returns (int24 downcasted) { downcasted = int24(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(24, value); } } /** * @dev Returns the downcasted int16 from int256, reverting on * overflow (when the input is less than smallest int16 or * greater than largest int16). * * Counterpart to Solidity's `int16` operator. * * Requirements: * * - input must fit into 16 bits */ function toInt16(int256 value) internal pure returns (int16 downcasted) { downcasted = int16(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(16, value); } } /** * @dev Returns the downcasted int8 from int256, reverting on * overflow (when the input is less than smallest int8 or * greater than largest int8). * * Counterpart to Solidity's `int8` operator. * * Requirements: * * - input must fit into 8 bits */ function toInt8(int256 value) internal pure returns (int8 downcasted) { downcasted = int8(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(8, value); } } /** * @dev Converts an unsigned uint256 into a signed int256. * * Requirements: * * - input must be less than or equal to maxInt256. */ function toInt256(uint256 value) internal pure returns (int256) { // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive if (value > uint256(type(int256).max)) { revert SafeCastOverflowedUintToInt(value); } return int256(value); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; import {IERC20Permit} from "../extensions/IERC20Permit.sol"; import {Address} from "../../../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 An operation with an ERC20 token failed. */ error SafeERC20FailedOperation(address token); /** * @dev Indicates a failed `decreaseAllowance` request. */ error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease); /** * @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.encodeCall(token.transfer, (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.encodeCall(token.transferFrom, (from, to, 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); forceApprove(token, spender, oldAllowance + value); } /** * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no * value, non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal { unchecked { uint256 currentAllowance = token.allowance(address(this), spender); if (currentAllowance < requestedDecrease) { revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease); } forceApprove(token, spender, currentAllowance - requestedDecrease); } } /** * @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.encodeCall(token.approve, (spender, value)); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0))); _callOptionalReturn(token, approvalCall); } } /** * @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); if (returndata.length != 0 && !abi.decode(returndata, (bool))) { revert SafeERC20FailedOperation(address(token)); } } /** * @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(token).code.length > 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol) pragma solidity ^0.8.20; import {Math} from "./math/Math.sol"; import {SignedMath} from "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant HEX_DIGITS = "0123456789abcdef"; uint8 private constant ADDRESS_LENGTH = 20; /** * @dev The `value` string doesn't fit in the specified `length`. */ error StringsInsufficientHexLength(uint256 value, uint256 length); /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), HEX_DIGITS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toStringSigned(int256 value) internal pure returns (string memory) { return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { uint256 localValue = value; bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = HEX_DIGITS[localValue & 0xf]; localValue >>= 4; } if (localValue != 0) { revert StringsInsufficientHexLength(value, length); } return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal * representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-Licence-Identifier: MIT pragma solidity ^0.8.0; // a library for performing various math operations library Math { function min(uint256 x, uint256 y) internal pure returns (uint256 z) { z = x < y ? x : y; } // babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method) function sqrt(uint256 y) internal pure returns (uint256 z) { if (y > 3) { z = y; uint256 x = y / 2 + 1; while (x < z) { z = x; x = (y / x + x) / 2; } } else if (y != 0) { z = 1; } } }
pragma solidity ^0.8.0; import { IERC20Metadata as IERC20 } from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import { IFraxswapPair } from "dev-fraxswap/src/contracts/core/interfaces/IFraxswapPair.sol"; import { IFraxswapFactory } from "dev-fraxswap/src/contracts/core/interfaces/IFraxswapFactory.sol"; import { IFraxswapRouterMultihop } from "dev-fraxswap/src/contracts/periphery/interfaces/IFraxswapRouterMultihop.sol"; import { BAMMERC20 } from "src/contracts/BAMMERC20.sol"; import { IFraxswapOracle } from "src/contracts/interfaces/IFraxswapOracle.sol"; import { IBAMMFactory } from "src/contracts/interfaces/IBAMMFactory.sol"; import { IVariableInterestRate } from "src/contracts/interfaces/IVariableInterestRate.sol"; interface IBAMM { // ##################################### // ############## Errors ############### // ##################################### error CannotWithdrawToSelf(); error InsufficientAmount(); error ZeroLiquidityMinted(); error NotSolvent(); error Solvent(); error IncorrectSwapTokens(); error InvalidVault(); error InvalidUtilityRate(); error OraclePriceDeviated(); error IncorrectAmountOutMinimum(); error InvalidRent(); error NotFactory(); error NoBAMMTokensMinted(); // ##################################### // ############## Structs ############## // ##################################### /// @notice Details for a user's vault struct Vault { int256 token0; // Token 0 in the LP int256 token1; // Token 1 in the LP int256 rented; // SQRT(#token0 * #token1) that is rented } /// @notice Function parameter pack for various actions. Different parts may be empty for different actions. struct Action { int256 token0Amount; // Amount of token 0. Positive = add to vault. Negative = remove from vault int256 token1Amount; // Amount of token 1. Positive = add to vault. Negative = remove from vault int256 rent; // SQRT(#token0 * #token1). Positive if borrowing, negative if repaying address to; // A destination address uint256 token0AmountMin; // Minimum amount of token 0 expected uint256 token1AmountMin; // Minimum amount of token 1 expected bool closePosition; // Whether to close the position or not bool approveMax; // Whether to approve max (e.g. uint256(-1) or similar) uint8 v; // Part of a signature bytes32 r; // Part of a signature bytes32 s; // Part of a signature uint256 deadline; // Deadline of this action } // ##################################### // ######### State variables ########### // ##################################### function iBammErc20() external view returns (BAMMERC20); function token0() external view returns (IERC20); function token1() external view returns (IERC20); function pair() external view returns (IFraxswapPair); function routerMultihop() external view returns (IFraxswapRouterMultihop); function fraxswapOracle() external view returns (IFraxswapOracle); function factory() external view returns (address); function sqrtRented() external view returns (int256); function rentedMultiplier() external view returns (uint256); function timeSinceLastInterestPayment() external view returns (uint256); function fullUtilizationRate() external view returns (uint256); function variableInterestRate() external view returns (IVariableInterestRate); function getUserVault(address user) external view returns (Vault memory vault); // ##################################### // ############ Functions ############## // ##################################### function version() external pure returns (uint256 major, uint256 minor, uint256 patch); function mint(address to, uint256 lpIn) external returns (uint256 bammOut); function redeem(address to, uint256 bammIn) external returns (uint256 lpOut); function executeActions(Action memory action) external returns (Vault memory vault); function executeActionsAndSwap( Action memory action, IFraxswapRouterMultihop.FraxswapParams memory swapParams ) external returns (Vault memory vault); function microLiquidate(address user) external returns (uint256 token0Fee, uint256 token1Fee); function addInterest() external returns (uint256 reserve0, uint256 reserve1, uint256 totalSupply, uint256 _rentedMultiplier); function previewInterestRate(uint256 _utilization) external view returns (uint256 newRatePerSec); // #################################### // ############## Events ############## // #################################### /// @notice Emitted when BAMM state changes /// @param sqrtRentedReal rented sqrt amount /// @param sqrtBalance sqrt of the LP tokens held /// @param rentedMultiplier multiplier that increases with interest /// @param interestRate current interest rate event BAMMState(uint256 sqrtRentedReal, uint256 sqrtBalance, uint256 rentedMultiplier, uint256 interestRate); /// @notice Emitted when BAMM tokens get minted by a user directly /// @param lender The person lending the LP /// @param recipient The recipient of the minted BAMM tokens /// @param lpIn The amount of LP being sent in /// @param bammOut The amount of BAMM tokens minted event BAMMMinted(address indexed lender, address indexed recipient, uint256 lpIn, uint256 bammOut); /// @notice Emitted when BAMM tokens get redeemed by a user directly /// @param lender The person redeeming the BAMM tokens /// @param recipient The recipient of the LP tokens /// @param bammIn The amount of BAMM tokens being sent in /// @param lpOut The amount of LP sent out event BAMMRedeemed(address indexed lender, address indexed recipient, uint256 bammIn, uint256 lpOut); /// @notice Emitted when a vault is updated /// @param user The address of the user /// @param token0 The amount of token0 in the vault /// @param token1 The amount of token1 in the vault event VaultUpdated(address indexed user, int256 token0, int256 token1, int256 rent); /// @notice Emitted a users executes a vault action /// @param user The address of the user /// @param token0 token0 changed (positive is tokens added, negative is tokens withdrawn) /// @param token1 token1 changed (positive is tokens added, negative is tokens withdrawn) /// @param rent Rent changed (positive is renting, negative is paying back) event ExecuteAction(address indexed user, int256 token0, int256 token1, int256 rent); /// @notice Emitted a users vault changes /// @param user The address of the user /// @param token0 token0 swapped (positive is in, negative is out) /// @param token1 token1 swapped (positive is in, negative is out) event VaultSwap(address indexed user, int256 token0, int256 token1); /// @notice Emitted when a user pays back the rented LP /// @param user The user /// @param rent The rent change /// @param token0ToAddToLp Token0 paid back /// @param token1ToAddToLp Token1 paid back /// @param closePosition Whether the position was closed or not event RentRepaid( address indexed user, int256 rent, uint256 token0ToAddToLp, uint256 token1ToAddToLp, bool closePosition ); /// @notice Emitted when a user starts renting /// @param user The user /// @param rent The rent change /// @param token0Amount Token0 credited to borrower's vault /// @param token1Amount Token1 credited to borrower's vault event Renting(address indexed user, int256 rent, int256 token0Amount, int256 token1Amount); /// @notice Emitted when a user gets micro liquidated /// @param user The user being liquidated /// @param liquidator The person doing the liquidating /// @param token0Fee Amount of liquidation fee in token0 paid /// @param token1Fee Amount of liquidation fee in token1 paid event MicroLiquidate(address indexed user, address indexed liquidator, uint256 token0Fee, uint256 token1Fee); /// @notice Emitted when a the interest rate contract is updated /// @param previousVariableInterestRate The previous interest rate contract /// @param newVariableInterestRate The new interest rate contract event NewVariableInterestRate( address indexed previousVariableInterestRate, address indexed newVariableInterestRate ); /// @notice Emitted when a new `maxOracleDiff` is set /// @param oldMaxOracleDiff The old `maxOracleDiff` /// @param newMaxOracleDiff The new `maxOracleDiff` event NewMaxOracleDiff(uint256 oldMaxOracleDiff, uint256 newMaxOracleDiff); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @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 value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 value) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 value) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol) pragma solidity ^0.8.20; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error AddressInsufficientBalance(address account); /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedInnerCall(); /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { if (address(this).balance < amount) { revert AddressInsufficientBalance(address(this)); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert FailedInnerCall(); } } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason or custom error, it is bubbled * up by this function (like regular Solidity function calls). However, if * the call reverted with no returned reason, this function reverts with a * {FailedInnerCall} error. * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { if (address(this).balance < value) { revert AddressInsufficientBalance(address(this)); } (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an * unsuccessful call. */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata ) internal view returns (bytes memory) { if (!success) { _revert(returndata); } else { // only check if target is a contract if the call was successful and the return data is empty // otherwise we already know that it was a contract if (returndata.length == 0 && target.code.length == 0) { revert AddressEmptyCode(target); } return returndata; } } /** * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the * revert reason or with a default {FailedInnerCall} error. */ function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) { if (!success) { _revert(returndata); } else { return returndata; } } /** * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}. */ function _revert(bytes memory returndata) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert FailedInnerCall(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol) pragma solidity ^0.8.20; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Muldiv operation overflow. */ error MathOverflowedMulDiv(); enum Rounding { Floor, // Toward negative infinity Ceil, // Toward positive infinity Trunc, // Toward zero Expand // Away from zero } /** * @dev Returns the addition of two unsigned integers, with an overflow flag. */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds towards infinity instead * of rounding towards zero. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { if (b == 0) { // Guarantee the same behavior as in a regular Solidity division. return a / b; } // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or * denominator == 0. * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by * Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0 = x * y; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. if (denominator <= prod1) { revert MathOverflowedMulDiv(); } /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. // Always >= 1. See https://cs.stackexchange.com/q/138556/92363. uint256 twos = denominator & (0 - denominator); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also // works in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded * towards zero. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256 of a positive value rounded towards zero. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0); } } /** * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers. */ function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) { return uint8(rounding) % 2 == 1; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.20; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.0; import { IUniswapV2Pair } from "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol"; /// @dev Fraxswap LP Pair Interface interface IFraxswapPair is IUniswapV2Pair { // TWAMM struct TWAPObservation { uint256 timestamp; uint256 price0CumulativeLast; uint256 price1CumulativeLast; } function TWAPObservationHistory(uint256 index) external view returns (TWAPObservation memory); event LongTermSwap0To1(address indexed addr, uint256 orderId, uint256 amount0In, uint256 numberOfTimeIntervals); event LongTermSwap1To0(address indexed addr, uint256 orderId, uint256 amount1In, uint256 numberOfTimeIntervals); event CancelLongTermOrder( address indexed addr, uint256 orderId, address sellToken, uint256 unsoldAmount, address buyToken, uint256 purchasedAmount ); event WithdrawProceedsFromLongTermOrder( address indexed addr, uint256 orderId, address indexed proceedToken, uint256 proceeds, bool orderExpired ); function fee() external view returns (uint256); function longTermSwapFrom0To1(uint256 amount0In, uint256 numberOfTimeIntervals) external returns (uint256 orderId); function longTermSwapFrom1To0(uint256 amount1In, uint256 numberOfTimeIntervals) external returns (uint256 orderId); function cancelLongTermSwap(uint256 orderId) external; function withdrawProceedsFromLongTermSwap( uint256 orderId ) external returns (bool is_expired, address rewardTkn, uint256 totalReward); function executeVirtualOrders(uint256 blockTimestamp) external; function getAmountOut(uint256 amountIn, address tokenIn) external view returns (uint256); function getAmountIn(uint256 amountOut, address tokenOut) external view returns (uint256); function orderTimeInterval() external returns (uint256); function getTWAPHistoryLength() external view returns (uint256); function getTwammReserves() external view returns ( uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast, uint112 _twammReserve0, uint112 _twammReserve1, uint256 _fee ); function getReserveAfterTwamm( uint256 blockTimestamp ) external view returns ( uint112 _reserve0, uint112 _reserve1, uint256 lastVirtualOrderTimestamp, uint112 _twammReserve0, uint112 _twammReserve1 ); function getNextOrderID() external view returns (uint256); function getOrderIDsForUser(address user) external view returns (uint256[] memory); function getOrderIDsForUserLength(address user) external view returns (uint256); function twammUpToDate() external view returns (bool); function getTwammState() external view returns ( uint256 token0Rate, uint256 token1Rate, uint256 lastVirtualOrderTimestamp, uint256 orderTimeInterval_rtn, uint256 rewardFactorPool0, uint256 rewardFactorPool1 ); function getTwammSalesRateEnding( uint256 _blockTimestamp ) external view returns (uint256 orderPool0SalesRateEnding, uint256 orderPool1SalesRateEnding); function getTwammRewardFactor( uint256 _blockTimestamp ) external view returns (uint256 rewardFactorPool0AtTimestamp, uint256 rewardFactorPool1AtTimestamp); function getTwammOrder( uint256 orderId ) external view returns ( uint256 id, uint256 creationTimestamp, uint256 expirationTimestamp, uint256 saleRate, address owner, address sellTokenAddr, address buyTokenAddr ); function getTwammOrderProceedsView( uint256 orderId, uint256 blockTimestamp ) external view returns (bool orderExpired, uint256 totalReward); function getTwammOrderProceeds(uint256 orderId) external returns (bool orderExpired, uint256 totalReward); function togglePauseNewSwaps() external; }
pragma solidity ^0.8.0; import { IUniswapV2Factory } from "@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol"; interface IFraxswapFactory is IUniswapV2Factory { function createPair(address tokenA, address tokenB, uint256 fee) external returns (address pair); function globalPause() external view returns (bool); function toggleGlobalPause() external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IFraxswapRouterMultihop { /// @notice Input to the swap function /// @dev contains the top level info for the swap /// @param tokenIn input token address /// @param amountIn input token amount /// @param tokenOut output token address /// @param amountOutMinimum output token minimum amount (reverts if lower) /// @param recipient recipient of the output token /// @param deadline deadline for this swap transaction (reverts if exceeded) /// @param v v value for permit signature if supported /// @param r r value for permit signature if supported /// @param s s value for permit signature if supported /// @param route byte encoded struct FraxswapParams { address tokenIn; uint256 amountIn; address tokenOut; uint256 amountOutMinimum; address recipient; uint256 deadline; bool approveMax; uint8 v; bytes32 r; bytes32 s; bytes route; } /// @notice A hop along the swap route /// @dev a series of swaps (steps) containing the same input token and output token /// @param tokenOut output token address /// @param amountOut output token amount /// @param percentOfHop amount of output tokens from the previous hop going into this hop /// @param steps list of swaps from the same input token to the same output token /// @param nextHops next hops from this one, the next hops' input token is the tokenOut struct FraxswapRoute { address tokenOut; uint256 amountOut; uint256 percentOfHop; bytes[] steps; bytes[] nextHops; } /// @notice A swap step in a specific route. routes can have multiple swap steps /// @dev a single swap to a token from the token of the previous hop in the route /// @param swapType type of the swap performed (Uniswap V2, Fraxswap,Curve, etc) /// @param directFundNextPool 0 = funds go via router, 1 = fund are sent directly to pool /// @param directFundThisPool 0 = funds go via router, 1 = fund are sent directly to pool /// @param tokenOut the target token of the step. output token address /// @param pool address of the pool to use in the step /// @param extraParam1 extra data used in the step /// @param extraParam2 extra data used in the step /// @param percentOfHop percentage of all of the steps in this route (hop) struct FraxswapStepData { uint8 swapType; uint8 directFundNextPool; uint8 directFundThisPool; address tokenOut; address pool; uint256 extraParam1; uint256 extraParam2; uint256 percentOfHop; } /// @notice struct for Uniswap V3 callback /// @param tokenIn address of input token /// @param directFundThisPool this pool already been funded struct SwapCallbackData { address tokenIn; bool directFundThisPool; } /// @notice Routing event emitted every swap /// @param tokenIn address of the original input token /// @param tokenOut address of the final output token /// @param amountIn input amount for original input token /// @param amountOut output amount for the final output token event Routed(address tokenIn, address tokenOut, uint256 amountIn, uint256 amountOut); function encodeRoute( address tokenOut, uint256 percentOfHop, bytes[] memory steps, bytes[] memory nextHops ) external pure returns (bytes memory out); function encodeStep( uint8 swapType, uint8 directFundNextPool, uint8 directFundThisPool, address tokenOut, address pool, uint256 extraParam1, uint256 extraParam2, uint256 percentOfHop ) external pure returns (bytes memory out); function swap(FraxswapParams memory params) external payable returns (uint256 amountOut); function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes memory _data) external; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity 0.8.23; import { IBAMMERC20 } from "./interfaces/IBAMMERC20.sol"; import { ERC20Permit, ERC20 } from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol"; import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; import { IERC20Metadata } from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; /// @dev supports OZ 5.0 interface contract BAMMERC20 is IBAMMERC20, ERC20Permit, Ownable { /// @notice Additional variables for name lookup IERC20Metadata public immutable token0; IERC20Metadata public immutable token1; string public id; constructor(address token0_, address token1_, string memory id_) ERC20("", "") ERC20Permit("") Ownable(msg.sender) { id = id_; token0 = IERC20Metadata(token0_); token1 = IERC20Metadata(token1_); } function mint(address account, uint256 value) external onlyOwner { _mint(account, value); } function burn(address account, uint256 value) external onlyOwner { _burn(account, value); } // ############################################ // ############## VIEW OVERRIDES ############# // ############################################ function ticker() internal view returns (string memory) { return string.concat(token0.symbol(), "/", token1.symbol()); } function symbol() public view override returns (string memory) { return string.concat("BAMM_", ticker()); } function name() public view override returns (string memory) { return string.concat("BAMM_", id, "_", ticker(), " Fraxswap V2"); } }
pragma solidity ^0.8.0; import { IFraxswapPair } from "dev-fraxswap/src/contracts/core/interfaces/IFraxswapPair.sol"; interface IFraxswapOracle { function getPrice( IFraxswapPair pool, uint256 period, uint256 rounds, uint256 maxDiffPerc ) external view returns (uint256 result0, uint256 result1); function getPrice0( IFraxswapPair pool, uint256 period, uint256 rounds, uint256 maxDiffPerc ) external view returns (uint256 result0); function getPrice1( IFraxswapPair pool, uint256 period, uint256 rounds, uint256 maxDiffPerc ) external view returns (uint256 result1); function mulDecode(uint224 value) external pure returns (uint256 result); }
pragma solidity ^0.8.0; import { IFraxswapFactory } from "dev-fraxswap/src/contracts/core/interfaces/IFraxswapFactory.sol"; interface IBAMMFactory { // State variables function iFraxswapFactory() external view returns (IFraxswapFactory); function routerMultihop() external view returns (address); function fraxswapOracle() external view returns (address); function variableInterestRate() external view returns (address); function isBamm(address bamm) external view returns (bool exists); function pairToBamm(address pair) external view returns (address bamm); function feeTo() external view returns (address); // Functions function version() external pure returns (uint256 _major, uint256 _minor, uint256 _patch); function createBamm(address _pair) external returns (address bamm); function bammsArray() external view returns (address[] memory); function bammsLength() external view returns (uint256); function setFeeTo(address _feeTo) external; // Events event BammCreated(address pair, address bamm); // Errors error Create2Failed(); error BammAlreadyCreated(); error PairNotFromFraxswapFactory(); error NotBAMM(); }
// SPDX-License-Identifier: ISC pragma solidity ^0.8.0; interface IVariableInterestRate { function MAX_FULL_UTIL_RATE() external view returns (uint256); function MAX_TARGET_UTIL() external view returns (uint256); function MIN_FULL_UTIL_RATE() external view returns (uint256); function MIN_TARGET_UTIL() external view returns (uint256); function RATE_HALF_LIFE() external view returns (uint256); function RATE_PREC() external view returns (uint256); function UTIL_PREC() external view returns (uint256); function VERTEX_RATE_PERCENT() external view returns (uint256); function VERTEX_UTILIZATION() external view returns (uint256); function ZERO_UTIL_RATE() external view returns (uint256); function getNewRate( uint256 _deltaTime, uint256 _utilization, uint64 _oldFullUtilizationInterest ) external view returns (uint64 _newRatePerSec, uint64 _newFullUtilizationInterest); function name() external view returns (string memory); function version() external view returns (uint256 _major, uint256 _minor, uint256 _patch); function suffix() external view returns (string memory); }
pragma solidity >=0.5.0; interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function price0CumulativeLast() external view returns (uint); function price1CumulativeLast() external view returns (uint); function kLast() external view returns (uint); function mint(address to) external returns (uint liquidity); function burn(address to) external returns (uint amount0, uint amount1); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; function initialize(address, address) external; }
pragma solidity >=0.5.0; interface IUniswapV2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(address tokenA, address tokenB) external view returns (address pair); function allPairs(uint) external view returns (address pair); function allPairsLength() external view returns (uint); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; }
pragma solidity ^0.8.0; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; interface IBAMMERC20 is IERC20 { function mint(address account, uint256 value) external; function burn(address account, uint256 value) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/ERC20Permit.sol) pragma solidity ^0.8.20; import {IERC20Permit} from "./IERC20Permit.sol"; import {ERC20} from "../ERC20.sol"; import {ECDSA} from "../../../utils/cryptography/ECDSA.sol"; import {EIP712} from "../../../utils/cryptography/EIP712.sol"; import {Nonces} from "../../../utils/Nonces.sol"; /** * @dev Implementation 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. */ abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712, Nonces { bytes32 private constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); /** * @dev Permit deadline has expired. */ error ERC2612ExpiredSignature(uint256 deadline); /** * @dev Mismatched signature. */ error ERC2612InvalidSigner(address signer, address owner); /** * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`. * * It's a good idea to use the same `name` that is defined as the ERC20 token name. */ constructor(string memory name) EIP712(name, "1") {} /** * @inheritdoc IERC20Permit */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual { if (block.timestamp > deadline) { revert ERC2612ExpiredSignature(deadline); } bytes32 structHash = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline)); bytes32 hash = _hashTypedDataV4(structHash); address signer = ECDSA.recover(hash, v, r, s); if (signer != owner) { revert ERC2612InvalidSigner(signer, owner); } _approve(owner, spender, value); } /** * @inheritdoc IERC20Permit */ function nonces(address owner) public view virtual override(IERC20Permit, Nonces) returns (uint256) { return super.nonces(owner); } /** * @inheritdoc IERC20Permit */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view virtual returns (bytes32) { return _domainSeparatorV4(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) pragma solidity ^0.8.20; import {Context} from "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * The initial owner is set to the address provided by the deployer. This can * later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; /** * @dev The caller account is not authorized to perform an operation. */ error OwnableUnauthorizedAccount(address account); /** * @dev The owner is not a valid owner account. (eg. `address(0)`) */ error OwnableInvalidOwner(address owner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the address provided by the deployer as the initial owner. */ constructor(address initialOwner) { if (initialOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(initialOwner); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { if (owner() != _msgSender()) { revert OwnableUnauthorizedAccount(_msgSender()); } } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { if (newOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "./IERC20.sol"; import {IERC20Metadata} from "./extensions/IERC20Metadata.sol"; import {Context} from "../../utils/Context.sol"; import {IERC20Errors} from "../../interfaces/draft-IERC6093.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * * TIP: For a detailed writeup see our guide * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * The default value of {decimals} is 18. To change this, you should override * this function so it returns a different value. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. */ abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors { mapping(address account => uint256) private _balances; mapping(address account => mapping(address spender => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the default value returned by this function, unless * it's overridden. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `value`. */ function transfer(address to, uint256 value) public virtual returns (bool) { address owner = _msgSender(); _transfer(owner, to, value); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 value) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, value); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `value`. * - the caller must have allowance for ``from``'s tokens of at least * `value`. */ function transferFrom(address from, address to, uint256 value) public virtual returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, value); _transfer(from, to, value); return true; } /** * @dev Moves a `value` amount of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _transfer(address from, address to, uint256 value) internal { if (from == address(0)) { revert ERC20InvalidSender(address(0)); } if (to == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(from, to, value); } /** * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from` * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding * this function. * * Emits a {Transfer} event. */ function _update(address from, address to, uint256 value) internal virtual { if (from == address(0)) { // Overflow check required: The rest of the code assumes that totalSupply never overflows _totalSupply += value; } else { uint256 fromBalance = _balances[from]; if (fromBalance < value) { revert ERC20InsufficientBalance(from, fromBalance, value); } unchecked { // Overflow not possible: value <= fromBalance <= totalSupply. _balances[from] = fromBalance - value; } } if (to == address(0)) { unchecked { // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply. _totalSupply -= value; } } else { unchecked { // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256. _balances[to] += value; } } emit Transfer(from, to, value); } /** * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0). * Relies on the `_update` mechanism * * Emits a {Transfer} event with `from` set to the zero address. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _mint(address account, uint256 value) internal { if (account == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(address(0), account, value); } /** * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply. * Relies on the `_update` mechanism. * * Emits a {Transfer} event with `to` set to the zero address. * * NOTE: This function is not virtual, {_update} should be overridden instead */ function _burn(address account, uint256 value) internal { if (account == address(0)) { revert ERC20InvalidSender(address(0)); } _update(account, address(0), value); } /** * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. * * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument. */ function _approve(address owner, address spender, uint256 value) internal { _approve(owner, spender, value, true); } /** * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event. * * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any * `Approval` event during `transferFrom` operations. * * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to * true using the following override: * ``` * function _approve(address owner, address spender, uint256 value, bool) internal virtual override { * super._approve(owner, spender, value, true); * } * ``` * * Requirements are the same as {_approve}. */ function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual { if (owner == address(0)) { revert ERC20InvalidApprover(address(0)); } if (spender == address(0)) { revert ERC20InvalidSpender(address(0)); } _allowances[owner][spender] = value; if (emitEvent) { emit Approval(owner, spender, value); } } /** * @dev Updates `owner` s allowance for `spender` based on spent `value`. * * Does not update the allowance value in case of infinite allowance. * Revert if not enough allowance is available. * * Does not emit an {Approval} event. */ function _spendAllowance(address owner, address spender, uint256 value) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { if (currentAllowance < value) { revert ERC20InsufficientAllowance(spender, currentAllowance, value); } unchecked { _approve(owner, spender, currentAllowance - value, false); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.20; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS } /** * @dev The signature derives the `address(0)`. */ error ECDSAInvalidSignature(); /** * @dev The signature has an invalid length. */ error ECDSAInvalidSignatureLength(uint256 length); /** * @dev The signature has an S value that is in the upper half order. */ error ECDSAInvalidSignatureS(bytes32 s); /** * @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not * return address(0) without also returning an error description. Errors are documented using an enum (error type) * and a bytes32 providing additional information about the error. * * If no error is returned, then the address can be used for verification purposes. * * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError, bytes32) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length)); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature); _throwError(error, errorArg); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] */ function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError, bytes32) { unchecked { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); // We do not check for an overflow here since the shift operation results in 0 or 1. uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. */ function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs); _throwError(error, errorArg); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError, bytes32) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS, s); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature, bytes32(0)); } return (signer, RecoverError.NoError, bytes32(0)); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, v, r, s); _throwError(error, errorArg); return recovered; } /** * @dev Optionally reverts with the corresponding custom error according to the `error` argument provided. */ function _throwError(RecoverError error, bytes32 errorArg) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert ECDSAInvalidSignature(); } else if (error == RecoverError.InvalidSignatureLength) { revert ECDSAInvalidSignatureLength(uint256(errorArg)); } else if (error == RecoverError.InvalidSignatureS) { revert ECDSAInvalidSignatureS(errorArg); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/EIP712.sol) pragma solidity ^0.8.20; import {MessageHashUtils} from "./MessageHashUtils.sol"; import {ShortStrings, ShortString} from "../ShortStrings.sol"; import {IERC5267} from "../../interfaces/IERC5267.sol"; /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. * * The encoding scheme specified in the EIP requires a domain separator and a hash of the typed structured data, whose * encoding is very generic and therefore its implementation in Solidity is not feasible, thus this contract * does not implement the encoding itself. Protocols need to implement the type-specific encoding they need in order to * produce the hash of their typed data using a combination of `abi.encode` and `keccak256`. * * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA * ({_hashTypedDataV4}). * * The implementation of the domain separator was designed to be as efficient as possible while still properly updating * the chain id to protect against replay attacks on an eventual fork of the chain. * * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. * * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain * separator of the implementation contract. This will cause the {_domainSeparatorV4} function to always rebuild the * separator from the immutable values, which is cheaper than accessing a cached version in cold storage. * * @custom:oz-upgrades-unsafe-allow state-variable-immutable */ abstract contract EIP712 is IERC5267 { using ShortStrings for *; bytes32 private constant TYPE_HASH = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"); // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to // invalidate the cached domain separator if the chain id changes. bytes32 private immutable _cachedDomainSeparator; uint256 private immutable _cachedChainId; address private immutable _cachedThis; bytes32 private immutable _hashedName; bytes32 private immutable _hashedVersion; ShortString private immutable _name; ShortString private immutable _version; string private _nameFallback; string private _versionFallback; /** * @dev Initializes the domain separator and parameter caches. * * The meaning of `name` and `version` is specified in * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]: * * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. * - `version`: the current major version of the signing domain. * * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart * contract upgrade]. */ constructor(string memory name, string memory version) { _name = name.toShortStringWithFallback(_nameFallback); _version = version.toShortStringWithFallback(_versionFallback); _hashedName = keccak256(bytes(name)); _hashedVersion = keccak256(bytes(version)); _cachedChainId = block.chainid; _cachedDomainSeparator = _buildDomainSeparator(); _cachedThis = address(this); } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { if (address(this) == _cachedThis && block.chainid == _cachedChainId) { return _cachedDomainSeparator; } else { return _buildDomainSeparator(); } } function _buildDomainSeparator() private view returns (bytes32) { return keccak256(abi.encode(TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this))); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return MessageHashUtils.toTypedDataHash(_domainSeparatorV4(), structHash); } /** * @dev See {IERC-5267}. */ function eip712Domain() public view virtual returns ( bytes1 fields, string memory name, string memory version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] memory extensions ) { return ( hex"0f", // 01111 _EIP712Name(), _EIP712Version(), block.chainid, address(this), bytes32(0), new uint256[](0) ); } /** * @dev The name parameter for the EIP712 domain. * * NOTE: By default this function reads _name which is an immutable value. * It only reads from storage if necessary (in case the value is too large to fit in a ShortString). */ // solhint-disable-next-line func-name-mixedcase function _EIP712Name() internal view returns (string memory) { return _name.toStringWithFallback(_nameFallback); } /** * @dev The version parameter for the EIP712 domain. * * NOTE: By default this function reads _version which is an immutable value. * It only reads from storage if necessary (in case the value is too large to fit in a ShortString). */ // solhint-disable-next-line func-name-mixedcase function _EIP712Version() internal view returns (string memory) { return _version.toStringWithFallback(_versionFallback); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Nonces.sol) pragma solidity ^0.8.20; /** * @dev Provides tracking nonces for addresses. Nonces will only increment. */ abstract contract Nonces { /** * @dev The nonce used for an `account` is not the expected current nonce. */ error InvalidAccountNonce(address account, uint256 currentNonce); mapping(address account => uint256) private _nonces; /** * @dev Returns the next unused nonce for an address. */ function nonces(address owner) public view virtual returns (uint256) { return _nonces[owner]; } /** * @dev Consumes a nonce. * * Returns the current value and increments nonce. */ function _useNonce(address owner) internal virtual returns (uint256) { // For each account, the nonce has an initial value of 0, can only be incremented by one, and cannot be // decremented or reset. This guarantees that the nonce never overflows. unchecked { // It is important to do x++ and not ++x here. return _nonces[owner]++; } } /** * @dev Same as {_useNonce} but checking that `nonce` is the next valid for `owner`. */ function _useCheckedNonce(address owner, uint256 nonce) internal virtual { uint256 current = _useNonce(owner); if (nonce != current) { revert InvalidAccountNonce(owner, current); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol) pragma solidity ^0.8.20; /** * @dev Standard ERC20 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens. */ interface IERC20Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC20InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC20InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers. * @param spender Address that may be allowed to operate on tokens without being their owner. * @param allowance Amount of tokens a `spender` is allowed to operate with. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC20InvalidApprover(address approver); /** * @dev Indicates a failure with the `spender` to be approved. Used in approvals. * @param spender Address that may be allowed to operate on tokens without being their owner. */ error ERC20InvalidSpender(address spender); } /** * @dev Standard ERC721 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens. */ interface IERC721Errors { /** * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20. * Used in balance queries. * @param owner Address of the current owner of a token. */ error ERC721InvalidOwner(address owner); /** * @dev Indicates a `tokenId` whose `owner` is the zero address. * @param tokenId Identifier number of a token. */ error ERC721NonexistentToken(uint256 tokenId); /** * @dev Indicates an error related to the ownership over a particular token. Used in transfers. * @param sender Address whose tokens are being transferred. * @param tokenId Identifier number of a token. * @param owner Address of the current owner of a token. */ error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC721InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC721InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param tokenId Identifier number of a token. */ error ERC721InsufficientApproval(address operator, uint256 tokenId); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC721InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC721InvalidOperator(address operator); } /** * @dev Standard ERC1155 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens. */ interface IERC1155Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. * @param tokenId Identifier number of a token. */ error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC1155InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC1155InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param owner Address of the current owner of a token. */ error ERC1155MissingApprovalForAll(address operator, address owner); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC1155InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC1155InvalidOperator(address operator); /** * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation. * Used in batch transfers. * @param idsLength Length of the array of token identifiers * @param valuesLength Length of the array of token amounts */ error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/MessageHashUtils.sol) pragma solidity ^0.8.20; import {Strings} from "../Strings.sol"; /** * @dev Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing. * * The library provides methods for generating a hash of a message that conforms to the * https://eips.ethereum.org/EIPS/eip-191[EIP 191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712] * specifications. */ library MessageHashUtils { /** * @dev Returns the keccak256 digest of an EIP-191 signed data with version * `0x45` (`personal_sign` messages). * * The digest is calculated by prefixing a bytes32 `messageHash` with * `"\x19Ethereum Signed Message:\n32"` and hashing the result. It corresponds with the * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method. * * NOTE: The `messageHash` parameter is intended to be the result of hashing a raw message with * keccak256, although any bytes32 value can be safely used because the final digest will * be re-hashed. * * See {ECDSA-recover}. */ function toEthSignedMessageHash(bytes32 messageHash) internal pure returns (bytes32 digest) { /// @solidity memory-safe-assembly assembly { mstore(0x00, "\x19Ethereum Signed Message:\n32") // 32 is the bytes-length of messageHash mstore(0x1c, messageHash) // 0x1c (28) is the length of the prefix digest := keccak256(0x00, 0x3c) // 0x3c is the length of the prefix (0x1c) + messageHash (0x20) } } /** * @dev Returns the keccak256 digest of an EIP-191 signed data with version * `0x45` (`personal_sign` messages). * * The digest is calculated by prefixing an arbitrary `message` with * `"\x19Ethereum Signed Message:\n" + len(message)` and hashing the result. It corresponds with the * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method. * * See {ECDSA-recover}. */ function toEthSignedMessageHash(bytes memory message) internal pure returns (bytes32) { return keccak256(bytes.concat("\x19Ethereum Signed Message:\n", bytes(Strings.toString(message.length)), message)); } /** * @dev Returns the keccak256 digest of an EIP-191 signed data with version * `0x00` (data with intended validator). * * The digest is calculated by prefixing an arbitrary `data` with `"\x19\x00"` and the intended * `validator` address. Then hashing the result. * * See {ECDSA-recover}. */ function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) { return keccak256(abi.encodePacked(hex"19_00", validator, data)); } /** * @dev Returns the keccak256 digest of an EIP-712 typed data (EIP-191 version `0x01`). * * The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with * `\x19\x01` and hashing the result. It corresponds to the hash signed by the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712. * * See {ECDSA-recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 digest) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) mstore(ptr, hex"19_01") mstore(add(ptr, 0x02), domainSeparator) mstore(add(ptr, 0x22), structHash) digest := keccak256(ptr, 0x42) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/ShortStrings.sol) pragma solidity ^0.8.20; import {StorageSlot} from "./StorageSlot.sol"; // | string | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | // | length | 0x BB | type ShortString is bytes32; /** * @dev This library provides functions to convert short memory strings * into a `ShortString` type that can be used as an immutable variable. * * Strings of arbitrary length can be optimized using this library if * they are short enough (up to 31 bytes) by packing them with their * length (1 byte) in a single EVM word (32 bytes). Additionally, a * fallback mechanism can be used for every other case. * * Usage example: * * ```solidity * contract Named { * using ShortStrings for *; * * ShortString private immutable _name; * string private _nameFallback; * * constructor(string memory contractName) { * _name = contractName.toShortStringWithFallback(_nameFallback); * } * * function name() external view returns (string memory) { * return _name.toStringWithFallback(_nameFallback); * } * } * ``` */ library ShortStrings { // Used as an identifier for strings longer than 31 bytes. bytes32 private constant FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF; error StringTooLong(string str); error InvalidShortString(); /** * @dev Encode a string of at most 31 chars into a `ShortString`. * * This will trigger a `StringTooLong` error is the input string is too long. */ function toShortString(string memory str) internal pure returns (ShortString) { bytes memory bstr = bytes(str); if (bstr.length > 31) { revert StringTooLong(str); } return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length)); } /** * @dev Decode a `ShortString` back to a "normal" string. */ function toString(ShortString sstr) internal pure returns (string memory) { uint256 len = byteLength(sstr); // using `new string(len)` would work locally but is not memory safe. string memory str = new string(32); /// @solidity memory-safe-assembly assembly { mstore(str, len) mstore(add(str, 0x20), sstr) } return str; } /** * @dev Return the length of a `ShortString`. */ function byteLength(ShortString sstr) internal pure returns (uint256) { uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF; if (result > 31) { revert InvalidShortString(); } return result; } /** * @dev Encode a string into a `ShortString`, or write it to storage if it is too long. */ function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) { if (bytes(value).length < 32) { return toShortString(value); } else { StorageSlot.getStringSlot(store).value = value; return ShortString.wrap(FALLBACK_SENTINEL); } } /** * @dev Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}. */ function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) { if (ShortString.unwrap(value) != FALLBACK_SENTINEL) { return toString(value); } else { return store; } } /** * @dev Return the length of a string that was encoded to `ShortString` or written to storage using * {setWithFallback}. * * WARNING: This will return the "byte length" of the string. This may not reflect the actual length in terms of * actual characters as the UTF-8 encoding of a single character can span over multiple bytes. */ function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) { if (ShortString.unwrap(value) != FALLBACK_SENTINEL) { return byteLength(value); } else { return bytes(store).length; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC5267.sol) pragma solidity ^0.8.20; interface IERC5267 { /** * @dev MAY be emitted to signal that the domain could have changed. */ event EIP712DomainChanged(); /** * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712 * signature. */ function eip712Domain() external view returns ( bytes1 fields, string memory name, string memory version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] memory extensions ); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol) // This file was procedurally generated from scripts/generate/templates/StorageSlot.js. pragma solidity ^0.8.20; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ```solidity * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(newImplementation.code.length > 0); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } struct StringSlot { string value; } struct BytesSlot { bytes value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` with member `value` located at `slot`. */ function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` representation of the string storage pointer `store`. */ function getStringSlot(string storage store) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } /** * @dev Returns an `BytesSlot` with member `value` located at `slot`. */ function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`. */ function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } }
{ "remappings": [ "frax-std/=node_modules/frax-standard-solidity/src/", "@prb/test/=node_modules/@prb/test/", "forge-std/=node_modules/forge-std/src/", "ds-test/=node_modules/ds-test/src/", "@openzeppelin/=node_modules/@openzeppelin/", "@uniswap/=node_modules/@uniswap/", "dev-fraxswap/=node_modules/dev-fraxswap/", "frax-standard-solidity/=node_modules/frax-standard-solidity/", "solidity-bytes-utils/=node_modules/solidity-bytes-utils/", "solmate/=node_modules/solmate/" ], "optimizer": { "enabled": true, "runs": 6900000 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "none", "appendCBOR": false }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "abi" ] } }, "evmVersion": "shanghai", "viaIR": false, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"bytes","name":"_encodedBammConstructorArgs","type":"bytes"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"CannotWithdrawToSelf","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"IncorrectAmountOutMinimum","type":"error"},{"inputs":[],"name":"IncorrectSwapTokens","type":"error"},{"inputs":[],"name":"InsufficientAmount","type":"error"},{"inputs":[],"name":"InvalidRent","type":"error"},{"inputs":[],"name":"InvalidUtilityRate","type":"error"},{"inputs":[],"name":"InvalidVault","type":"error"},{"inputs":[],"name":"NoBAMMTokensMinted","type":"error"},{"inputs":[],"name":"NotFactory","type":"error"},{"inputs":[],"name":"NotSolvent","type":"error"},{"inputs":[],"name":"OraclePriceDeviated","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"int256","name":"value","type":"int256"}],"name":"SafeCastOverflowedIntToUint","type":"error"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"SafeCastOverflowedUintToInt","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"Solvent","type":"error"},{"inputs":[],"name":"ZeroLiquidityMinted","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"lender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"lpIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"bammOut","type":"uint256"}],"name":"BAMMMinted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"lender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"bammIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lpOut","type":"uint256"}],"name":"BAMMRedeemed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"sqrtRentedReal","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"sqrtBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rentedMultiplier","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"interestRate","type":"uint256"}],"name":"BAMMState","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"int256","name":"token0","type":"int256"},{"indexed":false,"internalType":"int256","name":"token1","type":"int256"},{"indexed":false,"internalType":"int256","name":"rent","type":"int256"}],"name":"ExecuteAction","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"liquidator","type":"address"},{"indexed":false,"internalType":"uint256","name":"token0Fee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"token1Fee","type":"uint256"}],"name":"MicroLiquidate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldMaxOracleDiff","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newMaxOracleDiff","type":"uint256"}],"name":"NewMaxOracleDiff","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousVariableInterestRate","type":"address"},{"indexed":true,"internalType":"address","name":"newVariableInterestRate","type":"address"}],"name":"NewVariableInterestRate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"int256","name":"rent","type":"int256"},{"indexed":false,"internalType":"uint256","name":"token0ToAddToLp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"token1ToAddToLp","type":"uint256"},{"indexed":false,"internalType":"bool","name":"closePosition","type":"bool"}],"name":"RentRepaid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"int256","name":"rent","type":"int256"},{"indexed":false,"internalType":"int256","name":"token0Amount","type":"int256"},{"indexed":false,"internalType":"int256","name":"token1Amount","type":"int256"}],"name":"Renting","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"int256","name":"token0","type":"int256"},{"indexed":false,"internalType":"int256","name":"token1","type":"int256"}],"name":"VaultSwap","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"int256","name":"token0","type":"int256"},{"indexed":false,"internalType":"int256","name":"token1","type":"int256"},{"indexed":false,"internalType":"int256","name":"rent","type":"int256"}],"name":"VaultUpdated","type":"event"},{"inputs":[],"name":"FEE_SHARE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LIQUIDATION_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_UTILITY_RATE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINIMUM_LIQUIDITY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PRECISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SOLVENCY_THRESHOLD_FULL_LIQUIDATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SOLVENCY_THRESHOLD_LIQUIDATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"addInterest","outputs":[{"internalType":"uint256","name":"reserve0","type":"uint256"},{"internalType":"uint256","name":"reserve1","type":"uint256"},{"internalType":"uint256","name":"totalSupply","type":"uint256"},{"internalType":"uint256","name":"_rentedMultiplier","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"int256","name":"token0Amount","type":"int256"},{"internalType":"int256","name":"token1Amount","type":"int256"},{"internalType":"int256","name":"rent","type":"int256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"token0AmountMin","type":"uint256"},{"internalType":"uint256","name":"token1AmountMin","type":"uint256"},{"internalType":"bool","name":"closePosition","type":"bool"},{"internalType":"bool","name":"approveMax","type":"bool"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct IBAMM.Action","name":"action","type":"tuple"}],"name":"executeActions","outputs":[{"components":[{"internalType":"int256","name":"token0","type":"int256"},{"internalType":"int256","name":"token1","type":"int256"},{"internalType":"int256","name":"rented","type":"int256"}],"internalType":"struct IBAMM.Vault","name":"vault","type":"tuple"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"int256","name":"token0Amount","type":"int256"},{"internalType":"int256","name":"token1Amount","type":"int256"},{"internalType":"int256","name":"rent","type":"int256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"token0AmountMin","type":"uint256"},{"internalType":"uint256","name":"token1AmountMin","type":"uint256"},{"internalType":"bool","name":"closePosition","type":"bool"},{"internalType":"bool","name":"approveMax","type":"bool"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct IBAMM.Action","name":"action","type":"tuple"},{"components":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"bool","name":"approveMax","type":"bool"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"},{"internalType":"bytes","name":"route","type":"bytes"}],"internalType":"struct IFraxswapRouterMultihop.FraxswapParams","name":"swapParams","type":"tuple"}],"name":"executeActionsAndSwap","outputs":[{"components":[{"internalType":"int256","name":"token0","type":"int256"},{"internalType":"int256","name":"token1","type":"int256"},{"internalType":"int256","name":"rented","type":"int256"}],"internalType":"struct IBAMM.Vault","name":"vault","type":"tuple"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fraxswapOracle","outputs":[{"internalType":"contract IFraxswapOracle","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fullUtilizationRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenIn","type":"uint256"},{"internalType":"uint256","name":"tokenOut","type":"uint256"},{"internalType":"uint256","name":"reserveIn","type":"uint256"},{"internalType":"uint256","name":"reserveOut","type":"uint256"}],"name":"getMaxSell","outputs":[{"internalType":"uint256","name":"maxSell","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getUserVault","outputs":[{"components":[{"internalType":"int256","name":"token0","type":"int256"},{"internalType":"int256","name":"token1","type":"int256"},{"internalType":"int256","name":"rented","type":"int256"}],"internalType":"struct IBAMM.Vault","name":"vault","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"iBammErc20","outputs":[{"internalType":"contract BAMMERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isUser","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxOracleDiff","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"microLiquidate","outputs":[{"internalType":"uint256","name":"token0Fee","type":"uint256"},{"internalType":"uint256","name":"token1Fee","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"lpIn","type":"uint256"}],"name":"mint","outputs":[{"internalType":"uint256","name":"bammOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pair","outputs":[{"internalType":"contract IFraxswapPair","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pairFactory","outputs":[{"internalType":"contract IFraxswapFactory","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_utilization","type":"uint256"}],"name":"previewInterestRate","outputs":[{"internalType":"uint256","name":"newRatePerSec","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"bammIn","type":"uint256"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"lpOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rentedMultiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"routerMultihop","outputs":[{"internalType":"contract IFraxswapRouterMultihop","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"newMaxDiff","type":"uint256"}],"name":"setMaxOracleDeviation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newVariableInterestRate","type":"address"}],"name":"setVariableInterestRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sqrtRented","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"timeSinceLastInterestPayment","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token0","outputs":[{"internalType":"contract IERC20Metadata","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token1","outputs":[{"internalType":"contract IERC20Metadata","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userVaults","outputs":[{"internalType":"int256","name":"token0","type":"int256"},{"internalType":"int256","name":"token1","type":"int256"},{"internalType":"int256","name":"rented","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"users","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"usersArray","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"usersLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"variableInterestRate","outputs":[{"internalType":"contract IVariableInterestRate","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"uint256","name":"_major","type":"uint256"},{"internalType":"uint256","name":"_minor","type":"uint256"},{"internalType":"uint256","name":"_patch","type":"uint256"}],"stateMutability":"pure","type":"function"}]
Deployed Bytecode
0x608060405234801561000f575f80fd5b5060043610610283575f3560e01c80639115eacd11610157578063c4fbed55116100d2578063eab11db111610088578063f331b0ec1161006e578063f331b0ec14610622578063fab59f981461062b578063ffcc43c71461063e575f80fd5b8063eab11db114610607578063f2380a081461060f575f80fd5b8063cf521eaf116100b8578063cf521eaf146105b0578063d21220a7146105b9578063e14f870d146105e0575f80fd5b8063c4fbed5514610595578063c739efb9146105a8575f80fd5b8063aaf5eb6811610127578063b18273301161010d578063b182733014610565578063ba9a7a5614610565578063c45a01551461056e575f80fd5b8063aaf5eb681461054d578063ab3156f41461055c575f80fd5b80639115eacd14610502578063922fb3501461050a578063a8747dc614610513578063a8aa1b3114610526575f80fd5b806354fd4d5011610201578063750c3a16116101b75780638551be901161019d5780638551be90146104bc57806390c371e6146104d1578063910ab937146104da575f80fd5b8063750c3a161461046757806378f3a8941461049c575f80fd5b80636557ed77116101e75780636557ed77146104115780636bfd1cfb1461041957806370dcf16314610440575f80fd5b806354fd4d50146103f25780635cd02eb5146103fc575f80fd5b80632958d03111610256578063395db9ec1161023c578063395db9ec1461038657806340c10f19146103ad5780634209fff1146103c0575f80fd5b80632958d0311461032a578063365b98b214610373575f80fd5b80630d09365c146102875780630dfe1681146102b457806319b730d5146103005780631e9a695014610317575b5f80fd5b61028f610651565b6040805194855260208501939093529183015260608201526080015b60405180910390f35b6102db7f000000000000000000000000fc0000000000000000000000000000000000000181565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016102ab565b61030960025481565b6040519081526020016102ab565b610309610325366004615137565b6106a1565b610358610338366004615161565b60066020525f908152604090208054600182015460029092015490919083565b604080519384526020840192909252908201526060016102ab565b6102db61038136600461517c565b610a67565b6102db7f0000000000000000000000003b1d8484b7036f62fed9d5eae15b186bd7c3e8b481565b6103096103bb366004615137565b610a9c565b6103e26103ce366004615161565b60086020525f908152604090205460ff1681565b60405190151581526020016102ab565b5f60056002610358565b61040f61040a366004615161565b610f83565b005b61030961107f565b6102db7f00000000000000000000000037416992335d09875ce4cb186e3a04dcee9c685881565b6102db7f000000000000000000000000b244fd19cf3ad348ac3784c3ca48cdb2a1e50e7c81565b61047a6104753660046152eb565b6110a3565b60408051825181526020808401519082015291810151908201526060016102ab565b6001546102db9073ffffffffffffffffffffffffffffffffffffffff1681565b6104c461112f565b6040516102ab9190615306565b61030960035481565b6104ed6104e8366004615161565b61119c565b604080519283526020830191909152016102ab565b6103096122a1565b6103096103e881565b61047a610521366004615406565b6122b6565b6102db7f0000000000000000000000004527bced9d41706d1436507e9a6e354d3ff44ff981565b610309670de0b6b3a764000081565b61030960095481565b61030961271081565b6102db7f00000000000000000000000019928170d739139bfbbb6614007f8eeed17db0ba81565b61040f6105a336600461517c565b612a00565b610309612ab0565b61030960045481565b6102db7f000000000000000000000000fc0000000000000000000000000000000000000681565b6102db7f000000000000000000000000e30521fe7f3beb6ad556887b50739d6c7ca667e681565b600754610309565b61047a61061d366004615161565b612ac7565b61030960055481565b61030961063936600461517c565b612b36565b61030961064c366004615510565b612c3e565b5f805f8061065d612cce565b610665612d0f565b6003546dffffffffffffffffffffffffffff9384169750919092169450909250905061069284848461336e565b61069b60015f55565b90919293565b5f6106aa612cce565b5f805f6106b5612d0f565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015292955090935091505f908190819073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000004527bced9d41706d1436507e9a6e354d3ff44ff916906370a0823190602401602060405180830381865afa15801561074b573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061076f919061553f565b90506107966107916dffffffffffffffffffffffffffff808816908916615583565b61351d565b91505f846107a48484615583565b6107ae91906155c7565b90505f670de0b6b3a76400006003546002546107ca9190615583565b6107d491906155c7565b90507f00000000000000000000000037416992335d09875ce4cb186e3a04dcee9c685873ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561083f573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610863919061553f565b61086d82846155da565b610877908c615583565b61088191906155c7565b94505050505f8211156108f357806108998484615583565b6108a391906155c7565b95506108f37f0000000000000000000000004527bced9d41706d1436507e9a6e354d3ff44ff973ffffffffffffffffffffffffffffffffffffffff8a16156108eb57896108ed565b335b8861358b565b6040517f9dc29fac000000000000000000000000000000000000000000000000000000008152336004820152602481018890527f00000000000000000000000037416992335d09875ce4cb186e3a04dcee9c685873ffffffffffffffffffffffffffffffffffffffff1690639dc29fac906044015f604051808303815f87803b15801561097e575f80fd5b505af1158015610990573d5f803e3d5ffd5b5050505061099f858585613611565b6109d5576040517fdc4eb20d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080518881526020810188905273ffffffffffffffffffffffffffffffffffffffff8a169133917f2d470f4c23bc9e78b2eb9c3bc4bb61323c5f2b180b22adbb6bf535e73437531c910160405180910390a3610a53856dffffffffffffffffffffffffffff16856dffffffffffffffffffffffffffff168561336e565b5050505050610a6160015f55565b92915050565b60078181548110610a76575f80fd5b5f9182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b5f610aa5612cce565b5f805f610ab0612d0f565b9250925092505f610ae6836dffffffffffffffffffffffffffff16856dffffffffffffffffffffffffffff166107919190615583565b90505f82610af48389615583565b610afe91906155c7565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529091505f9073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000004527bced9d41706d1436507e9a6e354d3ff44ff916906370a0823190602401602060405180830381865afa158015610b8b573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610baf919061553f565b90505f7f00000000000000000000000037416992335d09875ce4cb186e3a04dcee9c685873ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c1b573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c3f919061553f565b9050805f03610cff57610c54612710846155ed565b6040517f40c10f190000000000000000000000000000000000000000000000000000000081526001600482015261271060248201529098507f00000000000000000000000037416992335d09875ce4cb186e3a04dcee9c685873ffffffffffffffffffffffffffffffffffffffff16906340c10f19906044015f604051808303815f87803b158015610ce4575f80fd5b505af1158015610cf6573d5f803e3d5ffd5b50505050610dc2565b5f85610d0b8685615583565b610d1591906155c7565b90508285610d238884615583565b610d2d91906155c7565b1015610d4157610d3e6001826155da565b90505b5f670de0b6b3a7640000600354600254610d5b9190615583565b610d6591906155c7565b9050600254600354670de0b6b3a764000083610d819190615583565b610d8b91906155c7565b1015610d9f57610d9c6001826155da565b90505b610da981836155da565b610db38487615583565b610dbd91906155c7565b995050505b875f03610dfb576040517ff479132400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610e277f0000000000000000000000004527bced9d41706d1436507e9a6e354d3ff44ff933308c613664565b73ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000037416992335d09875ce4cb186e3a04dcee9c68588116906340c10f19908c1615610e73578b610e75565b335b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16815273ffffffffffffffffffffffffffffffffffffffff9091166004820152602481018b90526044015f604051808303815f87803b158015610edf575f80fd5b505af1158015610ef1573d5f803e3d5ffd5b5050604080518c8152602081018c905273ffffffffffffffffffffffffffffffffffffffff8e1693503392507f4c41ea64d4e221fdad8918619af6f689a3fadc4c1f6553beea17454adf50f2e9910160405180910390a3610f73876dffffffffffffffffffffffffffff16876dffffffffffffffffffffffffffff168761336e565b50505050505050610a6160015f55565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000019928170d739139bfbbb6614007f8eeed17db0ba1614610ff2576040517f32cc723600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60015460405173ffffffffffffffffffffffffffffffffffffffff8084169216907f136f71f09725b684153996e63177d5c01891dd37e26af2cbe9b642a0556344b3905f90a3600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6103e8611096670de0b6b3a76400006103d4615583565b6110a091906155c7565b81565b6110c460405180606001604052805f81526020015f81526020015f81525090565b60408051610160810182525f8082526020820181905291810182905260608082018390526080820183905260a0820183905260c0820183905260e08201839052610100820183905261012082019290925261014081019190915261112883826122b6565b9392505050565b6060600780548060200260200160405190810160405280929190818152602001828054801561119257602002820191905f5260205f20905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311611167575b5050505050905090565b5f806111a6612cce565b5f805f6111b1612d0f565b9250925092506111c183836136b0565b73ffffffffffffffffffffffffffffffffffffffff86165f90815260066020908152604080832081516060810183528154815260018201549381019390935260020154908201529061121282613902565b90506103e861122b670de0b6b3a76400006103d4615583565b61123591906155c7565b8110156112a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f5573657220736f6c76656e74000000000000000000000000000000000000000060448201526064015b60405180910390fd5b5f806112ae83613945565b9050856dffffffffffffffffffffffffffff16876dffffffffffffffffffffffffffff1685602001516112e19190615583565b6112eb91906155c7565b845111156117dc575f611327855f015186602001518a6dffffffffffffffffffffffffffff168a6dffffffffffffffffffffffffffff16612c3e565b90505f6706e9405c8a250000831161135a57611344836002615583565b61135590660e35fa931a00006155da565b611364565b670de0b6b3a76400005b90505f670de0b6b3a764000061137a8385615583565b61138491906155c7565b905067016345785d8a0000821080156113b757506113a461015e8b615600565b6dffffffffffffffffffffffffffff1681115b156113fa576113c861015e8b615600565b6dffffffffffffffffffffffffffff169050826113ed670de0b6b3a764000083615583565b6113f791906155c7565b91505b80156116b9575f6114b98b6dffffffffffffffffffffffffffff168b6dffffffffffffffffffffffffffff16847f0000000000000000000000004527bced9d41706d1436507e9a6e354d3ff44ff973ffffffffffffffffffffffffffffffffffffffff1663ddca3f436040518163ffffffff1660e01b8152600401602060405180830381865afa158015611490573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114b4919061553f565b613acf565b90506114c761015e8c615600565b6dffffffffffffffffffffffffffff16820361151557611512858960200151836114f191906155da565b611503670de0b6b3a764000085615583565b61150d91906155c7565b613b3b565b94505b80156116b7576115667f000000000000000000000000fc000000000000000000000000000000000000017f0000000000000000000000004527bced9d41706d1436507e9a6e354d3ff44ff98461358b565b6040517f022c0d9f0000000000000000000000000000000000000000000000000000000081525f60048201819052602482018390523060448301526080606483015260848201527f0000000000000000000000004527bced9d41706d1436507e9a6e354d3ff44ff973ffffffffffffffffffffffffffffffffffffffff169063022c0d9f9060a4015f604051808303815f87803b158015611605575f80fd5b505af1158015611617573d5f803e3d5ffd5b5050505081885f0181815161162c919061562c565b905250602088018051829190611643908390615652565b905250611650828c615679565b9a5061165c818b6156a0565b995073ffffffffffffffffffffffffffffffffffffffff8e167f7e7baab210a5f4518cd09f1ad03965b00cda827470dc1e2afe18cc8d630c862e61169f846156c7565b60408051918252602082018590520160405180910390a25b505b6103e86116d0670de0b6b3a76400006103de615583565b6116da91906155c7565b8610801561172357506019611707670de0b6b3a76400006dffffffffffffffffffffffffffff8c16615583565b61171191906155c7565b8488602001516117219190615583565b115b15611767576020870151611738906019615583565b61175a670de0b6b3a76400006dffffffffffffffffffffffffffff8c16615583565b61176491906155c7565b93505b5f670de0b6b3a76400008589602001516117819190615583565b61178b91906155c7565b90506117d18a6dffffffffffffffffffffffffffff168c6dffffffffffffffffffffffffffff16836117bd9190615583565b6117c791906155c7565b6107919083615583565b955050505050611c5c565b5f6118108560200151865f0151896dffffffffffffffffffffffffffff168b6dffffffffffffffffffffffffffff16612c3e565b90505f6706e9405c8a25000083116118435761182d836002615583565b61183e90660e35fa931a00006155da565b61184d565b670de0b6b3a76400005b90505f670de0b6b3a76400006118638385615583565b61186d91906155c7565b905067016345785d8a0000821080156118a0575061188d61015e8a615600565b6dffffffffffffffffffffffffffff1681115b156118e3576118b161015e8a615600565b6dffffffffffffffffffffffffffff169050826118d6670de0b6b3a764000083615583565b6118e091906155c7565b91505b8015611b58575f6119798a6dffffffffffffffffffffffffffff168c6dffffffffffffffffffffffffffff16847f0000000000000000000000004527bced9d41706d1436507e9a6e354d3ff44ff973ffffffffffffffffffffffffffffffffffffffff1663ddca3f436040518163ffffffff1660e01b8152600401602060405180830381865afa158015611490573d5f803e3d5ffd5b905061198761015e8b615600565b6dffffffffffffffffffffffffffff1682036119b25787516119af9086906114f190846155da565b94505b8015611b5657611a037f000000000000000000000000fc000000000000000000000000000000000000067f0000000000000000000000004527bced9d41706d1436507e9a6e354d3ff44ff98461358b565b6040517f022c0d9f000000000000000000000000000000000000000000000000000000008152600481018290525f602482018190523060448301526080606483015260848201527f0000000000000000000000004527bced9d41706d1436507e9a6e354d3ff44ff973ffffffffffffffffffffffffffffffffffffffff169063022c0d9f9060a4015f604051808303815f87803b158015611aa2575f80fd5b505af1158015611ab4573d5f803e3d5ffd5b5050505080885f01818151611ac99190615652565b905250602088018051839190611ae090839061562c565b905250611aed818c6156a0565b9a50611af9828b615679565b995073ffffffffffffffffffffffffffffffffffffffff8e167f7e7baab210a5f4518cd09f1ad03965b00cda827470dc1e2afe18cc8d630c862e82611b3d856156c7565b6040805192835260208301919091520160405180910390a25b505b6103e8611b6f670de0b6b3a76400006103de615583565b611b7991906155c7565b86108015611bbf57506019611ba6670de0b6b3a76400006dffffffffffffffffffffffffffff8d16615583565b611bb091906155c7565b8751611bbd908690615583565b115b15611c00578651611bd1906019615583565b611bf3670de0b6b3a76400006dffffffffffffffffffffffffffff8d16615583565b611bfd91906155c7565b93505b5f670de0b6b3a764000085895f0151611c199190615583565b611c2391906155c7565b9050611c558b6dffffffffffffffffffffffffffff168b6dffffffffffffffffffffffffffff16836117bd9190615583565b9550505050505b6003545f90611c73670de0b6b3a764000085615583565b611c7d91906155c7565b90505f811315612181575f6103e8611c9f670de0b6b3a76400006103de615583565b611ca991906155c7565b8511611d41576103e8611cc6670de0b6b3a76400006103d4615583565b611cd091906155c7565b6103e8611ce7670de0b6b3a76400006103de615583565b611cf191906155c7565b611cfb91906155ed565b6103e8611d12670de0b6b3a76400006103d4615583565b611d1c91906155c7565b611d2690876155ed565b611d3290612710615583565b611d3c91906155c7565b611d45565b6127105b9050620f4240611d55828261562c565b611d5f90846156fd565b611d699190615748565b91508560400151821315611d7f57856040015191505b611d87612d0f565b919a50985096505f80611da588611d9d866156c7565b8d8d8d613b50565b92509250505f821280611db757505f81125b15611f7b57611e0f7f000000000000000000000000fc000000000000000000000000000000000000017f0000000000000000000000004527bced9d41706d1436507e9a6e354d3ff44ff9611e0a856156c7565b61358b565b611e5d7f000000000000000000000000fc000000000000000000000000000000000000067f0000000000000000000000004527bced9d41706d1436507e9a6e354d3ff44ff9611e0a846156c7565b6040517f6a6278420000000000000000000000000000000000000000000000000000000081523060048201527f0000000000000000000000004527bced9d41706d1436507e9a6e354d3ff44ff973ffffffffffffffffffffffffffffffffffffffff1690636a627842906024016020604051808303815f875af1158015611ee6573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611f0a919061553f565b5073ffffffffffffffffffffffffffffffffffffffff8e167fe99400bc86af5e7ed0dd704b625174a599b02a65b3030e676997821d0e4b9d0a85611f4d856156c7565b611f56856156c7565b604080519384526020840192909252908201525f606082015260800160405180910390a25b611f8883620f424061562c565b83611f92846156c7565b611f9c91906156fd565b611fa69190615748565b9c50611fb583620f424061562c565b83611fbf836156c7565b611fc991906156fd565b611fd39190615748565b8851909c508d1380611fe8575087602001518c135b15611ffa5787516020890151909d509b505b8c885f0181815161200b919061562c565b9052506020880180518d919061202290839061562c565b9052508751158061203557506020880151155b80612061575084670de0b6b3a76400001480156120615750670de0b6b3a764000061205f89613902565b115b156120b7578751612072908e6155da565b9c5087602001518c61208491906155da565b5f808a5260208a0181905260408a015160028054939f5090929091906120ab90849061562c565b90915550505f60408901525b6120e27f000000000000000000000000fc00000000000000000000000000000000000001338f61358b565b61210d7f000000000000000000000000fc00000000000000000000000000000000000006338e61358b565b3373ffffffffffffffffffffffffffffffffffffffff168e73ffffffffffffffffffffffffffffffffffffffff167f1c689b2b3b50bd5f6ff6e302f71840c102467517a5761af9541b8a10100f55758f8f604051612175929190918252602082015260400190565b60405180910390a35050505b845160208087015160408089015181519485529284019190915282015273ffffffffffffffffffffffffffffffffffffffff8c16907f5ea2a109c7dcd1207cb06b83a55f64561e075aff76a3aa612c46c32f43ea39119060600160405180910390a261220e886dffffffffffffffffffffffffffff16886dffffffffffffffffffffffffffff168861336e565b61221785613d9d565b61224d576040517fd03a632000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050505073ffffffffffffffffffffffffffffffffffffffff87165f90815260066020908152604091829020835181559083015160018201559101516002909101555061229c91506135179050565b915091565b6064611096670de0b6b3a7640000605f615583565b6122d760405180606001604052805f81526020015f81526020015f81525090565b6122df612cce565b50335f81815260066020908152604080832081516060810183528154815260018201548185015260029091015481830152938352600890915290205460ff166123b457335f81815260086020526040812080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660019081179091556007805491820181559091527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6880180547fffffffffffffffffffffffff00000000000000000000000000000000000000001690911790555b5f805f6123bf612d0f565b9250925092508560c001511561241f5760408601511561240b576040517f3d000cfe00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8360400151612419906156c7565b60408701525b5f8660400151131561243c5761243c848760400151858585613dfc565b85515f128061244e57505f8660200151135b1561245d5761245d8487614029565b60208501511561248157612471848661422c565b612479612d0f565b919450925090505b5f805f886040015112156124b0576124aa8689604001518787878d608001518e60a00151614662565b90925090505b8760c00151156124e45785516124c5906156c7565b885260208601516124d5906156c7565b60208901526124e48689614029565b811561269f576125357f000000000000000000000000fc000000000000000000000000000000000000017f0000000000000000000000004527bced9d41706d1436507e9a6e354d3ff44ff98461358b565b6125807f000000000000000000000000fc000000000000000000000000000000000000067f0000000000000000000000004527bced9d41706d1436507e9a6e354d3ff44ff98361358b565b6040517f6a6278420000000000000000000000000000000000000000000000000000000081523060048201527f0000000000000000000000004527bced9d41706d1436507e9a6e354d3ff44ff973ffffffffffffffffffffffffffffffffffffffff1690636a627842906024016020604051808303815f875af1158015612609573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061262d919061553f565b503373ffffffffffffffffffffffffffffffffffffffff167fe99400bc86af5e7ed0dd704b625174a599b02a65b3030e676997821d0e4b9d0a8960400151612674906156c7565b60c08b0151604080519283526020830187905282018590521515606082015260800160405180910390a25b87515f1315612780573073ffffffffffffffffffffffffffffffffffffffff16886060015173ffffffffffffffffffffffffffffffffffffffff1603612711576040517fd1fe293500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612780867f000000000000000000000000fc000000000000000000000000000000000000015f73ffffffffffffffffffffffffffffffffffffffff168b6060015173ffffffffffffffffffffffffffffffffffffffff1614612777578a60600151612779565b335b8b516146e1565b5f88602001511215612867573073ffffffffffffffffffffffffffffffffffffffff16886060015173ffffffffffffffffffffffffffffffffffffffff16036127f5576040517fd1fe293500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612867867f000000000000000000000000fc000000000000000000000000000000000000065f73ffffffffffffffffffffffffffffffffffffffff168b6060015173ffffffffffffffffffffffffffffffffffffffff161461285b578a6060015161285d565b335b8b602001516146e1565b87516020808a01516040808c015181519485529284019190915282015233907f62e2b047cc6a058bcacea33b9e79a615e51938feacf68d4611284b2d1950f8b79060600160405180910390a285516020808801516040808a015181519485529284019190915282015233907f5ea2a109c7dcd1207cb06b83a55f64561e075aff76a3aa612c46c32f43ea39119060600160405180910390a261292a856dffffffffffffffffffffffffffff16856dffffffffffffffffffffffffffff168561336e565b335f90815260066020908152604091829020885181559088015160018201559087015160029091015561297d866103e861296e670de0b6b3a76400006103d4615583565b61297891906155c7565b61479f565b6129b3576040517fe081c8f300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f88604001511315610a53576129ca858585613611565b610a53576040517fdc4eb20d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000019928170d739139bfbbb6614007f8eeed17db0ba1614612a6f576040517f32cc723600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60095460408051918252602082018390527f1cc7aa4534d42ef1b20c6c6f517e9e34995c5b6656aaa8471f0226594e0b250c910160405180910390a1600955565b6103e8611096670de0b6b3a76400006103de615583565b612ae860405180606001604052805f81526020015f81526020015f81525090565b5073ffffffffffffffffffffffffffffffffffffffff165f90815260066020908152604091829020825160608101845281548152600182015492810192909252600201549181019190915290565b5f806064612b4d670de0b6b3a7640000605f615583565b612b5791906155c7565b612b6484620186a0615583565b612b6e91906155c7565b90505f60045442612b7f91906155ed565b6001546005546040517fcd3181d5000000000000000000000000000000000000000000000000000000008152600481018490526024810186905267ffffffffffffffff909116604482015291925073ffffffffffffffffffffffffffffffffffffffff169063cd3181d5906064016040805180830381865afa158015612c07573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612c2b91906157c6565b5067ffffffffffffffff16949350505050565b5f80612c61612c4d87866155da565b612c5787866155da565b6107919190615583565b612c6e6107918686615583565b612c789190615583565b90505f612c858585615583565b612c8f8787615583565b612c9991906155da565b905080821115612cc457612cad86856155da565b612cb782846155ed565b612cc191906155c7565b92505b5050949350505050565b60025f5403612d09576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60025f55565b5f805f7f0000000000000000000000004527bced9d41706d1436507e9a6e354d3ff44ff973ffffffffffffffffffffffffffffffffffffffff1663fff6cae96040518163ffffffff1660e01b81526004015f604051808303815f87803b158015612d77575f80fd5b505af1158015612d89573d5f803e3d5ffd5b505050507f0000000000000000000000004527bced9d41706d1436507e9a6e354d3ff44ff973ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa158015612df6573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612e1a9190615814565b5080935081945050507f0000000000000000000000004527bced9d41706d1436507e9a6e354d3ff44ff973ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612e8c573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612eb0919061553f565b9050612edd836dffffffffffffffffffffffffffff16836dffffffffffffffffffffffffffff16836147ce565b612ee790826155da565b90505f60045442612ef891906155ed565b90505f612f06600254614992565b6003549091505f612f2d6107916dffffffffffffffffffffffffffff808916908a16615583565b90508315613365578215613360576040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201525f907f0000000000000000000000004527bced9d41706d1436507e9a6e354d3ff44ff973ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa158015612fc5573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612fe9919061553f565b90505f86612ff78484615583565b61300191906155c7565b9050818361300f8984615583565b61301991906155c7565b101561302d5761302a6001826155da565b90505b5f670de0b6b3a76400006130418688615583565b61304b91906155c7565b905085600354670de0b6b3a7640000836130659190615583565b61306f91906155c7565b1015613083576130806001826155da565b90505b5f61308e82846155da565b6130a0670de0b6b3a764000084615583565b6130aa91906155c7565b90505f6130b789836149d4565b90505f670de0b6b3a76400008a6130ce848b615583565b6130d89190615583565b6130e291906155c7565b90506130ee81896155da565b97505f7f00000000000000000000000019928170d739139bfbbb6614007f8eeed17db0ba73ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b8152600401602060405180830381865afa15801561315a573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061317e9190615860565b905073ffffffffffffffffffffffffffffffffffffffff811615613353575f6131b1670de0b6b3a7640000612710615583565b6103e86131be8d86615583565b6131c89190615583565b6131d291906155c7565b90505f81670de0b6b3a76400006131e98d8f615583565b6131f391906155c7565b6131fd908a6155da565b61320791906155ed565b7f00000000000000000000000037416992335d09875ce4cb186e3a04dcee9c685873ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613270573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613294919061553f565b61329e9084615583565b6132a891906155c7565b6040517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8581166004830152602482018390529192507f00000000000000000000000037416992335d09875ce4cb186e3a04dcee9c6858909116906340c10f19906044015f604051808303815f87803b15801561333a575f80fd5b505af115801561334c573d5f803e3d5ffd5b5050505050505b5050506003869055505050505b426004555b50505050909192565b6003546040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201525f907f0000000000000000000000004527bced9d41706d1436507e9a6e354d3ff44ff973ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa1580156133fb573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061341f919061553f565b90505f61342f6107918688615583565b90505f841561345257846134438385615583565b61344d91906155c7565b613454565b5f5b90505f670de0b6b3a76400008560025461346e9190615583565b61347891906155c7565b90505f8061348683856155da565b11156134b55761349682846155da565b6134a8670de0b6b3a764000084615583565b6134b291906155c7565b90505b5f6134c05f836149d4565b6040805185815260208101879052908101899052606081018290529091507f6e3bc82928d75c1549a4f19dbe02b242d66c49aa833b28fe0d135c6f79c5839b9060800160405180910390a150505050505050505050565b60015f55565b5f600382111561357c5750805f6135356002836155c7565b6135409060016155da565b90505b818110156135765790508060028161355b81866155c7565b61356591906155da565b61356f91906155c7565b9050613543565b50919050565b8115613586575060015b919050565b60405173ffffffffffffffffffffffffffffffffffffffff83811660248301526044820183905261360c91859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050614ad0565b505050565b5f80600254121561362357505f611128565b6064613638670de0b6b3a7640000605f615583565b61364291906155c7565b61364d858585614b64565b111561365a57505f611128565b5060019392505050565b60405173ffffffffffffffffffffffffffffffffffffffff84811660248301528381166044830152606482018390526136aa9186918216906323b872dd906084016135c5565b50505050565b6040517f8f4bb32a00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000004527bced9d41706d1436507e9a6e354d3ff44ff9811660048301526107086024830152600b604483015261271060648301525f9182917f0000000000000000000000003b1d8484b7036f62fed9d5eae15b186bd7c3e8b41690638f4bb32a906084016040805180830381865afa158015613774573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613798919061587b565b90925090506137c4827c03b58e88c75313ec9d329eaaa18fb92f75215b171000000000000000006155c7565b91505f836dffffffffffffffffffffffffffff16856dffffffffffffffffffffffffffff166e01ed09bead87c0378d8e64000000006138039190615583565b61380d91906155c7565b90505f8382116138265761382182856155ed565b613830565b61383084836155ed565b6009549091508461384383612710615583565b61384d91906155c7565b1115613885576040517f62f7964700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b82821161389b5761389682846155ed565b6138a5565b6138a583836155ed565b600954909150836138b883612710615583565b6138c291906155c7565b11156138fa576040517f62f7964700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505050505050565b5f81604001515f0361391557505f919050565b6020820151825161392991610791916156fd565b600354836040015161393b9190615583565b610a6191906155c7565b5f8060026103e8613960670de0b6b3a76400006103d4615583565b61396a91906155c7565b6103e8613981670de0b6b3a76400006103de615583565b61398b91906155c7565b61399591906155da565b61399f91906155c7565b90506103e86139b8670de0b6b3a76400006103de615583565b6139c291906155c7565b8311156139d957670de0b6b3a76400009150613576565b80831115613a4c57806103e86139f9670de0b6b3a76400006103de615583565b613a0391906155c7565b613a0d91906155ed565b613a1782856155ed565b613a2990670b1a2bc2ec500000615583565b613a3391906155c7565b613a45906702c68af0bb1400006155da565b9150613576565b6103e8613a63670de0b6b3a76400006103d4615583565b613a6d91906155c7565b613a7790826155ed565b6103e8613a8e670de0b6b3a76400006103d4615583565b613a9891906155c7565b613aa290856155ed565b613ab4906702bf6ff371870000615583565b613abe91906155c7565b6111289066071afd498d00006155da565b5f8083118015613ade57505f85115b8015613ae957505f84115b613af1575f80fd5b5f613afc8385615583565b90505f613b098683615583565b90505f82613b1989612710615583565b613b2391906155da565b9050613b2f81836155c7565b98975050505050505050565b5f818310613b495781611128565b5090919050565b5f805f80613b5f600354614cce565b90505f670de0b6b3a7640000613b75838b6156fd565b613b7f9190615748565b90505f613ba26107916dffffffffffffffffffffffffffff808b16908c16615583565b90505f8a1215613bde578983613bc084670de0b6b3a76400006156fd565b613bca9190615748565b1315613bde57613bdb60018361562c565b91505b80613be888614cce565b613bf290846156fd565b613bfc9190615748565b95505f8a1215613c385781613c1088614cce565b613c1a83896156fd565b613c249190615748565b1315613c3857613c3560018761562c565b95505b613c4187614cce565b613c5b876dffffffffffffffffffffffffffff8c166156fd565b613c659190615748565b9450613c7087614cce565b613c8a876dffffffffffffffffffffffffffff8b166156fd565b613c949190615748565b93505f8a1215613d345785613cb88a6dffffffffffffffffffffffffffff16614cce565b613cc189614cce565b613ccb90886156fd565b613cd59190615748565b1315613ce957613ce660018661562c565b94505b85613d03896dffffffffffffffffffffffffffff16614cce565b613d0c89614cce565b613d1690876156fd565b613d209190615748565b1315613d3457613d3160018561562c565b93505b898b604001818151613d469190615652565b9052508a5185908c90613d5a908390615652565b90525060208b018051859190613d71908390615652565b905250600280548b91905f90613d88908490615652565b92505081905550505050955095509592505050565b5f8082604001511280613db0575081515f135b80613dbe57505f8260200151125b15613dca57505f919050565b5f8260400151138015613de8575081511580613de857506020820151155b15613df457505f919050565b506001919050565b600254158015613e9657507f00000000000000000000000037416992335d09875ce4cb186e3a04dcee9c685873ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613e70573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613e94919061553f565b155b15613ecd576040517f2438e3d200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f805f613edd8888888888613b50565b925092509250613f2e7f0000000000000000000000004527bced9d41706d1436507e9a6e354d3ff44ff97f0000000000000000000000004527bced9d41706d1436507e9a6e354d3ff44ff98561358b565b6040517f89afcb440000000000000000000000000000000000000000000000000000000081523060048201527f0000000000000000000000004527bced9d41706d1436507e9a6e354d3ff44ff973ffffffffffffffffffffffffffffffffffffffff16906389afcb449060240160408051808303815f875af1158015613fb6573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613fda919061587b565b5050604080518881526020810184905290810182905233907f2fa7424edccb6fcf23a1453182641d32ca74f7bb2319235cc13e0ebdc673faae9060600160405180910390a25050505050505050565b61010081015160ff161580159061404d575080515f128061404d57505f8160200151135b156141b4575f80825f015113614083577f000000000000000000000000fc000000000000000000000000000000000000066140a5565b7f000000000000000000000000fc000000000000000000000000000000000000015b90505f8260e001516140ca5782515f126140c35782602001516140ec565b82516140ec565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff5b6101608401516101008501516101208601516101408701516040517fd505accf00000000000000000000000000000000000000000000000000000000815233600482015230602482015260448101869052606481019490945260ff909216608484015260a483015260c482015290915073ffffffffffffffffffffffffffffffffffffffff83169063d505accf9060e4015f604051808303815f87803b158015614194575f80fd5b505af11580156141a6573d5f803e3d5ffd5b50505f610100860152505050505b80515f12156141ec576141ec827f000000000000000000000000fc0000000000000000000000000000000000000130845f01516146e1565b5f8160200151131561422857614228827f000000000000000000000000fc000000000000000000000000000000000000063084602001516146e1565b5050565b7f000000000000000000000000fc0000000000000000000000000000000000000173ffffffffffffffffffffffffffffffffffffffff16815f015173ffffffffffffffffffffffffffffffffffffffff161480156142d957507f000000000000000000000000fc0000000000000000000000000000000000000673ffffffffffffffffffffffffffffffffffffffff16816040015173ffffffffffffffffffffffffffffffffffffffff16145b15801561439057507f000000000000000000000000fc0000000000000000000000000000000000000673ffffffffffffffffffffffffffffffffffffffff16815f015173ffffffffffffffffffffffffffffffffffffffff1614801561438e57507f000000000000000000000000fc0000000000000000000000000000000000000173ffffffffffffffffffffffffffffffffffffffff16816040015173ffffffffffffffffffffffffffffffffffffffff16145b155b156143c7576040517f428cce0e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6143f9815f01517f000000000000000000000000b244fd19cf3ad348ac3784c3ca48cdb2a1e50e7c8360200151614d2c565b30608082015260608101515f0361443c576040517f3aaebeba00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517fd2c904110000000000000000000000000000000000000000000000000000000081525f9073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000b244fd19cf3ad348ac3784c3ca48cdb2a1e50e7c169063d2c90411906144b0908590600401615908565b6020604051808303815f875af11580156144cc573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906144f0919061553f565b90507f000000000000000000000000fc0000000000000000000000000000000000000173ffffffffffffffffffffffffffffffffffffffff16825f015173ffffffffffffffffffffffffffffffffffffffff16036145e5576145558260200151614cce565b8351849061456490839061562c565b90525061457081614cce565b836020018181516145819190615652565b905250602082015133907f7e7baab210a5f4518cd09f1ad03965b00cda827470dc1e2afe18cc8d630c862e906145b690614cce565b6145bf906156c7565b6145c884614cce565b6040805192835260208301919091520160405180910390a2505050565b6145f28260200151614cce565b83602001818151614603919061562c565b90525061460f81614cce565b8351849061461e908390615652565b905250337f7e7baab210a5f4518cd09f1ad03965b00cda827470dc1e2afe18cc8d630c862e61464c83614cce565b6146598560200151614cce565b6145c8906156c7565b5f805f806146738b8b8b8b8b613b50565b925092505081614682906156c7565b935061468d816156c7565b92508584108061469c57508483105b156146d3576040517f5945ea5600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505097509795505050505050565b7f000000000000000000000000fc0000000000000000000000000000000000000173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361474d5780845f018181516147459190615652565b905250614763565b808460200181815161475f9190615652565b9052505b3073ffffffffffffffffffffffffffffffffffffffff8316036147915761478c83333084613664565b6136aa565b6136aa8383611e0a846156c7565b5f6147a983613d9d565b80156111285750604083015115806111285750816147c684613902565b109392505050565b5f8073ffffffffffffffffffffffffffffffffffffffff167f000000000000000000000000e30521fe7f3beb6ad556887b50739d6c7ca667e673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b8152600401602060405180830381865afa15801561484f573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906148739190615860565b73ffffffffffffffffffffffffffffffffffffffff1614611128575f7f0000000000000000000000004527bced9d41706d1436507e9a6e354d3ff44ff973ffffffffffffffffffffffffffffffffffffffff16637464fc3d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156148f8573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061491c919061553f565b9050801561498a575f6149326107918688615583565b90505f61493e8361351d565b905080821115614987575f61495382846155ed565b61495d9087615583565b90505f8261496c856005615583565b61497691906155da565b905061498281836155c7565b955050505b50505b509392505050565b5f808212156149d0576040517fa8ce44320000000000000000000000000000000000000000000000000000000081526004810183905260240161129a565b5090565b5f8060646149eb670de0b6b3a7640000605f615583565b6149f591906155c7565b614a0284620186a0615583565b614a0c91906155c7565b6001546005546040517fcd3181d5000000000000000000000000000000000000000000000000000000008152600481018890526024810184905267ffffffffffffffff909116604482015291925073ffffffffffffffffffffffffffffffffffffffff169063cd3181d5906064016040805180830381865afa158015614a94573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190614ab891906157c6565b67ffffffffffffffff90811660055516949350505050565b5f614af173ffffffffffffffffffffffffffffffffffffffff841683614dd9565b905080515f14158015614b15575080806020019051810190614b139190615a04565b155b1561360c576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416600482015260240161129a565b5f80614b71600254614992565b9050805f03614b83575f915050611128565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201525f907f0000000000000000000000004527bced9d41706d1436507e9a6e354d3ff44ff973ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa158015614c0d573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190614c31919061553f565b90505f614c8185614c526dffffffffffffffffffffffffffff891685615583565b614c5c91906155c7565b86614c776dffffffffffffffffffffffffffff8b1686615583565b612c5791906155c7565b90505f670de0b6b3a764000060035485614c9b9190615583565b614ca591906155c7565b90505f614cb282846155da565b614cc4670de0b6b3a764000084615583565b61498291906155c7565b5f7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8211156149d0576040517f24775e060000000000000000000000000000000000000000000000000000000081526004810183905260240161129a565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301525f919085169063dd62ed3e90604401602060405180830381865afa158015614d9f573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190614dc3919061553f565b90506136aa8484614dd485856155da565b614de6565b606061112883835f614ebd565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b300000000000000000000000000000000000000000000000000000000179052614e728482614f7c565b6136aa5760405173ffffffffffffffffffffffffffffffffffffffff84811660248301525f6044830152614eb391869182169063095ea7b3906064016135c5565b6136aa8482614ad0565b606081471015614efb576040517fcd78605900000000000000000000000000000000000000000000000000000000815230600482015260240161129a565b5f808573ffffffffffffffffffffffffffffffffffffffff168486604051614f239190615a1f565b5f6040518083038185875af1925050503d805f8114614f5d576040519150601f19603f3d011682016040523d82523d5f602084013e614f62565b606091505b5091509150614f72868383615037565b9695505050505050565b5f805f8473ffffffffffffffffffffffffffffffffffffffff1684604051614fa49190615a1f565b5f604051808303815f865af19150503d805f8114614fdd576040519150601f19603f3d011682016040523d82523d5f602084013e614fe2565b606091505b509150915081801561500c57508051158061500c57508080602001905181019061500c9190615a04565b801561502e57505f8573ffffffffffffffffffffffffffffffffffffffff163b115b95945050505050565b60608261504c57615047826150c6565b611128565b8151158015615070575073ffffffffffffffffffffffffffffffffffffffff84163b155b156150bf576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516600482015260240161129a565b5080611128565b8051156150d65780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50565b73ffffffffffffffffffffffffffffffffffffffff81168114615108575f80fd5b80356135868161510b565b5f8060408385031215615148575f80fd5b82356151538161510b565b946020939093013593505050565b5f60208284031215615171575f80fd5b81356111288161510b565b5f6020828403121561518c575f80fd5b5035919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b604051610180810167ffffffffffffffff811182821017156151e4576151e4615193565b60405290565b604051610160810167ffffffffffffffff811182821017156151e4576151e4615193565b8015158114615108575f80fd5b80356135868161520e565b803560ff81168114613586575f80fd5b5f6101808284031215615247575f80fd5b61524f6151c0565b90508135815260208201356020820152604082013560408201526152756060830161512c565b60608201526080820135608082015260a082013560a082015261529a60c0830161521b565b60c08201526152ab60e0830161521b565b60e08201526101006152be818401615226565b90820152610120828101359082015261014080830135908201526101609182013591810191909152919050565b5f61018082840312156152fc575f80fd5b6111288383615236565b602080825282518282018190525f9190848201906040850190845b8181101561535357835173ffffffffffffffffffffffffffffffffffffffff1683529284019291840191600101615321565b50909695505050505050565b5f82601f83011261536e575f80fd5b813567ffffffffffffffff8082111561538957615389615193565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019082821181831017156153cf576153cf615193565b816040528381528660208588010111156153e7575f80fd5b836020870160208301375f602085830101528094505050505092915050565b5f806101a08385031215615418575f80fd5b6154228484615236565b915061018083013567ffffffffffffffff8082111561543f575f80fd5b908401906101608287031215615453575f80fd5b61545b6151ea565b6154648361512c565b81526020830135602082015261547c6040840161512c565b6040820152606083013560608201526154976080840161512c565b608082015260a083013560a08201526154b260c0840161521b565b60c08201526154c360e08401615226565b60e08201526101008381013590820152610120808401359082015261014080840135838111156154f1575f80fd5b6154fd8982870161535f565b8284015250508093505050509250929050565b5f805f8060808587031215615523575f80fd5b5050823594602084013594506040840135936060013592509050565b5f6020828403121561554f575f80fd5b5051919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b8082028115828204841417610a6157610a61615556565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f826155d5576155d561559a565b500490565b80820180821115610a6157610a61615556565b81810381811115610a6157610a61615556565b5f6dffffffffffffffffffffffffffff808416806156205761562061559a565b92169190910492915050565b8181035f83128015838313168383128216171561564b5761564b615556565b5092915050565b8082018281125f83128015821682158216171561567157615671615556565b505092915050565b6dffffffffffffffffffffffffffff81811683821601908082111561564b5761564b615556565b6dffffffffffffffffffffffffffff82811682821603908082111561564b5761564b615556565b5f7f800000000000000000000000000000000000000000000000000000000000000082036156f7576156f7615556565b505f0390565b8082025f82127f80000000000000000000000000000000000000000000000000000000000000008414161561573457615734615556565b8181058314821517610a6157610a61615556565b5f826157565761575661559a565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83147f8000000000000000000000000000000000000000000000000000000000000000831416156157aa576157aa615556565b500590565b805167ffffffffffffffff81168114613586575f80fd5b5f80604083850312156157d7575f80fd5b6157e0836157af565b91506157ee602084016157af565b90509250929050565b80516dffffffffffffffffffffffffffff81168114613586575f80fd5b5f805f60608486031215615826575f80fd5b61582f846157f7565b925061583d602085016157f7565b9150604084015163ffffffff81168114615855575f80fd5b809150509250925092565b5f60208284031215615870575f80fd5b81516111288161510b565b5f806040838503121561588c575f80fd5b505080516020909101519092909150565b5f5b838110156158b757818101518382015260200161589f565b50505f910152565b5f81518084526158d681602086016020860161589d565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6020815261592f60208201835173ffffffffffffffffffffffffffffffffffffffff169052565b602082015160408201525f6040830151615961606084018273ffffffffffffffffffffffffffffffffffffffff169052565b5060608301516080830152608083015161599360a084018273ffffffffffffffffffffffffffffffffffffffff169052565b5060a083015160c083015260c08301516159b160e084018215159052565b5060e08301516101006159c88185018360ff169052565b84015161012084810191909152840151610140808501919091528401516101608085015290506159fc6101808401826158bf565b949350505050565b5f60208284031215615a14575f80fd5b81516111288161520e565b5f8251615a3081846020870161589d565b919091019291505056
Deployed Bytecode Sourcemap
6613:47802:28:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;41522:336;;;:::i;:::-;;;;245:25:35;;;301:2;286:18;;279:34;;;;329:18;;;322:34;387:2;372:18;;365:34;232:3;217:19;41522:336:28;;;;;;;;6961:30;;;;;;;;609:42:35;597:55;;;579:74;;567:2;552:18;6961:30:28;410:249:35;7767:24:28;;;;;;;;;808:25:35;;;796:2;781:18;7767:24:28;664:175:35;13742:1573:28;;;;;;:::i;:::-;;:::i;8327:43::-;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2092:25:35;;;2148:2;2133:18;;2126:34;;;;2176:18;;;2169:34;2080:2;2065:18;8327:43:28;1896:313:35;8418:22:28;;;;;;:::i;:::-;;:::i;7414:47::-;;;;;11613:1880;;;;;;:::i;:::-;;:::i;8489:38::-;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;3279:14:35;;3272:22;3254:41;;3242:2;3227:18;8489:38:28;3114:187:35;11056:123:28;11098:14;11167:1;11170;11056:123;;40388:311;;;;;;:::i;:::-;;:::i;:::-;;8957:81;;;:::i;6874:37::-;;;;;7301:55;;;;;15614:237;;;;;;:::i;:::-;;:::i;:::-;;;;6758:13:35;;6740:32;;6828:4;6816:17;;;6810:24;6788:20;;;6781:54;6879:17;;;6873:24;6851:20;;;6844:54;6728:2;6713:18;15614:237:28;6546:358:35;7626:49:28;;;;;;;;;51732:92;;;:::i;:::-;;;;;;;:::i;7932:43::-;;;;;;30435:9158;;;;;;:::i;:::-;;:::i;:::-;;;;8031:25:35;;;8087:2;8072:18;;8065:34;;;;8004:18;30435:9158:28;7857:248:35;9515:65:28;;;:::i;9284:55::-;;9320:19;9284:55;;21125:5453;;;;;;:::i;:::-;;:::i;7123:35::-;;;;;8815:40;;8851:4;8815:40;;8580:34;;;;;;9403:48;;9445:6;9403:48;;7535:32;;;;;40886:217;;;;;;:::i;:::-;;:::i;9132:86::-;;;:::i;8086:61::-;;;;;;7041:30;;;;;7213:45;;;;;51830:91;51902:5;:12;51830:91;;51189:120;;;;;;:::i;:::-;;:::i;8235:34::-;;;;;;42854:355;;;;;;:::i;:::-;;:::i;28750:576::-;;;;;;:::i;:::-;;:::i;41522:336::-;41600:16;41618;41636:19;41657:25;2356:21:12;:19;:21::i;:::-;41734:14:28::1;:12;:14::i;:::-;41778:16;::::0;41698:50:::1;::::0;;::::1;::::0;-1:-1:-1;41698:50:28;;;::::1;::::0;-1:-1:-1;41698:50:28;;-1:-1:-1;41778:16:28;-1:-1:-1;41804:47:28::1;41698:50:::0;;;41804:14:::1;:47::i;:::-;2398:20:12::0;1713:1;2924:7;:21;2744:208;2398:20;41522:336:28;;;;:::o;13742:1573::-;13817:13;2356:21:12;:19;:21::i;:::-;13889:16:28::1;13907::::0;13925:23:::1;13952:14;:12;:14::i;:::-;14115:29;::::0;;;;14138:4:::1;14115:29;::::0;::::1;579:74:35::0;13888:78:28;;-1:-1:-1;13888:78:28;;-1:-1:-1;13888:78:28;-1:-1:-1;14024:20:28::1;::::0;;;;;14115:14:::1;:4;:14;::::0;::::1;::::0;552:18:35;;14115:29:28::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;14097:47:::0;-1:-1:-1;14172:39:28::1;14182:28;;::::0;;::::1;::::0;:17;::::1;:28;:::i;:::-;14172:9;:39::i;:::-;14158:53:::0;-1:-1:-1;14225:19:28::1;14273:15:::0;14248:21:::1;14158:53:::0;14248:7;:21:::1;:::i;:::-;14247:41;;;;:::i;:::-;14225:63;;14302:22;8851:4;14350:16;;14336:10;;14328:38;;;;:::i;:::-;14327:52;;;;:::i;:::-;14302:77;;14452:10;:22;;;:24;;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;14419:28;14433:14:::0;14419:11;:28:::1;:::i;:::-;14409:39;::::0;:6;:39:::1;:::i;:::-;14408:68;;;;:::i;:::-;14393:83;;14083:404;;;14589:1;14574:12;:16;14570:287;;;14649:11:::0;14615:30:::1;14630:15:::0;14615:12;:30:::1;:::i;:::-;14614:46;;;;:::i;:::-;14606:54:::0;-1:-1:-1;14674:172:28::1;14737:4;14766:16;::::0;::::1;::::0;:34:::1;;14798:2;14766:34;;;14785:10;14766:34;14826:5;14674:22;:172::i;:::-;14866:55;::::0;;;;14893:10:::1;14866:55;::::0;::::1;12372:74:35::0;12462:18;;;12455:34;;;14866:10:28::1;:15;;::::0;::::1;::::0;12345:18:35;;14866:55:28::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;15000:97;15032:8;15052;15079:15;15000:19;:97::i;:::-;14995:156;;15120:20;;;;;;;;;;;;;;14995:156;15166:81;::::0;;8031:25:35;;;8087:2;8072:18;;8065:34;;;15166:81:28::1;::::0;::::1;::::0;15189:10:::1;::::0;15166:81:::1;::::0;8004:18:35;15166:81:28::1;;;;;;;15257:51;15272:8;15257:51;;15282:8;15257:51;;15292:15;15257:14;:51::i;:::-;13832:1483;;;;;2398:20:12::0;1713:1;2924:7;:21;2744:208;2398:20;13742:1573:28;;;;:::o;8418:22::-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;8418:22:28;:::o;11613:1880::-;11684:15;2356:21:12;:19;:21::i;:::-;11758:16:28::1;11776::::0;11794:23:::1;11821:14;:12;:14::i;:::-;11757:78;;;;;;11893:19;11915:39;11945:8;11925:28;;11933:8;11925:17;;:28;;;;:::i;11915:39::-;11893:61:::0;-1:-1:-1;11964:18:28::1;12008:15:::0;11986:18:::1;11893:61:::0;11986:4;:18:::1;:::i;:::-;11985:38;;;;:::i;:::-;12051:29;::::0;;;;12074:4:::1;12051:29;::::0;::::1;579:74:35::0;11964:59:28;;-1:-1:-1;12033:15:28::1;::::0;12051:14:::1;:4;:14;::::0;::::1;::::0;552:18:35;;12051:29:28::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;12033:47;;12164:20;12187:10;:22;;;:24;;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;12164:47;;12225:12;12241:1;12225:17:::0;12221:679:::1;;12331:30;9697:3;12331:10:::0;:30:::1;:::i;:::-;12375:46;::::0;;;;12399:1:::1;12375:46;::::0;::::1;12372:74:35::0;9697:3:28::1;12462:18:35::0;;;12455:34;12321:40:28;;-1:-1:-1;12375:10:28::1;:15;;::::0;::::1;::::0;12345:18:35;;12375:46:28::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;12221:679;;;12452:19;12500:15:::0;12475:21:::1;12485:11:::0;12475:7;:21:::1;:::i;:::-;12474:41;;;;:::i;:::-;12452:63:::0;-1:-1:-1;12581:7:28;12567:11;12534:29:::1;12548:15:::0;12452:63;12534:29:::1;:::i;:::-;12533:45;;;;:::i;:::-;:55;12529:77;;;12590:16;12605:1;12590:16:::0;::::1;:::i;:::-;;;12529:77;12620:22;8851:4;12668:16;;12654:10;;12646:38;;;;:::i;:::-;12645:52;;;;:::i;:::-;12620:77;;12773:10;;12746:16;;8851:4;12716:14;:26;;;;:::i;:::-;12715:47;;;;:::i;:::-;:69;12711:94;;;12786:19;12804:1;12786:19:::0;::::1;:::i;:::-;;;12711:94;12860:28;12874:14:::0;12860:11;:28:::1;:::i;:::-;12830:25;12843:12:::0;12830:10;:25:::1;:::i;:::-;12829:60;;;;:::i;:::-;12819:70;;12438:462;;12221:679;12998:7;13009:1;12998:12:::0;12994:46:::1;;13019:21;;;;;;;;;;;;;;12994:46;13126:110;13177:4;13191:10;13215:4;13229;13126:26;:110::i;:::-;13246:15;:10;:15:::0;::::1;::::0;::::1;::::0;13275:16;::::1;::::0;13274:36:::1;;13308:2;13274:36;;;13295:10;13274:36;13246:84;::::0;;::::1;::::0;;;;;;12402:42:35;12390:55;;;13246:84:28::1;::::0;::::1;12372:74:35::0;12462:18;;;12455:34;;;12345:18;;13246:84:28::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;-1:-1:-1::0;;13346:79:28::1;::::0;;8031:25:35;;;8087:2;8072:18;;8065:34;;;13346:79:28::1;::::0;::::1;::::0;-1:-1:-1;13367:10:28::1;::::0;-1:-1:-1;13346:79:28::1;::::0;8004:18:35;13346:79:28::1;;;;;;;13435:51;13450:8;13435:51;;13460:8;13435:51;;13470:15;13435:14;:51::i;:::-;11701:1792;;;;;;;2398:20:12::0;1713:1;2924:7;:21;2744:208;40388:311:28;40477:10;:21;40491:7;40477:21;;40473:46;;40507:12;;;;;;;;;;;;;;40473:46;40566:20;;40534:79;;;;;;;40566:20;;40534:79;;40566:20;;40534:79;40623:20;:69;;;;;;;;;;;;;;;40388:311::o;8957:81::-;9034:4;9015:15;8851:4;9015:3;:15;:::i;:::-;9014:24;;;;:::i;:::-;8957:81;:::o;15614:237::-;15676:18;-1:-1:-1;;;;;;;;;;;;;;;;;;;;;;;;15676:18:28;-1:-1:-1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;15779:65:28;15811:6;15831:10;15779:21;:65::i;:::-;15772:72;15614:237;-1:-1:-1;;;15614:237:28:o;51732:92::-;51777:16;51812:5;51805:12;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;51732:92;:::o;30435:9158::-;30504:17;30523;2356:21:12;:19;:21::i;:::-;30599:16:28::1;30617::::0;30635:23:::1;30662:14;:12;:14::i;:::-;30598:78;;;;;;30796:33;30810:8;30820;30796:13;:33::i;:::-;30913:16;::::0;::::1;30892:18;30913:16:::0;;;:10:::1;:16;::::0;;;;;;;30892:37;;::::1;::::0;::::1;::::0;;;;;;::::1;::::0;::::1;::::0;;;::::1;::::0;;;;::::1;;::::0;;;;;;31023:10:::1;30892:37:::0;31023:3:::1;:10::i;:::-;31008:25:::0;-1:-1:-1;9034:4:28::1;9015:15;8851:4;9015:3;:15;:::i;:::-;9014:24;;;;:::i;:::-;31047:4;:37;31043:65;;;31086:22;::::0;::::1;::::0;;12835:2:35;31086:22:28::1;::::0;::::1;12817:21:35::0;12874:2;12854:18;;;12847:30;12913:14;12893:18;;;12886:42;12945:18;;31086:22:28::1;;;;;;;;31043:65;31118:23;31151:24:::0;31178:21:::1;31194:4;31178:15;:21::i;:::-;31151:48;;31274:8;31237:45;;31262:8;31238:32;;31246:5;:12;;;31238:32;;;;:::i;:::-;31237:45;;;;:::i;:::-;31221:12:::0;;31213:69:::1;31209:5023;;;31350:15;31368:172;31404:5;:12;;;31443:5;:12;;;31482:8;31474:17;;31517:8;31509:17;;31368:10;:172::i;:::-;31350:190;;31631:22;31675:8;31656:16;:27;:68;;31704:20;:16:::0;31723:1:::1;31704:20;:::i;:::-;31693:31;::::0;:8:::1;:31;:::i;:::-;31656:68;;;31686:4;31656:68;31631:93:::0;-1:-1:-1;31738:18:28::1;8851:4;31760:24;31631:93:::0;31760:7;:24:::1;:::i;:::-;31759:38;;;;:::i;:::-;31738:59;;31923:6;31906:14;:23;:54;;;;-1:-1:-1::0;31946:14:28::1;31957:3;31946:8:::0;:14:::1;:::i;:::-;31933:27;;:10;:27;31906:54;31902:189;;;31993:14;32004:3;31993:8:::0;:14:::1;:::i;:::-;31980:27;;::::0;-1:-1:-1;32069:7:28;32043:22:::1;8851:4;31980:27:::0;32043:22:::1;:::i;:::-;32042:34;;;;:::i;:::-;32025:51;;31902:189;32108:14:::0;;32104:1025:::1;;32142:17;32162:56;32175:8;32162:56;;32185:8;32162:56;;32195:10;32207:4;:8;;;:10;;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;32162:12;:56::i;:::-;32142:76:::0;-1:-1:-1;32254:14:28::1;32265:3;32254:8:::0;:14:::1;:::i;:::-;32240:28;;:10;:28:::0;32236:322:::1;;32380:159;32414:16;32503:5;:12;;;32483:9;:33;;;;:::i;:::-;32457:21;8851:4;32457:9:::0;:21:::1;:::i;:::-;32456:61;;;;:::i;:::-;32380:8;:159::i;:::-;32361:178;;32236:322;32579:13:::0;;32575:540:::1;;32651:57;32674:6;32690:4;32697:10;32651:22;:57::i;:::-;32730:42;::::0;;;;32740:1:::1;32730:42;::::0;::::1;13466:25:35::0;;;13507:18;;;13500:34;;;32762:4:28::1;13550:18:35::0;;;13543:83;13662:3;13642:18;;;13635:31;13682:19;;;13675:30;32730:4:28::1;:9;;::::0;::::1;::::0;13722:19:35;;32730:42:28::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;32817:10;32794:5;:12;;:34;;;;;;;:::i;:::-;::::0;;-1:-1:-1;32850:12:28::1;::::0;::::1;:33:::0;;32873:9;;32850:12;:33:::1;::::0;32873:9;;32850:33:::1;:::i;:::-;::::0;;-1:-1:-1;32905:31:28::1;32925:10:::0;32905:31;::::1;:::i;:::-;::::0;-1:-1:-1;32958:30:28::1;32978:9:::0;32958:30;::::1;:::i;:::-;::::0;-1:-1:-1;33015:81:28::1;::::0;::::1;;33047:19;33055:10:::0;33047:19:::1;:::i;:::-;33015:81;::::0;;8031:25:35;;;8087:2;8072:18;;8065:34;;;8004:18;33015:81:28::1;;;;;;;32575:540;32124:1005;32104:1025;9214:4;9195:15;8851:4;9195:3;:15;:::i;:::-;9194:24;;;;:::i;:::-;33323:4;:42;:132;;;;-1:-1:-1::0;33453:2:28::1;33429:20;8851:4;33429:20;::::0;::::1;;:::i;:::-;33428:27;;;;:::i;:::-;33409:16;33393:5;:12;;;33385:40;;;;:::i;:::-;:70;33323:132;33302:240;;;33528:12;::::0;::::1;::::0;33515:26:::1;::::0;:2:::1;:26;:::i;:::-;33490:20;8851:4;33490:20;::::0;::::1;;:::i;:::-;33489:53;;;;:::i;:::-;33470:72;;33302:240;33556:25;8851:4;33609:16;33593:5;:12;;;33585:40;;;;:::i;:::-;33584:54;;;;:::i;:::-;33556:82;;33670:74;33734:8;33701:41;;33722:8;33702:28;;:17;:28;;;;:::i;:::-;33701:41;;;;:::i;:::-;33680:63;::::0;:17;:63:::1;:::i;33670:74::-;33652:92;;31284:2471;;;;31209:5023;;;33827:15;33845:172;33881:5;:12;;;33920:5;:12;;;33959:8;33951:17;;33994:8;33986:17;;33845:10;:172::i;:::-;33827:190;;34108:22;34152:8;34133:16;:27;:68;;34181:20;:16:::0;34200:1:::1;34181:20;:::i;:::-;34170:31;::::0;:8:::1;:31;:::i;:::-;34133:68;;;34163:4;34133:68;34108:93:::0;-1:-1:-1;34215:18:28::1;8851:4;34237:24;34108:93:::0;34237:7;:24:::1;:::i;:::-;34236:38;;;;:::i;:::-;34215:59;;34400:6;34383:14;:23;:54;;;;-1:-1:-1::0;34423:14:28::1;34434:3;34423:8:::0;:14:::1;:::i;:::-;34410:27;;:10;:27;34383:54;34379:189;;;34470:14;34481:3;34470:8:::0;:14:::1;:::i;:::-;34457:27;;::::0;-1:-1:-1;34546:7:28;34520:22:::1;8851:4;34457:27:::0;34520:22:::1;:::i;:::-;34519:34;;;;:::i;:::-;34502:51;;34379:189;34585:14:::0;;34581:1025:::1;;34619:17;34639:56;34652:8;34639:56;;34662:8;34639:56;;34672:10;34684:4;:8;;;:10;;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;::::1;;;;34639:56;34619:76:::0;-1:-1:-1;34731:14:28::1;34742:3;34731:8:::0;:14:::1;:::i;:::-;34717:28;;:10;:28:::0;34713:322:::1;;34980:12:::0;;34857:159:::1;::::0;34891:16;;34960:33:::1;::::0;:9;:33:::1;:::i;34857:159::-;34838:178;;34713:322;35056:13:::0;;35052:540:::1;;35128:57;35151:6;35167:4;35174:10;35128:22;:57::i;:::-;35207:42;::::0;;;;::::1;::::0;::::1;13466:25:35::0;;;35228:1:28::1;13507:18:35::0;;;13500:34;;;35239:4:28::1;13550:18:35::0;;;13543:83;13662:3;13642:18;;;13635:31;13682:19;;;13675:30;35207:4:28::1;:9;;::::0;::::1;::::0;13722:19:35;;35207:42:28::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;35294:9;35271:5;:12;;:33;;;;;;;:::i;:::-;::::0;;-1:-1:-1;35326:12:28::1;::::0;::::1;:34:::0;;35349:10;;35326:12;:34:::1;::::0;35349:10;;35326:34:::1;:::i;:::-;::::0;;-1:-1:-1;35382:30:28::1;35402:9:::0;35382:30;::::1;:::i;:::-;::::0;-1:-1:-1;35434:31:28::1;35454:10:::0;35434:31;::::1;:::i;:::-;::::0;-1:-1:-1;35492:81:28::1;::::0;::::1;;35531:9:::0;35551:19:::1;35559:10:::0;35551:19:::1;:::i;:::-;35492:81;::::0;;8031:25:35;;;8087:2;8072:18;;8065:34;;;;8004:18;35492:81:28::1;;;;;;;35052:540;34601:1005;34581:1025;9214:4;9195:15;8851:4;9195:3;:15;:::i;:::-;9194:24;;;;:::i;:::-;35800:4;:42;:132;;;;-1:-1:-1::0;35930:2:28::1;35906:20;8851:4;35906:20;::::0;::::1;;:::i;:::-;35905:27;;;;:::i;:::-;35870:12:::0;;35862:40:::1;::::0;35886:16;;35862:40:::1;:::i;:::-;:70;35800:132;35779:240;;;36005:12:::0;;35992:26:::1;::::0;:2:::1;:26;:::i;:::-;35967:20;8851:4;35967:20;::::0;::::1;;:::i;:::-;35966:53;;;;:::i;:::-;35947:72;;35779:240;36033:25;8851:4;36086:16;36070:5;:12;;;36062:40;;;;:::i;:::-;36061:54;;;;:::i;:::-;36033:82;;36147:74;36211:8;36178:41;;36199:8;36179:28;;:17;:28;;;;:::i;36147:74::-;36129:92;;33761:2471;;;;31209:5023;36305:16;::::0;36241:22:::1;::::0;36274:27:::1;8851:4;36274:15:::0;:27:::1;:::i;:::-;36273:48;;;;:::i;:::-;36241:81;;36355:1;36337:15;:19;36333:2943;;;36372:21;9214:4;9195:15;8851:4;9195:3;:15;:::i;:::-;9194:24;;;;:::i;:::-;36420:4;:42;:259;;9034:4;9015:15;8851:4;9015:3;:15;:::i;:::-;9014:24;;;;:::i;:::-;9214:4;9195:15;8851:4;9195:3;:15;:::i;:::-;9194:24;;;;:::i;:::-;36610:68;;;;:::i;:::-;9034:4;9015:15;8851:4;9015:3;:15;:::i;:::-;9014:24;;;;:::i;:::-;36543:37;::::0;:4;:37:::1;:::i;:::-;36524:57;::::0;9445:6:::1;36524:57;:::i;:::-;36523:156;;;;:::i;:::-;36420:259;;;9445:6;36420:259;36372:321:::0;-1:-1:-1;36776:9:28::1;36745:26;36372:321:::0;36776:9;36745:26:::1;:::i;:::-;36726:46;::::0;:15;:46:::1;:::i;:::-;36725:60;;;;:::i;:::-;36707:78;;36821:5;:12;;;36803:15;:30;36799:66;;;36853:5;:12;;;36835:30;;36799:66;36920:14;:12;:14::i;:::-;36880:54:::0;;-1:-1:-1;36880:54:28;-1:-1:-1;36880:54:28;-1:-1:-1;36951:19:28::1;::::0;36995:166:::1;37023:5:::0;37046:16:::1;37047:15:::0;37046:16:::1;:::i;:::-;37080:8;37106;37132:15;36995:10;:166::i;:::-;36948:213;;;;;37195:1;37180:12;:16;:36;;;;37215:1;37200:12;:16;37180:36;37176:647;;;37273:91;37305:6;37325:4;37347:13;37348:12:::0;37347:13:::1;:::i;:::-;37273:22;:91::i;:::-;37382;37414:6;37434:4;37456:13;37457:12:::0;37456:13:::1;:::i;37382:91::-;37491:24;::::0;;;;37509:4:::1;37491:24;::::0;::::1;579:74:35::0;37491:4:28::1;:9;;::::0;::::1;::::0;552:18:35;;37491:24:28::1;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1::0;37539:269:28::1;::::0;::::1;;37610:15:::0;37672:13:::1;37673:12:::0;37672:13:::1;:::i;:::-;37733;37734:12:::0;37733:13:::1;:::i;:::-;37539:269;::::0;;16416:25:35;;;16472:2;16457:18;;16450:34;;;;16500:18;;;16493:34;37784:5:28::1;16558:2:35::0;16543:18;;16536:50;16403:3;16388:19;37539:269:28::1;;;;;;;37176:647;37991:26;38003:14:::0;37991:9:::1;:26;:::i;:::-;37972:14:::0;37956:13:::1;37957:12:::0;37956:13:::1;:::i;:::-;:30;;;;:::i;:::-;37955:63;;;;:::i;:::-;37935:84:::0;-1:-1:-1;38089:26:28::1;38101:14:::0;38089:9:::1;:26;:::i;:::-;38070:14:::0;38054:13:::1;38055:12:::0;38054:13:::1;:::i;:::-;:30;;;;:::i;:::-;38053:63;;;;:::i;:::-;38155:12:::0;;38033:84;;-1:-1:-1;38135:32:28;::::1;::::0;:68:::1;;;38191:5;:12;;;38178:9;38171:32;38135:68;38131:284;;;38336:12:::0;;38387::::1;::::0;::::1;::::0;38336;;-1:-1:-1;38387:12:28;-1:-1:-1;38131:284:28::1;38451:9;38428:5;:12;;:33;;;;;;;:::i;:::-;::::0;;-1:-1:-1;38475:12:28::1;::::0;::::1;:33:::0;;38498:9;;38475:12;:33:::1;::::0;38498:9;;38475:33:::1;:::i;:::-;::::0;;-1:-1:-1;38527:12:28;;:17;;:38:::1;;-1:-1:-1::0;38548:12:28::1;::::0;::::1;::::0;:17;38527:38:::1;:94;;;;38570:16;38590:4;38570:24;:50;;;;;8851:4;38598:10;38602:5;38598:3;:10::i;:::-;:22;38570:50;38523:403;;;38700:12:::0;;38679:34:::1;::::0;;::::1;:::i;:::-;;;38752:5;:12;;;38731:34;;;;;:::i;:::-;38798:1;38783:16:::0;;;38817:12:::1;::::0;::::1;:16:::0;;;38865:12:::1;::::0;::::1;::::0;38851:10:::1;:26:::0;;38731:34;;-1:-1:-1;38865:12:28;;38851:10;;38798:1;38851:26:::1;::::0;38865:12;;38851:26:::1;:::i;:::-;::::0;;;-1:-1:-1;;38910:1:28::1;38895:12;::::0;::::1;:16:::0;38523:403:::1;38994:70;39032:6;39042:10;39054:9;38994:22;:70::i;:::-;39078;39116:6;39126:10;39138:9;39078:22;:70::i;:::-;39208:10;39167:98;;39190:4;39167:98;;;39231:9;39253;39167:98;;;;;;8031:25:35::0;;;8087:2;8072:18;;8065:34;8019:2;8004:18;;7857:248;39167:98:28::1;;;;;;;;36358:2918;;;36333:2943;39325:12:::0;;39347::::1;::::0;;::::1;::::0;39367::::1;::::0;;::::1;::::0;39290:92;;2092:25:35;;;2133:18;;;2126:34;;;;2176:18;;2169:34;39290:92:28::1;::::0;::::1;::::0;::::1;::::0;2080:2:35;2065:18;39290:92:28::1;;;;;;;39392:51;39407:8;39392:51;;39417:8;39392:51;;39427:15;39392:14;:51::i;:::-;39509:20;39523:5;39509:13;:20::i;:::-;39504:48;;39538:14;;;;;;;;;;;;;;39504:48;-1:-1:-1::0;;;;39562:16:28::1;::::0;::::1;;::::0;;;:10:::1;:16;::::0;;;;;;;;:24;;;;;;::::1;::::0;::::1;::::0;::::1;::::0;;::::1;::::0;::::1;::::0;;::::1;::::0;-1:-1:-1;2398:20:12;;-1:-1:-1;2398:18:12;;-1:-1:-1;2398:20:12:i;:::-;30435:9158:28;;;:::o;9515:65::-;9577:3;9559:14;8851:4;9571:2;9559:14;:::i;21125:5453::-;21287:18;-1:-1:-1;;;;;;;;;;;;;;;;;;;;;;;;21287:18:28;2356:21:12;:19;:21::i;:::-;-1:-1:-1;21388:10:28::1;21377:22;::::0;;;:10:::1;:22;::::0;;;;;;;21369:30;;::::1;::::0;::::1;::::0;;;;;;::::1;::::0;::::1;::::0;;;::::1;::::0;::::1;::::0;;::::1;::::0;;;;;21456:18;;;:6:::1;:18:::0;;;;;;::::1;;21451:111;;21497:10;21490:18;::::0;;;:6:::1;:18;::::0;;;;:25;;;::::1;21511:4;21490:25:::0;;::::1;::::0;;;21529:5:::1;:22:::0;;;;::::1;::::0;;;;;;::::1;::::0;;;::::1;::::0;;::::1;::::0;;21451:111:::1;21619:16;21637::::0;21655:23:::1;21682:14;:12;:14::i;:::-;21618:78;;;;;;21763:6;:20;;;21759:134;;;21803:11;::::0;::::1;::::0;:16;21799:42:::1;;21828:13;;;;;;;;;;;;;;21799:42;21870:5;:12;;;21869:13;;;:::i;:::-;21855:11;::::0;::::1;:27:::0;21759:134:::1;22005:1;21991:6;:11;;;:15;21987:261;;;22022:215;22056:5;22086:6;:11;;;22126:8;22163;22207:15;22022:7;:215::i;:::-;22432:19:::0;;22454:1:::1;-1:-1:-1::0;22432:23:28;:50:::1;;;22481:1;22459:6;:19;;;:23;22432:50;22428:109;;;22484:53;22512:5;22528:6;22484:17;:53::i;:::-;22604:19;::::0;::::1;::::0;:24;22600:247:::1;;22671:31;22684:5;22691:10;22671:12;:31::i;:::-;22822:14;:12;:14::i;:::-;22782:54:::0;;-1:-1:-1;22782:54:28;-1:-1:-1;22782:54:28;-1:-1:-1;22600:247:28::1;22994:23;23027::::0;23078:1:::1;23064:6;:11;;;:15;23060:413;;;23132:330;23165:5;23195:6;:11;;;23235:8;23272;23316:15;23367:6;:22;;;23425:6;:22;;;23132:6;:330::i;:::-;23095:367:::0;;-1:-1:-1;23095:367:28;-1:-1:-1;23060:413:28::1;23532:6;:20;;;23528:303;;;23692:12:::0;;23691:13:::1;::::0;::::1;:::i;:::-;23669:35:::0;;23741:12:::1;::::0;::::1;::::0;23740:13:::1;::::0;::::1;:::i;:::-;23718:19;::::0;::::1;:35:::0;23767:53:::1;23795:5:::0;23718:6;23767:17:::1;:53::i;:::-;23990:19:::0;;23986:691:::1;;24090:84;24122:6;24142:4;24156:15;24090:22;:84::i;:::-;24188;24220:6;24240:4;24254:15;24188:22;:84::i;:::-;24373:24;::::0;;;;24391:4:::1;24373:24;::::0;::::1;579:74:35::0;24373:4:28::1;:9;;::::0;::::1;::::0;552:18:35;;24373:24:28::1;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;24452:10;24417:249;;;24487:6;:11;;;24486:12;;;:::i;:::-;24631:20;::::0;::::1;::::0;24417:249:::1;::::0;;16416:25:35;;;16472:2;16457:18;;16450:34;;;16500:18;;16493:34;;;16570:14;16563:22;16558:2;16543:18;;16536:50;16403:3;16388:19;24417:249:28::1;;;;;;;23986:691;24824:19:::0;;24846:1:::1;-1:-1:-1::0;24820:350:28::1;;;24888:4;24867:26;;:6;:9;;;:26;;::::0;24863:61:::1;;24902:22;;;;;;;;;;;;;;24863:61;24938:221;24983:5;25014:6;25065:1;25044:23;;:6;:9;;;:23;;;:48;;25083:6;:9;;;25044:48;;;25070:10;25044:48;25125:19:::0;;24938:18:::1;:221::i;:::-;25339:1;25317:6;:19;;;:23;25313:350;;;25381:4;25360:26;;:6;:9;;;:26;;::::0;25356:61:::1;;25395:22;;;;;;;;;;;;;;25356:61;25431:221;25476:5;25507:6;25558:1;25537:23;;:6;:9;;;:23;;;:48;;25576:6;:9;;;25537:48;;;25563:10;25537:48;25618:6;:19;;;25431:18;:221::i;:::-;25743:19:::0;;25784::::1;::::0;;::::1;::::0;25823:11:::1;::::0;;::::1;::::0;25677:168;;2092:25:35;;;2133:18;;;2126:34;;;;2176:18;;2169:34;25711:10:28::1;::::0;25677:168:::1;::::0;2080:2:35;2065:18;25677:168:28::1;;;;;;;25901:12:::0;;25923::::1;::::0;;::::1;::::0;25943::::1;::::0;;::::1;::::0;25860:98;;2092:25:35;;;2133:18;;;2126:34;;;;2176:18;;2169:34;25881:10:28::1;::::0;25860:98:::1;::::0;2080:2:35;2065:18;25860:98:28::1;;;;;;;25968:51;25983:8;25968:51;;25993:8;25968:51;;26003:15;25968:14;:51::i;:::-;26136:10;26125:22;::::0;;;:10:::1;:22;::::0;;;;;;;;:30;;;;;;::::1;::::0;::::1;::::0;::::1;::::0;;;::::1;::::0;::::1;::::0;;::::1;::::0;26218:47:::1;26150:5:::0;9034:4:::1;9015:15;8851:4;9015:3;:15;:::i;:::-;9014:24;;;;:::i;:::-;26218:8;:47::i;:::-;26213:98;;26288:12;;;;;;;;;;;;;;26213:98;26381:1;26367:6;:11;;;:15;26363:209;;;26403:97;26435:8;26455;26482:15;26403:19;:97::i;:::-;26398:164;;26527:20;;;;;;;;;;;;;;40886:217:::0;40960:10;:21;40974:7;40960:21;;40956:46;;40990:12;;;;;;;;;;;;;;40956:46;41034:13;;41017:43;;;8031:25:35;;;8087:2;8072:18;;8065:34;;;41017:43:28;;8004:18:35;41017:43:28;;;;;;;41070:13;:26;40886:217::o;9132:86::-;9214:4;9195:15;8851:4;9195:3;:15;:::i;51189:120::-;51248:18;-1:-1:-1;;;;;;;;;;;;;;;;;;;;;;;;51248:18:28;-1:-1:-1;51286:16:28;;;;;;:10;:16;;;;;;;;;51278:24;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;51189:120::o;42854:355::-;42926:21;;9577:3;9559:14;8851:4;9571:2;9559:14;:::i;:::-;9558:22;;;;:::i;:::-;42981:18;:12;42996:3;42981:18;:::i;:::-;42980:39;;;;:::i;:::-;42959:60;;43029:14;43064:28;;43046:15;:46;;;;:::i;:::-;43122:20;;43181:19;;43122:80;;;;;;;;16797:25:35;;;16838:18;;;16831:34;;;16913:18;16901:31;;;16881:18;;;16874:59;43029:63:28;;-1:-1:-1;43122:20:28;;;:31;;16770:18:35;;43122:80:28;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;43102:100:28;;;42854:355;-1:-1:-1;;;;42854:355:28:o;28750:576::-;28903:15;;29112:58;29149:19;29161:7;29149:9;:19;:::i;:::-;29123:21;29136:8;29123:10;:21;:::i;:::-;29122:47;;;;:::i;29112:58::-;29076:33;29086:22;29099:9;29086:10;:22;:::i;29076:33::-;:94;;;;:::i;:::-;29061:109;-1:-1:-1;29180:13:28;29219:22;29232:9;29219:10;:22;:::i;:::-;29196:20;29208:8;29196:9;:20;:::i;:::-;:45;;;;:::i;:::-;29180:61;;29262:5;29255:4;:12;29251:68;;;29297:21;29310:8;29297:10;:21;:::i;:::-;29280:12;29287:5;29280:4;:12;:::i;:::-;29279:40;;;;:::i;:::-;29269:50;;29251:68;28920:406;;28750:576;;;;;;:::o;2431:307:12:-;1755:1;2558:7;;:18;2554:86;;2599:30;;;;;;;;;;;;;;2554:86;1755:1;2714:7;:17;2431:307::o;47558:2872:28:-;47600:16;47618;47636:23;47746:4;:9;;;:11;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;47850:4;:16;;;:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;47825:43;;;;;;;;;47896:4;:16;;;:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;47878:36;;47943:69;47976:8;47943:69;;47986:8;47943:69;;47996:15;47943:32;:69::i;:::-;47924:88;;;;:::i;:::-;;;48087:14;48122:28;;48104:15;:46;;;;:::i;:::-;48087:63;;48160:24;48187:22;:10;;:20;:22::i;:::-;48254:16;;48160:49;;-1:-1:-1;48226:25:28;48309:39;48319:28;;;;;;:17;;:28;:::i;48309:39::-;48287:61;-1:-1:-1;48362:10:28;;48358:2066;;48447:20;;48443:1855;;48553:29;;;;;48576:4;48553:29;;;579:74:35;48535:15:28;;48553:4;:14;;;;;552:18:35;;48553:29:28;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;48535:47;-1:-1:-1;48600:19:28;48648:15;48623:21;48633:11;48535:47;48623:21;:::i;:::-;48622:41;;;;:::i;:::-;48600:63;-1:-1:-1;48733:7:28;48719:11;48686:29;48700:15;48600:63;48686:29;:::i;:::-;48685:45;;;;:::i;:::-;:55;48681:77;;;48742:16;48757:1;48742:16;;:::i;:::-;;;48681:77;48776:22;8851:4;48802:36;48821:17;48802:16;:36;:::i;:::-;48801:50;;;;:::i;:::-;48776:75;;48923:16;48904;;8851:4;48874:14;:26;;;;:::i;:::-;48873:47;;;;:::i;:::-;:66;48869:91;;;48941:19;48959:1;48941:19;;:::i;:::-;;;48869:91;48978:19;49041:28;49055:14;49041:11;:28;:::i;:::-;49001:35;8851:4;49009:14;49001:35;:::i;:::-;49000:70;;;;:::i;:::-;48978:92;;49089:20;49112:45;49137:6;49145:11;49112:24;:45::i;:::-;49089:68;-1:-1:-1;49175:23:28;8851:4;49237:6;49202:32;49089:68;49202:17;:32;:::i;:::-;:41;;;;:::i;:::-;49201:55;;;;:::i;:::-;49175:81;-1:-1:-1;49438:36:28;49175:81;49438:36;;:::i;:::-;;;49603:13;49632:7;49619:27;;;:29;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;49603:45;-1:-1:-1;49674:19:28;;;;49670:492;;49783:18;49856;8851:4;49856:6;:18;:::i;:::-;9320:19;49805:34;49823:16;49805:15;:34;:::i;:::-;:46;;;;:::i;:::-;49804:71;;;;:::i;:::-;49783:92;-1:-1:-1;49901:21:28;49783:92;8851:4;50012:36;50031:17;50012:16;:36;:::i;:::-;50011:50;;;;:::i;:::-;49996:66;;:11;:66;:::i;:::-;:79;;;;:::i;:::-;49939:10;:22;;;:24;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;49926:37;;:10;:37;:::i;:::-;49925:151;;;;:::i;:::-;50102:37;;;;;:15;12390:55:35;;;50102:37:28;;;12372:74:35;12462:18;;;12455:34;;;49901:175:28;;-1:-1:-1;50102:10:28;:15;;;;;;12345:18:35;;50102:37:28;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;49695:467;;49670:492;-1:-1:-1;;;50247:16:28;:36;;;-1:-1:-1;;;;48443:1855:28;50398:15;50367:28;:46;48358:2066;47661:2769;;;;47558:2872;;;:::o;27518:938::-;27650:16;;27694:29;;;;;27717:4;27694:29;;;579:74:35;27622:25:28;;27694:4;:14;;;;;552:18:35;;27694:29:28;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;27676:47;-1:-1:-1;27733:19:28;27755:39;27765:28;27785:8;27773;27765:28;:::i;27755:39::-;27733:61;-1:-1:-1;27804:19:28;27826:20;;:70;;27880:15;27855:21;27865:11;27855:7;:21;:::i;:::-;27854:41;;;;:::i;:::-;27826:70;;;27849:1;27826:70;27804:92;;27906:22;8851:4;27954:17;27940:10;;27932:39;;;;:::i;:::-;27931:53;;;;:::i;:::-;27906:78;-1:-1:-1;27994:19:28;;28027:28;27906:78;28027:11;:28;:::i;:::-;:32;28023:147;;;28130:28;28144:14;28130:11;:28;:::i;:::-;28090:35;8851:4;28098:14;28090:35;:::i;:::-;28089:70;;;;:::i;:::-;28075:84;;28023:147;28179:20;28202:40;28227:1;28230:11;28202:24;:40::i;:::-;28257:192;;;245:25:35;;;301:2;286:18;;279:34;;;329:18;;;322:34;;;387:2;372:18;;365:34;;;28179:63:28;;-1:-1:-1;28257:192:28;;232:3:35;217:19;28257:192:28;;;;;;;27612:844;;;;;;;27518:938;;;:::o;2744:208:12:-;1713:1;2924:7;:21;2744:208::o;347:301:26:-;395:9;424:1;420;:5;416:226;;;-1:-1:-1;445:1:26;460:9;472:5;476:1;445;472:5;:::i;:::-;:9;;480:1;472:9;:::i;:::-;460:21;;495:89;506:1;502;:5;495:89;;;531:1;-1:-1:-1;531:1:26;568;531;555:5;531:1;555;:5;:::i;:::-;:9;;;;:::i;:::-;554:15;;;;:::i;:::-;550:19;;495:89;;;427:167;347:301;;;:::o;416:226::-;604:6;;600:42;;-1:-1:-1;630:1:26;600:42;347:301;;;:::o;1303:160:8:-;1412:43;;1427:14;12390:55:35;;;1412:43:8;;;12372:74:35;12462:18;;;12455:34;;;1385:71:8;;1405:5;;1427:14;;;;;12345:18:35;;1412:43:8;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1385:19;:71::i;:::-;1303:160;;;:::o;52887:445:28:-;53030:4;53063:1;53050:10;;:14;53046:57;;;-1:-1:-1;53087:5:28;53080:12;;53046:57;9577:3;9559:14;8851:4;9571:2;9559:14;:::i;:::-;9558:22;;;;:::i;:::-;53129:97;53161:8;53181;53208:15;53129:19;:97::i;:::-;:128;53112:193;;;-1:-1:-1;53289:5:28;53282:12;;53112:193;-1:-1:-1;53321:4:28;52887:445;;;;;:::o;1702:188:8:-;1829:53;;1844:18;18603:15:35;;;1829:53:8;;;18585:34:35;18655:15;;;18635:18;;;18628:43;18687:18;;;18680:34;;;1802:81:8;;1822:5;;1844:18;;;;;18497::35;;1829:53:8;18322:398:35;1802:81:8;1702:188;;;;:::o;53536:877:28:-;53698:145;;;;;:23;53742:4;19028:55:35;;53698:145:28;;;19010:74:35;53768:7:28;19100:18:35;;;19093:34;53797:2:28;19143:18:35;;;19136:34;53826:6:28;19186:18:35;;;19179:34;-1:-1:-1;;;;53698:14:28;:23;;;;18982:19:35;;53698:145:28;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;53661:182;;-1:-1:-1;53661:182:28;-1:-1:-1;53863:14:28;53661:182;53863:4;:14;:::i;:::-;53853:24;;53887:17;53936:8;53907:37;;53916:8;53908:17;;53928:4;53908:24;;;;:::i;:::-;53907:37;;;;:::i;:::-;53887:57;;54026:12;54054:7;54042:9;:19;:63;;54086:19;54096:9;54086:7;:19;:::i;:::-;54042:63;;;54064:19;54076:7;54064:9;:19;:::i;:::-;54148:13;;54026:80;;-1:-1:-1;54138:7:28;54121:13;54026:80;54128:6;54121:13;:::i;:::-;54120:25;;;;:::i;:::-;:41;54116:100;;;54184:21;;;;;;;;;;;;;;54116:100;54245:7;54233:9;:19;:63;;54277:19;54287:9;54277:7;:19;:::i;:::-;54233:63;;;54255:19;54267:7;54255:9;:19;:::i;:::-;54339:13;;54225:72;;-1:-1:-1;54329:7:28;54312:13;54225:72;54319:6;54312:13;:::i;:::-;54311:25;;;;:::i;:::-;:41;54307:100;;;54375:21;;;;;;;;;;;;;;54307:100;53609:804;;;;53536:877;;:::o;50907:222::-;50963:7;50986:5;:12;;;51002:1;50986:17;50982:31;;-1:-1:-1;51012:1:28;;50907:222;-1:-1:-1;50907:222:28:o;50982:31::-;51108:12;;;;51093;;51075:47;;51093:27;;;:::i;51075:47::-;51055:16;;51039:5;:12;;;51031:40;;;;:::i;:::-;51030:92;;;;:::i;29479:649::-;29541:24;;29665:1;9034:4;9015:15;8851:4;9015:3;:15;:::i;:::-;9014:24;;;;:::i;:::-;9214:4;9195:15;8851:4;9195:3;:15;:::i;:::-;9194:24;;;;:::i;:::-;29593:68;;;;:::i;:::-;29592:74;;;;:::i;:::-;29577:89;-1:-1:-1;9214:4:28;9195:15;8851:4;9195:3;:15;:::i;:::-;9194:24;;;;:::i;:::-;29680:4;:42;29676:446;;;29757:4;29738:23;;29676:446;;;29789:4;29782;:11;29778:344;;;29903:4;9214;9195:15;8851:4;9195:3;:15;:::i;:::-;9194:24;;;;:::i;:::-;29865:42;;;;:::i;:::-;29848:11;29855:4;29848;:11;:::i;:::-;29838:22;;:6;:22;:::i;:::-;29837:71;;;;:::i;:::-;29828:80;;:6;:80;:::i;:::-;29809:99;;29778:344;;;9034:4;9015:15;8851:4;9015:3;:15;:::i;:::-;9014:24;;;;:::i;:::-;30073:37;;:4;:37;:::i;:::-;9034:4;9015:15;8851:4;9015:3;:15;:::i;:::-;9014:24;;;;:::i;:::-;30014:37;;:4;:37;:::i;:::-;30002:50;;:8;:50;:::i;:::-;30001:110;;;;:::i;:::-;29974:137;;:8;:137;:::i;39599:506::-;39752:7;39790:1;39779:8;:12;:29;;;;;39807:1;39795:9;:13;39779:29;:47;;;;;39825:1;39812:10;:14;39779:47;39771:56;;;;;;39890:23;39916:14;39927:3;39916:8;:14;:::i;:::-;39890:40;-1:-1:-1;39940:17:28;39960:28;39978:10;39890:40;39960:28;:::i;:::-;39940:48;-1:-1:-1;39998:19:28;40043:15;40021:18;:9;40033:6;40021:18;:::i;:::-;40020:38;;;;:::i;:::-;39998:60;-1:-1:-1;40075:23:28;39998:60;40075:9;:23;:::i;:::-;40068:30;39599:506;-1:-1:-1;;;;;;;;39599:506:28:o;129:103:26:-;187:9;216:1;212;:5;:13;;224:1;212:13;;;-1:-1:-1;220:1:26;;208:17;-1:-1:-1;129:103:26:o;17062:1750:28:-;17245:20;17267:19;17288;17377:28;17408:27;:16;;:25;:27::i;:::-;17377:58;-1:-1:-1;17452:23:28;17512:4;17479:29;17377:58;17479:5;:29;:::i;:::-;17478:38;;;;:::i;:::-;17452:64;-1:-1:-1;17526:19:28;17555:41;17565:30;;;;;;:18;;:30;:::i;17555:41::-;17526:71;;17619:1;17611:5;:9;17607:126;;;17694:5;17669:21;17642:23;:16;17661:4;17642:23;:::i;:::-;17641:49;;;;:::i;:::-;17640:59;17636:86;;;17701:21;17721:1;17701:21;;:::i;:::-;;;17636:86;17809:12;17778:27;:16;:25;:27::i;:::-;17759:46;;:16;:46;:::i;:::-;17758:63;;;;:::i;:::-;17742:79;;17843:1;17835:5;:9;17831:177;;;17929:16;17898:27;:16;:25;:27::i;:::-;17866:28;17882:12;17866:13;:28;:::i;:::-;17865:60;;;;:::i;:::-;17864:81;17860:138;;;17965:18;17982:1;17965:18;;:::i;:::-;;;17860:138;18079:27;:16;:25;:27::i;:::-;18033:42;18062:13;18040:18;;;18033:42;:::i;:::-;18032:74;;;;:::i;:::-;18017:89;;18178:27;:16;:25;:27::i;:::-;18132:42;18161:13;18139:18;;;18132:42;:::i;:::-;18131:74;;;;:::i;:::-;18116:89;;18228:1;18220:5;:9;18216:334;;;18321:13;18297:20;:9;:18;;;:20::i;:::-;18266:27;:16;:25;:27::i;:::-;18251:42;;:12;:42;:::i;:::-;18250:67;;;;:::i;:::-;18249:85;18245:141;;;18354:17;18370:1;18354:17;;:::i;:::-;;;18245:141;18475:13;18451:20;:9;:18;;;:20::i;:::-;18420:27;:16;:25;:27::i;:::-;18405:42;;:12;:42;:::i;:::-;18404:67;;;;:::i;:::-;18403:85;18399:141;;;18508:17;18524:1;18508:17;;:::i;:::-;;;18399:141;18647:5;18630:6;:13;;:22;;;;;;;:::i;:::-;;;-1:-1:-1;18662:29:28;;18679:12;;18662:6;;:29;;18679:12;;18662:29;:::i;:::-;;;-1:-1:-1;18701:13:28;;;:29;;18718:12;;18701:13;:29;;18718:12;;18701:29;:::i;:::-;;;-1:-1:-1;18786:10:28;:19;;18800:5;;18786:10;;;:19;;18800:5;;18786:19;:::i;:::-;;;;;;;;17309:1503;;;17062:1750;;;;;;;;;:::o;50436:465::-;50502:4;50537:1;50522:5;:12;;;:16;:36;;;-1:-1:-1;50542:12:28;;50557:1;-1:-1:-1;50522:36:28;:56;;;;50577:1;50562:5;:12;;;:16;50522:56;50518:356;;;-1:-1:-1;50664:5:28;;50436:465;-1:-1:-1;50436:465:28:o;50518:356::-;50705:1;50690:5;:12;;;:16;:60;;;;-1:-1:-1;50711:12:28;;:17;;:38;;-1:-1:-1;50732:12:28;;;;:17;50711:38;50686:188;;;-1:-1:-1;50858:5:28;;50436:465;-1:-1:-1;50436:465:28:o;50686:188::-;-1:-1:-1;50890:4:28;;50436:465;-1:-1:-1;50436:465:28:o;18849:1053::-;19034:10;;:15;:48;;;;;19053:10;:22;;;:24;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:29;19034:48;19030:81;;;19091:20;;;;;;;;;;;;;;19030:81;19122:20;19144:19;19165;19188:192;19221:6;19248:5;19278:9;19312;19353:16;19188:10;:192::i;:::-;19121:259;;;;;;19641:106;19688:4;19708;19730:13;19641:22;:106::i;:::-;19757:24;;;;;19775:4;19757:24;;;579:74:35;19757:4:28;:9;;;;;552:18:35;;19757:24:28;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;;19797:98:28;;;2092:25:35;;;2148:2;2133:18;;2126:34;;;2176:18;;;2169:34;;;19813:10:28;;19797:98;;2080:2:35;2065:18;19797:98:28;;;;;;;19020:882;;;18849:1053;;;;;:::o;43648:1528::-;43772:9;;;;:14;;;;;;:72;;-1:-1:-1;43791:20:28;;43814:1;-1:-1:-1;43791:24:28;:52;;;43842:1;43819:7;:20;;;:24;43791:52;43768:830;;;43909:12;43947:1;43924:7;:20;;;:24;:42;;43960:6;43924:42;;;43951:6;43924:42;43909:57;;44010:14;44027:7;:18;;;:152;;44108:20;;44131:1;-1:-1:-1;44108:70:28;;44158:7;:20;;;44027:152;;44108:70;44135:20;;44027:152;;;44064:17;44027:152;44363:16;;;;44400:9;;;;44430;;;;44460;;;;44193:291;;;;;44254:10;44193:291;;;19926:34:35;44299:4:28;19976:18:35;;;19969:43;20028:18;;;20021:34;;;20071:18;;;20064:34;;;;20147:4;20135:17;;;20114:19;;;20107:46;20169:19;;;20162:35;20213:19;;;20206:35;44010:169:28;;-1:-1:-1;44193:35:28;;;;;;19837:19:35;;44193:291:28;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;44586:1:28;44574:9;;;:13;-1:-1:-1;;;;43768:830:28;44647:20;;44670:1;-1:-1:-1;44643:241:28;;;44687:186;44732:6;44764;44801:4;44838:7;:20;;;44687:18;:186::i;:::-;44956:1;44933:7;:20;;;:24;44929:241;;;44973:186;45018:6;45050;45087:4;45124:7;:20;;;44973:18;:186::i;:::-;43648:1528;;:::o;45428:1935::-;45664:6;45634:37;;:10;:18;;;:37;;;:79;;;;;45706:6;45675:38;;:10;:19;;;:38;;;45634:79;45632:82;:180;;;;;45762:6;45732:37;;:10;:18;;;:37;;;:79;;;;;45804:6;45773:38;;:10;:19;;;:38;;;45732:79;45730:82;45632:180;45615:261;;;45844:21;;;;;;;;;;;;;;45615:261;45935:176;45995:10;:18;;;46045:14;46081:10;:19;;;45935:31;:176::i;:::-;46198:4;46167:20;;;:36;46276:27;;;;46307:1;46276:32;46272:72;;46317:27;;;;;;;;;;;;;;46272:72;46631:31;;;;;46611:17;;46631:19;:14;:19;;;;:31;;46651:10;;46631:31;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;46611:51;;46706:6;46676:37;;:10;:18;;;:37;;;46672:685;;46745:30;:10;:19;;;:28;:30::i;:::-;46729:46;;:5;;:46;;;;;:::i;:::-;;;-1:-1:-1;46805:20:28;:9;:18;:20::i;:::-;46789:5;:12;;:36;;;;;;;:::i;:::-;;;-1:-1:-1;46922:19:28;;;;46878:10;;46844:178;;46922:30;;:28;:30::i;:::-;46914:39;;;:::i;:::-;46986:20;:9;:18;:20::i;:::-;46844:178;;;8031:25:35;;;8087:2;8072:18;;8065:34;;;;8004:18;46844:178:28;;;;;;;1303:160:8;;;:::o;46672:685:28:-;47069:30;:10;:19;;;:28;:30::i;:::-;47053:5;:12;;:46;;;;;;;:::i;:::-;;;-1:-1:-1;47129:20:28;:9;:18;:20::i;:::-;47113:36;;:5;;:36;;;;;:::i;:::-;;;-1:-1:-1;47202:10:28;47168:178;47245:20;:9;:18;:20::i;:::-;47300:30;:10;:19;;;:28;:30::i;:::-;47292:39;;;:::i;19938:961::-;20185:23;20210;20248:19;20269;20292:192;20325:6;20352:5;20382:9;20416;20457:16;20292:10;:192::i;:::-;20245:239;;;;;20651:12;20650:13;;;:::i;:::-;20624:40;-1:-1:-1;20700:13:28;20701:12;20700:13;:::i;:::-;20674:40;;20782:16;20764:15;:34;20763:76;;;;20822:16;20804:15;:34;20763:76;20759:134;;;20862:20;;;;;;;;;;;;;;20759:134;20235:664;;19938:961;;;;;;;;;;:::o;26584:928::-;26823:6;26813:16;;:6;:16;;;26809:235;;26862:12;26845:6;:13;;:29;;;;;;;:::i;:::-;;;-1:-1:-1;26809:235:28;;;27021:12;27004:6;:13;;:29;;;;;;;:::i;:::-;;;-1:-1:-1;26809:235:28;27073:4;27058:20;;;;27054:452;;27117:203;27169:6;27199:10;27239:4;27292:12;27117:26;:203::i;:::-;27054:452;;;27414:81;27446:6;27458:3;27478:13;27479:12;27478:13;:::i;51531:195::-;51619:4;51642:20;51656:5;51642:13;:20::i;:::-;:77;;;;-1:-1:-1;51667:12:28;;;;:17;;:51;;;51701:17;51688:10;51692:5;51688:3;:10::i;:::-;:30;;51531:195;-1:-1:-1;;;51531:195:28:o;16366:690::-;16518:20;16585:1;16554:33;;:11;:17;;;:19;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:33;;;16550:500;;16603:13;16619:4;:10;;;:12;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;16603:28;-1:-1:-1;16649:10:28;;16645:395;;16679:13;16695:39;16705:28;16725:8;16713;16705:28;:::i;16695:39::-;16679:55;;16752:17;16772:16;16782:5;16772:9;:16::i;:::-;16752:36;;16818:9;16810:5;:17;16806:220;;;16851:11;16880:17;16888:9;16880:5;:17;:::i;:::-;16865:33;;:11;:33;:::i;:::-;16851:47;-1:-1:-1;16920:13:28;16950:9;16937;:5;16945:1;16937:9;:::i;:::-;16936:23;;;;:::i;:::-;16920:39;-1:-1:-1;16996:11:28;16920:39;16996:3;:11;:::i;:::-;16981:26;;16829:197;;16806:220;16661:379;;16645:395;16589:461;16366:690;;;;;:::o;17166:193:20:-;17222:7;17253:1;17245:5;:9;17241:81;;;17277:34;;;;;;;;808:25:35;;;781:18;;17277:34:20;664:175:35;17241:81:20;-1:-1:-1;17346:5:20;17166:193::o;42190:395:28:-;42306:21;;9577:3;9559:14;8851:4;9571:2;9559:14;:::i;:::-;9558:22;;;;:::i;:::-;42361:18;:12;42376:3;42361:18;:::i;:::-;42360:39;;;;:::i;:::-;42448:20;;42548:19;;42448:130;;;;;;;;16797:25:35;;;16838:18;;;16831:34;;;16913:18;16901:31;;;16881:18;;;16874:59;42339:60:28;;-1:-1:-1;42448:20:28;;;:31;;16770:18:35;;42448:130:28;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;42409:169;;;;42425:19;42409:169;;;42190:395;-1:-1:-1;;;;42190:395:28:o;4059:629:8:-;4478:23;4504:33;:27;;;4532:4;4504:27;:33::i;:::-;4478:59;;4551:10;:17;4572:1;4551:22;;:57;;;;;4589:10;4578:30;;;;;;;;;;;;:::i;:::-;4577:31;4551:57;4547:135;;;4631:40;;;;;609:42:35;597:55;;4631:40:8;;;579:74:35;552:18;;4631:40:8;410:249:35;52100:705:28;52243:7;52262:24;52289:22;:10;;:20;:22::i;:::-;52262:49;;52332:16;52352:1;52332:21;52328:60;;52376:1;52369:8;;;;;52328:60;52416:29;;;;;52439:4;52416:29;;;579:74:35;52398:15:28;;52416:4;:14;;;;;552:18:35;;52416:29:28;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;52398:47;-1:-1:-1;52455:19:28;52477:116;52567:15;52545:18;;;;52398:47;52545:18;:::i;:::-;52544:38;;;;:::i;:::-;52524:15;52502:18;;;;:7;:18;:::i;:::-;52501:38;;;;:::i;52477:116::-;52455:138;;52603:22;8851:4;52648:16;;52629;:35;;;;:::i;:::-;52628:49;;;;:::i;:::-;52603:74;-1:-1:-1;52687:19:28;52741:28;52603:74;52741:11;:28;:::i;:::-;52710:26;8851:4;52710:14;:26;:::i;:::-;52709:61;;;;:::i;34375:314:20:-;34431:6;34568:16;34552:5;:33;34548:105;;;34608:34;;;;;;;;808:25:35;;;781:18;;34608:34:20;664:175:35;2081:225:8;2200:39;;;;;2224:4;2200:39;;;22648:34:35;2200:15:8;22718::35;;;22698:18;;;22691:43;2177:20:8;;2200:15;;;;;;22560:18:35;;2200:39:8;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;2177:62;-1:-1:-1;2249:50:8;2262:5;2269:7;2278:20;2293:5;2177:62;2278:20;:::i;:::-;2249:12;:50::i;2705:151:9:-;2780:12;2811:38;2833:6;2841:4;2847:1;2811:21;:38::i;3296:380:8:-;3411:47;;;3426:13;12390:55:35;;3411:47:8;;;12372:74:35;12462:18;;;;12455:34;;;3411:47:8;;;;;;;;;;12345:18:35;;;;3411:47:8;;;;;;;;;;;;;;3474:44;3426:13;3411:47;3474:23;:44::i;:::-;3469:201;;3561:43;;3576:13;12390:55:35;;;3561:43:8;;;12372:74:35;3601:1:8;12462:18:35;;;12455:34;3534:71:8;;3554:5;;3576:13;;;;;12345:18:35;;3561:43:8;12198:297:35;3534:71:8;3619:40;3639:5;3646:12;3619:19;:40::i;3180:392:9:-;3279:12;3331:5;3307:21;:29;3303:108;;;3359:41;;;;;3394:4;3359:41;;;579:74:35;552:18;;3359:41:9;410:249:35;3303:108:9;3421:12;3435:23;3462:6;:11;;3481:5;3488:4;3462:31;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3420:73;;;;3510:55;3537:6;3545:7;3554:10;3510:26;:55::i;:::-;3503:62;3180:392;-1:-1:-1;;;;;;3180:392:9:o;5189:578:8:-;5272:4;5574:12;5588:23;5623:5;5615:19;;5635:4;5615:25;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5573:67;;;;5657:7;:69;;;;-1:-1:-1;5669:17:8;;:22;;:56;;;5706:10;5695:30;;;;;;;;;;;;:::i;:::-;5657:103;;;;;5759:1;5738:5;5730:26;;;:30;5657:103;5650:110;5189:578;-1:-1:-1;;;;;5189:578:8:o;4625:582:9:-;4769:12;4798:7;4793:408;;4821:19;4829:10;4821:7;:19::i;:::-;4793:408;;;5045:17;;:22;:49;;;;-1:-1:-1;5071:18:9;;;;:23;5045:49;5041:119;;;5121:24;;;;;609:42:35;597:55;;5121:24:9;;;579:74:35;552:18;;5121:24:9;410:249:35;5041:119:9;-1:-1:-1;5180:10:9;5173:17;;5743:516;5874:17;;:21;5870:383;;6102:10;6096:17;6158:15;6145:10;6141:2;6137:19;6130:44;5870:383;6225:17;;;;;;;;;;;;;;5870:383;5743:516;:::o;844:154:35:-;930:42;923:5;919:54;912:5;909:65;899:93;;988:1;985;978:12;1003:134;1071:20;;1100:31;1071:20;1100:31;:::i;1142:315::-;1210:6;1218;1271:2;1259:9;1250:7;1246:23;1242:32;1239:52;;;1287:1;1284;1277:12;1239:52;1326:9;1313:23;1345:31;1370:5;1345:31;:::i;:::-;1395:5;1447:2;1432:18;;;;1419:32;;-1:-1:-1;;;1142:315:35:o;1644:247::-;1703:6;1756:2;1744:9;1735:7;1731:23;1727:32;1724:52;;;1772:1;1769;1762:12;1724:52;1811:9;1798:23;1830:31;1855:5;1830:31;:::i;2214:180::-;2273:6;2326:2;2314:9;2305:7;2301:23;2297:32;2294:52;;;2342:1;2339;2332:12;2294:52;-1:-1:-1;2365:23:35;;2214:180;-1:-1:-1;2214:180:35:o;4143:184::-;4195:77;4192:1;4185:88;4292:4;4289:1;4282:15;4316:4;4313:1;4306:15;4332:255;4404:2;4398:9;4446:6;4434:19;;4483:18;4468:34;;4504:22;;;4465:62;4462:88;;;4530:18;;:::i;:::-;4566:2;4559:22;4332:255;:::o;4592:250::-;4659:2;4653:9;4701:6;4689:19;;4738:18;4723:34;;4759:22;;;4720:62;4717:88;;;4785:18;;:::i;4847:118::-;4933:5;4926:13;4919:21;4912:5;4909:32;4899:60;;4955:1;4952;4945:12;4970:128;5035:20;;5064:28;5035:20;5064:28;:::i;5103:156::-;5169:20;;5229:4;5218:16;;5208:27;;5198:55;;5249:1;5246;5239:12;5264:1045;5317:5;5365:6;5353:9;5348:3;5344:19;5340:32;5337:52;;;5385:1;5382;5375:12;5337:52;5407:22;;:::i;:::-;5398:31;;5465:9;5452:23;5445:5;5438:38;5536:2;5525:9;5521:18;5508:32;5503:2;5496:5;5492:14;5485:56;5601:2;5590:9;5586:18;5573:32;5568:2;5561:5;5557:14;5550:56;5638:38;5672:2;5661:9;5657:18;5638:38;:::i;:::-;5633:2;5626:5;5622:14;5615:62;5738:3;5727:9;5723:19;5710:33;5704:3;5697:5;5693:15;5686:58;5805:3;5794:9;5790:19;5777:33;5771:3;5764:5;5760:15;5753:58;5844:36;5875:3;5864:9;5860:19;5844:36;:::i;:::-;5838:3;5831:5;5827:15;5820:61;5914:36;5945:3;5934:9;5930:19;5914:36;:::i;:::-;5908:3;5901:5;5897:15;5890:61;5970:3;6005:36;6037:2;6026:9;6022:18;6005:36;:::i;:::-;5989:14;;;5982:60;6061:3;6109:18;;;6096:32;6080:14;;;6073:56;6148:3;6196:18;;;6183:32;6167:14;;;6160:56;6235:3;6283:18;;;6270:32;6254:14;;;6247:56;;;;5993:5;5264:1045;-1:-1:-1;5264:1045:35:o;6314:227::-;6398:6;6451:3;6439:9;6430:7;6426:23;6422:33;6419:53;;;6468:1;6465;6458:12;6419:53;6491:44;6527:7;6516:9;6491:44;:::i;7171:681::-;7342:2;7394:21;;;7464:13;;7367:18;;;7486:22;;;7313:4;;7342:2;7565:15;;;;7539:2;7524:18;;;7313:4;7608:218;7622:6;7619:1;7616:13;7608:218;;;7687:13;;7702:42;7683:62;7671:75;;7801:15;;;;7766:12;;;;7644:1;7637:9;7608:218;;;-1:-1:-1;7843:3:35;;7171:681;-1:-1:-1;;;;;;7171:681:35:o;8110:777::-;8152:5;8205:3;8198:4;8190:6;8186:17;8182:27;8172:55;;8223:1;8220;8213:12;8172:55;8259:6;8246:20;8285:18;8322:2;8318;8315:10;8312:36;;;8328:18;;:::i;:::-;8462:2;8456:9;8524:4;8516:13;;8367:66;8512:22;;;8536:2;8508:31;8504:40;8492:53;;;8560:18;;;8580:22;;;8557:46;8554:72;;;8606:18;;:::i;:::-;8646:10;8642:2;8635:22;8681:2;8673:6;8666:18;8727:3;8720:4;8715:2;8707:6;8703:15;8699:26;8696:35;8693:55;;;8744:1;8741;8734:12;8693:55;8808:2;8801:4;8793:6;8789:17;8782:4;8774:6;8770:17;8757:54;8855:1;8848:4;8843:2;8835:6;8831:15;8827:26;8820:37;8875:6;8866:15;;;;;;8110:777;;;;:::o;8892:1407::-;9017:6;9025;9078:3;9066:9;9057:7;9053:23;9049:33;9046:53;;;9095:1;9092;9085:12;9046:53;9118:44;9154:7;9143:9;9118:44;:::i;:::-;9108:54;;9213:3;9202:9;9198:19;9185:33;9237:18;9278:2;9270:6;9267:14;9264:34;;;9294:1;9291;9284:12;9264:34;9317:22;;;;9373:6;9355:16;;;9351:29;9348:49;;;9393:1;9390;9383:12;9348:49;9419:17;;:::i;:::-;9459:22;9478:2;9459:22;:::i;:::-;9452:5;9445:37;9535:2;9531;9527:11;9514:25;9509:2;9502:5;9498:14;9491:49;9572:31;9599:2;9595;9591:11;9572:31;:::i;:::-;9567:2;9560:5;9556:14;9549:55;9657:2;9653;9649:11;9636:25;9631:2;9624:5;9620:14;9613:49;9695:32;9722:3;9718:2;9714:12;9695:32;:::i;:::-;9689:3;9682:5;9678:15;9671:57;9782:3;9778:2;9774:12;9761:26;9755:3;9748:5;9744:15;9737:51;9821:29;9845:3;9841:2;9837:12;9821:29;:::i;:::-;9815:3;9808:5;9804:15;9797:54;9884:30;9909:3;9905:2;9901:12;9884:30;:::i;:::-;9878:3;9867:15;;9860:55;9934:3;9982:11;;;9969:25;9953:14;;;9946:49;10014:3;10062:11;;;10049:25;10033:14;;;10026:49;10094:3;10135:11;;;10122:25;10159:16;;;10156:36;;;10188:1;10185;10178:12;10156:36;10224:44;10260:7;10249:8;10245:2;10241:17;10224:44;:::i;:::-;10219:2;10212:5;10208:14;10201:68;;;10288:5;10278:15;;;;;8892:1407;;;;;:::o;10813:385::-;10899:6;10907;10915;10923;10976:3;10964:9;10955:7;10951:23;10947:33;10944:53;;;10993:1;10990;10983:12;10944:53;-1:-1:-1;;11016:23:35;;;11086:2;11071:18;;11058:32;;-1:-1:-1;11137:2:35;11122:18;;11109:32;;11188:2;11173:18;11160:32;;-1:-1:-1;10813:385:35;-1:-1:-1;10813:385:35:o;11203:184::-;11273:6;11326:2;11314:9;11305:7;11301:23;11297:32;11294:52;;;11342:1;11339;11332:12;11294:52;-1:-1:-1;11365:16:35;;11203:184;-1:-1:-1;11203:184:35:o;11392:::-;11444:77;11441:1;11434:88;11541:4;11538:1;11531:15;11565:4;11562:1;11555:15;11581:168;11654:9;;;11685;;11702:15;;;11696:22;;11682:37;11672:71;;11723:18;;:::i;11754:184::-;11806:77;11803:1;11796:88;11903:4;11900:1;11893:15;11927:4;11924:1;11917:15;11943:120;11983:1;12009;11999:35;;12014:18;;:::i;:::-;-1:-1:-1;12048:9:35;;11943:120::o;12068:125::-;12133:9;;;12154:10;;;12151:36;;;12167:18;;:::i;12500:128::-;12567:9;;;12588:11;;;12585:37;;;12602:18;;:::i;12974:212::-;13014:1;13040:30;13097:2;13094:1;13090:10;13119:3;13109:37;;13126:18;;:::i;:::-;13164:10;;13160:20;;;;;12974:212;-1:-1:-1;;12974:212:35:o;13752:200::-;13818:9;;;13791:4;13846:9;;13874:10;;13886:12;;;13870:29;13909:12;;;13901:21;;13867:56;13864:82;;;13926:18;;:::i;:::-;13864:82;13752:200;;;;:::o;13957:216::-;14021:9;;;14049:11;;;13996:3;14079:9;;14107:10;;14103:19;;14132:10;;14124:19;;14100:44;14097:70;;;14147:18;;:::i;:::-;14097:70;;13957:216;;;;:::o;14178:193::-;14246:30;14296:10;;;14308;;;14292:27;;14331:11;;;14328:37;;;14345:18;;:::i;14376:196::-;14445:30;14508:10;;;14496;;;14492:27;;14531:12;;;14528:38;;;14546:18;;:::i;14577:191::-;14612:3;14643:66;14636:5;14633:77;14630:103;;14713:18;;:::i;:::-;-1:-1:-1;14753:1:35;14749:13;;14577:191::o;15583:292::-;15655:9;;;15622:7;15680:9;;15697:66;15691:73;;15676:89;15673:115;;;15768:18;;:::i;:::-;15841:1;15832:7;15827:16;15824:1;15821:23;15817:1;15810:9;15807:38;15797:72;;15849:18;;:::i;15880:308::-;15919:1;15945;15935:35;;15950:18;;:::i;:::-;16067:66;16064:1;16061:73;15992:66;15989:1;15986:73;15982:153;15979:179;;;16138:18;;:::i;:::-;-1:-1:-1;16172:10:35;;15880:308::o;16944:175::-;17022:13;;17075:18;17064:30;;17054:41;;17044:69;;17109:1;17106;17099:12;17124:289;17201:6;17209;17262:2;17250:9;17241:7;17237:23;17233:32;17230:52;;;17278:1;17275;17268:12;17230:52;17301:39;17330:9;17301:39;:::i;:::-;17291:49;;17359:48;17403:2;17392:9;17388:18;17359:48;:::i;:::-;17349:58;;17124:289;;;;;:::o;17418:188::-;17497:13;;17550:30;17539:42;;17529:53;;17519:81;;17596:1;17593;17586:12;17611:450;17698:6;17706;17714;17767:2;17755:9;17746:7;17742:23;17738:32;17735:52;;;17783:1;17780;17773:12;17735:52;17806:40;17836:9;17806:40;:::i;:::-;17796:50;;17865:49;17910:2;17899:9;17895:18;17865:49;:::i;:::-;17855:59;;17957:2;17946:9;17942:18;17936:25;18001:10;17994:5;17990:22;17983:5;17980:33;17970:61;;18027:1;18024;18017:12;17970:61;18050:5;18040:15;;;17611:450;;;;;:::o;18066:251::-;18136:6;18189:2;18177:9;18168:7;18164:23;18160:32;18157:52;;;18205:1;18202;18195:12;18157:52;18237:9;18231:16;18256:31;18281:5;18256:31;:::i;19224:245::-;19303:6;19311;19364:2;19352:9;19343:7;19339:23;19335:32;19332:52;;;19380:1;19377;19370:12;19332:52;-1:-1:-1;;19403:16:35;;19459:2;19444:18;;;19438:25;19403:16;;19438:25;;-1:-1:-1;19224:245:35:o;20252:250::-;20337:1;20347:113;20361:6;20358:1;20355:13;20347:113;;;20437:11;;;20431:18;20418:11;;;20411:39;20383:2;20376:10;20347:113;;;-1:-1:-1;;20494:1:35;20476:16;;20469:27;20252:250::o;20507:329::-;20548:3;20586:5;20580:12;20613:6;20608:3;20601:19;20629:76;20698:6;20691:4;20686:3;20682:14;20675:4;20668:5;20664:16;20629:76;:::i;:::-;20750:2;20738:15;20755:66;20734:88;20725:98;;;;20825:4;20721:109;;20507:329;-1:-1:-1;;20507:329:35:o;20841:1317::-;21034:2;21023:9;21016:21;21046:53;21095:2;21084:9;21080:18;21071:6;21065:13;2476:42;2465:54;2453:67;;2399:127;21046:53;21153:2;21145:6;21141:15;21135:22;21130:2;21119:9;21115:18;21108:50;20997:4;21205:2;21197:6;21193:15;21187:22;21218:52;21266:2;21255:9;21251:18;21237:12;2476:42;2465:54;2453:67;;2399:127;21218:52;;21325:2;21317:6;21313:15;21307:22;21301:3;21290:9;21286:19;21279:51;21379:3;21371:6;21367:16;21361:23;21393:55;21443:3;21432:9;21428:19;21412:14;2476:42;2465:54;2453:67;;2399:127;21393:55;;21503:3;21495:6;21491:16;21485:23;21479:3;21468:9;21464:19;21457:52;21558:3;21550:6;21546:16;21540:23;21572:52;21619:3;21608:9;21604:19;21588:14;3088:13;3081:21;3069:34;;3018:91;21572:52;;21673:3;21665:6;21661:16;21655:23;21697:3;21709:52;21757:2;21746:9;21742:18;21726:14;19541:4;19530:16;19518:29;;19474:75;21709:52;21786:15;;21780:22;21821:3;21840:18;;;21833:30;;;;21888:15;;21882:22;21923:3;21942:18;;;21935:30;;;;22002:15;;21996:22;22037:6;22059:18;;;22052:30;21996:22;-1:-1:-1;22099:53:35;22147:3;22132:19;;21996:22;22099:53;:::i;:::-;22091:61;20841:1317;-1:-1:-1;;;;20841:1317:35:o;22163:245::-;22230:6;22283:2;22271:9;22262:7;22258:23;22254:32;22251:52;;;22299:1;22296;22289:12;22251:52;22331:9;22325:16;22350:28;22372:5;22350:28;:::i;23055:287::-;23184:3;23222:6;23216:13;23238:66;23297:6;23292:3;23285:4;23277:6;23273:17;23238:66;:::i;:::-;23320:16;;;;;23055:287;-1:-1:-1;;23055:287:35:o
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.