ERC-20
Overview
Max Total Supply
1,046,935.029542064120948389 stHYPE AMM LP
Holders
5,464
Market
Price
$0.00 @ 0.000000 HYPE
Onchain Market Cap
-
Circulating Supply Market Cap
-
Other Info
Token Contract (WITH 18 Decimals)
Balance
494.774516032753981381 stHYPE AMM LPValue
$0.00Loading...
Loading
Loading...
Loading
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
STEXAMM
Compiler Version
v0.8.25+commit.b61c2a91
Optimization Enabled:
Yes with 10000 runs
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.25; import {ALMLiquidityQuoteInput, ALMLiquidityQuote} from "@valantis-core/ALM/structs/SovereignALMStructs.sol"; import {ISovereignPool} from "@valantis-core/pools/interfaces/ISovereignPool.sol"; import {IProtocolFactory} from "@valantis-core/protocol-factory/interfaces/IProtocolFactory.sol"; import {SovereignPoolConstructorArgs} from "@valantis-core/pools/structs/SovereignPoolStructs.sol"; import {SwapFeeModuleData} from "@valantis-core/swap-fee-modules/interfaces/ISwapFeeModule.sol"; import {Address} from "@openzeppelin/contracts/utils/Address.sol"; import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {Math} from "@openzeppelin/contracts/utils/math/Math.sol"; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; import {Pausable} from "@openzeppelin/contracts/utils/Pausable.sol"; import {ReentrancyGuardTransient} from "@openzeppelin/contracts/utils/ReentrancyGuardTransient.sol"; import {IWithdrawalModule} from "./interfaces/IWithdrawalModule.sol"; import {ISTEXAMM} from "./interfaces/ISTEXAMM.sol"; import {IWETH9} from "./interfaces/IWETH9.sol"; import {ISwapFeeModuleMinimalView} from "./interfaces/ISwapFeeModuleMinimalView.sol"; import {SwapFeeModuleProposal, WithdrawalModuleProposal} from "./structs/STEXAMMStructs.sol"; /** * @title Stake Exchange AMM. */ contract STEXAMM is ISTEXAMM, Ownable, ERC20, ReentrancyGuardTransient, Pausable { using SafeERC20 for ERC20; /** * * CUSTOM ERRORS * */ error STEXAMM__OnlyPool(); error STEXAMM__OnlyWithdrawalModule(); error STEXAMM__ZeroAddress(); error STEXAMM__deposit_lessThanMinShares(); error STEXAMM__deposit_zeroShares(); error STEXAMM__getLiquidityQuote_nonReentrant(); error STEXAMM__onSwapCallback_NotImplemented(); error STEXAMM__receive_onlyWETH9(); error STEXAMM__proposeSwapFeeModule_ProposalAlreadyActive(); error STEXAMM__setProposedSwapFeeModule_InactiveProposal(); error STEXAMM__setProposedSwapFeeModule_Timelock(); error STEXAMM__proposeWithdrawalModule_ProposalAlreadyActive(); error STEXAMM__setProposedWithdrawalModule_InactiveProposal(); error STEXAMM__setProposedWithdrawalModule_Timelock(); error STEXAMM__unstakeToken0Reserves_amountCannotBeZero(); error STEXAMM__unstakeToken0Reserves_amountTooHigh(); error STEXAMM__withdraw_insufficientToken0Withdrawn(); error STEXAMM__withdraw_insufficientToken1Withdrawn(); error STEXAMM__withdraw_zeroShares(); error STEXAMM___checkDeadline_expired(); error STEXAMM___verifyTimelockDelay_timelockTooLow(); error STEXAMM___verifyTimelockDelay_timelockTooHigh(); /** * * CUSTOM INTERNAL STRUCTS * */ struct WithdrawCache { uint256 totalSupply; uint256 reserve0Pool; uint256 reserve1Pool; uint256 amount1LendingPool; uint256 instantWithdrawalFee1; uint256 amount1Remaining; } /** * * CONSTANTS * */ uint256 private constant BIPS = 10_000; uint256 private constant MINIMUM_LIQUIDITY = 1e3; uint256 private constant MIN_TIMELOCK_DELAY = 3 days; uint256 private constant MAX_TIMELOCK_DELAY = 7 days; /** * * IMMUTABLES * */ /** * @notice Address of Valantis Sovereign Pool. */ address public immutable pool; /** * @notice Address of Liquid Staking token. */ address public immutable token0; /** * @notice Address of wrapped native token. */ address public immutable token1; /** * @notice Address of pool manager fee recipients. */ address public immutable poolFeeRecipient1; address public immutable poolFeeRecipient2; /** * * STORAGE * */ /** * @notice Pending update proposal to Swap Fee Module. * *swapFeeModule: Address of new Swap Fee Module. * *startTimestamp: Block timestamp after which this proposal can be applied by `owner`. */ SwapFeeModuleProposal public swapFeeModuleProposal; /** * @notice Pending update proposal to Withdrawal Module. * *withdrawalModule: Address of new Withdrawal Module. * *startTimestamp: Block timestamp after which this proposal can be applied by `owner`. */ WithdrawalModuleProposal public withdrawalModuleProposal; /** * @notice Withdrawal Module. * @dev This is the module which will interface with * token0's native withdrawal queue and/or token1's Lending Protocol integration. * @dev WARNING: This is a critical dependency which can affect the solvency of the pool. * Upgrades are made under 7 days timelock and expect the `owner` to have sufficient internal security checks. */ IWithdrawalModule private _withdrawalModule; /** * * CONSTRUCTOR * */ constructor( string memory _name, string memory _symbol, address _token0, address _token1, address _swapFeeModule, address _protocolFactory, address _poolFeeRecipient1, address _poolFeeRecipient2, address _owner, address withdrawalModule_, uint256 _token0AbsErrorTolerance ) Ownable(_owner) ERC20(_name, _symbol) { if ( _token0 == address(0) || _token1 == address(0) || _swapFeeModule == address(0) || _protocolFactory == address(0) || _poolFeeRecipient1 == address(0) || _poolFeeRecipient2 == address(0) || _owner == address(0) || withdrawalModule_ == address(0) ) revert STEXAMM__ZeroAddress(); SovereignPoolConstructorArgs memory args = SovereignPoolConstructorArgs( _token0, _token1, _protocolFactory, address(this), address(0), address(0), true, // token0 and token1 reserves will be measured as pool's balances true, _token0AbsErrorTolerance, 0, 0 ); pool = IProtocolFactory(_protocolFactory).deploySovereignPool(args); ISovereignPool(pool).setSwapFeeModule(_swapFeeModule); ISovereignPool(pool).setALM(address(this)); poolFeeRecipient1 = _poolFeeRecipient1; poolFeeRecipient2 = _poolFeeRecipient2; token0 = _token0; token1 = _token1; _withdrawalModule = IWithdrawalModule(withdrawalModule_); } /** * * MODIFIERS * */ modifier onlyPool() { if (msg.sender != pool) { revert STEXAMM__OnlyPool(); } _; } modifier onlyWithdrawalModule() { if (msg.sender != address(_withdrawalModule)) { revert STEXAMM__OnlyWithdrawalModule(); } _; } /** * * VIEW FUNCTIONS * */ /** * @notice Returns true if ReentrancyGuard lock is active, false otherwise. */ function isLocked() external view override returns (bool) { return _reentrancyGuardEntered(); } /** * @notice Returns address of Withdrawal Module. */ function withdrawalModule() external view override returns (address) { return address(_withdrawalModule); } /** * @notice Helper function to estimate swap quote amounts. * @dev WARNING: This function has minimal internal checks, * do not use for accurate simulation for `SovereignPool::swap`. * @param _tokenIn Address of input token to swap. * @param _amountIn Amount if `_tokenIn` to swap. * @param _isInstantWithdraw Boolean to indicate if it should be called through `withdraw` * with `_isInstantWithdraw=true`. * WARNING: If `_isInstantWithdraw=true`, `_amountIn` should not be accounted for fee calculation. * @return amountOut Amount of output token received. */ function getAmountOut(address _tokenIn, uint256 _amountIn, bool _isInstantWithdraw) public view override returns (uint256 amountOut) { if ((_tokenIn != token0 && _tokenIn != token1) || _amountIn == 0) { return 0; } address swapFeeModule = ISovereignPool(pool).swapFeeModule(); SwapFeeModuleData memory swapFeeData = ISwapFeeModuleMinimalView(swapFeeModule).getSwapFeeInBips( _tokenIn, address(0), _isInstantWithdraw ? 0 : _amountIn, address(0), new bytes(0) ); uint256 amountInWithoutFee = Math.mulDiv(_amountIn, BIPS, BIPS + swapFeeData.feeInBips); bool isZeroToOne = _tokenIn == token0; // token0 balances might not be 1:1 mapped to token1 balances, // hence we rely on the withdrawalModule to convert it (e.g., if token0 balances represent shares) amountOut = isZeroToOne ? _withdrawalModule.convertToToken1(amountInWithoutFee) : _withdrawalModule.convertToToken0(amountInWithoutFee); } /** * * EXTERNAL FUNCTIONS * */ receive() external payable { if (msg.sender != token1) revert STEXAMM__receive_onlyWETH9(); } /** * @notice Pause STEX AMM Liquidity Module. * @dev Only callable by `owner`. */ function pause() external override onlyOwner whenNotPaused { _pause(); } /** * @notice Unpause STEX AMM Liquidity Module. * @dev Only callable by `owner`. */ function unpause() external override onlyOwner whenPaused { _unpause(); } /** * @notice Propose an update to Swap Fee Module under a timelock. * @dev Only callable by `owner`. * @param _swapFeeModule Address of new Swap Fee Module to set. * @param _timelockDelay Timelock delay in seconds. Must be in range [3 days, 7 days]. */ function proposeSwapFeeModule(address _swapFeeModule, uint256 _timelockDelay) external override onlyOwner { if (_swapFeeModule == address(0)) revert STEXAMM__ZeroAddress(); // An honest `owner` can propose a timelock delay greater than the minimum, // but no greater than the maximum _verifyTimelockDelay(_timelockDelay); if (swapFeeModuleProposal.startTimestamp > 0) { revert STEXAMM__proposeSwapFeeModule_ProposalAlreadyActive(); } swapFeeModuleProposal = SwapFeeModuleProposal({swapFeeModule: _swapFeeModule, startTimestamp: block.timestamp + _timelockDelay}); emit SwapFeeModuleProposed(_swapFeeModule, block.timestamp + _timelockDelay); } /** * @notice Cancel a pending update proposal to Swap Fee Module. * @dev Only callable by `owner`. */ function cancelSwapFeeModuleProposal() external override onlyOwner { emit SwapFeeModuleProposalCancelled(); delete swapFeeModuleProposal; } /** * @notice Set the proposed Swap Fee Module in Sovereign Pool after timelock delay. * @dev Only callable by `owner`. */ function setProposedSwapFeeModule() external override onlyOwner { SwapFeeModuleProposal memory proposal = swapFeeModuleProposal; if (proposal.startTimestamp == 0) { revert STEXAMM__setProposedSwapFeeModule_InactiveProposal(); } if (block.timestamp < proposal.startTimestamp) { revert STEXAMM__setProposedSwapFeeModule_Timelock(); } ISovereignPool(pool).setSwapFeeModule(proposal.swapFeeModule); emit SwapFeeModuleSet(proposal.swapFeeModule); delete swapFeeModuleProposal; } /** * @notice Propose an update to Withdrawal Module under a 7 days timelock. * @dev Only callable by `owner`. * @dev WARNING: This is a critical dependency which affects the solvency of LPs, * hence owner should have sufficient internal checks and protections. * @param withdrawalModule_ Address of new Withdrawal Module to set. */ function proposeWithdrawalModule(address withdrawalModule_) external override onlyOwner { if (withdrawalModule_ == address(0)) revert STEXAMM__ZeroAddress(); if (withdrawalModuleProposal.startTimestamp > 0) { revert STEXAMM__proposeWithdrawalModule_ProposalAlreadyActive(); } withdrawalModuleProposal = WithdrawalModuleProposal({withdrawalModule: withdrawalModule_, startTimestamp: block.timestamp + 7 days}); emit WithdrawalModuleProposed(withdrawalModule_, block.timestamp + 7 days); } /** * @notice Cancel a pending update proposal to Withdrawal Module. * @dev Only callable by `owner`. */ function cancelWithdrawalModuleProposal() external override onlyOwner { emit WithdrawalModuleProposalCancelled(); delete withdrawalModuleProposal; } /** * @notice Set the proposed Withdrawal Module in Sovereign Pool after a 7 days timelock delay. * @dev Only callable by `owner`. */ function setProposedWithdrawalModule() external override onlyOwner { WithdrawalModuleProposal memory proposal = withdrawalModuleProposal; if (proposal.startTimestamp == 0) { revert STEXAMM__setProposedWithdrawalModule_InactiveProposal(); } if (block.timestamp < proposal.startTimestamp) { revert STEXAMM__setProposedWithdrawalModule_Timelock(); } _withdrawalModule = IWithdrawalModule(proposal.withdrawalModule); emit WithdrawalModuleSet(proposal.withdrawalModule); delete withdrawalModuleProposal; } /** * @notice Sets a manager/protocol fee on every swap. * @dev Only callable by `owner`. * @param _poolManagerFeeBips New pool manager fee to apply in `pool`. */ function setPoolManagerFeeBips(uint256 _poolManagerFeeBips) external override onlyOwner nonReentrant { ISovereignPool(pool).setPoolManagerFeeBips(_poolManagerFeeBips); emit PoolManagerFeeSet(_poolManagerFeeBips); } /** * @notice Claim any accrued manager/protocol fees. * @dev Anyone can call this function. */ function claimPoolManagerFees() external override nonReentrant { // WARNING: No donations should be made to this contract, // otherwise they will be accounted as manager fees // token0 fees are automatically sent to this contract (poolManager) on every swap, // because of SovereignPool::swap behavior for rebase input token uint256 fee0Received = ERC20(token0).balanceOf(address(this)); // token1 fees are accrued on instant withdrawals uint256 fee1Received = ERC20(token1).balanceOf(address(this)); // 50/50 split between `poolFeeRecipient1` and `poolFeeRecipient2` if (fee0Received > 0) { uint256 fee0ToRecipient1 = fee0Received / 2; if (fee0ToRecipient1 > 0) { ERC20(token0).safeTransfer(poolFeeRecipient1, fee0ToRecipient1); } uint256 fee0ToRecipient2 = fee0Received - fee0ToRecipient1; if (fee0ToRecipient2 > 0) { ERC20(token0).safeTransfer(poolFeeRecipient2, fee0ToRecipient2); } } if (fee1Received > 0) { uint256 fee1ToRecipient1 = fee1Received / 2; if (fee1ToRecipient1 > 0) { ERC20(token1).safeTransfer(poolFeeRecipient1, fee1ToRecipient1); } uint256 fee1ToRecipient2 = fee1Received - fee1ToRecipient1; if (fee1ToRecipient2 > 0) { ERC20(token1).safeTransfer(poolFeeRecipient2, fee1ToRecipient2); } } emit PoolManagerFeesClaimed(fee0Received, fee1Received); } /** * @notice Allows the withdrawal module to transfer a portion of `token0` reserves from `pool` * and send those to the staking protocol's native withdrawal queue. * @dev Only callable by `withdrawalModule`. * @param _unstakeAmountToken0 Amount of `token0` reserves to unstake. */ function unstakeToken0Reserves(uint256 _unstakeAmountToken0) external override onlyWithdrawalModule nonReentrant { if (_unstakeAmountToken0 == 0) { revert STEXAMM__unstakeToken0Reserves_amountCannotBeZero(); } ISovereignPool poolInterface = ISovereignPool(pool); (uint256 reserve0,) = poolInterface.getReserves(); if (_unstakeAmountToken0 > reserve0) { revert STEXAMM__unstakeToken0Reserves_amountTooHigh(); } poolInterface.withdrawLiquidity(_unstakeAmountToken0, 0, msg.sender, msg.sender, new bytes(0)); emit Token0ReservesUnstaked(_unstakeAmountToken0); } /** * @notice Allows the withdrawal module to supply a portion of `token1` reserves * from `pool` into a lending protocol. * @dev Only callable by `withdrawalModule`. */ function supplyToken1Reserves(uint256 _amount1) external override onlyWithdrawalModule nonReentrant { ISovereignPool(pool).withdrawLiquidity(0, _amount1, msg.sender, msg.sender, new bytes(0)); } /** * @notice Deposit liquidity into `pool` and mint LP tokens. * @param _amount Amount of token1 deposited. * @param _minShares Minimum amount of shares to mint. * @param _deadline Block timestamp after which this call reverts. * @param _recipient Address to mint LP tokens for. * @return shares Amount of shares minted. */ function deposit(uint256 _amount, uint256 _minShares, uint256 _deadline, address _recipient) external override nonReentrant whenNotPaused returns (uint256 shares) { _checkDeadline(_deadline); _withdrawalModule.update(); uint256 totalSupplyCache = totalSupply(); if (totalSupplyCache == 0) { _mint(address(1), MINIMUM_LIQUIDITY); shares = _amount - MINIMUM_LIQUIDITY; } else { (uint256 reserve0Pool, uint256 reserve1Pool) = ISovereignPool(pool).getReserves(); // Account for token0 in pool (liquid) and pending unstaking (locked) uint256 reserve0Total = reserve0Pool + _withdrawalModule.amountToken0PendingUnstaking(); // Account for token1 pending withdrawal to LPs (locked) uint256 reserve1PendingWithdrawal = _withdrawalModule.amountToken1PendingLPWithdrawal(); // shares calculated in terms of token1 shares = Math.mulDiv( _amount, totalSupplyCache, reserve1Pool + _withdrawalModule.amountToken1LendingPool() + _withdrawalModule.convertToToken1(reserve0Total) - reserve1PendingWithdrawal ); } if (shares < _minShares) revert STEXAMM__deposit_lessThanMinShares(); if (shares == 0) revert STEXAMM__deposit_zeroShares(); _mint(_recipient, shares); ISovereignPool(pool).depositLiquidity(0, _amount, msg.sender, new bytes(0), abi.encode(msg.sender)); emit Deposit(msg.sender, _recipient, _amount, shares); } /** * @notice Callback to transfer tokens from user into `pool` during deposits. * @dev Only callable by `pool`. */ function onDepositLiquidityCallback( uint256, /*_amount0*/ uint256 _amount1, bytes memory _data ) external override onlyPool { address user = abi.decode(_data, (address)); // Only token1 deposits are allowed if (_amount1 > 0) { ERC20(token1).safeTransferFrom(user, msg.sender, _amount1); } } /** * @notice Withdraw liquidity from `pool` and burn LP tokens. * @param _shares Amount of LP tokens to burn. * @param _amount0Min Minimum amount of token0 required for `_recipient`. * @param _amount1Min Minimum amount of token1 required for `_recipient`. * @param _deadline Block timestamp after which this call reverts. * @param _recipient Address to receive token0 and token1 amounts. * @param _unwrapToNativeToken True if pool's token1 is WETH and `_recipient` wants the native token. * @param _isInstantWithdrawal True if user wants to swap token0 amount into token1 against the pool. * @return amount0 Amount of token0 withdrawn. WARNING: Potentially innacurate in case token0 is rebase. * @return amount1 Amount of token1 withdrawn. WARNING: Potentially innacurate in case token1 is rebase. */ function withdraw( uint256 _shares, uint256 _amount0Min, uint256 _amount1Min, uint256 _deadline, address _recipient, bool _unwrapToNativeToken, bool _isInstantWithdrawal ) external override nonReentrant returns (uint256 amount0, uint256 amount1) { _checkDeadline(_deadline); if (_shares == 0) revert STEXAMM__withdraw_zeroShares(); if (_recipient == address(0)) { revert STEXAMM__ZeroAddress(); } _withdrawalModule.update(); WithdrawCache memory cache; (cache.reserve0Pool, cache.reserve1Pool) = ISovereignPool(pool).getReserves(); cache.totalSupply = totalSupply(); { uint256 amountToken0PendingUnstaking = _withdrawalModule.amountToken0PendingUnstaking(); uint256 reserve0PendingWithdrawal = _withdrawalModule.convertToToken0(_withdrawalModule.amountToken1PendingLPWithdrawal()); uint256 amount0Deduction; if (cache.reserve0Pool + amountToken0PendingUnstaking > reserve0PendingWithdrawal) { // pro-rata share of token0 reserves in pool (liquid), token0 reserves pending in withdrawal queue (locked) // minus token0 amount already owed to pending LP withdrawals. amount0 = Math.mulDiv( cache.reserve0Pool + amountToken0PendingUnstaking - reserve0PendingWithdrawal, _shares, cache.totalSupply ); } else { // In this case there is more token0 owed to pending LP withdrawals, // but not enough token0 in pool reserves nor pending unstaking. // To ensure solvency of pending LP withdrawals, // this amount will be deducted from the user's token1 total amount (`amount1`) amount0Deduction = Math.mulDiv( reserve0PendingWithdrawal - cache.reserve0Pool - amountToken0PendingUnstaking, _shares, cache.totalSupply, Math.Rounding.Ceil ); } cache.amount1LendingPool = Math.mulDiv(_withdrawalModule.amountToken1LendingPool(), _shares, cache.totalSupply); // token1 amount calculated as pro-rata share of token1 reserves in the pool (liquid) // plus pro-rata share of token1 reserves earning yield in lending pool (liquid, assuming lending pool allows for instant withdrawals) amount1 = cache.amount1LendingPool + Math.mulDiv(cache.reserve1Pool, _shares, cache.totalSupply); if (amount0Deduction > 0) { // Deduct this amount from `amount1`, as it needs to be held to honor pending LP withdrawals uint256 amount1Deduction = _withdrawalModule.convertToToken1(amount0Deduction); amount1 = amount1 > amount1Deduction ? amount1 - amount1Deduction : 0; } } // This is equivalent to an instant swap into token1 (with an extra fee in token1), // and withdraw the total amount in token1 if (_isInstantWithdrawal) { uint256 amount1SwapEquivalent = getAmountOut(token0, amount0, true); uint256 amount1WithFee = _withdrawalModule.convertToToken1(amount0); // Apply manager fee on instant withdrawals in token1 cache.instantWithdrawalFee1 = ((amount1WithFee - amount1SwapEquivalent) * ISovereignPool(pool).poolManagerFeeBips()) / BIPS; amount1 += amount1SwapEquivalent; amount0 = 0; } // Slippage protection checks if (amount0 < _amount0Min) { revert STEXAMM__withdraw_insufficientToken0Withdrawn(); } if (amount1 < _amount1Min) { revert STEXAMM__withdraw_insufficientToken1Withdrawn(); } // Burn LP tokens _burn(msg.sender, _shares); // Send token0 withdrawal request to withdrawal module, // to be processed asynchronously if (amount0 > 0) { _withdrawalModule.burnToken0AfterWithdraw(amount0, _recipient); } if (amount1 + cache.instantWithdrawalFee1 > 0) { // token1 amount left to withdraw cache.amount1Remaining = amount1 + cache.instantWithdrawalFee1; (, uint256 reserve1) = ISovereignPool(pool).getReserves(); if (cache.amount1Remaining <= reserve1) { // If pool has enough token1 liquidity ISovereignPool(pool).withdrawLiquidity( 0, cache.amount1Remaining, msg.sender, address(this), new bytes(0) ); } else { // If pool does not have enough token1 liquidity, // we withdraw full reserves from pool, // and attempt to withdraw remaining amount from lending pool ISovereignPool(pool).withdrawLiquidity(0, reserve1, msg.sender, address(this), new bytes(0)); _withdrawalModule.withdrawToken1FromLendingPool(cache.amount1Remaining - reserve1, address(this)); } // All token1 liquidity is sent to this contract beforehand, // so that the instant wihtdrawal fee can be deducted if (cache.amount1Remaining > cache.instantWithdrawalFee1) { if (_unwrapToNativeToken) { IWETH9(token1).withdraw(cache.amount1Remaining - cache.instantWithdrawalFee1); Address.sendValue(payable(_recipient), cache.amount1Remaining - cache.instantWithdrawalFee1); } else { ERC20(token1).safeTransfer(_recipient, cache.amount1Remaining - cache.instantWithdrawalFee1); } } } emit Withdraw(msg.sender, _recipient, amount0, amount1, _shares); } /** * @notice Called by the Sovereign pool to request a liquidity quote from this Liquidity Module. * @param _almLiquidityQuoteInput Contains fundamental data about the swap. * @return quote Struct containing tokenIn and tokenOut amounts filled. */ function getLiquidityQuote( ALMLiquidityQuoteInput memory _almLiquidityQuoteInput, bytes calldata, /*_externalContext*/ bytes calldata /*_verifierData*/ ) external view override whenNotPaused returns (ALMLiquidityQuote memory quote) { // Prevents read-only reentrancy via `SovereignPool::swap`, // while keeping `getLiquidityQuote` as read-only if (_reentrancyGuardEntered()) { revert STEXAMM__getLiquidityQuote_nonReentrant(); } // The swap happens at 1:1 exchange rate, // given that the dynamic fee has already been applied // to the total tokenIn amount quote.amountInFilled = _almLiquidityQuoteInput.amountInMinusFee; // token0 balances might not be 1:1 mapped to token1 balances, // hence we rely on the withdrawalModule to convert it (e.g., if token0 balances represent shares) quote.amountOut = _almLiquidityQuoteInput.isZeroToOne ? _withdrawalModule.convertToToken1(quote.amountInFilled) : _withdrawalModule.convertToToken0(quote.amountInFilled); } /** * @notice Callback to Liquidity Module after swap into liquidity pool. * @dev Not implemented. */ function onSwapCallback( bool, /*_isZeroToOne*/ uint256, /*_amountIn*/ uint256 /*_amountOut*/ ) external pure override { revert STEXAMM__onSwapCallback_NotImplemented(); } /** * * PRIVATE FUNCTIONS * */ function _checkDeadline(uint256 deadline) private view { if (block.timestamp > deadline) { revert STEXAMM___checkDeadline_expired(); } } function _verifyTimelockDelay(uint256 _timelockDelay) private pure { if (_timelockDelay < MIN_TIMELOCK_DELAY) { revert STEXAMM___verifyTimelockDelay_timelockTooLow(); } if (_timelockDelay > MAX_TIMELOCK_DELAY) { revert STEXAMM___verifyTimelockDelay_timelockTooHigh(); } } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.25; struct SwapFeeModuleProposal { address swapFeeModule; uint256 startTimestamp; } struct WithdrawalModuleProposal { address withdrawalModule; uint256 startTimestamp; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/math/Math.sol) pragma solidity ^0.8.20; import {Panic} from "../Panic.sol"; import {SafeCast} from "./SafeCast.sol"; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { 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 success flag (no overflow). */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an success flag (no overflow). */ function trySub(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an success flag (no overflow). */ function tryMul(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) { 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 success flag (no division by zero). */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a success flag (no division by zero). */ function tryMod(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Branchless ternary evaluation for `a ? b : c`. Gas costs are constant. * * IMPORTANT: This function may reduce bytecode size and consume less gas when used standalone. * However, the compiler may optimize Solidity ternary operations (i.e. `a ? b : c`) to only compute * one branch when needed, making this function more expensive. */ function ternary(bool condition, uint256 a, uint256 b) internal pure returns (uint256) { unchecked { // branchless ternary works because: // b ^ (a ^ b) == a // b ^ 0 == b return b ^ ((a ^ b) * SafeCast.toUint(condition)); } } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return ternary(a > b, a, b); } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return ternary(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. Panic.panic(Panic.DIVISION_BY_ZERO); } // The following calculation ensures accurate ceiling division without overflow. // Since a is non-zero, (a - 1) / b will not overflow. // The largest possible result occurs when (a - 1) / b is type(uint256).max, // but the largest value we can obtain is type(uint256).max - 1, which happens // when a = type(uint256).max and b = 1. unchecked { return SafeCast.toUint(a > 0) * ((a - 1) / b + 1); } } /** * @dev Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or * denominator == 0. * * 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²⁵⁶ and mod 2²⁵⁶ - 1, then use // the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2²⁵⁶ + 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²⁵⁶. Also prevents denominator == 0. if (denominator <= prod1) { Panic.panic(ternary(denominator == 0, Panic.DIVISION_BY_ZERO, Panic.UNDER_OVERFLOW)); } /////////////////////////////////////////////// // 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²⁵⁶ / 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²⁵⁶. Now that denominator is an odd number, it has an inverse modulo 2²⁵⁶ such // that denominator * inv ≡ 1 mod 2²⁵⁶. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv ≡ 1 mod 2⁴. 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⁸ inverse *= 2 - denominator * inverse; // inverse mod 2¹⁶ inverse *= 2 - denominator * inverse; // inverse mod 2³² inverse *= 2 - denominator * inverse; // inverse mod 2⁶⁴ inverse *= 2 - denominator * inverse; // inverse mod 2¹²⁸ inverse *= 2 - denominator * inverse; // inverse mod 2²⁵⁶ // 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²⁵⁶. Since the preconditions guarantee that the outcome is // less than 2²⁵⁶, 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; } } /** * @dev 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) { return mulDiv(x, y, denominator) + SafeCast.toUint(unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0); } /** * @dev Calculate the modular multiplicative inverse of a number in Z/nZ. * * If n is a prime, then Z/nZ is a field. In that case all elements are inversible, except 0. * If n is not a prime, then Z/nZ is not a field, and some elements might not be inversible. * * If the input value is not inversible, 0 is returned. * * NOTE: If you know for sure that n is (big) a prime, it may be cheaper to use Fermat's little theorem and get the * inverse using `Math.modExp(a, n - 2, n)`. See {invModPrime}. */ function invMod(uint256 a, uint256 n) internal pure returns (uint256) { unchecked { if (n == 0) return 0; // The inverse modulo is calculated using the Extended Euclidean Algorithm (iterative version) // Used to compute integers x and y such that: ax + ny = gcd(a, n). // When the gcd is 1, then the inverse of a modulo n exists and it's x. // ax + ny = 1 // ax = 1 + (-y)n // ax ≡ 1 (mod n) # x is the inverse of a modulo n // If the remainder is 0 the gcd is n right away. uint256 remainder = a % n; uint256 gcd = n; // Therefore the initial coefficients are: // ax + ny = gcd(a, n) = n // 0a + 1n = n int256 x = 0; int256 y = 1; while (remainder != 0) { uint256 quotient = gcd / remainder; (gcd, remainder) = ( // The old remainder is the next gcd to try. remainder, // Compute the next remainder. // Can't overflow given that (a % gcd) * (gcd // (a % gcd)) <= gcd // where gcd is at most n (capped to type(uint256).max) gcd - remainder * quotient ); (x, y) = ( // Increment the coefficient of a. y, // Decrement the coefficient of n. // Can overflow, but the result is casted to uint256 so that the // next value of y is "wrapped around" to a value between 0 and n - 1. x - y * int256(quotient) ); } if (gcd != 1) return 0; // No inverse exists. return ternary(x < 0, n - uint256(-x), uint256(x)); // Wrap the result if it's negative. } } /** * @dev Variant of {invMod}. More efficient, but only works if `p` is known to be a prime greater than `2`. * * From https://en.wikipedia.org/wiki/Fermat%27s_little_theorem[Fermat's little theorem], we know that if p is * prime, then `a**(p-1) ≡ 1 mod p`. As a consequence, we have `a * a**(p-2) ≡ 1 mod p`, which means that * `a**(p-2)` is the modular multiplicative inverse of a in Fp. * * NOTE: this function does NOT check that `p` is a prime greater than `2`. */ function invModPrime(uint256 a, uint256 p) internal view returns (uint256) { unchecked { return Math.modExp(a, p - 2, p); } } /** * @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m) * * Requirements: * - modulus can't be zero * - underlying staticcall to precompile must succeed * * IMPORTANT: The result is only valid if the underlying call succeeds. When using this function, make * sure the chain you're using it on supports the precompiled contract for modular exponentiation * at address 0x05 as specified in https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise, * the underlying function will succeed given the lack of a revert, but the result may be incorrectly * interpreted as 0. */ function modExp(uint256 b, uint256 e, uint256 m) internal view returns (uint256) { (bool success, uint256 result) = tryModExp(b, e, m); if (!success) { Panic.panic(Panic.DIVISION_BY_ZERO); } return result; } /** * @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m). * It includes a success flag indicating if the operation succeeded. Operation will be marked as failed if trying * to operate modulo 0 or if the underlying precompile reverted. * * IMPORTANT: The result is only valid if the success flag is true. When using this function, make sure the chain * you're using it on supports the precompiled contract for modular exponentiation at address 0x05 as specified in * https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise, the underlying function will succeed given the lack * of a revert, but the result may be incorrectly interpreted as 0. */ function tryModExp(uint256 b, uint256 e, uint256 m) internal view returns (bool success, uint256 result) { if (m == 0) return (false, 0); assembly ("memory-safe") { let ptr := mload(0x40) // | Offset | Content | Content (Hex) | // |-----------|------------|--------------------------------------------------------------------| // | 0x00:0x1f | size of b | 0x0000000000000000000000000000000000000000000000000000000000000020 | // | 0x20:0x3f | size of e | 0x0000000000000000000000000000000000000000000000000000000000000020 | // | 0x40:0x5f | size of m | 0x0000000000000000000000000000000000000000000000000000000000000020 | // | 0x60:0x7f | value of b | 0x<.............................................................b> | // | 0x80:0x9f | value of e | 0x<.............................................................e> | // | 0xa0:0xbf | value of m | 0x<.............................................................m> | mstore(ptr, 0x20) mstore(add(ptr, 0x20), 0x20) mstore(add(ptr, 0x40), 0x20) mstore(add(ptr, 0x60), b) mstore(add(ptr, 0x80), e) mstore(add(ptr, 0xa0), m) // Given the result < m, it's guaranteed to fit in 32 bytes, // so we can use the memory scratch space located at offset 0. success := staticcall(gas(), 0x05, ptr, 0xc0, 0x00, 0x20) result := mload(0x00) } } /** * @dev Variant of {modExp} that supports inputs of arbitrary length. */ function modExp(bytes memory b, bytes memory e, bytes memory m) internal view returns (bytes memory) { (bool success, bytes memory result) = tryModExp(b, e, m); if (!success) { Panic.panic(Panic.DIVISION_BY_ZERO); } return result; } /** * @dev Variant of {tryModExp} that supports inputs of arbitrary length. */ function tryModExp( bytes memory b, bytes memory e, bytes memory m ) internal view returns (bool success, bytes memory result) { if (_zeroBytes(m)) return (false, new bytes(0)); uint256 mLen = m.length; // Encode call args in result and move the free memory pointer result = abi.encodePacked(b.length, e.length, mLen, b, e, m); assembly ("memory-safe") { let dataPtr := add(result, 0x20) // Write result on top of args to avoid allocating extra memory. success := staticcall(gas(), 0x05, dataPtr, mload(result), dataPtr, mLen) // Overwrite the length. // result.length > returndatasize() is guaranteed because returndatasize() == m.length mstore(result, mLen) // Set the memory pointer after the returned data. mstore(0x40, add(dataPtr, mLen)) } } /** * @dev Returns whether the provided byte array is zero. */ function _zeroBytes(bytes memory byteArray) private pure returns (bool) { for (uint256 i = 0; i < byteArray.length; ++i) { if (byteArray[i] != 0) { return false; } } return true; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded * towards zero. * * This method is based on Newton's method for computing square roots; the algorithm is restricted to only * using integer operations. */ function sqrt(uint256 a) internal pure returns (uint256) { unchecked { // Take care of easy edge cases when a == 0 or a == 1 if (a <= 1) { return a; } // In this function, we use Newton's method to get a root of `f(x) := x² - a`. It involves building a // sequence x_n that converges toward sqrt(a). For each iteration x_n, we also define the error between // the current value as `ε_n = | x_n - sqrt(a) |`. // // For our first estimation, we consider `e` the smallest power of 2 which is bigger than the square root // of the target. (i.e. `2**(e-1) ≤ sqrt(a) < 2**e`). We know that `e ≤ 128` because `(2¹²⁸)² = 2²⁵⁶` is // bigger than any uint256. // // By noticing that // `2**(e-1) ≤ sqrt(a) < 2**e → (2**(e-1))² ≤ a < (2**e)² → 2**(2*e-2) ≤ a < 2**(2*e)` // we can deduce that `e - 1` is `log2(a) / 2`. We can thus compute `x_n = 2**(e-1)` using a method similar // to the msb function. uint256 aa = a; uint256 xn = 1; if (aa >= (1 << 128)) { aa >>= 128; xn <<= 64; } if (aa >= (1 << 64)) { aa >>= 64; xn <<= 32; } if (aa >= (1 << 32)) { aa >>= 32; xn <<= 16; } if (aa >= (1 << 16)) { aa >>= 16; xn <<= 8; } if (aa >= (1 << 8)) { aa >>= 8; xn <<= 4; } if (aa >= (1 << 4)) { aa >>= 4; xn <<= 2; } if (aa >= (1 << 2)) { xn <<= 1; } // We now have x_n such that `x_n = 2**(e-1) ≤ sqrt(a) < 2**e = 2 * x_n`. This implies ε_n ≤ 2**(e-1). // // We can refine our estimation by noticing that the middle of that interval minimizes the error. // If we move x_n to equal 2**(e-1) + 2**(e-2), then we reduce the error to ε_n ≤ 2**(e-2). // This is going to be our x_0 (and ε_0) xn = (3 * xn) >> 1; // ε_0 := | x_0 - sqrt(a) | ≤ 2**(e-2) // From here, Newton's method give us: // x_{n+1} = (x_n + a / x_n) / 2 // // One should note that: // x_{n+1}² - a = ((x_n + a / x_n) / 2)² - a // = ((x_n² + a) / (2 * x_n))² - a // = (x_n⁴ + 2 * a * x_n² + a²) / (4 * x_n²) - a // = (x_n⁴ + 2 * a * x_n² + a² - 4 * a * x_n²) / (4 * x_n²) // = (x_n⁴ - 2 * a * x_n² + a²) / (4 * x_n²) // = (x_n² - a)² / (2 * x_n)² // = ((x_n² - a) / (2 * x_n))² // ≥ 0 // Which proves that for all n ≥ 1, sqrt(a) ≤ x_n // // This gives us the proof of quadratic convergence of the sequence: // ε_{n+1} = | x_{n+1} - sqrt(a) | // = | (x_n + a / x_n) / 2 - sqrt(a) | // = | (x_n² + a - 2*x_n*sqrt(a)) / (2 * x_n) | // = | (x_n - sqrt(a))² / (2 * x_n) | // = | ε_n² / (2 * x_n) | // = ε_n² / | (2 * x_n) | // // For the first iteration, we have a special case where x_0 is known: // ε_1 = ε_0² / | (2 * x_0) | // ≤ (2**(e-2))² / (2 * (2**(e-1) + 2**(e-2))) // ≤ 2**(2*e-4) / (3 * 2**(e-1)) // ≤ 2**(e-3) / 3 // ≤ 2**(e-3-log2(3)) // ≤ 2**(e-4.5) // // For the following iterations, we use the fact that, 2**(e-1) ≤ sqrt(a) ≤ x_n: // ε_{n+1} = ε_n² / | (2 * x_n) | // ≤ (2**(e-k))² / (2 * 2**(e-1)) // ≤ 2**(2*e-2*k) / 2**e // ≤ 2**(e-2*k) xn = (xn + a / xn) >> 1; // ε_1 := | x_1 - sqrt(a) | ≤ 2**(e-4.5) -- special case, see above xn = (xn + a / xn) >> 1; // ε_2 := | x_2 - sqrt(a) | ≤ 2**(e-9) -- general case with k = 4.5 xn = (xn + a / xn) >> 1; // ε_3 := | x_3 - sqrt(a) | ≤ 2**(e-18) -- general case with k = 9 xn = (xn + a / xn) >> 1; // ε_4 := | x_4 - sqrt(a) | ≤ 2**(e-36) -- general case with k = 18 xn = (xn + a / xn) >> 1; // ε_5 := | x_5 - sqrt(a) | ≤ 2**(e-72) -- general case with k = 36 xn = (xn + a / xn) >> 1; // ε_6 := | x_6 - sqrt(a) | ≤ 2**(e-144) -- general case with k = 72 // Because e ≤ 128 (as discussed during the first estimation phase), we know have reached a precision // ε_6 ≤ 2**(e-144) < 1. Given we're operating on integers, then we can ensure that xn is now either // sqrt(a) or sqrt(a) + 1. return xn - SafeCast.toUint(xn > a / xn); } } /** * @dev 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 + SafeCast.toUint(unsignedRoundsUp(rounding) && result * result < a); } } /** * @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; uint256 exp; unchecked { exp = 128 * SafeCast.toUint(value > (1 << 128) - 1); value >>= exp; result += exp; exp = 64 * SafeCast.toUint(value > (1 << 64) - 1); value >>= exp; result += exp; exp = 32 * SafeCast.toUint(value > (1 << 32) - 1); value >>= exp; result += exp; exp = 16 * SafeCast.toUint(value > (1 << 16) - 1); value >>= exp; result += exp; exp = 8 * SafeCast.toUint(value > (1 << 8) - 1); value >>= exp; result += exp; exp = 4 * SafeCast.toUint(value > (1 << 4) - 1); value >>= exp; result += exp; exp = 2 * SafeCast.toUint(value > (1 << 2) - 1); value >>= exp; result += exp; result += SafeCast.toUint(value > 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 + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << result < value); } } /** * @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 + SafeCast.toUint(unsignedRoundsUp(rounding) && 10 ** result < value); } } /** * @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; uint256 isGt; unchecked { isGt = SafeCast.toUint(value > (1 << 128) - 1); value >>= isGt * 128; result += isGt * 16; isGt = SafeCast.toUint(value > (1 << 64) - 1); value >>= isGt * 64; result += isGt * 8; isGt = SafeCast.toUint(value > (1 << 32) - 1); value >>= isGt * 32; result += isGt * 4; isGt = SafeCast.toUint(value > (1 << 16) - 1); value >>= isGt * 16; result += isGt * 2; result += SafeCast.toUint(value > (1 << 8) - 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 + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << (result << 3) < value); } } /** * @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.2.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; import {IERC1363} from "../../../interfaces/IERC1363.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC-20 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 { /** * @dev An operation with an ERC-20 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. * * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client" * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior. */ 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. * * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client" * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior. */ 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. * * NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function * only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being * set here. */ 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 Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when * targeting contracts. * * Reverts if the returned value is other than `true`. */ function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal { if (to.code.length == 0) { safeTransfer(token, to, value); } else if (!token.transferAndCall(to, value, data)) { revert SafeERC20FailedOperation(address(token)); } } /** * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target * has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when * targeting contracts. * * Reverts if the returned value is other than `true`. */ function transferFromAndCallRelaxed( IERC1363 token, address from, address to, uint256 value, bytes memory data ) internal { if (to.code.length == 0) { safeTransferFrom(token, from, to, value); } else if (!token.transferFromAndCall(from, to, value, data)) { revert SafeERC20FailedOperation(address(token)); } } /** * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when * targeting contracts. * * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}. * Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall} * once without retrying, and relies on the returned value to be true. * * Reverts if the returned value is other than `true`. */ function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal { if (to.code.length == 0) { forceApprove(token, to, value); } else if (!token.approveAndCall(to, value, data)) { 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 {_callOptionalReturnBool} that reverts if call fails to meet the requirements. */ function _callOptionalReturn(IERC20 token, bytes memory data) private { uint256 returnSize; uint256 returnValue; assembly ("memory-safe") { let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20) // bubble errors if iszero(success) { let ptr := mload(0x40) returndatacopy(ptr, 0, returndatasize()) revert(ptr, returndatasize()) } returnSize := returndatasize() returnValue := mload(0) } if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) { 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 silently catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { bool success; uint256 returnSize; uint256 returnValue; assembly ("memory-safe") { success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20) returnSize := returndatasize() returnValue := mload(0) } return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.25; import {SwapFeeModuleData} from "@valantis-core/swap-fee-modules/interfaces/ISwapFeeModule.sol"; /** * @notice A version of valantis-core `ISwapFeeModuleMinimal` where `getSwapFeeInBips` is read-only. */ interface ISwapFeeModuleMinimalView { /** * @notice Returns the swap fee in bips for both Universal & Sovereign Pools. * @param _tokenIn The address of the token that the user wants to swap. * @param _tokenOut The address of the token that the user wants to receive. * @param _amountIn The amount of tokenIn being swapped. * @param _user The address of the user. * @param _swapFeeModuleContext Arbitrary bytes data which can be sent to the swap fee module. * @return swapFeeModuleData A struct containing the swap fee in bips, and internal context data. */ function getSwapFeeInBips( address _tokenIn, address _tokenOut, uint256 _amountIn, address _user, bytes memory _swapFeeModuleContext ) external view returns (SwapFeeModuleData memory swapFeeModuleData); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import { IERC20 } from '../../../lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol'; import { ISwapFeeModule } from '../../swap-fee-modules/interfaces/ISwapFeeModule.sol'; struct SovereignPoolConstructorArgs { address token0; address token1; address protocolFactory; address poolManager; address sovereignVault; address verifierModule; bool isToken0Rebase; bool isToken1Rebase; uint256 token0AbsErrorTolerance; uint256 token1AbsErrorTolerance; uint256 defaultSwapFeeBips; } struct SovereignPoolSwapContextData { bytes externalContext; bytes verifierContext; bytes swapCallbackContext; bytes swapFeeModuleContext; } struct SwapCache { ISwapFeeModule swapFeeModule; IERC20 tokenInPool; IERC20 tokenOutPool; uint256 amountInWithoutFee; } struct SovereignPoolSwapParams { bool isSwapCallback; bool isZeroToOne; uint256 amountIn; uint256 amountOutMin; uint256 deadline; address recipient; address swapTokenOut; SovereignPoolSwapContextData swapContext; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/Panic.sol) pragma solidity ^0.8.20; /** * @dev Helper library for emitting standardized panic codes. * * ```solidity * contract Example { * using Panic for uint256; * * // Use any of the declared internal constants * function foo() { Panic.GENERIC.panic(); } * * // Alternatively * function foo() { Panic.panic(Panic.GENERIC); } * } * ``` * * Follows the list from https://github.com/ethereum/solidity/blob/v0.8.24/libsolutil/ErrorCodes.h[libsolutil]. * * _Available since v5.1._ */ // slither-disable-next-line unused-state library Panic { /// @dev generic / unspecified error uint256 internal constant GENERIC = 0x00; /// @dev used by the assert() builtin uint256 internal constant ASSERT = 0x01; /// @dev arithmetic underflow or overflow uint256 internal constant UNDER_OVERFLOW = 0x11; /// @dev division or modulo by zero uint256 internal constant DIVISION_BY_ZERO = 0x12; /// @dev enum conversion error uint256 internal constant ENUM_CONVERSION_ERROR = 0x21; /// @dev invalid encoding in storage uint256 internal constant STORAGE_ENCODING_ERROR = 0x22; /// @dev empty array pop uint256 internal constant EMPTY_ARRAY_POP = 0x31; /// @dev array out of bounds access uint256 internal constant ARRAY_OUT_OF_BOUNDS = 0x32; /// @dev resource error (too large allocation or too large array) uint256 internal constant RESOURCE_ERROR = 0x41; /// @dev calling invalid internal function uint256 internal constant INVALID_INTERNAL_FUNCTION = 0x51; /// @dev Reverts with a panic code. Recommended to use with /// the internal constants with predefined codes. function panic(uint256 code) internal pure { assembly ("memory-safe") { mstore(0x00, 0x4e487b71) mstore(0x20, code) revert(0x1c, 0x24) } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.25; import {LPWithdrawalRequest} from "../structs/WithdrawalModuleStructs.sol"; import {ILendingModule} from "./ILendingModule.sol"; interface IWithdrawalModule { function overseer() external view returns (address); function lendingModule() external view returns (ILendingModule); function stex() external view returns (address); function pool() external view returns (address); function amountToken0PendingUnstaking() external view returns (uint256); function amountToken1LendingPool() external view returns (uint256); function amountToken1PendingLPWithdrawal() external view returns (uint256); function amountToken1ClaimableLPWithdrawal() external view returns (uint256); function cumulativeAmountToken1LPWithdrawal() external view returns (uint256); function cumulativeAmountToken1ClaimableLPWithdrawal() external view returns (uint256); function isLocked() external view returns (bool); function convertToToken0(uint256 _amountToken1) external view returns (uint256); function convertToToken1(uint256 _amountToken0) external view returns (uint256); function token0SharesToBalance(uint256 _shares) external view returns (uint256); function token0BalanceToShares(uint256 _balance) external view returns (uint256); function token0SharesOf(address _account) external view returns (uint256); function getLPWithdrawals(uint256 _idLPWithdrawal) external view returns (LPWithdrawalRequest memory); function unstakeToken0Reserves(uint256 _unstakeAmountToken0) external; function burnToken0AfterWithdraw(uint256 _amountToken0, address _recipient) external; function supplyToken1ToLendingPool(uint256 _amountToken1) external; function withdrawToken1FromLendingPool(uint256 _amountToken1, address _recipient) external; function update() external; function claim(uint256 _idLPQueue) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../token/ERC20/IERC20.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol) pragma solidity ^0.8.20; import {IERC165} from "../utils/introspection/IERC165.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC-165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[ERC]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import { ALMLiquidityQuoteInput, ALMLiquidityQuote } from '../structs/SovereignALMStructs.sol'; /** @title Sovereign ALM interface @notice All ALMs bound to a Sovereign Pool must implement it. */ interface ISovereignALM { /** @notice Called by the Sovereign pool to request a liquidity quote from the ALM. @param _almLiquidityQuoteInput Contains fundamental data about the swap. @param _externalContext Data received by the pool from the user. @param _verifierData Verification data received by the pool from the verifier module @return almLiquidityQuote Liquidity quote containing tokenIn and tokenOut amounts filled. */ function getLiquidityQuote( ALMLiquidityQuoteInput memory _almLiquidityQuoteInput, bytes calldata _externalContext, bytes calldata _verifierData ) external returns (ALMLiquidityQuote memory); /** @notice Callback function for `depositLiquidity` . @param _amount0 Amount of token0 being deposited. @param _amount1 Amount of token1 being deposited. @param _data Context data passed by the ALM, while calling `depositLiquidity`. */ function onDepositLiquidityCallback(uint256 _amount0, uint256 _amount1, bytes memory _data) external; /** @notice Callback to ALM after swap into liquidity pool. @dev Only callable by pool. @param _isZeroToOne Direction of swap. @param _amountIn Amount of tokenIn in swap. @param _amountOut Amount of tokenOut in swap. */ function onSwapCallback(bool _isZeroToOne, uint256 _amountIn, uint256 _amountOut) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC-20 standard as defined in the ERC. */ 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.1.0) (utils/TransientSlot.sol) // This file was procedurally generated from scripts/generate/templates/TransientSlot.js. pragma solidity ^0.8.24; /** * @dev Library for reading and writing value-types to specific transient storage slots. * * Transient slots are often used to store temporary values that are removed after the current transaction. * This library helps with reading and writing to such slots without the need for inline assembly. * * * Example reading and writing values using transient storage: * ```solidity * contract Lock { * using TransientSlot for *; * * // Define the slot. Alternatively, use the SlotDerivation library to derive the slot. * bytes32 internal constant _LOCK_SLOT = 0xf4678858b2b588224636b8522b729e7722d32fc491da849ed75b3fdf3c84f542; * * modifier locked() { * require(!_LOCK_SLOT.asBoolean().tload()); * * _LOCK_SLOT.asBoolean().tstore(true); * _; * _LOCK_SLOT.asBoolean().tstore(false); * } * } * ``` * * TIP: Consider using this library along with {SlotDerivation}. */ library TransientSlot { /** * @dev UDVT that represent a slot holding a address. */ type AddressSlot is bytes32; /** * @dev Cast an arbitrary slot to a AddressSlot. */ function asAddress(bytes32 slot) internal pure returns (AddressSlot) { return AddressSlot.wrap(slot); } /** * @dev UDVT that represent a slot holding a bool. */ type BooleanSlot is bytes32; /** * @dev Cast an arbitrary slot to a BooleanSlot. */ function asBoolean(bytes32 slot) internal pure returns (BooleanSlot) { return BooleanSlot.wrap(slot); } /** * @dev UDVT that represent a slot holding a bytes32. */ type Bytes32Slot is bytes32; /** * @dev Cast an arbitrary slot to a Bytes32Slot. */ function asBytes32(bytes32 slot) internal pure returns (Bytes32Slot) { return Bytes32Slot.wrap(slot); } /** * @dev UDVT that represent a slot holding a uint256. */ type Uint256Slot is bytes32; /** * @dev Cast an arbitrary slot to a Uint256Slot. */ function asUint256(bytes32 slot) internal pure returns (Uint256Slot) { return Uint256Slot.wrap(slot); } /** * @dev UDVT that represent a slot holding a int256. */ type Int256Slot is bytes32; /** * @dev Cast an arbitrary slot to a Int256Slot. */ function asInt256(bytes32 slot) internal pure returns (Int256Slot) { return Int256Slot.wrap(slot); } /** * @dev Load the value held at location `slot` in transient storage. */ function tload(AddressSlot slot) internal view returns (address value) { assembly ("memory-safe") { value := tload(slot) } } /** * @dev Store `value` at location `slot` in transient storage. */ function tstore(AddressSlot slot, address value) internal { assembly ("memory-safe") { tstore(slot, value) } } /** * @dev Load the value held at location `slot` in transient storage. */ function tload(BooleanSlot slot) internal view returns (bool value) { assembly ("memory-safe") { value := tload(slot) } } /** * @dev Store `value` at location `slot` in transient storage. */ function tstore(BooleanSlot slot, bool value) internal { assembly ("memory-safe") { tstore(slot, value) } } /** * @dev Load the value held at location `slot` in transient storage. */ function tload(Bytes32Slot slot) internal view returns (bytes32 value) { assembly ("memory-safe") { value := tload(slot) } } /** * @dev Store `value` at location `slot` in transient storage. */ function tstore(Bytes32Slot slot, bytes32 value) internal { assembly ("memory-safe") { tstore(slot, value) } } /** * @dev Load the value held at location `slot` in transient storage. */ function tload(Uint256Slot slot) internal view returns (uint256 value) { assembly ("memory-safe") { value := tload(slot) } } /** * @dev Store `value` at location `slot` in transient storage. */ function tstore(Uint256Slot slot, uint256 value) internal { assembly ("memory-safe") { tstore(slot, value) } } /** * @dev Load the value held at location `slot` in transient storage. */ function tload(Int256Slot slot) internal view returns (int256 value) { assembly ("memory-safe") { value := tload(slot) } } /** * @dev Store `value` at location `slot` in transient storage. */ function tstore(Int256Slot slot, int256 value) internal { assembly ("memory-safe") { tstore(slot, value) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol) pragma solidity ^0.8.20; import {Context} from "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { bool private _paused; /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); /** * @dev The operation failed because the contract is paused. */ error EnforcedPause(); /** * @dev The operation failed because the contract is not paused. */ error ExpectedPause(); /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { if (paused()) { revert EnforcedPause(); } } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { if (!paused()) { revert ExpectedPause(); } } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import { IValantisPool } from '../interfaces/IValantisPool.sol'; import { PoolLocks } from '../structs/ReentrancyGuardStructs.sol'; import { SovereignPoolSwapContextData, SovereignPoolSwapParams } from '../structs/SovereignPoolStructs.sol'; interface ISovereignPool is IValantisPool { event SwapFeeModuleSet(address swapFeeModule); event ALMSet(address alm); event GaugeSet(address gauge); event PoolManagerSet(address poolManager); event PoolManagerFeeSet(uint256 poolManagerFeeBips); event SovereignOracleSet(address sovereignOracle); event PoolManagerFeesClaimed(uint256 amount0, uint256 amount1); event DepositLiquidity(uint256 amount0, uint256 amount1); event WithdrawLiquidity(address indexed recipient, uint256 amount0, uint256 amount1); event Swap(address indexed sender, bool isZeroToOne, uint256 amountIn, uint256 fee, uint256 amountOut); function getTokens() external view returns (address[] memory tokens); function sovereignVault() external view returns (address); function protocolFactory() external view returns (address); function gauge() external view returns (address); function poolManager() external view returns (address); function sovereignOracleModule() external view returns (address); function swapFeeModule() external view returns (address); function verifierModule() external view returns (address); function isLocked() external view returns (bool); function isRebaseTokenPool() external view returns (bool); function poolManagerFeeBips() external view returns (uint256); function defaultSwapFeeBips() external view returns (uint256); function swapFeeModuleUpdateTimestamp() external view returns (uint256); function alm() external view returns (address); function getPoolManagerFees() external view returns (uint256 poolManagerFee0, uint256 poolManagerFee1); function getReserves() external view returns (uint256 reserve0, uint256 reserve1); function setPoolManager(address _manager) external; function setGauge(address _gauge) external; function setPoolManagerFeeBips(uint256 _poolManagerFeeBips) external; function setSovereignOracle(address sovereignOracle) external; function setSwapFeeModule(address _swapFeeModule) external; function setALM(address _alm) external; function swap(SovereignPoolSwapParams calldata _swapParams) external returns (uint256, uint256); function depositLiquidity( uint256 _amount0, uint256 _amount1, address _sender, bytes calldata _verificationContext, bytes calldata _depositData ) external returns (uint256 amount0Deposited, uint256 amount1Deposited); function withdrawLiquidity( uint256 _amount0, uint256 _amount1, address _sender, address _recipient, bytes calldata _verificationContext ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.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 ERC-20 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: MIT // OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1363.sol) pragma solidity ^0.8.20; import {IERC20} from "./IERC20.sol"; import {IERC165} from "./IERC165.sol"; /** * @title IERC1363 * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363]. * * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction. */ interface IERC1363 is IERC20, IERC165 { /* * Note: the ERC-165 identifier for this interface is 0xb0202a11. * 0xb0202a11 === * bytes4(keccak256('transferAndCall(address,uint256)')) ^ * bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^ * bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^ * bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^ * bytes4(keccak256('approveAndCall(address,uint256)')) ^ * bytes4(keccak256('approveAndCall(address,uint256,bytes)')) */ /** * @dev Moves a `value` amount of tokens from the caller's account to `to` * and then calls {IERC1363Receiver-onTransferReceived} on `to`. * @param to The address which you want to transfer to. * @param value The amount of tokens to be transferred. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function transferAndCall(address to, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from the caller's account to `to` * and then calls {IERC1363Receiver-onTransferReceived} on `to`. * @param to The address which you want to transfer to. * @param value The amount of tokens to be transferred. * @param data Additional data with no specified format, sent in call to `to`. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism * and then calls {IERC1363Receiver-onTransferReceived} on `to`. * @param from The address which you want to send tokens from. * @param to The address which you want to transfer to. * @param value The amount of tokens to be transferred. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function transferFromAndCall(address from, address to, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism * and then calls {IERC1363Receiver-onTransferReceived} on `to`. * @param from The address which you want to send tokens from. * @param to The address which you want to transfer to. * @param value The amount of tokens to be transferred. * @param data Additional data with no specified format, sent in call to `to`. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`. * @param spender The address which will spend the funds. * @param value The amount of tokens to be spent. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function approveAndCall(address spender, uint256 value) external returns (bool); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`. * @param spender The address which will spend the funds. * @param value The amount of tokens to be spent. * @param data Additional data with no specified format, sent in call to `spender`. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; struct ALMLiquidityQuoteInput { bool isZeroToOne; uint256 amountInMinusFee; uint256 feeInBips; address sender; address recipient; address tokenOutSwap; } struct ALMLiquidityQuote { bool isCallbackOnSwap; uint256 amountOut; uint256 amountInFilled; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.25; import {ISovereignALM} from "@valantis-core/ALM/interfaces/ISovereignALM.sol"; import {ISwapFeeModuleMinimal} from "@valantis-core/swap-fee-modules/interfaces/ISwapFeeModule.sol"; interface ISTEXAMM is ISovereignALM { event SwapFeeModuleProposed(address swapFeeModule, uint256 startTimestamp); event SwapFeeModuleProposalCancelled(); event SwapFeeModuleSet(address swapFeeModule); event WithdrawalModuleProposed(address withdrawalModule, uint256 startTimestamp); event WithdrawalModuleProposalCancelled(); event WithdrawalModuleSet(address withdrawalModule); event PoolManagerFeeSet(uint256 poolManagerFeeBips); event PoolManagerFeesClaimed(uint256 fee0, uint256 fee1); event Token0ReservesUnstaked(uint256 reserve0); event Deposit(address indexed sender, address indexed recipient, uint256 amountToken1, uint256 shares); event Withdraw( address indexed sender, address indexed recipient, uint256 amountToken0, uint256 amountToken1, uint256 shares ); function isLocked() external view returns (bool); function pool() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function poolFeeRecipient1() external view returns (address); function poolFeeRecipient2() external view returns (address); function withdrawalModule() external view returns (address); function pause() external; function unpause() external; function proposeSwapFeeModule(address _swapFeeModule, uint256 _timelockDelay) external; function cancelSwapFeeModuleProposal() external; function setProposedSwapFeeModule() external; function proposeWithdrawalModule(address withdrawalModule_) external; function cancelWithdrawalModuleProposal() external; function setProposedWithdrawalModule() external; function setPoolManagerFeeBips(uint256 _poolManagerFeeBips) external; function claimPoolManagerFees() external; function unstakeToken0Reserves(uint256 _unstakeAmountToken0) external; function supplyToken1Reserves(uint256 _amount1) external; function getAmountOut(address _tokenIn, uint256 _amountIn, bool _isInstantWithdraw) external view returns (uint256 amountOut); function deposit(uint256 _amount, uint256 _minShares, uint256 _deadline, address _recipient) external returns (uint256 shares); function withdraw( uint256 _shares, uint256 _amount0Min, uint256 _amount1Min, uint256 _deadline, address _recipient, bool _unwrapToNativeToken, bool _isInstantWithdrawal ) external returns (uint256 amount0, uint256 amount1); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.25; interface ILendingModule { function assetBalance() external view returns (uint256); function deposit(uint256 amount) external; function withdraw(uint256 amount, address recipient) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import { IFlashBorrower } from './IFlashBorrower.sol'; interface IValantisPool { /************************************************ * EVENTS ***********************************************/ event Flashloan(address indexed initiator, address indexed receiver, uint256 amount, address token); /************************************************ * ERRORS ***********************************************/ error ValantisPool__flashloan_callbackFailed(); error ValantisPool__flashLoan_flashLoanDisabled(); error ValantisPool__flashLoan_flashLoanNotRepaid(); error ValantisPool__flashLoan_rebaseTokenNotAllowed(); /************************************************ * VIEW FUNCTIONS ***********************************************/ /** @notice Address of ERC20 token0 of the pool. */ function token0() external view returns (address); /** @notice Address of ERC20 token1 of the pool. */ function token1() external view returns (address); /************************************************ * EXTERNAL FUNCTIONS ***********************************************/ /** @notice Claim share of protocol fees accrued by this pool. @dev Can only be claimed by `gauge` of the pool. */ function claimProtocolFees() external returns (uint256, uint256); /** @notice Claim share of fees accrued by this pool And optionally share some with the protocol. @dev Only callable by `poolManager`. @param _feeProtocol0Bips Percent of `token0` fees to be shared with protocol. @param _feeProtocol1Bips Percent of `token1` fees to be shared with protocol. */ function claimPoolManagerFees( uint256 _feeProtocol0Bips, uint256 _feeProtocol1Bips ) external returns (uint256 feePoolManager0Received, uint256 feePoolManager1Received); /** @notice Sets the gauge contract address for the pool. @dev Only callable by `protocolFactory`. @dev Once a gauge is set it cannot be changed again. @param _gauge address of the gauge. */ function setGauge(address _gauge) external; /** @notice Allows anyone to flash loan any amount of tokens from the pool. @param _isTokenZero True if token0 is being flash loaned, False otherwise. @param _receiver Address of the flash loan receiver. @param _amount Amount of tokens to be flash loaned. @param _data Bytes encoded data for flash loan callback. */ function flashLoan(bool _isTokenZero, IFlashBorrower _receiver, uint256 _amount, bytes calldata _data) external; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.25; struct LPWithdrawalRequest { address recipient; uint96 amountToken1; uint256 cumulativeAmountToken1LPWithdrawalCheckpoint; } struct LendingModuleProposal { address lendingModule; uint256 startTimestamp; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.2.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 ERC-20 * applications. */ 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}. * * Skips emitting an {Approval} event indicating an allowance update. This is not * required by the ERC. See {xref-ERC20-_approve-address-address-uint256-bool-}[_approve]. * * 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: * * ```solidity * 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 pragma solidity ^0.8.19; enum Lock { WITHDRAWAL, DEPOSIT, SWAP, SPOT_PRICE_TICK } struct PoolLocks { /** @notice Locks all functions that require any withdrawal of funds from the pool This involves the following functions - * withdrawLiquidity * claimProtocolFees * claimPoolManagerFees */ uint8 withdrawals; /** @notice Only locks the deposit function */ uint8 deposit; /** @notice Only locks the swap function */ uint8 swap; /** @notice Only locks the spotPriceTick function */ uint8 spotPriceTick; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 amount) external returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; interface IFlashBorrower { /** @dev Receive a flash loan. @param initiator The initiator of the loan. @param token The loan currency. @param amount The amount of tokens lent. @param data Arbitrary data structure, intended to contain user-defined parameters. @return The keccak256 hash of "ERC3156FlashBorrower.onFlashLoan" */ function onFlashLoan( address initiator, address token, uint256 amount, bytes calldata data ) external returns (bytes32); }
// 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.1.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/bool 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); } /** * @dev Cast a boolean (false or true) to a uint256 (0 or 1) with no jump. */ function toUint(bool b) internal pure returns (uint256 u) { assembly ("memory-safe") { u := iszero(iszero(b)) } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import { SovereignPoolConstructorArgs } from '../../pools/structs/SovereignPoolStructs.sol'; interface IProtocolFactory { event GovernanceTokenSet(address governanceToken); event ProtocolManagerSet(address protocolManager); event UniversalPoolFactorySet(address universalPoolFactory); event SovereignPoolFactorySet(address sovereignPoolFactory); event AuctionControllerSet(address auctionController); event EmissionsControllerSet(address emissionsController); event UniversalGaugeFactorySet(address universalGaugeFactory); event SovereignGaugeFactorySet(address sovereignGaugeFactory); event UniversalALMDeployed(address alm, address pool, address factory); event SovereignALMDeployed(address alm, address pool, address factory); event SwapFeeModuleDeployed(address swapFeeModule, address pool, address factory); event UniversalOracleDeployed(address universalOracle, address pool, address factory); event SovereignOracleDeployed(address sovereignOracle, address pool, address factory); event UniversalPoolDeployed(address indexed token0, address indexed token1, address pool); event SovereignPoolDeployed(address indexed token0, address indexed token1, address pool); event UniversalGaugeDeployed(address gauge, address pool, address manager); event SovereignGaugeDeployed(address gauge, address pool, address manager); event UniversalALMFactoryAdded(address factory); event UniversalALMFactoryRemoved(address factory); event SovereignALMFactoryAdded(address factory); event SovereignALMFactoryRemoved(address factory); event SwapFeeModuleFactoryAdded(address factory); event SwapFeeModuleFactoryRemoved(address factory); event UniversalOracleFactoryAdded(address factory); event UniversalOracleFactoryRemoved(address factory); event SovereignOracleFactoryAdded(address factory); event SovereignOracleFactoryRemoved(address factory); function protocolDeployer() external view returns (address); function almFactories(address _almPosition) external view returns (address); function swapFeeModules(address _pool) external view returns (address); function universalOracleModules(address _pool) external view returns (address); function sovereignOracleModules(address _pool) external view returns (address); function auctionController() external view returns (address); function emissionsController() external view returns (address); function almNonce() external view returns (uint256); function swapFeeModuleNonce() external view returns (uint256); function universalOracleModuleNonce() external view returns (uint256); function sovereignOracleModuleNonce() external view returns (uint256); function protocolManager() external view returns (address); function governanceToken() external view returns (address); function universalPoolFactory() external view returns (address); function sovereignPoolFactory() external view returns (address); function universalGaugeFactory() external view returns (address); function sovereignGaugeFactory() external view returns (address); function getUniversalALMFactories() external view returns (address[] memory); function getSovereignALMFactories() external view returns (address[] memory); function getSwapFeeModuleFactories() external view returns (address[] memory); function getUniversalOracleModuleFactories() external view returns (address[] memory); function getSovereignOracleModuleFactories() external view returns (address[] memory); function gaugeByPool(address _pool) external view returns (address); function poolByGauge(address _gauge) external view returns (address); function isValidUniversalPool(address _pool) external view returns (bool); function isValidSovereignPool(address _pool) external view returns (bool); function isValidUniversalALMFactory(address _almFactory) external view returns (bool); function isValidSovereignALMFactory(address _almFactory) external view returns (bool); function isValidSwapFeeModuleFactory(address _swapFeeModuleFactory) external view returns (bool); function isValidUniversalOracleModuleFactory(address _universalOracleModuleFactory) external view returns (bool); function isValidSovereignOracleModuleFactory(address _sovereignOracleModuleFactory) external view returns (bool); function isValidUniversalALMPosition(address _almPosition) external view returns (bool); function isValidSovereignALMPosition(address _almPosition) external view returns (bool); function isValidSwapFeeModule(address _swapFeeModule) external view returns (bool); function isValidUniversalOracleModule(address _universalOracleModule) external view returns (bool); function isValidSovereignOracleModule(address _sovereignOracleModule) external view returns (bool); function setGovernanceToken(address _governanceToken) external; function setProtocolManager(address _protocolManager) external; function setUniversalPoolFactory(address _universalPoolFactory) external; function setSovereignPoolFactory(address _sovereignPoolFactory) external; function setAuctionController(address _auctionController) external; function setEmissionsController(address _emissionsController) external; function setSovereignGaugeFactory(address _poolGaugeFactory) external; function setUniversalGaugeFactory(address _universalGaugeFactory) external; function deployUniversalGauge(address _pool, address _manager) external returns (address gauge); function deploySovereignGauge(address _pool, address _manager) external returns (address gauge); function deployALMPositionForUniversalPool( address _pool, address _almFactory, bytes calldata _constructorArgs ) external returns (address alm); function deployALMPositionForSovereignPool( address _pool, address _almFactory, bytes calldata _constructorArgs ) external returns (address alm); function deploySwapFeeModuleForPool( address _pool, address _swapFeeModuleFactory, bytes calldata _constructorArgs ) external returns (address swapFeeModule); function deployUniversalPool( address _token0, address _token1, address _poolManager, uint256 _deploySwapFeeBips ) external returns (address pool); function deploySovereignPool(SovereignPoolConstructorArgs memory _args) external returns (address pool); function deployUniversalOracleForPool( address _pool, address _universalOracleModuleFactory, bytes calldata _constructorArgs ) external returns (address universalOracleModule); function deploySovereignOracleForPool( address _pool, address _sovereignOracleModuleFactory, bytes calldata _constructorArgs ) external returns (address sovereignOracleModule); function addUniversalALMFactory(address _almFactory) external; function addSovereignALMFactory(address _almFactory) external; function addSwapFeeModuleFactory(address _swapFeeModuleFactory) external; function addUniversalOracleModuleFactory(address _universalOracleModuleFactory) external; function addSovereignOracleModuleFactory(address _sovereignOracleModuleFactory) external; function removeUniversalALMFactory(address _almFactory) external; function removeSovereignALMFactory(address _almFactory) external; function removeSwapFeeModuleFactory(address _swapFeeModuleFactory) external; function removeUniversalOracleModuleFactory(address _universalOracleModuleFactory) external; function removeSovereignOracleModuleFactory(address _sovereignOracleModuleFactory) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/ReentrancyGuardTransient.sol) pragma solidity ^0.8.24; import {TransientSlot} from "./TransientSlot.sol"; /** * @dev Variant of {ReentrancyGuard} that uses transient storage. * * NOTE: This variant only works on networks where EIP-1153 is available. * * _Available since v5.1._ */ abstract contract ReentrancyGuardTransient { using TransientSlot for *; // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ReentrancyGuard")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant REENTRANCY_GUARD_STORAGE = 0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00; /** * @dev Unauthorized reentrant call. */ error ReentrancyGuardReentrantCall(); /** * @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 (_reentrancyGuardEntered()) { revert ReentrancyGuardReentrantCall(); } // Any calls to nonReentrant after this point will fail REENTRANCY_GUARD_STORAGE.asBoolean().tstore(true); } function _nonReentrantAfter() private { REENTRANCY_GUARD_STORAGE.asBoolean().tstore(false); } /** * @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 REENTRANCY_GUARD_STORAGE.asBoolean().tload(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/Errors.sol) pragma solidity ^0.8.20; /** * @dev Collection of common custom errors used in multiple contracts * * IMPORTANT: Backwards compatibility is not guaranteed in future versions of the library. * It is recommended to avoid relying on the error API for critical functionality. * * _Available since v5.1._ */ library Errors { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error InsufficientBalance(uint256 balance, uint256 needed); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedCall(); /** * @dev The deployment failed. */ error FailedDeployment(); /** * @dev A necessary precompile is missing. */ error MissingPrecompile(address); }
// 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.1.0) (interfaces/draft-IERC6093.sol) pragma solidity ^0.8.20; /** * @dev Standard ERC-20 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 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 ERC-721 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens. */ interface IERC721Errors { /** * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-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 ERC-1155 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 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 pragma solidity ^0.8.25; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface IWETH9 is IERC20 { function deposit() external payable; function withdraw(uint256) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; /** @notice Struct returned by the swapFeeModule during the getSwapFeeInBips call. * feeInBips: The swap fee in bips. * internalContext: Arbitrary bytes context data. */ struct SwapFeeModuleData { uint256 feeInBips; bytes internalContext; } interface ISwapFeeModuleMinimal { /** @notice Returns the swap fee in bips for both Universal & Sovereign Pools. @param _tokenIn The address of the token that the user wants to swap. @param _tokenOut The address of the token that the user wants to receive. @param _amountIn The amount of tokenIn being swapped. @param _user The address of the user. @param _swapFeeModuleContext Arbitrary bytes data which can be sent to the swap fee module. @return swapFeeModuleData A struct containing the swap fee in bips, and internal context data. */ function getSwapFeeInBips( address _tokenIn, address _tokenOut, uint256 _amountIn, address _user, bytes memory _swapFeeModuleContext ) external returns (SwapFeeModuleData memory swapFeeModuleData); } interface ISwapFeeModule is ISwapFeeModuleMinimal { /** @notice Callback function called by the pool after the swap has finished. ( Universal Pools ) @param _effectiveFee The effective fee charged for the swap. @param _spotPriceTick The spot price tick after the swap. @param _amountInUsed The amount of tokenIn used for the swap. @param _amountOut The amount of the tokenOut transferred to the user. @param _swapFeeModuleData The context data returned by getSwapFeeInBips. */ function callbackOnSwapEnd( uint256 _effectiveFee, int24 _spotPriceTick, uint256 _amountInUsed, uint256 _amountOut, SwapFeeModuleData memory _swapFeeModuleData ) external; /** @notice Callback function called by the pool after the swap has finished. ( Sovereign Pools ) @param _effectiveFee The effective fee charged for the swap. @param _amountInUsed The amount of tokenIn used for the swap. @param _amountOut The amount of the tokenOut transferred to the user. @param _swapFeeModuleData The context data returned by getSwapFeeInBips. */ function callbackOnSwapEnd( uint256 _effectiveFee, uint256 _amountInUsed, uint256 _amountOut, SwapFeeModuleData memory _swapFeeModuleData ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.2.0) (utils/Address.sol) pragma solidity ^0.8.20; import {Errors} from "./Errors.sol"; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @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 Errors.InsufficientBalance(address(this).balance, amount); } (bool success, bytes memory returndata) = recipient.call{value: amount}(""); if (!success) { _revert(returndata); } } /** * @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 * {Errors.FailedCall} 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 Errors.InsufficientBalance(address(this).balance, value); } (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 {Errors.FailedCall}) 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 {Errors.FailedCall} 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 {Errors.FailedCall}. */ 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 assembly ("memory-safe") { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert Errors.FailedCall(); } } }
{ "evmVersion": "cancun", "libraries": {}, "metadata": { "appendCBOR": true, "bytecodeHash": "ipfs", "useLiteralContent": false }, "optimizer": { "enabled": true, "runs": 10000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "remappings": [ "forge-std/=lib/forge-std/src/", "@valantis-core/=lib/valantis-core/src/", "@openzeppelin/=lib/openzeppelin-contracts/", "@solmate/=lib/solmate/src/", "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "ds-test/=lib/solmate/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "openzeppelin/=lib/valantis-core/lib/openzeppelin-contracts/contracts/", "solmate/=lib/solmate/src/", "valantis-core/=lib/valantis-core/src/" ], "viaIR": false }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"address","name":"_token0","type":"address"},{"internalType":"address","name":"_token1","type":"address"},{"internalType":"address","name":"_swapFeeModule","type":"address"},{"internalType":"address","name":"_protocolFactory","type":"address"},{"internalType":"address","name":"_poolFeeRecipient1","type":"address"},{"internalType":"address","name":"_poolFeeRecipient2","type":"address"},{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"withdrawalModule_","type":"address"},{"internalType":"uint256","name":"_token0AbsErrorTolerance","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"allowance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientAllowance","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC20InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC20InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC20InvalidSender","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"}],"name":"ERC20InvalidSpender","type":"error"},{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[],"name":"FailedCall","type":"error"},{"inputs":[{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[],"name":"STEXAMM__OnlyPool","type":"error"},{"inputs":[],"name":"STEXAMM__OnlyWithdrawalModule","type":"error"},{"inputs":[],"name":"STEXAMM__ZeroAddress","type":"error"},{"inputs":[],"name":"STEXAMM___checkDeadline_expired","type":"error"},{"inputs":[],"name":"STEXAMM___verifyTimelockDelay_timelockTooHigh","type":"error"},{"inputs":[],"name":"STEXAMM___verifyTimelockDelay_timelockTooLow","type":"error"},{"inputs":[],"name":"STEXAMM__deposit_lessThanMinShares","type":"error"},{"inputs":[],"name":"STEXAMM__deposit_zeroShares","type":"error"},{"inputs":[],"name":"STEXAMM__getLiquidityQuote_nonReentrant","type":"error"},{"inputs":[],"name":"STEXAMM__onSwapCallback_NotImplemented","type":"error"},{"inputs":[],"name":"STEXAMM__proposeSwapFeeModule_ProposalAlreadyActive","type":"error"},{"inputs":[],"name":"STEXAMM__proposeWithdrawalModule_ProposalAlreadyActive","type":"error"},{"inputs":[],"name":"STEXAMM__receive_onlyWETH9","type":"error"},{"inputs":[],"name":"STEXAMM__setProposedSwapFeeModule_InactiveProposal","type":"error"},{"inputs":[],"name":"STEXAMM__setProposedSwapFeeModule_Timelock","type":"error"},{"inputs":[],"name":"STEXAMM__setProposedWithdrawalModule_InactiveProposal","type":"error"},{"inputs":[],"name":"STEXAMM__setProposedWithdrawalModule_Timelock","type":"error"},{"inputs":[],"name":"STEXAMM__unstakeToken0Reserves_amountCannotBeZero","type":"error"},{"inputs":[],"name":"STEXAMM__unstakeToken0Reserves_amountTooHigh","type":"error"},{"inputs":[],"name":"STEXAMM__withdraw_insufficientToken0Withdrawn","type":"error"},{"inputs":[],"name":"STEXAMM__withdraw_insufficientToken1Withdrawn","type":"error"},{"inputs":[],"name":"STEXAMM__withdraw_zeroShares","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountToken1","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"poolManagerFeeBips","type":"uint256"}],"name":"PoolManagerFeeSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"fee0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee1","type":"uint256"}],"name":"PoolManagerFeesClaimed","type":"event"},{"anonymous":false,"inputs":[],"name":"SwapFeeModuleProposalCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"swapFeeModule","type":"address"},{"indexed":false,"internalType":"uint256","name":"startTimestamp","type":"uint256"}],"name":"SwapFeeModuleProposed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"swapFeeModule","type":"address"}],"name":"SwapFeeModuleSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"reserve0","type":"uint256"}],"name":"Token0ReservesUnstaked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountToken0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountToken1","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"Withdraw","type":"event"},{"anonymous":false,"inputs":[],"name":"WithdrawalModuleProposalCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"withdrawalModule","type":"address"},{"indexed":false,"internalType":"uint256","name":"startTimestamp","type":"uint256"}],"name":"WithdrawalModuleProposed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"withdrawalModule","type":"address"}],"name":"WithdrawalModuleSet","type":"event"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cancelSwapFeeModuleProposal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"cancelWithdrawalModuleProposal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimPoolManagerFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_minShares","type":"uint256"},{"internalType":"uint256","name":"_deadline","type":"uint256"},{"internalType":"address","name":"_recipient","type":"address"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenIn","type":"address"},{"internalType":"uint256","name":"_amountIn","type":"uint256"},{"internalType":"bool","name":"_isInstantWithdraw","type":"bool"}],"name":"getAmountOut","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"bool","name":"isZeroToOne","type":"bool"},{"internalType":"uint256","name":"amountInMinusFee","type":"uint256"},{"internalType":"uint256","name":"feeInBips","type":"uint256"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"tokenOutSwap","type":"address"}],"internalType":"struct ALMLiquidityQuoteInput","name":"_almLiquidityQuoteInput","type":"tuple"},{"internalType":"bytes","name":"","type":"bytes"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"getLiquidityQuote","outputs":[{"components":[{"internalType":"bool","name":"isCallbackOnSwap","type":"bool"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountInFilled","type":"uint256"}],"internalType":"struct ALMLiquidityQuote","name":"quote","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"_amount1","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"onDepositLiquidityCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"","type":"bool"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"onSwapCallback","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolFeeRecipient1","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolFeeRecipient2","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_swapFeeModule","type":"address"},{"internalType":"uint256","name":"_timelockDelay","type":"uint256"}],"name":"proposeSwapFeeModule","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"withdrawalModule_","type":"address"}],"name":"proposeWithdrawalModule","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_poolManagerFeeBips","type":"uint256"}],"name":"setPoolManagerFeeBips","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"setProposedSwapFeeModule","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"setProposedWithdrawalModule","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount1","type":"uint256"}],"name":"supplyToken1Reserves","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"swapFeeModuleProposal","outputs":[{"internalType":"address","name":"swapFeeModule","type":"address"},{"internalType":"uint256","name":"startTimestamp","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token0","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token1","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_unstakeAmountToken0","type":"uint256"}],"name":"unstakeToken0Reserves","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"},{"internalType":"uint256","name":"_amount0Min","type":"uint256"},{"internalType":"uint256","name":"_amount1Min","type":"uint256"},{"internalType":"uint256","name":"_deadline","type":"uint256"},{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"bool","name":"_unwrapToNativeToken","type":"bool"},{"internalType":"bool","name":"_isInstantWithdrawal","type":"bool"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawalModule","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawalModuleProposal","outputs":[{"internalType":"address","name":"withdrawalModule","type":"address"},{"internalType":"uint256","name":"startTimestamp","type":"uint256"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
610120604052348015610010575f80fd5b5060405161499438038061499483398101604081905261002f916103fa565b8a8a846001600160a01b03811661005f57604051631e4fbdf760e01b81525f600482015260240160405180910390fd5b610068816102f4565b5060046100758382610570565b5060056100828282610570565b50506006805460ff19169055506001600160a01b03891615806100ac57506001600160a01b038816155b806100be57506001600160a01b038716155b806100d057506001600160a01b038616155b806100e257506001600160a01b038516155b806100f457506001600160a01b038416155b8061010657506001600160a01b038316155b8061011857506001600160a01b038216155b1561013657604051630f03184360e11b815260040160405180910390fd5b60408051610160810182526001600160a01b03808c1682528a8116602083015288168183018190523060608301525f6080830181905260a08301819052600160c0840181905260e0840152610100830185905261012083018190526101408301529151631f156d7560e21b8152909190637c55b5d4906101ba90849060040161062f565b6020604051808303815f875af11580156101d6573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101fa9190610718565b6001600160a01b03908116608081905260405163186e70fb60e21b8152918a166004830152906361b9c3ec906024015f604051808303815f87803b158015610240575f80fd5b505af1158015610252573d5f803e3d5ffd5b5050608051604051639e25bc7d60e01b81523060048201526001600160a01b039091169250639e25bc7d91506024015f604051808303815f87803b158015610298575f80fd5b505af11580156102aa573d5f803e3d5ffd5b505050506001600160a01b0395861660e0525050918316610100525094811660a05292831660c0525050600b80546001600160a01b03191692909116919091179055506107389050565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b634e487b7160e01b5f52604160045260245ffd5b5f82601f830112610366575f80fd5b81516001600160401b038082111561038057610380610343565b604051601f8301601f19908116603f011681019082821181831017156103a8576103a8610343565b816040528381528660208588010111156103c0575f80fd5b8360208701602083015e5f602085830101528094505050505092915050565b80516001600160a01b03811681146103f5575f80fd5b919050565b5f805f805f805f805f805f6101608c8e031215610415575f80fd5b8b516001600160401b0381111561042a575f80fd5b6104368e828f01610357565b60208e0151909c5090506001600160401b03811115610453575f80fd5b61045f8e828f01610357565b9a505061046e60408d016103df565b985061047c60608d016103df565b975061048a60808d016103df565b965061049860a08d016103df565b95506104a660c08d016103df565b94506104b460e08d016103df565b93506104c36101008d016103df565b92506104d26101208d016103df565b91506101408c015190509295989b509295989b9093969950565b600181811c9082168061050057607f821691505b60208210810361051e57634e487b7160e01b5f52602260045260245ffd5b50919050565b601f82111561056b57805f5260205f20601f840160051c810160208510156105495750805b601f840160051c820191505b81811015610568575f8155600101610555565b50505b505050565b81516001600160401b0381111561058957610589610343565b61059d8161059784546104ec565b84610524565b602080601f8311600181146105d0575f84156105b95750858301515b5f19600386901b1c1916600185901b178555610627565b5f85815260208120601f198616915b828110156105fe578886015182559484019460019091019084016105df565b508582101561061b57878501515f19600388901b60f8161c191681555b505060018460011b0185555b505050505050565b81516001600160a01b031681526101608101602083015161065b60208401826001600160a01b03169052565b50604083015161067660408401826001600160a01b03169052565b50606083015161069160608401826001600160a01b03169052565b5060808301516106ac60808401826001600160a01b03169052565b5060a08301516106c760a08401826001600160a01b03169052565b5060c08301516106db60c084018215159052565b5060e08301516106ef60e084018215159052565b506101008381015190830152610120808401519083015261014092830151929091019190915290565b5f60208284031215610728575f80fd5b610731826103df565b9392505050565b60805160a05160c05160e0516101005161414661084e5f395f818161076d01528181611a5f0152611b3701525f8181610499015281816119f80152611ad001525f81816102be0152818161071b01528181610a1d01528181611695015281816117650152818161194401528181611aae01528181611b1501526124ac01525f81816103850152818161117101528181611898015281816119d601528181611a3d0152818161246f015261264b01525f81816103d00152818161099c01528181610ad301528181610d99015281816112280152818161140c015281816114da0152818161158501528181611bf901528181611efb015281816124f9015281816128a901528181612c190152612d7501526141465ff3fe6080604052600436106102ae575f3560e01c80638a7dbaa211610165578063d435c1b9116100c6578063ef2238161161007c578063f2fde38b11610062578063f2fde38b14610866578063fad3cc4b14610885578063fc760cca146108a4575f80fd5b8063ef2238161461082a578063f2d6561714610847575f80fd5b8063dd03e4d3116100ac578063dd03e4d31461078f578063dd62ed3e146107a3578063ede5e584146107e7575f80fd5b8063d435c1b91461073d578063d4e8d0241461075c575f80fd5b8063a4e2d6341161011b578063bb93f07511610101578063bb93f075146106d7578063cb0dc7c3146106eb578063d21220a71461070a575f80fd5b8063a4e2d63414610685578063a9059cbb146106b8575f80fd5b80639194cf091161014b5780639194cf091461063e57806395d89b4114610652578063a3f3d72214610666575f80fd5b80638a7dbaa2146106035780638da5cb5b14610622575f80fd5b80633f4ba83a1161020f57806372a5635f116101c557806383b1d51e116101ab57806383b1d51e1461058a5780638456cb59146105cc578063896c470b146105e0575f80fd5b806372a5635f146105625780637ae42ac714610576575f80fd5b80635c975abb116101f55780635c975abb1461050357806370a082311461051a578063715018a61461054e575f80fd5b80633f4ba83a146104bb57806358eea9dd146104cf575f80fd5b806323b872dd11610264578063313ce5671161024a578063313ce5671461044e578063371ba7f9146104695780633d782c0714610488575f80fd5b806323b872dd146104105780632d4b23bd1461042f575f80fd5b80630dfe1681116102945780630dfe16811461037457806316f0115b146103bf57806318160ddd146103f2575f80fd5b806306fdde031461031b578063095ea7b314610345575f80fd5b3661031757336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610315576040517f54cb0ba300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b005b5f80fd5b348015610326575f80fd5b5061032f6108c3565b60405161033c9190613932565b60405180910390f35b348015610350575f80fd5b5061036461035f366004613958565b610953565b604051901515815260200161033c565b34801561037f575f80fd5b506103a77f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161033c565b3480156103ca575f80fd5b506103a77f000000000000000000000000000000000000000000000000000000000000000081565b3480156103fd575f80fd5b506003545b60405190815260200161033c565b34801561041b575f80fd5b5061036461042a366004613982565b61096c565b34801561043a575f80fd5b50610315610449366004613acd565b610991565b348015610459575f80fd5b506040516012815260200161033c565b348015610474575f80fd5b50610315610483366004613b59565b610a4b565b348015610493575f80fd5b506103a77f000000000000000000000000000000000000000000000000000000000000000081565b3480156104c6575f80fd5b50610315610c5c565b3480156104da575f80fd5b506104ee6104e9366004613b84565b610c76565b6040805192835260208301919091520161033c565b34801561050e575f80fd5b5060065460ff16610364565b348015610525575f80fd5b50610402610534366004613beb565b6001600160a01b03165f9081526001602052604090205490565b348015610559575f80fd5b506103156117f1565b34801561056d575f80fd5b50610315611802565b348015610581575f80fd5b50610315611860565b348015610595575f80fd5b50600954600a546105ad916001600160a01b03169082565b604080516001600160a01b03909316835260208301919091520161033c565b3480156105d7575f80fd5b50610315611ba2565b3480156105eb575f80fd5b506007546008546105ad916001600160a01b03169082565b34801561060e575f80fd5b5061031561061d366004613b59565b611bba565b34801561062d575f80fd5b505f546001600160a01b03166103a7565b348015610649575f80fd5b50610315611c99565b34801561065d575f80fd5b5061032f611dd3565b348015610671575f80fd5b50610315610680366004613c06565b611de2565b348015610690575f80fd5b507f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f005c610364565b3480156106c3575f80fd5b506103646106d2366004613958565b611e14565b3480156106e2575f80fd5b50610315611e21565b3480156106f6575f80fd5b50610315610705366004613958565b611fc3565b348015610715575f80fd5b506103a77f000000000000000000000000000000000000000000000000000000000000000081565b348015610748575f80fd5b50610315610757366004613beb565b612108565b348015610767575f80fd5b506103a77f000000000000000000000000000000000000000000000000000000000000000081565b34801561079a575f80fd5b50610315612249565b3480156107ae575f80fd5b506104026107bd366004613c36565b6001600160a01b039182165f90815260026020908152604080832093909416825291909152205490565b3480156107f2575f80fd5b50610806610801366004613cb2565b6122a7565b6040805182511515815260208084015190820152918101519082015260600161033c565b348015610835575f80fd5b50600b546001600160a01b03166103a7565b348015610852575f80fd5b50610402610861366004613d94565b61246c565b348015610871575f80fd5b50610315610880366004613beb565b61279e565b348015610890575f80fd5b5061040261089f366004613dcf565b6127f6565b3480156108af575f80fd5b506103156108be366004613b59565b612ceb565b6060600480546108d290613e0d565b80601f01602080910402602001604051908101604052809291908181526020018280546108fe90613e0d565b80156109495780601f1061092057610100808354040283529160200191610949565b820191905f5260205f20905b81548152906001019060200180831161092c57829003601f168201915b5050505050905090565b5f33610960818585612de5565b60019150505b92915050565b5f33610979858285612df7565b610984858585612ea5565b60019150505b9392505050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146109f3576040517fc335b1ed00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f81806020019051810190610a089190613e5e565b90508215610a4557610a456001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016823386612f34565b50505050565b600b546001600160a01b03163314610a8f576040517f0de7cc2d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610a97612fb0565b805f03610ad0576040517ff62b3b5b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f7f000000000000000000000000000000000000000000000000000000000000000090505f816001600160a01b0316630902f1ac6040518163ffffffff1660e01b81526004016040805180830381865afa158015610b30573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b549190613e79565b50905080831115610b91576040517fc56ce9a100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080515f80825260208201928390527f712290c0000000000000000000000000000000000000000000000000000000009092526001600160a01b0384169163712290c091610be99187913390819060248101613e9b565b5f604051808303815f87803b158015610c00575f80fd5b505af1158015610c12573d5f803e3d5ffd5b505050507fde72f906b8ecb1b486a298b5b3beea3da5c1e75fe09e6f4c26cd401a6cc8e77983604051610c4791815260200190565b60405180910390a15050610c59613036565b50565b610c64613060565b610c6c6130a5565b610c746130e1565b565b5f80610c80612fb0565b610c8986613151565b885f03610cc2576040517fa3beeaf900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038516610d02576040517f1e06308600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600b5f9054906101000a90046001600160a01b03166001600160a01b031663a2e620456040518163ffffffff1660e01b81526004015f604051808303815f87803b158015610d4e575f80fd5b505af1158015610d60573d5f803e3d5ffd5b50505050610d976040518060c001604052805f81526020015f81526020015f81526020015f81526020015f81526020015f81525090565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630902f1ac6040518163ffffffff1660e01b81526004016040805180830381865afa158015610df2573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e169190613e79565b604083015260208201526003548152600b54604080517ffc02abec00000000000000000000000000000000000000000000000000000000815290515f926001600160a01b03169163fc02abec9160048083019260209291908290030181865afa158015610e85573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ea99190613edd565b600b54604080517fa2fd923600000000000000000000000000000000000000000000000000000000815290519293505f926001600160a01b03909216916364697b9991839163a2fd9236916004808201926020929091908290030181865afa158015610f17573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f3b9190613edd565b6040518263ffffffff1660e01b8152600401610f5991815260200190565b602060405180830381865afa158015610f74573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f989190613edd565b90505f81838560200151610fac9190613f21565b1115610fe057610fd982848660200151610fc69190613f21565b610fd09190613f34565b85518f9061318b565b955061100c565b61100983856020015184610ff49190613f34565b610ffe9190613f34565b85518f906001613260565b90505b600b54604080517f4083902e0000000000000000000000000000000000000000000000000000000081529051611092926001600160a01b031691634083902e9160048083019260209291908290030181865afa15801561106e573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610fd09190613edd565b6060850152604084015184516110aa91908f9061318b565b84606001516110b99190613f21565b9450801561116257600b546040517fea949a1c000000000000000000000000000000000000000000000000000000008152600481018390525f916001600160a01b03169063ea949a1c90602401602060405180830381865afa158015611121573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906111459190613edd565b9050808611611154575f61115e565b61115e8187613f34565b9550505b50505083156112db575f6111987f000000000000000000000000000000000000000000000000000000000000000085600161246c565b600b546040517fea949a1c000000000000000000000000000000000000000000000000000000008152600481018790529192505f916001600160a01b039091169063ea949a1c90602401602060405180830381865afa1580156111fd573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112219190613edd565b90506127107f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316632ddf0fa16040518163ffffffff1660e01b8152600401602060405180830381865afa158015611282573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112a69190613edd565b6112b08484613f34565b6112ba9190613f47565b6112c49190613f8b565b60808401526112d38285613f21565b93505f945050505b88831015611315576040517f184d77c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8782101561134f576040517fbace11e100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611359338b6132ab565b82156113da57600b546040517f0e41ee95000000000000000000000000000000000000000000000000000000008152600481018590526001600160a01b03888116602483015290911690630e41ee95906044015f604051808303815f87803b1580156113c3575f80fd5b505af11580156113d5573d5f803e3d5ffd5b505050505b5f8160800151836113eb9190613f21565b111561178e5760808101516114009083613f21565b8160a00181815250505f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630902f1ac6040518163ffffffff1660e01b81526004016040805180830381865afa158015611465573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114899190613e79565b915050808260a00151116115475760a0820151604080515f80825260208201928390527f712290c0000000000000000000000000000000000000000000000000000000009092526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169263712290c092611515929091903390309060248101613e9b565b5f604051808303815f87803b15801561152c575f80fd5b505af115801561153e573d5f803e3d5ffd5b5050505061167d565b604080515f80825260208201928390527f712290c0000000000000000000000000000000000000000000000000000000009092526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163712290c0916115c0919085903390309060248101613e9b565b5f604051808303815f87803b1580156115d7575f80fd5b505af11580156115e9573d5f803e3d5ffd5b5050600b5460a08501516001600160a01b03909116925063cb79520c9150611612908490613f34565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16815260048101919091523060248201526044015f604051808303815f87803b158015611666575f80fd5b505af1158015611678573d5f803e3d5ffd5b505050505b81608001518260a00151111561178c578515611743577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316632e1a7d4d83608001518460a001516116d69190613f34565b6040518263ffffffff1660e01b81526004016116f491815260200190565b5f604051808303815f87803b15801561170b575f80fd5b505af115801561171d573d5f803e3d5ffd5b5050505061173e8783608001518460a001516117399190613f34565b6132fc565b61178c565b61178c8783608001518460a0015161175b9190613f34565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691906133a1565b505b60408051848152602081018490529081018b90526001600160a01b0387169033907febff2602b3f468259e1e99f613fed6691f3a6526effe6ef3e768ba7ae7a36c4f9060600160405180910390a3506117e5613036565b97509795505050505050565b6117f9613060565b610c745f6133d2565b61180a613060565b6040517f28ec0a071183a116bbb80faab6cc9b1e01d6dea5029ba3f9a133bc9d3f79f5cf905f90a1600980547fffffffffffffffffffffffff00000000000000000000000000000000000000001690555f600a55565b611868612fb0565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa1580156118e5573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906119099190613edd565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529091505f906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015611989573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906119ad9190613edd565b90508115611a87575f6119c1600284613f8b565b90508015611a1d57611a1d6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000167f0000000000000000000000000000000000000000000000000000000000000000836133a1565b5f611a288285613f34565b90508015611a8457611a846001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000167f0000000000000000000000000000000000000000000000000000000000000000836133a1565b50505b8015611b5f575f611a99600283613f8b565b90508015611af557611af56001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000167f0000000000000000000000000000000000000000000000000000000000000000836133a1565b5f611b008284613f34565b90508015611b5c57611b5c6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000167f0000000000000000000000000000000000000000000000000000000000000000836133a1565b50505b60408051838152602081018390527f9354b101c687c179e9516ece0f8b0cebbfdc205da033d49eb2b9598548ed75c2910160405180910390a15050610c74613036565b611baa613060565b611bb2613439565b610c74613476565b611bc2613060565b611bca612fb0565b6040517f8a7dbaa2000000000000000000000000000000000000000000000000000000008152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690638a7dbaa2906024015f604051808303815f87803b158015611c42575f80fd5b505af1158015611c54573d5f803e3d5ffd5b505050507f67c138aed690b53f8472c70911848132b03f2e8c321a03e5db379ad5e085020581604051611c8991815260200190565b60405180910390a1610c59613036565b611ca1613060565b604080518082019091526009546001600160a01b03168152600a54602082018190525f03611cfb576040517f7c1fa0aa00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060200151421015611d39576040517f26fbce0e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8051600b80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0390921691821790556040519081527fc72ef4a33852d89759748795117fe25697e0f54943b7d6796cafab7ec16e8dfb9060200160405180910390a150600980547fffffffffffffffffffffffff00000000000000000000000000000000000000001690555f600a55565b6060600580546108d290613e0d565b6040517f9df7851d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f33610960818585612ea5565b611e29613060565b604080518082019091526007546001600160a01b03168152600854602082018190525f03611e83576040517fc640b9e200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060200151421015611ec1576040517f9b63025800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80516040517f61b9c3ec0000000000000000000000000000000000000000000000000000000081526001600160a01b0391821660048201527f0000000000000000000000000000000000000000000000000000000000000000909116906361b9c3ec906024015f604051808303815f87803b158015611f3e575f80fd5b505af1158015611f50573d5f803e3d5ffd5b505082516040516001600160a01b0390911681527fe0d3edb906e9f17a6c8342bada5bdd7051f42bbed87eec9af9e69cd75ad98bd29250602001905060405180910390a150600780547fffffffffffffffffffffffff00000000000000000000000000000000000000001690555f600855565b611fcb613060565b6001600160a01b03821661200b576040517f1e06308600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612014816134d1565b6008541561204e576040517fdf282ba600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040518060400160405280836001600160a01b0316815260200182426120749190613f21565b90528051600780547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03909216919091179055602001516008557f61aba17274c445f1318e424e93935a8ed80fa8c683d973bd15f9eb15054b5824826120e28342613f21565b604080516001600160a01b03909316835260208301919091520160405180910390a15050565b612110613060565b6001600160a01b038116612150576040517f1e06308600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600a541561218a576040517f52c7b12a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040518060400160405280826001600160a01b031681526020014262093a806121b39190613f21565b90528051600980547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0390921691909117905560200151600a557f67dfc8da1c3ad30d749770ff7f84ea40439e0f49a4cf9e7100df62f7dbc5e1e7816122244262093a80613f21565b604080516001600160a01b03909316835260208301919091520160405180910390a150565b612251613060565b6040517f771180d15167512bd24f550dc63d38fcd3ee33b0387ebe0db8260191397c5d92905f90a1600780547fffffffffffffffffffffffff00000000000000000000000000000000000000001690555f600855565b6122ca60405180606001604052805f151581526020015f81526020015f81525090565b6122d2613439565b7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f005c1561232b576040517f49afa93800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6020860151604082015285516123cf57600b5460408083015190517f64697b990000000000000000000000000000000000000000000000000000000081526001600160a01b03909216916364697b999161238b9160040190815260200190565b602060405180830381865afa1580156123a6573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906123ca9190613edd565b61245e565b600b5460408083015190517fea949a1c0000000000000000000000000000000000000000000000000000000081526001600160a01b039092169163ea949a1c9161241f9160040190815260200190565b602060405180830381865afa15801561243a573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061245e9190613edd565b602082015295945050505050565b5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b0316141580156124e157507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b031614155b806124ea575082155b156124f657505f61098a565b5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166323c43a516040518163ffffffff1660e01b8152600401602060405180830381865afa158015612553573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906125779190613e5e565b90505f816001600160a01b0316634c7b5106875f876125965788612598565b5f5b604080515f808252602082019092526040518663ffffffff1660e01b81526004016125c7959493929190613f9e565b5f60405180830381865afa1580156125e1573d5f803e3d5ffd5b505050506040513d5f823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526126269190810190613fd7565b90505f61264686612710845f01516127106126419190613f21565b61318b565b90505f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316886001600160a01b03161490508061270e57600b546040517f64697b99000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b03909116906364697b9990602401602060405180830381865afa1580156126e5573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906127099190613edd565b612792565b600b546040517fea949a1c000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b039091169063ea949a1c90602401602060405180830381865afa15801561276e573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906127929190613edd565b98975050505050505050565b6127a6613060565b6001600160a01b0381166127ed576040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081525f60048201526024015b60405180910390fd5b610c59816133d2565b5f6127ff612fb0565b612807613439565b61281083613151565b600b5f9054906101000a90046001600160a01b03166001600160a01b031663a2e620456040518163ffffffff1660e01b81526004015f604051808303815f87803b15801561285c575f80fd5b505af115801561286e573d5f803e3d5ffd5b505050505f61287c60035490565b9050805f036128a55761289260016103e861354b565b61289e6103e887613f34565b9150612b48565b5f807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630902f1ac6040518163ffffffff1660e01b81526004016040805180830381865afa158015612902573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906129269190613e79565b915091505f600b5f9054906101000a90046001600160a01b03166001600160a01b031663fc02abec6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561297b573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061299f9190613edd565b6129a99084613f21565b90505f600b5f9054906101000a90046001600160a01b03166001600160a01b031663a2fd92366040518163ffffffff1660e01b8152600401602060405180830381865afa1580156129fc573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612a209190613edd565b600b546040517fea949a1c00000000000000000000000000000000000000000000000000000000815260048101859052919250612b41918c91889185916001600160a01b03169063ea949a1c90602401602060405180830381865afa158015612a8b573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612aaf9190613edd565b600b5f9054906101000a90046001600160a01b03166001600160a01b0316634083902e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612aff573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612b239190613edd565b612b2d9089613f21565b612b379190613f21565b6126419190613f34565b9550505050505b84821015612b82576040517f3ace3f6c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b815f03612bbb576040517f633b078f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612bc5838361354b565b604080515f8082526020820183523382840181905283518084038501815260608401948590527f41a41e9e000000000000000000000000000000000000000000000000000000009094526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016936341a41e9e93612c5393928c9290919060648201614083565b60408051808303815f875af1158015612c6e573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612c929190613e79565b505060408051878152602081018490526001600160a01b0385169133917fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7910160405180910390a350612ce3613036565b949350505050565b600b546001600160a01b03163314612d2f576040517f0de7cc2d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612d37612fb0565b604080515f80825260208201928390527f712290c0000000000000000000000000000000000000000000000000000000009092526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163712290c091612db0919085903390819060248101613e9b565b5f604051808303815f87803b158015612dc7575f80fd5b505af1158015612dd9573d5f803e3d5ffd5b50505050610c59613036565b612df28383836001613598565b505050565b6001600160a01b038381165f908152600260209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811015610a455781811015612e97576040517ffb8f41b20000000000000000000000000000000000000000000000000000000081526001600160a01b038416600482015260248101829052604481018390526064016127e4565b610a4584848484035f613598565b6001600160a01b038316612ee7576040517f96c6fd1e0000000000000000000000000000000000000000000000000000000081525f60048201526024016127e4565b6001600160a01b038216612f29576040517fec442f050000000000000000000000000000000000000000000000000000000081525f60048201526024016127e4565b612df283838361369c565b6040516001600160a01b038481166024830152838116604483015260648201839052610a459186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506137db565b7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f005c15613009576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610c7460017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f005b90613860565b610c745f7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00613030565b5f546001600160a01b03163314610c74576040517f118cdaa70000000000000000000000000000000000000000000000000000000081523360048201526024016127e4565b60065460ff16610c74576040517f8dfc202b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6130e96130a5565b600680547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b80421115610c59576040517f5090a91600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f838302817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff85870982811083820303915050805f036131de578382816131d4576131d4613f5e565b049250505061098a565b8084116131f5576131f56003851502601118613867565b5f848688095f868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b5f61328d61326d83613878565b801561328857505f848061328357613283613f5e565b868809115b151590565b61329886868661318b565b6132a29190613f21565b95945050505050565b6001600160a01b0382166132ed576040517f96c6fd1e0000000000000000000000000000000000000000000000000000000081525f60048201526024016127e4565b6132f8825f8361369c565b5050565b8047101561333f576040517fcf479181000000000000000000000000000000000000000000000000000000008152476004820152602481018290526044016127e4565b5f80836001600160a01b0316836040515f6040518083038185875af1925050503d805f8114613389576040519150601f19603f3d011682016040523d82523d5f602084013e61338e565b606091505b509150915081610a4557610a45816138a4565b6040516001600160a01b03838116602483015260448201839052612df291859182169063a9059cbb90606401612f69565b5f80546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60065460ff1615610c74576040517fd93c066500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61347e613439565b600680547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586131343390565b6203f48081101561350e576040517f312ed06f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b62093a80811115610c59576040517f4bd681fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b03821661358d576040517fec442f050000000000000000000000000000000000000000000000000000000081525f60048201526024016127e4565b6132f85f838361369c565b6001600160a01b0384166135da576040517fe602df050000000000000000000000000000000000000000000000000000000081525f60048201526024016127e4565b6001600160a01b03831661361c576040517f94280d620000000000000000000000000000000000000000000000000000000081525f60048201526024016127e4565b6001600160a01b038085165f9081526002602090815260408083209387168352929052208290558015610a4557826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161368e91815260200190565b60405180910390a350505050565b6001600160a01b0383166136c6578060035f8282546136bb9190613f21565b9091555061374f9050565b6001600160a01b0383165f9081526001602052604090205481811015613731576040517fe450d38c0000000000000000000000000000000000000000000000000000000081526001600160a01b038516600482015260248101829052604481018390526064016127e4565b6001600160a01b0384165f9081526001602052604090209082900390555b6001600160a01b03821661376b57600380548290039055613789565b6001600160a01b0382165f9081526001602052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516137ce91815260200190565b60405180910390a3505050565b5f8060205f8451602086015f885af1806137fa576040513d5f823e3d81fd5b50505f513d9150811561381157806001141561381e565b6001600160a01b0384163b155b15610a45576040517f5274afe70000000000000000000000000000000000000000000000000000000081526001600160a01b03851660048201526024016127e4565b80825d5050565b634e487b715f52806020526024601cfd5b5f600282600381111561388d5761388d6140c2565b61389791906140ef565b60ff166001149050919050565b8051156138b45780518082602001fd5b6040517fd6bda27500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f81518084528060208401602086015e5f6020828601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010191505092915050565b602081525f61098a60208301846138e6565b6001600160a01b0381168114610c59575f80fd5b5f8060408385031215613969575f80fd5b823561397481613944565b946020939093013593505050565b5f805f60608486031215613994575f80fd5b833561399f81613944565b925060208401356139af81613944565b929592945050506040919091013590565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b60405160c0810167ffffffffffffffff81118282101715613a1057613a106139c0565b60405290565b6040805190810167ffffffffffffffff81118282101715613a1057613a106139c0565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715613a8057613a806139c0565b604052919050565b5f67ffffffffffffffff821115613aa157613aa16139c0565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b5f805f60608486031215613adf575f80fd5b8335925060208401359150604084013567ffffffffffffffff811115613b03575f80fd5b8401601f81018613613b13575f80fd5b8035613b26613b2182613a88565b613a39565b818152876020838501011115613b3a575f80fd5b816020840160208301375f602083830101528093505050509250925092565b5f60208284031215613b69575f80fd5b5035919050565b80358015158114613b7f575f80fd5b919050565b5f805f805f805f60e0888a031215613b9a575f80fd5b873596506020880135955060408801359450606088013593506080880135613bc181613944565b9250613bcf60a08901613b70565b9150613bdd60c08901613b70565b905092959891949750929550565b5f60208284031215613bfb575f80fd5b813561098a81613944565b5f805f60608486031215613c18575f80fd5b613c2184613b70565b95602085013595506040909401359392505050565b5f8060408385031215613c47575f80fd5b8235613c5281613944565b91506020830135613c6281613944565b809150509250929050565b5f8083601f840112613c7d575f80fd5b50813567ffffffffffffffff811115613c94575f80fd5b602083019150836020828501011115613cab575f80fd5b9250929050565b5f805f805f858703610100811215613cc8575f80fd5b60c0811215613cd5575f80fd5b50613cde6139ed565b613ce787613b70565b815260208701356020820152604087013560408201526060870135613d0b81613944565b60608201526080870135613d1e81613944565b608082015260a0870135613d3181613944565b60a0820152945060c086013567ffffffffffffffff80821115613d52575f80fd5b613d5e89838a01613c6d565b909650945060e0880135915080821115613d76575f80fd5b50613d8388828901613c6d565b969995985093965092949392505050565b5f805f60608486031215613da6575f80fd5b8335613db181613944565b925060208401359150613dc660408501613b70565b90509250925092565b5f805f8060808587031215613de2575f80fd5b8435935060208501359250604085013591506060850135613e0281613944565b939692955090935050565b600181811c90821680613e2157607f821691505b602082108103613e58577f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b50919050565b5f60208284031215613e6e575f80fd5b815161098a81613944565b5f8060408385031215613e8a575f80fd5b505080516020909101519092909150565b8581528460208201525f6001600160a01b03808616604084015280851660608401525060a06080830152613ed260a08301846138e6565b979650505050505050565b5f60208284031215613eed575f80fd5b5051919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b8082018082111561096657610966613ef4565b8181038181111561096657610966613ef4565b808202811582820484141761096657610966613ef4565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f82613f9957613f99613f5e565b500490565b5f6001600160a01b038088168352808716602084015285604084015280851660608401525060a06080830152613ed260a08301846138e6565b5f6020808385031215613fe8575f80fd5b825167ffffffffffffffff80821115613fff575f80fd5b9084019060408287031215614012575f80fd5b61401a613a16565b82518152838301518281111561402e575f80fd5b80840193505086601f840112614042575f80fd5b82519150614052613b2183613a88565b8281528785848601011115614065575f80fd5b828585018683015e5f92810185019290925292830152509392505050565b8581528460208201526001600160a01b038416604082015260a060608201525f6140b060a08301856138e6565b828103608084015261279281856138e6565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b5f60ff83168061410157614101613f5e565b8060ff8416069150509291505056fea264697066735822122043038e10b6deca78ec5cbc9805b7557d092f80a283b0f7d7ee1bf0cb792e7ebb64736f6c63430008190033000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000ffaa4a3d97fe9107cef8a3f48c069f577ff76cc1000000000000000000000000555555555555555555555555555555555555555500000000000000000000000069317cecf77fb5dc68abe5c7aafb283de46956d90000000000000000000000007e028ac56cb2af75292f3d967978189698c24732000000000000000000000000a2666b4dd1242def4c3cf5731a85aa8457fe01c100000000000000000000000024577bacbd3b74c4065226a97e789023bba3296e000000000000000000000000388e360edaac94372df1a2663ffe52671bbd8b5800000000000000000000000040ba056b004edd0b572509a1276fd8530cf2bb7f000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000a73744859504520414d4d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d73744859504520414d4d204c5000000000000000000000000000000000000000
Deployed Bytecode
0x6080604052600436106102ae575f3560e01c80638a7dbaa211610165578063d435c1b9116100c6578063ef2238161161007c578063f2fde38b11610062578063f2fde38b14610866578063fad3cc4b14610885578063fc760cca146108a4575f80fd5b8063ef2238161461082a578063f2d6561714610847575f80fd5b8063dd03e4d3116100ac578063dd03e4d31461078f578063dd62ed3e146107a3578063ede5e584146107e7575f80fd5b8063d435c1b91461073d578063d4e8d0241461075c575f80fd5b8063a4e2d6341161011b578063bb93f07511610101578063bb93f075146106d7578063cb0dc7c3146106eb578063d21220a71461070a575f80fd5b8063a4e2d63414610685578063a9059cbb146106b8575f80fd5b80639194cf091161014b5780639194cf091461063e57806395d89b4114610652578063a3f3d72214610666575f80fd5b80638a7dbaa2146106035780638da5cb5b14610622575f80fd5b80633f4ba83a1161020f57806372a5635f116101c557806383b1d51e116101ab57806383b1d51e1461058a5780638456cb59146105cc578063896c470b146105e0575f80fd5b806372a5635f146105625780637ae42ac714610576575f80fd5b80635c975abb116101f55780635c975abb1461050357806370a082311461051a578063715018a61461054e575f80fd5b80633f4ba83a146104bb57806358eea9dd146104cf575f80fd5b806323b872dd11610264578063313ce5671161024a578063313ce5671461044e578063371ba7f9146104695780633d782c0714610488575f80fd5b806323b872dd146104105780632d4b23bd1461042f575f80fd5b80630dfe1681116102945780630dfe16811461037457806316f0115b146103bf57806318160ddd146103f2575f80fd5b806306fdde031461031b578063095ea7b314610345575f80fd5b3661031757336001600160a01b037f00000000000000000000000055555555555555555555555555555555555555551614610315576040517f54cb0ba300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b005b5f80fd5b348015610326575f80fd5b5061032f6108c3565b60405161033c9190613932565b60405180910390f35b348015610350575f80fd5b5061036461035f366004613958565b610953565b604051901515815260200161033c565b34801561037f575f80fd5b506103a77f000000000000000000000000ffaa4a3d97fe9107cef8a3f48c069f577ff76cc181565b6040516001600160a01b03909116815260200161033c565b3480156103ca575f80fd5b506103a77f0000000000000000000000005365b6ef09253c7abc0a9286ec578a9f4b413b7d81565b3480156103fd575f80fd5b506003545b60405190815260200161033c565b34801561041b575f80fd5b5061036461042a366004613982565b61096c565b34801561043a575f80fd5b50610315610449366004613acd565b610991565b348015610459575f80fd5b506040516012815260200161033c565b348015610474575f80fd5b50610315610483366004613b59565b610a4b565b348015610493575f80fd5b506103a77f000000000000000000000000a2666b4dd1242def4c3cf5731a85aa8457fe01c181565b3480156104c6575f80fd5b50610315610c5c565b3480156104da575f80fd5b506104ee6104e9366004613b84565b610c76565b6040805192835260208301919091520161033c565b34801561050e575f80fd5b5060065460ff16610364565b348015610525575f80fd5b50610402610534366004613beb565b6001600160a01b03165f9081526001602052604090205490565b348015610559575f80fd5b506103156117f1565b34801561056d575f80fd5b50610315611802565b348015610581575f80fd5b50610315611860565b348015610595575f80fd5b50600954600a546105ad916001600160a01b03169082565b604080516001600160a01b03909316835260208301919091520161033c565b3480156105d7575f80fd5b50610315611ba2565b3480156105eb575f80fd5b506007546008546105ad916001600160a01b03169082565b34801561060e575f80fd5b5061031561061d366004613b59565b611bba565b34801561062d575f80fd5b505f546001600160a01b03166103a7565b348015610649575f80fd5b50610315611c99565b34801561065d575f80fd5b5061032f611dd3565b348015610671575f80fd5b50610315610680366004613c06565b611de2565b348015610690575f80fd5b507f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f005c610364565b3480156106c3575f80fd5b506103646106d2366004613958565b611e14565b3480156106e2575f80fd5b50610315611e21565b3480156106f6575f80fd5b50610315610705366004613958565b611fc3565b348015610715575f80fd5b506103a77f000000000000000000000000555555555555555555555555555555555555555581565b348015610748575f80fd5b50610315610757366004613beb565b612108565b348015610767575f80fd5b506103a77f00000000000000000000000024577bacbd3b74c4065226a97e789023bba3296e81565b34801561079a575f80fd5b50610315612249565b3480156107ae575f80fd5b506104026107bd366004613c36565b6001600160a01b039182165f90815260026020908152604080832093909416825291909152205490565b3480156107f2575f80fd5b50610806610801366004613cb2565b6122a7565b6040805182511515815260208084015190820152918101519082015260600161033c565b348015610835575f80fd5b50600b546001600160a01b03166103a7565b348015610852575f80fd5b50610402610861366004613d94565b61246c565b348015610871575f80fd5b50610315610880366004613beb565b61279e565b348015610890575f80fd5b5061040261089f366004613dcf565b6127f6565b3480156108af575f80fd5b506103156108be366004613b59565b612ceb565b6060600480546108d290613e0d565b80601f01602080910402602001604051908101604052809291908181526020018280546108fe90613e0d565b80156109495780601f1061092057610100808354040283529160200191610949565b820191905f5260205f20905b81548152906001019060200180831161092c57829003601f168201915b5050505050905090565b5f33610960818585612de5565b60019150505b92915050565b5f33610979858285612df7565b610984858585612ea5565b60019150505b9392505050565b336001600160a01b037f0000000000000000000000005365b6ef09253c7abc0a9286ec578a9f4b413b7d16146109f3576040517fc335b1ed00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f81806020019051810190610a089190613e5e565b90508215610a4557610a456001600160a01b037f000000000000000000000000555555555555555555555555555555555555555516823386612f34565b50505050565b600b546001600160a01b03163314610a8f576040517f0de7cc2d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610a97612fb0565b805f03610ad0576040517ff62b3b5b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f7f0000000000000000000000005365b6ef09253c7abc0a9286ec578a9f4b413b7d90505f816001600160a01b0316630902f1ac6040518163ffffffff1660e01b81526004016040805180830381865afa158015610b30573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b549190613e79565b50905080831115610b91576040517fc56ce9a100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080515f80825260208201928390527f712290c0000000000000000000000000000000000000000000000000000000009092526001600160a01b0384169163712290c091610be99187913390819060248101613e9b565b5f604051808303815f87803b158015610c00575f80fd5b505af1158015610c12573d5f803e3d5ffd5b505050507fde72f906b8ecb1b486a298b5b3beea3da5c1e75fe09e6f4c26cd401a6cc8e77983604051610c4791815260200190565b60405180910390a15050610c59613036565b50565b610c64613060565b610c6c6130a5565b610c746130e1565b565b5f80610c80612fb0565b610c8986613151565b885f03610cc2576040517fa3beeaf900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038516610d02576040517f1e06308600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600b5f9054906101000a90046001600160a01b03166001600160a01b031663a2e620456040518163ffffffff1660e01b81526004015f604051808303815f87803b158015610d4e575f80fd5b505af1158015610d60573d5f803e3d5ffd5b50505050610d976040518060c001604052805f81526020015f81526020015f81526020015f81526020015f81526020015f81525090565b7f0000000000000000000000005365b6ef09253c7abc0a9286ec578a9f4b413b7d6001600160a01b0316630902f1ac6040518163ffffffff1660e01b81526004016040805180830381865afa158015610df2573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e169190613e79565b604083015260208201526003548152600b54604080517ffc02abec00000000000000000000000000000000000000000000000000000000815290515f926001600160a01b03169163fc02abec9160048083019260209291908290030181865afa158015610e85573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ea99190613edd565b600b54604080517fa2fd923600000000000000000000000000000000000000000000000000000000815290519293505f926001600160a01b03909216916364697b9991839163a2fd9236916004808201926020929091908290030181865afa158015610f17573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f3b9190613edd565b6040518263ffffffff1660e01b8152600401610f5991815260200190565b602060405180830381865afa158015610f74573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f989190613edd565b90505f81838560200151610fac9190613f21565b1115610fe057610fd982848660200151610fc69190613f21565b610fd09190613f34565b85518f9061318b565b955061100c565b61100983856020015184610ff49190613f34565b610ffe9190613f34565b85518f906001613260565b90505b600b54604080517f4083902e0000000000000000000000000000000000000000000000000000000081529051611092926001600160a01b031691634083902e9160048083019260209291908290030181865afa15801561106e573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610fd09190613edd565b6060850152604084015184516110aa91908f9061318b565b84606001516110b99190613f21565b9450801561116257600b546040517fea949a1c000000000000000000000000000000000000000000000000000000008152600481018390525f916001600160a01b03169063ea949a1c90602401602060405180830381865afa158015611121573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906111459190613edd565b9050808611611154575f61115e565b61115e8187613f34565b9550505b50505083156112db575f6111987f000000000000000000000000ffaa4a3d97fe9107cef8a3f48c069f577ff76cc185600161246c565b600b546040517fea949a1c000000000000000000000000000000000000000000000000000000008152600481018790529192505f916001600160a01b039091169063ea949a1c90602401602060405180830381865afa1580156111fd573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112219190613edd565b90506127107f0000000000000000000000005365b6ef09253c7abc0a9286ec578a9f4b413b7d6001600160a01b0316632ddf0fa16040518163ffffffff1660e01b8152600401602060405180830381865afa158015611282573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112a69190613edd565b6112b08484613f34565b6112ba9190613f47565b6112c49190613f8b565b60808401526112d38285613f21565b93505f945050505b88831015611315576040517f184d77c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8782101561134f576040517fbace11e100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611359338b6132ab565b82156113da57600b546040517f0e41ee95000000000000000000000000000000000000000000000000000000008152600481018590526001600160a01b03888116602483015290911690630e41ee95906044015f604051808303815f87803b1580156113c3575f80fd5b505af11580156113d5573d5f803e3d5ffd5b505050505b5f8160800151836113eb9190613f21565b111561178e5760808101516114009083613f21565b8160a00181815250505f7f0000000000000000000000005365b6ef09253c7abc0a9286ec578a9f4b413b7d6001600160a01b0316630902f1ac6040518163ffffffff1660e01b81526004016040805180830381865afa158015611465573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114899190613e79565b915050808260a00151116115475760a0820151604080515f80825260208201928390527f712290c0000000000000000000000000000000000000000000000000000000009092526001600160a01b037f0000000000000000000000005365b6ef09253c7abc0a9286ec578a9f4b413b7d169263712290c092611515929091903390309060248101613e9b565b5f604051808303815f87803b15801561152c575f80fd5b505af115801561153e573d5f803e3d5ffd5b5050505061167d565b604080515f80825260208201928390527f712290c0000000000000000000000000000000000000000000000000000000009092526001600160a01b037f0000000000000000000000005365b6ef09253c7abc0a9286ec578a9f4b413b7d169163712290c0916115c0919085903390309060248101613e9b565b5f604051808303815f87803b1580156115d7575f80fd5b505af11580156115e9573d5f803e3d5ffd5b5050600b5460a08501516001600160a01b03909116925063cb79520c9150611612908490613f34565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16815260048101919091523060248201526044015f604051808303815f87803b158015611666575f80fd5b505af1158015611678573d5f803e3d5ffd5b505050505b81608001518260a00151111561178c578515611743577f00000000000000000000000055555555555555555555555555555555555555556001600160a01b0316632e1a7d4d83608001518460a001516116d69190613f34565b6040518263ffffffff1660e01b81526004016116f491815260200190565b5f604051808303815f87803b15801561170b575f80fd5b505af115801561171d573d5f803e3d5ffd5b5050505061173e8783608001518460a001516117399190613f34565b6132fc565b61178c565b61178c8783608001518460a0015161175b9190613f34565b6001600160a01b037f00000000000000000000000055555555555555555555555555555555555555551691906133a1565b505b60408051848152602081018490529081018b90526001600160a01b0387169033907febff2602b3f468259e1e99f613fed6691f3a6526effe6ef3e768ba7ae7a36c4f9060600160405180910390a3506117e5613036565b97509795505050505050565b6117f9613060565b610c745f6133d2565b61180a613060565b6040517f28ec0a071183a116bbb80faab6cc9b1e01d6dea5029ba3f9a133bc9d3f79f5cf905f90a1600980547fffffffffffffffffffffffff00000000000000000000000000000000000000001690555f600a55565b611868612fb0565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201525f907f000000000000000000000000ffaa4a3d97fe9107cef8a3f48c069f577ff76cc16001600160a01b0316906370a0823190602401602060405180830381865afa1580156118e5573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906119099190613edd565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529091505f906001600160a01b037f000000000000000000000000555555555555555555555555555555555555555516906370a0823190602401602060405180830381865afa158015611989573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906119ad9190613edd565b90508115611a87575f6119c1600284613f8b565b90508015611a1d57611a1d6001600160a01b037f000000000000000000000000ffaa4a3d97fe9107cef8a3f48c069f577ff76cc1167f000000000000000000000000a2666b4dd1242def4c3cf5731a85aa8457fe01c1836133a1565b5f611a288285613f34565b90508015611a8457611a846001600160a01b037f000000000000000000000000ffaa4a3d97fe9107cef8a3f48c069f577ff76cc1167f00000000000000000000000024577bacbd3b74c4065226a97e789023bba3296e836133a1565b50505b8015611b5f575f611a99600283613f8b565b90508015611af557611af56001600160a01b037f0000000000000000000000005555555555555555555555555555555555555555167f000000000000000000000000a2666b4dd1242def4c3cf5731a85aa8457fe01c1836133a1565b5f611b008284613f34565b90508015611b5c57611b5c6001600160a01b037f0000000000000000000000005555555555555555555555555555555555555555167f00000000000000000000000024577bacbd3b74c4065226a97e789023bba3296e836133a1565b50505b60408051838152602081018390527f9354b101c687c179e9516ece0f8b0cebbfdc205da033d49eb2b9598548ed75c2910160405180910390a15050610c74613036565b611baa613060565b611bb2613439565b610c74613476565b611bc2613060565b611bca612fb0565b6040517f8a7dbaa2000000000000000000000000000000000000000000000000000000008152600481018290527f0000000000000000000000005365b6ef09253c7abc0a9286ec578a9f4b413b7d6001600160a01b031690638a7dbaa2906024015f604051808303815f87803b158015611c42575f80fd5b505af1158015611c54573d5f803e3d5ffd5b505050507f67c138aed690b53f8472c70911848132b03f2e8c321a03e5db379ad5e085020581604051611c8991815260200190565b60405180910390a1610c59613036565b611ca1613060565b604080518082019091526009546001600160a01b03168152600a54602082018190525f03611cfb576040517f7c1fa0aa00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060200151421015611d39576040517f26fbce0e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8051600b80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0390921691821790556040519081527fc72ef4a33852d89759748795117fe25697e0f54943b7d6796cafab7ec16e8dfb9060200160405180910390a150600980547fffffffffffffffffffffffff00000000000000000000000000000000000000001690555f600a55565b6060600580546108d290613e0d565b6040517f9df7851d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f33610960818585612ea5565b611e29613060565b604080518082019091526007546001600160a01b03168152600854602082018190525f03611e83576040517fc640b9e200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060200151421015611ec1576040517f9b63025800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80516040517f61b9c3ec0000000000000000000000000000000000000000000000000000000081526001600160a01b0391821660048201527f0000000000000000000000005365b6ef09253c7abc0a9286ec578a9f4b413b7d909116906361b9c3ec906024015f604051808303815f87803b158015611f3e575f80fd5b505af1158015611f50573d5f803e3d5ffd5b505082516040516001600160a01b0390911681527fe0d3edb906e9f17a6c8342bada5bdd7051f42bbed87eec9af9e69cd75ad98bd29250602001905060405180910390a150600780547fffffffffffffffffffffffff00000000000000000000000000000000000000001690555f600855565b611fcb613060565b6001600160a01b03821661200b576040517f1e06308600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612014816134d1565b6008541561204e576040517fdf282ba600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040518060400160405280836001600160a01b0316815260200182426120749190613f21565b90528051600780547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03909216919091179055602001516008557f61aba17274c445f1318e424e93935a8ed80fa8c683d973bd15f9eb15054b5824826120e28342613f21565b604080516001600160a01b03909316835260208301919091520160405180910390a15050565b612110613060565b6001600160a01b038116612150576040517f1e06308600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600a541561218a576040517f52c7b12a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040518060400160405280826001600160a01b031681526020014262093a806121b39190613f21565b90528051600980547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0390921691909117905560200151600a557f67dfc8da1c3ad30d749770ff7f84ea40439e0f49a4cf9e7100df62f7dbc5e1e7816122244262093a80613f21565b604080516001600160a01b03909316835260208301919091520160405180910390a150565b612251613060565b6040517f771180d15167512bd24f550dc63d38fcd3ee33b0387ebe0db8260191397c5d92905f90a1600780547fffffffffffffffffffffffff00000000000000000000000000000000000000001690555f600855565b6122ca60405180606001604052805f151581526020015f81526020015f81525090565b6122d2613439565b7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f005c1561232b576040517f49afa93800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6020860151604082015285516123cf57600b5460408083015190517f64697b990000000000000000000000000000000000000000000000000000000081526001600160a01b03909216916364697b999161238b9160040190815260200190565b602060405180830381865afa1580156123a6573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906123ca9190613edd565b61245e565b600b5460408083015190517fea949a1c0000000000000000000000000000000000000000000000000000000081526001600160a01b039092169163ea949a1c9161241f9160040190815260200190565b602060405180830381865afa15801561243a573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061245e9190613edd565b602082015295945050505050565b5f7f000000000000000000000000ffaa4a3d97fe9107cef8a3f48c069f577ff76cc16001600160a01b0316846001600160a01b0316141580156124e157507f00000000000000000000000055555555555555555555555555555555555555556001600160a01b0316846001600160a01b031614155b806124ea575082155b156124f657505f61098a565b5f7f0000000000000000000000005365b6ef09253c7abc0a9286ec578a9f4b413b7d6001600160a01b03166323c43a516040518163ffffffff1660e01b8152600401602060405180830381865afa158015612553573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906125779190613e5e565b90505f816001600160a01b0316634c7b5106875f876125965788612598565b5f5b604080515f808252602082019092526040518663ffffffff1660e01b81526004016125c7959493929190613f9e565b5f60405180830381865afa1580156125e1573d5f803e3d5ffd5b505050506040513d5f823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526126269190810190613fd7565b90505f61264686612710845f01516127106126419190613f21565b61318b565b90505f7f000000000000000000000000ffaa4a3d97fe9107cef8a3f48c069f577ff76cc16001600160a01b0316886001600160a01b03161490508061270e57600b546040517f64697b99000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b03909116906364697b9990602401602060405180830381865afa1580156126e5573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906127099190613edd565b612792565b600b546040517fea949a1c000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b039091169063ea949a1c90602401602060405180830381865afa15801561276e573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906127929190613edd565b98975050505050505050565b6127a6613060565b6001600160a01b0381166127ed576040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081525f60048201526024015b60405180910390fd5b610c59816133d2565b5f6127ff612fb0565b612807613439565b61281083613151565b600b5f9054906101000a90046001600160a01b03166001600160a01b031663a2e620456040518163ffffffff1660e01b81526004015f604051808303815f87803b15801561285c575f80fd5b505af115801561286e573d5f803e3d5ffd5b505050505f61287c60035490565b9050805f036128a55761289260016103e861354b565b61289e6103e887613f34565b9150612b48565b5f807f0000000000000000000000005365b6ef09253c7abc0a9286ec578a9f4b413b7d6001600160a01b0316630902f1ac6040518163ffffffff1660e01b81526004016040805180830381865afa158015612902573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906129269190613e79565b915091505f600b5f9054906101000a90046001600160a01b03166001600160a01b031663fc02abec6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561297b573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061299f9190613edd565b6129a99084613f21565b90505f600b5f9054906101000a90046001600160a01b03166001600160a01b031663a2fd92366040518163ffffffff1660e01b8152600401602060405180830381865afa1580156129fc573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612a209190613edd565b600b546040517fea949a1c00000000000000000000000000000000000000000000000000000000815260048101859052919250612b41918c91889185916001600160a01b03169063ea949a1c90602401602060405180830381865afa158015612a8b573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612aaf9190613edd565b600b5f9054906101000a90046001600160a01b03166001600160a01b0316634083902e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612aff573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612b239190613edd565b612b2d9089613f21565b612b379190613f21565b6126419190613f34565b9550505050505b84821015612b82576040517f3ace3f6c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b815f03612bbb576040517f633b078f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612bc5838361354b565b604080515f8082526020820183523382840181905283518084038501815260608401948590527f41a41e9e000000000000000000000000000000000000000000000000000000009094526001600160a01b037f0000000000000000000000005365b6ef09253c7abc0a9286ec578a9f4b413b7d16936341a41e9e93612c5393928c9290919060648201614083565b60408051808303815f875af1158015612c6e573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612c929190613e79565b505060408051878152602081018490526001600160a01b0385169133917fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7910160405180910390a350612ce3613036565b949350505050565b600b546001600160a01b03163314612d2f576040517f0de7cc2d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612d37612fb0565b604080515f80825260208201928390527f712290c0000000000000000000000000000000000000000000000000000000009092526001600160a01b037f0000000000000000000000005365b6ef09253c7abc0a9286ec578a9f4b413b7d169163712290c091612db0919085903390819060248101613e9b565b5f604051808303815f87803b158015612dc7575f80fd5b505af1158015612dd9573d5f803e3d5ffd5b50505050610c59613036565b612df28383836001613598565b505050565b6001600160a01b038381165f908152600260209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811015610a455781811015612e97576040517ffb8f41b20000000000000000000000000000000000000000000000000000000081526001600160a01b038416600482015260248101829052604481018390526064016127e4565b610a4584848484035f613598565b6001600160a01b038316612ee7576040517f96c6fd1e0000000000000000000000000000000000000000000000000000000081525f60048201526024016127e4565b6001600160a01b038216612f29576040517fec442f050000000000000000000000000000000000000000000000000000000081525f60048201526024016127e4565b612df283838361369c565b6040516001600160a01b038481166024830152838116604483015260648201839052610a459186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506137db565b7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f005c15613009576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610c7460017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f005b90613860565b610c745f7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00613030565b5f546001600160a01b03163314610c74576040517f118cdaa70000000000000000000000000000000000000000000000000000000081523360048201526024016127e4565b60065460ff16610c74576040517f8dfc202b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6130e96130a5565b600680547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b80421115610c59576040517f5090a91600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f838302817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff85870982811083820303915050805f036131de578382816131d4576131d4613f5e565b049250505061098a565b8084116131f5576131f56003851502601118613867565b5f848688095f868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b5f61328d61326d83613878565b801561328857505f848061328357613283613f5e565b868809115b151590565b61329886868661318b565b6132a29190613f21565b95945050505050565b6001600160a01b0382166132ed576040517f96c6fd1e0000000000000000000000000000000000000000000000000000000081525f60048201526024016127e4565b6132f8825f8361369c565b5050565b8047101561333f576040517fcf479181000000000000000000000000000000000000000000000000000000008152476004820152602481018290526044016127e4565b5f80836001600160a01b0316836040515f6040518083038185875af1925050503d805f8114613389576040519150601f19603f3d011682016040523d82523d5f602084013e61338e565b606091505b509150915081610a4557610a45816138a4565b6040516001600160a01b03838116602483015260448201839052612df291859182169063a9059cbb90606401612f69565b5f80546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60065460ff1615610c74576040517fd93c066500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61347e613439565b600680547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586131343390565b6203f48081101561350e576040517f312ed06f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b62093a80811115610c59576040517f4bd681fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b03821661358d576040517fec442f050000000000000000000000000000000000000000000000000000000081525f60048201526024016127e4565b6132f85f838361369c565b6001600160a01b0384166135da576040517fe602df050000000000000000000000000000000000000000000000000000000081525f60048201526024016127e4565b6001600160a01b03831661361c576040517f94280d620000000000000000000000000000000000000000000000000000000081525f60048201526024016127e4565b6001600160a01b038085165f9081526002602090815260408083209387168352929052208290558015610a4557826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161368e91815260200190565b60405180910390a350505050565b6001600160a01b0383166136c6578060035f8282546136bb9190613f21565b9091555061374f9050565b6001600160a01b0383165f9081526001602052604090205481811015613731576040517fe450d38c0000000000000000000000000000000000000000000000000000000081526001600160a01b038516600482015260248101829052604481018390526064016127e4565b6001600160a01b0384165f9081526001602052604090209082900390555b6001600160a01b03821661376b57600380548290039055613789565b6001600160a01b0382165f9081526001602052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516137ce91815260200190565b60405180910390a3505050565b5f8060205f8451602086015f885af1806137fa576040513d5f823e3d81fd5b50505f513d9150811561381157806001141561381e565b6001600160a01b0384163b155b15610a45576040517f5274afe70000000000000000000000000000000000000000000000000000000081526001600160a01b03851660048201526024016127e4565b80825d5050565b634e487b715f52806020526024601cfd5b5f600282600381111561388d5761388d6140c2565b61389791906140ef565b60ff166001149050919050565b8051156138b45780518082602001fd5b6040517fd6bda27500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f81518084528060208401602086015e5f6020828601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010191505092915050565b602081525f61098a60208301846138e6565b6001600160a01b0381168114610c59575f80fd5b5f8060408385031215613969575f80fd5b823561397481613944565b946020939093013593505050565b5f805f60608486031215613994575f80fd5b833561399f81613944565b925060208401356139af81613944565b929592945050506040919091013590565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b60405160c0810167ffffffffffffffff81118282101715613a1057613a106139c0565b60405290565b6040805190810167ffffffffffffffff81118282101715613a1057613a106139c0565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715613a8057613a806139c0565b604052919050565b5f67ffffffffffffffff821115613aa157613aa16139c0565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b5f805f60608486031215613adf575f80fd5b8335925060208401359150604084013567ffffffffffffffff811115613b03575f80fd5b8401601f81018613613b13575f80fd5b8035613b26613b2182613a88565b613a39565b818152876020838501011115613b3a575f80fd5b816020840160208301375f602083830101528093505050509250925092565b5f60208284031215613b69575f80fd5b5035919050565b80358015158114613b7f575f80fd5b919050565b5f805f805f805f60e0888a031215613b9a575f80fd5b873596506020880135955060408801359450606088013593506080880135613bc181613944565b9250613bcf60a08901613b70565b9150613bdd60c08901613b70565b905092959891949750929550565b5f60208284031215613bfb575f80fd5b813561098a81613944565b5f805f60608486031215613c18575f80fd5b613c2184613b70565b95602085013595506040909401359392505050565b5f8060408385031215613c47575f80fd5b8235613c5281613944565b91506020830135613c6281613944565b809150509250929050565b5f8083601f840112613c7d575f80fd5b50813567ffffffffffffffff811115613c94575f80fd5b602083019150836020828501011115613cab575f80fd5b9250929050565b5f805f805f858703610100811215613cc8575f80fd5b60c0811215613cd5575f80fd5b50613cde6139ed565b613ce787613b70565b815260208701356020820152604087013560408201526060870135613d0b81613944565b60608201526080870135613d1e81613944565b608082015260a0870135613d3181613944565b60a0820152945060c086013567ffffffffffffffff80821115613d52575f80fd5b613d5e89838a01613c6d565b909650945060e0880135915080821115613d76575f80fd5b50613d8388828901613c6d565b969995985093965092949392505050565b5f805f60608486031215613da6575f80fd5b8335613db181613944565b925060208401359150613dc660408501613b70565b90509250925092565b5f805f8060808587031215613de2575f80fd5b8435935060208501359250604085013591506060850135613e0281613944565b939692955090935050565b600181811c90821680613e2157607f821691505b602082108103613e58577f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b50919050565b5f60208284031215613e6e575f80fd5b815161098a81613944565b5f8060408385031215613e8a575f80fd5b505080516020909101519092909150565b8581528460208201525f6001600160a01b03808616604084015280851660608401525060a06080830152613ed260a08301846138e6565b979650505050505050565b5f60208284031215613eed575f80fd5b5051919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b8082018082111561096657610966613ef4565b8181038181111561096657610966613ef4565b808202811582820484141761096657610966613ef4565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f82613f9957613f99613f5e565b500490565b5f6001600160a01b038088168352808716602084015285604084015280851660608401525060a06080830152613ed260a08301846138e6565b5f6020808385031215613fe8575f80fd5b825167ffffffffffffffff80821115613fff575f80fd5b9084019060408287031215614012575f80fd5b61401a613a16565b82518152838301518281111561402e575f80fd5b80840193505086601f840112614042575f80fd5b82519150614052613b2183613a88565b8281528785848601011115614065575f80fd5b828585018683015e5f92810185019290925292830152509392505050565b8581528460208201526001600160a01b038416604082015260a060608201525f6140b060a08301856138e6565b828103608084015261279281856138e6565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b5f60ff83168061410157614101613f5e565b8060ff8416069150509291505056fea264697066735822122043038e10b6deca78ec5cbc9805b7557d092f80a283b0f7d7ee1bf0cb792e7ebb64736f6c63430008190033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000ffaa4a3d97fe9107cef8a3f48c069f577ff76cc1000000000000000000000000555555555555555555555555555555555555555500000000000000000000000069317cecf77fb5dc68abe5c7aafb283de46956d90000000000000000000000007e028ac56cb2af75292f3d967978189698c24732000000000000000000000000a2666b4dd1242def4c3cf5731a85aa8457fe01c100000000000000000000000024577bacbd3b74c4065226a97e789023bba3296e000000000000000000000000388e360edaac94372df1a2663ffe52671bbd8b5800000000000000000000000040ba056b004edd0b572509a1276fd8530cf2bb7f000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000a73744859504520414d4d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d73744859504520414d4d204c5000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _name (string): stHYPE AMM
Arg [1] : _symbol (string): stHYPE AMM LP
Arg [2] : _token0 (address): 0xfFaa4a3D97fE9107Cef8a3F48c069F577Ff76cC1
Arg [3] : _token1 (address): 0x5555555555555555555555555555555555555555
Arg [4] : _swapFeeModule (address): 0x69317CEcf77Fb5dc68aBE5C7aAfB283De46956d9
Arg [5] : _protocolFactory (address): 0x7E028ac56cB2AF75292F3D967978189698C24732
Arg [6] : _poolFeeRecipient1 (address): 0xA2666B4dD1242Def4c3cf5731a85Aa8457fe01C1
Arg [7] : _poolFeeRecipient2 (address): 0x24577bacbd3B74C4065226a97e789023bba3296e
Arg [8] : _owner (address): 0x388E360eDaaC94372df1a2663FFe52671bbd8B58
Arg [9] : withdrawalModule_ (address): 0x40Ba056B004Edd0b572509A1276Fd8530cf2bb7f
Arg [10] : _token0AbsErrorTolerance (uint256): 10
-----Encoded View---------------
15 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000160
Arg [1] : 00000000000000000000000000000000000000000000000000000000000001a0
Arg [2] : 000000000000000000000000ffaa4a3d97fe9107cef8a3f48c069f577ff76cc1
Arg [3] : 0000000000000000000000005555555555555555555555555555555555555555
Arg [4] : 00000000000000000000000069317cecf77fb5dc68abe5c7aafb283de46956d9
Arg [5] : 0000000000000000000000007e028ac56cb2af75292f3d967978189698c24732
Arg [6] : 000000000000000000000000a2666b4dd1242def4c3cf5731a85aa8457fe01c1
Arg [7] : 00000000000000000000000024577bacbd3b74c4065226a97e789023bba3296e
Arg [8] : 000000000000000000000000388e360edaac94372df1a2663ffe52671bbd8b58
Arg [9] : 00000000000000000000000040ba056b004edd0b572509a1276fd8530cf2bb7f
Arg [10] : 000000000000000000000000000000000000000000000000000000000000000a
Arg [11] : 000000000000000000000000000000000000000000000000000000000000000a
Arg [12] : 73744859504520414d4d00000000000000000000000000000000000000000000
Arg [13] : 000000000000000000000000000000000000000000000000000000000000000d
Arg [14] : 73744859504520414d4d204c5000000000000000000000000000000000000000
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.