Source Code
More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 9 internal transactions
Advanced mode:
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 13267963 | 54 days ago | 0.0466192 ETH | ||||
| 13267963 | 54 days ago | 0.0025 ETH | ||||
| 13267901 | 54 days ago | 0.00039218 ETH | ||||
| 13267901 | 54 days ago | 0.03961039 ETH | ||||
| 13267828 | 54 days ago | 0.000099 ETH | ||||
| 13267828 | 54 days ago | 0.01 ETH | ||||
| 13267790 | 54 days ago | 0 ETH | ||||
| 13267790 | 54 days ago | 0 ETH | ||||
| 13267790 | 54 days ago | Contract Creation | 0 ETH |
Cross-Chain Transactions
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
MemeTokenV3
Compiler Version
v0.8.27+commit.40a35a09
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.23;
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import {ERC20Burnable} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import {INonfungiblePositionManager} from "./interfaces/INonfungiblePositionManager.sol";
import {IUniswapV3Factory} from "./interfaces/IUniswapV3Factory.sol";
import {IUniswapV3Pool} from "./interfaces/IUniswapV3Pool.sol";
import {IMemeTokenV3} from "./interfaces/IMemeTokenV3.sol";
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
contract MemeTokenV3 is ERC20Burnable, IMemeTokenV3, ReentrancyGuard {
error InvalidMarketCapTarget();
error PoolAlreadyExists();
uint256 public immutable initialTokenSupply;
uint256 public virtualTokenReserves;
uint256 public virtualCollateralReserves;
uint256 public immutable virtualCollateralReservesInitial;
uint256 public immutable feeBPS;
uint256 public immutable dexFeeBPS;
uint256 public immutable mcLowerLimit;
uint256 public immutable mcUpperLimit;
uint256 public immutable tokensMigrationThreshold;
uint256 public immutable fixedMigrationFee;
uint256 public immutable poolCreationFee;
address public immutable creator;
address public pair; // uniswap v3 pool address after migration
address public immutable treasury;
address public immutable dexTreasury;
address public immutable factory;
uint256 public positionTokenId;
// Address to receive collected Uniswap V3 LP fees (token + WETH)
address public lpFeeReceiver;
// the initial LP ID and amount will be stored after adding initial liquidity
// to allow removal of liquidity when migrating
uint256 public initialLPTokenId;
uint128 public initialLPLiquidity;
bool public tradingStopped;
bool public pairTransferringNotAllowed = true;
// Snapshot of token balance when trading stopped (prevents donation attacks)
uint256 private _migrationTokenBalance;
uint256 public constant MULTIPLIER = 10_000;
INonfungiblePositionManager public immutable positionManager;
address public immutable WETH9;
uint24 public immutable poolFee;
int24 internal constant MIN_TICK = -887272;
int24 internal constant MAX_TICK = 887272;
int24 public minTick;
int24 public maxTick;
uint256 public tokenCreationFee; // fee paid to factory when deploying token
modifier buyChecks() {
if (tradingStopped) revert TradingStopped();
_;
_checkMcLower();
_checkMcUpperLimit();
}
modifier sellChecks() {
if (tradingStopped) revert TradingStopped();
_;
}
modifier onlyFactory() {
if (msg.sender != factory) revert OnlyFactory();
_;
}
constructor(ConstructorParams memory _params) ERC20(_params.name, _params.symbol) {
_mint(address(this), _params.totalSupply);
initialTokenSupply = _params.totalSupply;
virtualCollateralReserves = _params.virtualCollateralReserves;
virtualCollateralReservesInitial = _params.virtualCollateralReserves;
virtualTokenReserves = _params.virtualTokenReserves;
creator = _params.creator;
feeBPS = _params.feeBasisPoints;
dexFeeBPS = _params.dexFeeBasisPoints;
treasury = _params.treasury;
dexTreasury = _params.dexTreasury;
fixedMigrationFee = _params.migrationFeeFixed;
poolCreationFee = _params.poolCreationFee;
mcLowerLimit = _params.mcLowerLimit;
mcUpperLimit = _params.mcUpperLimit;
tokensMigrationThreshold = _params.tokensMigrationThreshold;
positionManager = INonfungiblePositionManager(_params.positionManager);
WETH9 = INonfungiblePositionManager(_params.positionManager).WETH9();
poolFee = _params.poolFee;
factory = msg.sender;
// Set LP fee receiver from params
lpFeeReceiver = _params.lpFeeReceiver;
tokenCreationFee = _params.tokenCreationFee;
int24 tickSpacing = IUniswapV3Factory(positionManager.factory()).feeAmountTickSpacing(poolFee);
minTick = int24((MIN_TICK / tickSpacing) * tickSpacing);
maxTick = int24((MAX_TICK / tickSpacing) * tickSpacing);
// Create and initialize the Uniswap V3 pool immediately to pin the initial price
(address token0, address token1) = address(this) < WETH9 ? (address(this), WETH9) : (WETH9, address(this));
// Estimate reserves at migration threshold (when mc = mcLowerLimit) by solving:
// 1) vtAtMcLower * vcAtMcLower = vt0 * vc0 (constant product invariant)
// 2) mcLowerLimit = (vcAtMcLower * initialTokenSupply) / vtAtMcLower
uint256 migrationThreshold = _params.tokensMigrationThreshold;
(uint256 vtAtMcLower, uint256 vcAtMcLower) = _reservesAfterTokensSold(
_params.virtualTokenReserves, _params.virtualCollateralReserves, migrationThreshold
);
uint160 sqrtPriceX96Init = _getSqrtPriceX96(vtAtMcLower, vcAtMcLower, token0 == address(this));
pair = _initOrValidatePool(token0, token1, sqrtPriceX96Init);
}
// function to add liquidity after contract creation to avoid price manipulation
// this function can only be called once by the factory immediately after deployment
function addInitialLiquidity() external payable onlyFactory nonReentrant {
require(tokenCreationFee > 0, "Liquidity already initialized");
uint256 ethAmount = tokenCreationFee;
require(msg.value == ethAmount, "Insufficient ETH for token creation");
tokenCreationFee = 0; // prevent re-entrancy
(address token0, address token1) = address(this) < WETH9 ? (address(this), WETH9) : (WETH9, address(this));
bool token0IsThis = token0 == address(this);
// the amount of token to add is determined by the current price in the uniswap pool
address pool = IUniswapV3Factory(positionManager.factory()).getPool(token0, token1, poolFee);
(uint160 sqrtPriceX96,,,,,,) = IUniswapV3Pool(pool).slot0();
uint256 priceX192 = uint256(sqrtPriceX96) * uint256(sqrtPriceX96);
uint256 tokenAmount = 0;
// price = token1/token0 = (priceX192 / 2^192)
// if token0 is this token, price = ETH / token
// if token0 is WETH, price = token / ETH
if (token0IsThis) {
// price = ETH / token
// => token = ETH / price
// increase 10% amount of token to ensure all ETH is used to add initial liquidity
tokenAmount = Math.mulDiv(ethAmount, 1 << 192, priceX192) * 11 / 10;
} else {
// price = token / ETH
// => token = ETH * price
// increase 10% amount of token to ensure all ETH is used to add initial liquidity
tokenAmount = Math.mulDiv(ethAmount, priceX192, 1 << 192) * 11 / 10;
}
// the amount of 2 tokens must be greater than 0
require(tokenAmount > 0 && ethAmount > 0, "Cannot add 0 liquidity");
require(balanceOf(address(this)) >= tokenAmount, "Insufficient token balance for liquidity");
_approve(address(this), address(positionManager), tokenAmount);
// close the pairTransferringNotAllowed flag to allow adding liquidity
pairTransferringNotAllowed = false;
(initialLPTokenId, initialLPLiquidity,,) = positionManager.mint{value: ethAmount}(
INonfungiblePositionManager.MintParams({
token0: token0,
token1: token1,
fee: poolFee,
tickLower: minTick,
tickUpper: maxTick,
amount0Desired: token0IsThis ? tokenAmount : ethAmount,
amount1Desired: token0IsThis ? ethAmount : tokenAmount,
amount0Min: token0IsThis ? 0 : ethAmount,
amount1Min: token0IsThis ? ethAmount : 0,
recipient: address(this),
deadline: block.timestamp
})
);
// Claim any remaining token in the position manager (should be zero)
positionManager.sweepToken(address(this), 0, address(this));
// open the pairTransferringNotAllowed flag to prevent transfers to/from pair before migration
pairTransferringNotAllowed = true;
}
function _reservesAfterTokensSold(uint256 vt0, uint256 vc0, uint256 tokensSold)
internal
pure
returns (uint256 vtAtMcLower, uint256 vcAtMcLower)
{
if (tokensSold == 0 || tokensSold >= vt0) revert InvalidMarketCapTarget();
vtAtMcLower = vt0 - tokensSold;
uint256 product = vt0 * vc0;
vcAtMcLower = product / vtAtMcLower;
}
function buyExactIn(uint256 _amountOutMin)
external
payable
onlyFactory
buyChecks
returns (uint256 collateralToPayWithFee, uint256 helioFee, uint256 dexFee)
{
if (balanceOf(address(this)) <= _amountOutMin) revert InsufficientTokenReserves();
collateralToPayWithFee = msg.value;
uint256 collateralToSpendMinusFee;
(collateralToSpendMinusFee, helioFee, dexFee) = _calculateFeeFromTotalAmount(collateralToPayWithFee);
_transferCollateral(treasury, helioFee);
_transferCollateral(dexTreasury, dexFee);
uint256 tokensOut =
(collateralToSpendMinusFee * virtualTokenReserves) / (virtualCollateralReserves + collateralToSpendMinusFee);
if (tokensOut < _amountOutMin) revert SlippageCheckFailed();
virtualTokenReserves -= tokensOut;
virtualCollateralReserves += collateralToSpendMinusFee;
_transfer(address(this), msg.sender, tokensOut);
}
function sellExactIn(uint256 _tokenAmount, uint256 _amountCollateralMin)
external
onlyFactory
sellChecks
returns (uint256 collateralToReceiveMinusFee, uint256 helioFee, uint256 dexFee)
{
uint256 collateralToReceive = (_tokenAmount * virtualCollateralReserves) / (virtualTokenReserves + _tokenAmount);
(helioFee, dexFee) = _calculateFee(collateralToReceive);
collateralToReceiveMinusFee = collateralToReceive - helioFee - dexFee;
_transferCollateral(treasury, helioFee);
_transferCollateral(dexTreasury, dexFee);
if (collateralToReceiveMinusFee < _amountCollateralMin) revert SlippageCheckFailed();
virtualTokenReserves += _tokenAmount;
virtualCollateralReserves -= collateralToReceive;
_transfer(msg.sender, address(this), _tokenAmount);
_transferCollateral(msg.sender, collateralToReceiveMinusFee);
}
function getAmountOutAndFee(uint256 _amountIn, uint256 _reserveIn, uint256 _reserveOut, bool _paymentTokenIsIn)
external
view
returns (uint256 amountOut, uint256 fee)
{
if (_paymentTokenIsIn) {
(uint256 amountInWithoutFee, uint256 helioFee, uint256 dexFee) = _calculateFeeFromTotalAmount(_amountIn);
fee = helioFee + dexFee;
amountOut = (amountInWithoutFee * _reserveOut) / (_reserveIn + amountInWithoutFee);
} else {
amountOut = (_amountIn * _reserveOut) / (_reserveIn + _amountIn);
(uint256 helioFee, uint256 dexFee) = _calculateFee(amountOut);
fee = helioFee + dexFee;
amountOut -= fee;
}
}
function migrate() external onlyFactory returns (uint256 tokensToMigrate, uint256 collateralAmount) {
pairTransferringNotAllowed = false;
// remove initial liquidity if any
if (initialLPTokenId != 0 && initialLPLiquidity != 0) {
positionManager.decreaseLiquidity(
INonfungiblePositionManager.DecreaseLiquidityParams({
tokenId: initialLPTokenId,
liquidity: initialLPLiquidity,
amount0Min: 0,
amount1Min: 0,
deadline: block.timestamp
})
);
positionManager.collect(
INonfungiblePositionManager.CollectParams({
tokenId: initialLPTokenId,
recipient: address(this),
amount0Max: type(uint128).max,
amount1Max: type(uint128).max
})
);
initialLPTokenId = 0;
initialLPLiquidity = 0;
}
uint256 tokensRemaining = _migrationTokenBalance;
_approve(address(this), address(positionManager), tokensRemaining);
tokensToMigrate = tokensRemaining;
(uint256 treasuryFee, uint256 dexFee) = _splitFee(fixedMigrationFee);
_transferCollateral(treasury, treasuryFee + poolCreationFee);
_transferCollateral(dexTreasury, dexFee);
collateralAmount =
virtualCollateralReserves - virtualCollateralReservesInitial - treasuryFee - dexFee - poolCreationFee;
// Determine token ordering
(address token0, address token1) = address(this) < WETH9 ? (address(this), WETH9) : (WETH9, address(this));
// Get pool address
address poolAddr = IUniswapV3Factory(positionManager.factory()).getPool(token0, token1, poolFee);
if (poolAddr != address(0)) {
pair = poolAddr;
}
uint256 amount0Desired = token0 == address(this) ? tokensToMigrate : collateralAmount;
uint256 amount1Desired = token0 == address(this) ? collateralAmount : tokensToMigrate;
INonfungiblePositionManager.MintParams memory params = INonfungiblePositionManager.MintParams({
token0: token0,
token1: token1,
fee: poolFee,
tickLower: minTick,
tickUpper: maxTick,
amount0Desired: amount0Desired,
amount1Desired: amount1Desired,
amount0Min: 0,
amount1Min: 0,
recipient: address(this),
deadline: block.timestamp + 10
});
(uint256 tokenId,,,) = positionManager.mint{value: collateralAmount}(params);
positionTokenId = tokenId;
// Return any unspent ETH to treasury
positionManager.refundETH();
if (address(this).balance > 0) {
_transferCollateral(treasury, address(this).balance);
}
// Claim any remaining token in the position manager (should be zero)
positionManager.sweepToken(address(this), 0, address(this));
// burn any remaining token in this contract
uint256 remainingTokenBalance = balanceOf(address(this));
if (remainingTokenBalance > 0) {
_burn(address(this), remainingTokenBalance);
}
// Liquidity is locked by holding the NFT in this contract with no withdrawal path
}
function setLpFeeReceiver(address _receiver) external onlyFactory {
require(_receiver != address(0), "lpFeeReceiver zero");
lpFeeReceiver = _receiver;
}
function collectLpFees(uint128 amount0Max, uint128 amount1Max)
external
onlyFactory
nonReentrant
returns (uint256 amount0, uint256 amount1)
{
require(positionTokenId != 0, "not migrated");
(amount0, amount1) = positionManager.collect(
INonfungiblePositionManager.CollectParams({
tokenId: positionTokenId,
recipient: lpFeeReceiver,
amount0Max: amount0Max,
amount1Max: amount1Max
})
);
}
// Transfer ownership of the Uniswap V3 LP position NFT to `recipient` so they can manage liquidity.
function transfer_lp(address recipient) external onlyFactory nonReentrant {
require(positionTokenId != 0, "not migrated");
if (recipient == address(0)) recipient = treasury;
uint256 tokenId = positionTokenId;
IERC721(address(positionManager)).safeTransferFrom(address(this), recipient, tokenId);
positionTokenId = 0;
}
function getMarketCap() public view returns (uint256) {
uint256 mc = (virtualCollateralReserves * 10 ** 18 * totalSupply()) / virtualTokenReserves;
return mc / 10 ** 18;
}
function getMaxMarketCap() public view returns (uint256) {
uint256 mc = (virtualCollateralReserves * 10 ** 18 * initialTokenSupply) / virtualTokenReserves;
return mc / 10 ** 18;
}
function getCurveProgressBps() external view returns (uint256) {
uint256 progress = ((initialTokenSupply - balanceOf(address(this))) * MULTIPLIER) / tokensMigrationThreshold;
return progress < 100 ? 100 : (progress > MULTIPLIER ? MULTIPLIER : progress);
}
function _calculateFee(uint256 _amount) internal view returns (uint256 treasuryFee, uint256 dexFee) {
treasuryFee = (_amount * feeBPS) / MULTIPLIER;
dexFee = (treasuryFee * dexFeeBPS) / MULTIPLIER;
treasuryFee -= dexFee;
}
function _calculateFeeFromTotalAmount(uint256 totalAmount)
internal
view
returns (uint256 swapAmount, uint256 treasuryFee, uint256 dexFee)
{
// totalAmount = swapAmount + treasuryFee; // From function _calculateFee
// totalAmount = swapAmount + (swapAmount * feeBPS / MULTIPLIER)
// totalAmount = swapAmount * ((MULTIPLIER + feeBPS) / MULTIPLIER)
// swapAmount = totalAmount / ((MULTIPLIER + feeBPS) / MULTIPLIER)
// swapAmount = (totalAmount * MULTIPLIER) / (MULTIPLIER + feeBPS);
swapAmount = (totalAmount * MULTIPLIER) / (MULTIPLIER + feeBPS);
treasuryFee = totalAmount - swapAmount;
dexFee = (treasuryFee * dexFeeBPS) / MULTIPLIER;
treasuryFee -= dexFee;
}
function _splitFee(uint256 _feeAmount) internal view returns (uint256 treasuryFee, uint256 dexFee) {
dexFee = (_feeAmount * dexFeeBPS) / MULTIPLIER;
treasuryFee = _feeAmount - dexFee;
}
function _transferCollateral(address _to, uint256 _amount) internal {
(bool sent,) = _to.call{value: _amount}("");
if (!sent) revert FailedToSendETH();
}
function _checkMcUpperLimit() internal view {
uint256 mc = getMaxMarketCap();
if (mc > mcUpperLimit) revert MarketcapThresholdReached();
}
function _checkMcLower() internal {
uint256 mc = getMaxMarketCap();
if (mc > mcLowerLimit) {
tradingStopped = true;
// Snapshot token balance to prevent donation attacks during migration
_migrationTokenBalance = balanceOf(address(this));
}
}
function transfer(address to, uint256 amount) public override(ERC20, IERC20) returns (bool) {
if (pairTransferringNotAllowed && (to == pair || msg.sender == pair)) {
revert PairTransferringIsNotAllowedBeforeMigration();
}
return super.transfer(to, amount);
}
function transferFrom(address from, address to, uint256 amount) public override(ERC20, IERC20) returns (bool) {
if (pairTransferringNotAllowed && (to == pair || from == pair)) {
revert PairTransferringIsNotAllowedBeforeMigration();
}
return super.transferFrom(from, to, amount);
}
function _initOrValidatePool(address token0, address token1, uint160 targetSqrtPrice)
internal
returns (address pool)
{
address uniFactory = positionManager.factory();
pool = IUniswapV3Factory(uniFactory).getPool(token0, token1, poolFee);
if (pool != address(0)) {
revert PoolAlreadyExists();
}
// Create and initialize the pool when none exists
pool = positionManager.createAndInitializePoolIfNecessary(token0, token1, poolFee, targetSqrtPrice);
}
function _getSqrtPriceX96(uint256 amountToken, uint256 amountETH, bool token0IsThis)
internal
pure
returns (uint160 priceX96)
{
// price = token1/token0
// If token0 is this token, price = ETH / token
// If token0 is WETH, price = token / ETH
if (token0IsThis) {
// price = sqrt(amountETH / amountToken) * 2^48 * 2^48 = sqrt(amountETH * 2^96 / amountToken) * 2^48
priceX96 = uint160(_sqrt((amountETH << 96) / amountToken)) << 48;
} else {
// price = sqrt(amountToken / amountETH) * 2^48 * 2^48 = sqrt(amountToken * 2^96 / amountETH) * 2^48
priceX96 = uint160(_sqrt((amountToken << 96) / amountETH)) << 48;
}
}
function _ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) return 0;
return (a - 1) / b + 1;
}
// FROM https://github.com/abdk-consulting/abdk-libraries-solidity/blob/16d7e1dd8628dfa2f88d5dadab731df7ada70bdd/ABDKMath64x64.sol#L687
function _sqrt(uint256 _x) private pure returns (uint128) {
if (_x == 0) {
return 0;
} else {
uint256 xx = _x;
uint256 r = 1;
if (xx >= 0x100000000000000000000000000000000) {
xx >>= 128;
r <<= 64;
}
if (xx >= 0x10000000000000000) {
xx >>= 64;
r <<= 32;
}
if (xx >= 0x100000000) {
xx >>= 32;
r <<= 16;
}
if (xx >= 0x10000) {
xx >>= 16;
r <<= 8;
}
if (xx >= 0x100) {
xx >>= 8;
r <<= 4;
}
if (xx >= 0x10) {
xx >>= 4;
r <<= 2;
}
if (xx >= 0x8) r <<= 1;
r = (r + _x / r) >> 1;
r = (r + _x / r) >> 1;
r = (r + _x / r) >> 1;
r = (r + _x / r) >> 1;
r = (r + _x / r) >> 1;
r = (r + _x / r) >> 1;
r = (r + _x / r) >> 1; // Seven iterations should be enough
uint256 r1 = _x / r;
return uint128(r < r1 ? r : r1);
}
}
receive() external payable {}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.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}.
*
* Both 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;
}
/// @inheritdoc IERC20
function totalSupply() public view virtual returns (uint256) {
return _totalSupply;
}
/// @inheritdoc IERC20
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;
}
/// @inheritdoc IERC20
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
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/IERC20.sol)
pragma solidity >=0.4.16;
/**
* @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/ReentrancyGuard.sol)
pragma solidity ^0.8.20;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If EIP-1153 (transient storage) is available on the chain you're deploying at,
* consider using {ReentrancyGuardTransient} instead.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant NOT_ENTERED = 1;
uint256 private constant ENTERED = 2;
uint256 private _status;
/**
* @dev Unauthorized reentrant call.
*/
error ReentrancyGuardReentrantCall();
constructor() {
_status = NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be NOT_ENTERED
if (_status == ENTERED) {
revert ReentrancyGuardReentrantCall();
}
// Any calls to nonReentrant after this point will fail
_status = ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == ENTERED;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/ERC20Burnable.sol)
pragma solidity ^0.8.20;
import {ERC20} from "../ERC20.sol";
import {Context} from "../../../utils/Context.sol";
/**
* @dev Extension of {ERC20} that allows token holders to destroy both their own
* tokens and those that they have an allowance for, in a way that can be
* recognized off-chain (via event analysis).
*/
abstract contract ERC20Burnable is Context, ERC20 {
/**
* @dev Destroys a `value` amount of tokens from the caller.
*
* See {ERC20-_burn}.
*/
function burn(uint256 value) public virtual {
_burn(_msgSender(), value);
}
/**
* @dev Destroys a `value` amount of tokens from `account`, deducting from
* the caller's allowance.
*
* See {ERC20-_burn} and {ERC20-allowance}.
*
* Requirements:
*
* - the caller must have allowance for ``accounts``'s tokens of at least
* `value`.
*/
function burnFrom(address account, uint256 value) public virtual {
_spendAllowance(account, _msgSender(), value);
_burn(account, value);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC721/IERC721.sol)
pragma solidity >=0.6.2;
import {IERC165} from "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC-721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon
* a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC-721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must have been allowed to move this token by either {approve} or
* {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon
* a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC-721
* or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
* understand this adds an external call which potentially creates a reentrancy vulnerability.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the address zero.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
}// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.23;
interface INonfungiblePositionManager {
struct CollectParams {
uint256 tokenId;
address recipient;
uint128 amount0Max;
uint128 amount1Max;
}
struct MintParams {
address token0;
address token1;
uint24 fee;
int24 tickLower;
int24 tickUpper;
uint256 amount0Desired;
uint256 amount1Desired;
uint256 amount0Min;
uint256 amount1Min;
address recipient;
uint256 deadline;
}
struct DecreaseLiquidityParams {
uint256 tokenId;
uint128 liquidity;
uint256 amount0Min;
uint256 amount1Min;
uint256 deadline;
}
/// @notice Decreases the amount of liquidity in a position and accounts it to the position
/// @param params tokenId The ID of the token for which liquidity is being decreased,
/// amount The amount by which liquidity will be decreased,
/// amount0Min The minimum amount of token0 that should be accounted for the burned liquidity,
/// amount1Min The minimum amount of token1 that should be accounted for the burned liquidity,
/// deadline The time by which the transaction must be included to effect the change
/// @return amount0 The amount of token0 accounted to the position's tokens owed
/// @return amount1 The amount of token1 accounted to the position's tokens owed
function decreaseLiquidity(DecreaseLiquidityParams calldata params)
external
payable
returns (uint256 amount0, uint256 amount1);
function factory() external view returns (address);
function WETH9() external view returns (address);
function createAndInitializePoolIfNecessary(address token0, address token1, uint24 fee, uint160 sqrtPriceX96)
external
payable
returns (address pool);
function mint(MintParams calldata params)
external
payable
returns (uint256 tokenId, uint128 liquidity, uint256 amount0, uint256 amount1);
/// @notice Refunds any ETH balance held by this contract to the `msg.sender`
/// @dev Useful for bundling with mint or increase liquidity that uses ether, or exact output swaps
/// that use ether for the input amount
function refundETH() external payable;
/// @notice Transfers the full amount of a token held by this contract to recipient
/// @dev The amountMinimum parameter prevents malicious contracts from stealing the token from users
/// @param token The contract address of the token which will be transferred to `recipient`
/// @param amountMinimum The minimum amount of token required for a transfer
/// @param recipient The destination address of the token
function sweepToken(address token, uint256 amountMinimum, address recipient) external payable;
function collect(CollectParams calldata params) external payable returns (uint256 amount0, uint256 amount1);
}// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.23;
interface IUniswapV3Factory {
event PoolCreated(address token0, address token1, uint24 fee, int24 tickSpacing, address pool);
function getPool(address tokenA, address tokenB, uint24 fee) external view returns (address pool);
function createPool(address tokenA, address tokenB, uint24 fee) external returns (address pool);
function feeAmountTickSpacing(uint24 fee) external view returns (int24);
}// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.23;
interface IUniswapV3Pool {
function slot0()
external
view
returns (
uint160 sqrtPriceX96,
int24 tick,
uint16 observationIndex,
uint16 observationCardinality,
uint16 observationCardinalityNext,
uint8 feeProtocol,
bool unlocked
);
function initialize(uint160 sqrtPriceX96) external;
function swap(
address recipient,
bool zeroForOne,
int256 amountSpecified,
uint160 sqrtPriceLimitX96,
bytes calldata data
) external returns (int256 amount0, int256 amount1);
}// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.23;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
interface IMemeTokenV3 is IERC20 {
struct ConstructorParams {
string name;
string symbol;
address creator;
uint256 totalSupply;
uint256 virtualTokenReserves;
uint256 virtualCollateralReserves;
uint256 feeBasisPoints;
uint256 dexFeeBasisPoints;
uint256 migrationFeeFixed;
uint256 poolCreationFee;
uint256 mcLowerLimit;
uint256 mcUpperLimit;
uint256 tokensMigrationThreshold;
address treasury;
address positionManager;
address dexTreasury;
uint24 poolFee;
address lpFeeReceiver; // receiver of collected Uniswap V3 LP fees
uint256 tokenCreationFee; // initial liquidity provided by the token creator
}
error NotEnoughETHReserves();
error InsufficientTokenReserves();
error FailedToSendETH();
error NotEnoughETHToBuyTokens();
error SlippageCheckFailed();
error MarketcapThresholdReached();
error PairTransferringIsNotAllowedBeforeMigration();
error TradingStopped();
error OnlyFactory();
error PoolAlreadyInitializedWithDifferentPrice();
function buyExactIn(uint256 _amountOutMin)
external
payable
returns (uint256 collateralToPayWithFee, uint256 helioFee, uint256 dexFee);
function sellExactIn(uint256 _tokenAmount, uint256 _amountOutMin)
external
returns (uint256 collateralToReceiveMinusFee, uint256 helioFee, uint256 dexFee);
function getAmountOutAndFee(uint256 _amountIn, uint256 _reserveIn, uint256 _reserveOut, bool _paymentTokenIsIn)
external
view
returns (uint256 amountOut, uint256 fee);
function migrate() external returns (uint256 tokensToMigrate, uint256 collateralAmount);
function getCurveProgressBps() external view returns (uint256);
function getMarketCap() external view returns (uint256);
function getMaxMarketCap() external view returns (uint256);
// LP fee receiver config and collection
function lpFeeReceiver() external view returns (address);
function setLpFeeReceiver(address _receiver) external;
function collectLpFees(uint128 amount0Max, uint128 amount1Max)
external
returns (uint256 amount0, uint256 amount1);
// Transfer LP position NFT to recipient
function transfer_lp(address recipient) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.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 Return the 512-bit addition of two uint256.
*
* The result is stored in two 256 variables such that sum = high * 2²⁵⁶ + low.
*/
function add512(uint256 a, uint256 b) internal pure returns (uint256 high, uint256 low) {
assembly ("memory-safe") {
low := add(a, b)
high := lt(low, a)
}
}
/**
* @dev Return the 512-bit multiplication of two uint256.
*
* The result is stored in two 256 variables such that product = high * 2²⁵⁶ + low.
*/
function mul512(uint256 a, uint256 b) internal pure returns (uint256 high, uint256 low) {
// 512-bit multiply [high low] = 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 = high * 2²⁵⁶ + low.
assembly ("memory-safe") {
let mm := mulmod(a, b, not(0))
low := mul(a, b)
high := sub(sub(mm, low), lt(mm, low))
}
}
/**
* @dev Returns the addition of two unsigned integers, with a success flag (no overflow).
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
unchecked {
uint256 c = a + b;
success = c >= a;
result = c * SafeCast.toUint(success);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with a success flag (no overflow).
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
unchecked {
uint256 c = a - b;
success = c <= a;
result = c * SafeCast.toUint(success);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with a success flag (no overflow).
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
unchecked {
uint256 c = a * b;
assembly ("memory-safe") {
// Only true when the multiplication doesn't overflow
// (c / a == b) || (a == 0)
success := or(eq(div(c, a), b), iszero(a))
}
// equivalent to: success ? c : 0
result = c * SafeCast.toUint(success);
}
}
/**
* @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 {
success = b > 0;
assembly ("memory-safe") {
// The `DIV` opcode returns zero when the denominator is 0.
result := div(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 {
success = b > 0;
assembly ("memory-safe") {
// The `MOD` opcode returns zero when the denominator is 0.
result := mod(a, b)
}
}
}
/**
* @dev Unsigned saturating addition, bounds to `2²⁵⁶ - 1` instead of overflowing.
*/
function saturatingAdd(uint256 a, uint256 b) internal pure returns (uint256) {
(bool success, uint256 result) = tryAdd(a, b);
return ternary(success, result, type(uint256).max);
}
/**
* @dev Unsigned saturating subtraction, bounds to zero instead of overflowing.
*/
function saturatingSub(uint256 a, uint256 b) internal pure returns (uint256) {
(, uint256 result) = trySub(a, b);
return result;
}
/**
* @dev Unsigned saturating multiplication, bounds to `2²⁵⁶ - 1` instead of overflowing.
*/
function saturatingMul(uint256 a, uint256 b) internal pure returns (uint256) {
(bool success, uint256 result) = tryMul(a, b);
return ternary(success, result, type(uint256).max);
}
/**
* @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 {
(uint256 high, uint256 low) = mul512(x, y);
// Handle non-overflow cases, 256 by 256 division.
if (high == 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 low / denominator;
}
// Make sure the result is less than 2²⁵⁶. Also prevents denominator == 0.
if (denominator <= high) {
Panic.panic(ternary(denominator == 0, Panic.DIVISION_BY_ZERO, Panic.UNDER_OVERFLOW));
}
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [high low].
uint256 remainder;
assembly ("memory-safe") {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
high := sub(high, gt(remainder, low))
low := sub(low, 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 ("memory-safe") {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [high low] by twos.
low := div(low, 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 high into low.
low |= high * 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 high
// is no longer required.
result = low * 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 Calculates floor(x * y >> n) with full precision. Throws if result overflows a uint256.
*/
function mulShr(uint256 x, uint256 y, uint8 n) internal pure returns (uint256 result) {
unchecked {
(uint256 high, uint256 low) = mul512(x, y);
if (high >= 1 << n) {
Panic.panic(Panic.UNDER_OVERFLOW);
}
return (high << (256 - n)) | (low >> n);
}
}
/**
* @dev Calculates x * y >> n with full precision, following the selected rounding direction.
*/
function mulShr(uint256 x, uint256 y, uint8 n, Rounding rounding) internal pure returns (uint256) {
return mulShr(x, y, n) + SafeCast.toUint(unsignedRoundsUp(rounding) && mulmod(x, y, 1 << n) > 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 x) internal pure returns (uint256 r) {
// If value has upper 128 bits set, log2 result is at least 128
r = SafeCast.toUint(x > 0xffffffffffffffffffffffffffffffff) << 7;
// If upper 64 bits of 128-bit half set, add 64 to result
r |= SafeCast.toUint((x >> r) > 0xffffffffffffffff) << 6;
// If upper 32 bits of 64-bit half set, add 32 to result
r |= SafeCast.toUint((x >> r) > 0xffffffff) << 5;
// If upper 16 bits of 32-bit half set, add 16 to result
r |= SafeCast.toUint((x >> r) > 0xffff) << 4;
// If upper 8 bits of 16-bit half set, add 8 to result
r |= SafeCast.toUint((x >> r) > 0xff) << 3;
// If upper 4 bits of 8-bit half set, add 4 to result
r |= SafeCast.toUint((x >> r) > 0xf) << 2;
// Shifts value right by the current result and use it as an index into this lookup table:
//
// | x (4 bits) | index | table[index] = MSB position |
// |------------|---------|-----------------------------|
// | 0000 | 0 | table[0] = 0 |
// | 0001 | 1 | table[1] = 0 |
// | 0010 | 2 | table[2] = 1 |
// | 0011 | 3 | table[3] = 1 |
// | 0100 | 4 | table[4] = 2 |
// | 0101 | 5 | table[5] = 2 |
// | 0110 | 6 | table[6] = 2 |
// | 0111 | 7 | table[7] = 2 |
// | 1000 | 8 | table[8] = 3 |
// | 1001 | 9 | table[9] = 3 |
// | 1010 | 10 | table[10] = 3 |
// | 1011 | 11 | table[11] = 3 |
// | 1100 | 12 | table[12] = 3 |
// | 1101 | 13 | table[13] = 3 |
// | 1110 | 14 | table[14] = 3 |
// | 1111 | 15 | table[15] = 3 |
//
// The lookup table is represented as a 32-byte value with the MSB positions for 0-15 in the last 16 bytes.
assembly ("memory-safe") {
r := or(r, byte(shr(r, x), 0x0000010102020202030303030303030300000000000000000000000000000000))
}
}
/**
* @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 x) internal pure returns (uint256 r) {
// If value has upper 128 bits set, log2 result is at least 128
r = SafeCast.toUint(x > 0xffffffffffffffffffffffffffffffff) << 7;
// If upper 64 bits of 128-bit half set, add 64 to result
r |= SafeCast.toUint((x >> r) > 0xffffffffffffffff) << 6;
// If upper 32 bits of 64-bit half set, add 32 to result
r |= SafeCast.toUint((x >> r) > 0xffffffff) << 5;
// If upper 16 bits of 32-bit half set, add 16 to result
r |= SafeCast.toUint((x >> r) > 0xffff) << 4;
// Add 1 if upper 8 bits of 16-bit half set, and divide accumulated result by 8
return (r >> 3) | SafeCast.toUint((x >> r) > 0xff);
}
/**
* @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.4.0) (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity >=0.6.2;
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.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.4.0) (interfaces/draft-IERC6093.sol)
pragma solidity >=0.8.4;
/**
* @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
// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/IERC165.sol)
pragma solidity >=0.4.16;
/**
* @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
// 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
// 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))
}
}
}{
"remappings": [
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
"forge-std/=lib/forge-std/src/",
"halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/"
],
"optimizer": {
"enabled": true,
"runs": 200
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"abi"
]
}
},
"evmVersion": "prague",
"viaIR": true
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"address","name":"creator","type":"address"},{"internalType":"uint256","name":"totalSupply","type":"uint256"},{"internalType":"uint256","name":"virtualTokenReserves","type":"uint256"},{"internalType":"uint256","name":"virtualCollateralReserves","type":"uint256"},{"internalType":"uint256","name":"feeBasisPoints","type":"uint256"},{"internalType":"uint256","name":"dexFeeBasisPoints","type":"uint256"},{"internalType":"uint256","name":"migrationFeeFixed","type":"uint256"},{"internalType":"uint256","name":"poolCreationFee","type":"uint256"},{"internalType":"uint256","name":"mcLowerLimit","type":"uint256"},{"internalType":"uint256","name":"mcUpperLimit","type":"uint256"},{"internalType":"uint256","name":"tokensMigrationThreshold","type":"uint256"},{"internalType":"address","name":"treasury","type":"address"},{"internalType":"address","name":"positionManager","type":"address"},{"internalType":"address","name":"dexTreasury","type":"address"},{"internalType":"uint24","name":"poolFee","type":"uint24"},{"internalType":"address","name":"lpFeeReceiver","type":"address"},{"internalType":"uint256","name":"tokenCreationFee","type":"uint256"}],"internalType":"struct IMemeTokenV3.ConstructorParams","name":"_params","type":"tuple"}],"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":"FailedToSendETH","type":"error"},{"inputs":[],"name":"InsufficientTokenReserves","type":"error"},{"inputs":[],"name":"InvalidMarketCapTarget","type":"error"},{"inputs":[],"name":"MarketcapThresholdReached","type":"error"},{"inputs":[],"name":"NotEnoughETHReserves","type":"error"},{"inputs":[],"name":"NotEnoughETHToBuyTokens","type":"error"},{"inputs":[],"name":"OnlyFactory","type":"error"},{"inputs":[],"name":"PairTransferringIsNotAllowedBeforeMigration","type":"error"},{"inputs":[],"name":"PoolAlreadyExists","type":"error"},{"inputs":[],"name":"PoolAlreadyInitializedWithDifferentPrice","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[],"name":"SlippageCheckFailed","type":"error"},{"inputs":[],"name":"TradingStopped","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":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"MULTIPLIER","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WETH9","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"addInitialLiquidity","outputs":[],"stateMutability":"payable","type":"function"},{"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":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"burnFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amountOutMin","type":"uint256"}],"name":"buyExactIn","outputs":[{"internalType":"uint256","name":"collateralToPayWithFee","type":"uint256"},{"internalType":"uint256","name":"helioFee","type":"uint256"},{"internalType":"uint256","name":"dexFee","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint128","name":"amount0Max","type":"uint128"},{"internalType":"uint128","name":"amount1Max","type":"uint128"}],"name":"collectLpFees","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"creator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dexFeeBPS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dexTreasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeBPS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fixedMigrationFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amountIn","type":"uint256"},{"internalType":"uint256","name":"_reserveIn","type":"uint256"},{"internalType":"uint256","name":"_reserveOut","type":"uint256"},{"internalType":"bool","name":"_paymentTokenIsIn","type":"bool"}],"name":"getAmountOutAndFee","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"fee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurveProgressBps","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMarketCap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMaxMarketCap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialLPLiquidity","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialLPTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialTokenSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lpFeeReceiver","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxTick","outputs":[{"internalType":"int24","name":"","type":"int24"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mcLowerLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mcUpperLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"migrate","outputs":[{"internalType":"uint256","name":"tokensToMigrate","type":"uint256"},{"internalType":"uint256","name":"collateralAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"minTick","outputs":[{"internalType":"int24","name":"","type":"int24"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pair","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pairTransferringNotAllowed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolCreationFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolFee","outputs":[{"internalType":"uint24","name":"","type":"uint24"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"positionManager","outputs":[{"internalType":"contract INonfungiblePositionManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"positionTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenAmount","type":"uint256"},{"internalType":"uint256","name":"_amountCollateralMin","type":"uint256"}],"name":"sellExactIn","outputs":[{"internalType":"uint256","name":"collateralToReceiveMinusFee","type":"uint256"},{"internalType":"uint256","name":"helioFee","type":"uint256"},{"internalType":"uint256","name":"dexFee","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_receiver","type":"address"}],"name":"setLpFeeReceiver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenCreationFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokensMigrationThreshold","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tradingStopped","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","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":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"}],"name":"transfer_lp","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"virtualCollateralReserves","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"virtualCollateralReservesInitial","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"virtualTokenReserves","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
610280806040523461080157613780803803809161001d8285610bab565b8339810190602081830312610801578051906001600160401b038211610801570161026081830312610801576040519161026083016001600160401b03811184821017610abc5760405281516001600160401b0381116108015781610083918401610bce565b83526020820151906001600160401b038211610801576100a4918301610bce565b908160208401526100b760408201610c23565b6040840152606081015160608401526080810151608084015260a081015160a084015260c081015160c084015260e081015160e084015261010081015161010084015261012081015161012084015261014081015161014084015261016081015161016084015261018081015190610180840191825261013a6101a08201610c23565b6101a085015261014d6101c08201610c23565b6101c08501526101606101e08201610c23565b6101e08501526102008101519062ffffff8216820361080157610240916102008601526101906102208201610c23565b6102208601520151610240840152825180519093906001600160401b038111610abc57600354600181811c91168015610ba1575b6020821014610a9e57601f8111610b3e575b50602094601f8211600114610adb579481929394955f92610ad0575b50508160011b915f199060031b1c1916176003555b82516001600160401b038111610abc57600454600181811c91168015610ab2575b6020821014610a9e57601f8111610a3b575b506020601f82116001146109d857819293945f926109cd575b50508160011b915f199060031b1c1916176004555b6001600555600c805460ff60881b1916600160881b179055606081015130156109ba5761029781600254610c58565b600255305f525f60205260405f208181540190556040519081525f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60203093a36060810151608090815260a080830151600781905590528101516006556040808201516001600160a01b039081166101a090815260c080850151905260e080850151905283015181166101c09081526101e080850151831690526101008085015161016090815261012080870151610180526101408088015190935290860151905285519052830180518216610220525191516312a9293f60e21b81529160209183916004918391165afa90811561080d575f91610980575b506102409081526102008281015162ffffff166102605233905261022080830151600a80546001600160a01b0319166001600160a01b0392831617905591830151600f555160405163c45a015560e01b81529160209183916004918391165afa90811561080d575f91610946575b50602062ffffff61026051166024604051809481936322afcccb60e01b8352600483015260018060a01b03165afa90811561080d575f9161090a575b508060020b80156108f65762ffffff61046c61045d8484620d89e71905610c37565b93600e5493620d89e805610c37565b60181b65ffffff0000001692169065ffffffffffff19161717600e5560018060a01b0361024051168030105f146108ef573090925b5160a0608084015193015190801580156108e5575b6108d6578303928084116108c2578181029181830414901517156108c257826104de91610c4e565b6001600160a01b039091169130830361089b57600160301b600160a01b03916105129161050d9160601b610c4e565b610c65565b60301b16915b6102205160405163c45a015560e01b815290602090829060049082906001600160a01b03165afa90811561080d575f91610861575b50602062ffffff610260511692606460405180948193630b4c774160e11b835288600484015260018060a01b031696876024840152604483015260018060a01b03165afa90811561080d575f91610827575b506001600160a01b03166108185760846020925f60018060a01b03610220511662ffffff61026051169660405197889687956309f56ab160e11b875260048701526024860152604485015260018060a01b031660648401525af190811561080d575f916107cf575b50600880546001600160a01b0319166001600160a01b03929092169190911790556040516129b99081610dc782396080518181816102f40152818161169c0152612479015260a05181818161061801526109ec015260c0518181816118cc015281816125d2015261264a015260e0518181816109300152818161105d0152818161260301526126960152610100518181816110d0015261126c01526101205181818161129b015261136501526101405181818161026d01526116db01526101605181818161055d01526109020152610180518181816105dd015261098701526101a05181611b7201526101c0518181816103b20152818161096201528181611109015281816111c9015261165601526101e0518181816103dc015281816109c001528181610f5e01526111f301526102005181818161032f0152818161059601528181610874015281816111680152818161142301528181611563015281816117870152611baf0152610220518181816108cd01528181610d8f01528181610ff5015281816115bc015281816118180152611c49015261024051818181610a140152818161139e0152611bfd015261026051818181610a9401528181611a5e0152611cbd0152f35b90506020813d602011610805575b816107ea60209383610bab565b81010312610801576107fb90610c23565b5f610607565b5f80fd5b3d91506107dd565b6040513d5f823e3d90fd5b630188c99160e11b5f5260045ffd5b90506020813d602011610859575b8161084260209383610bab565b810103126108015761085390610c23565b5f61059f565b3d9150610835565b90506020813d602011610893575b8161087c60209383610bab565b810103126108015761088d90610c23565b5f61054d565b3d915061086f565b600160301b600160a01b03916108b89161050d919060601b610c4e565b60301b1691610518565b634e487b7160e01b5f52601160045260245ffd5b635c571f3760e11b5f5260045ffd5b50838110156104b6565b30926104a1565b634e487b7160e01b5f52601260045260245ffd5b90506020813d60201161093e575b8161092560209383610bab565b8101031261080157518060020b8103610801575f61043b565b3d9150610918565b90506020813d602011610978575b8161096160209383610bab565b810103126108015761097290610c23565b5f6103ff565b3d9150610954565b90506020813d6020116109b2575b8161099b60209383610bab565b81010312610801576109ac90610c23565b5f610391565b3d915061098e565b63ec442f0560e01b5f525f60045260245ffd5b015190505f80610253565b601f1982169060045f52805f20915f5b818110610a2357509583600195969710610a0b575b505050811b01600455610268565b01515f1960f88460031b161c191690555f80806109fd565b9192602060018192868b0151815501940192016109e8565b60045f527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b601f830160051c81019160208410610a94575b601f0160051c01905b818110610a89575061023a565b5f8155600101610a7c565b9091508190610a73565b634e487b7160e01b5f52602260045260245ffd5b90607f1690610228565b634e487b7160e01b5f52604160045260245ffd5b015190505f806101f2565b601f1982169560035f52805f20915f5b888110610b2657508360019596979810610b0e575b505050811b01600355610207565b01515f1960f88460031b161c191690555f8080610b00565b91926020600181928685015181550194019201610aeb565b60035f527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b601f830160051c81019160208410610b97575b601f0160051c01905b818110610b8c57506101d6565b5f8155600101610b7f565b9091508190610b76565b90607f16906101c4565b601f909101601f19168101906001600160401b03821190821017610abc57604052565b81601f82011215610801578051906001600160401b038211610abc5760405192610c02601f8401601f191660200185610bab565b8284526020838301011161080157815f9260208093018386015e8301015290565b51906001600160a01b038216820361080157565b9060020b9060020b02908160020b9182036108c257565b81156108f6570490565b919082018092116108c257565b80610c6f57505f90565b600181600160801b811015610daf575b610d34610d27610d1a610d0d610d00610cf3610d4b9760088868010000000000000000610d419a1015610da2575b640100000000811015610d95575b62010000811015610d89575b610100811015610d7d575b6010811015610d70575b1015610d68575b610ced818b610c4e565b90610c58565b60011c610ced818a610c4e565b60011c610ced8189610c4e565b60011c610ced8188610c4e565b60011c610ced8187610c4e565b60011c610ced8186610c4e565b60011c610ced8185610c4e565b60011c8092610c4e565b80821015610d6157505b6001600160801b031690565b9050610d55565b60011b610ce3565b60041c9160021b91610cdc565b811c9160041b91610cd2565b60101c91811b91610cc7565b60201c9160101b91610cbb565b60401c9160201b91610cad565b50680100000000000000009050608082901c610c7f56fe6080604052600436101561001a575b3615610018575f80fd5b005b5f5f3560e01c80630210a83d14611ba157806302d05d3f14611b5c578063059f8b1614611b3f57806306fdde0314611a82578063089fe6aa14611a425780630955947114611a1c578063095ea7b3146119f557806309d2d0bc146119cc578063152044811461192b5780631655bc621461190d57806318160ddd146118ef5780631a1c6e53146118b45780631db3b6dd146118905780631f4db4e11461174a5780632368da321461167a57806323a682ef1461154757806323b872dd146114b55780632a2befd914611407578063313ce567146113eb57806342966c68146113cd5780634aa4a4fc146113885780634c7766b51461134d5780634fb3fbe714611156578063540a9f6f1461113857806361d027b3146110f35780636d04eb9f146110b857806370a082311461108057806371ea0d8e1461104557806372fcfbf814611024578063791b98bc14610fdf57806379cc679014610fab578063815eaa2014610f8d57806385f377ca14610f485780638fd3ab801461086157806390825c28146107ea57806395d89b41146106e5578063a8aa1b31146106bc578063a9059cbb1461063b578063b026a12114610600578063be74615f146105c5578063c45a015514610580578063c48afe1614610545578063ceefe5d114610527578063dd62ed3e146104d4578063dfe70ea7146104ad578063e8e70c4c1461048f578063e98d5cd514610317578063eb13a7d2146102dc578063ed4c639d146102b9578063fd62bcd7146102935763fe94c26914610256575061000e565b3461029057806003193601126102905760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b80fd5b5034610290578060031936011261029057602060ff600c5460801c166040519015158152f35b503461029057806003193601126102905760206102d4612443565b604051908152f35b503461029057806003193601126102905760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b503461029057604036600319011261029057600435907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031633036104805760ff600c5460801c166104715761038b6103796007548461229f565b6103858460065461239b565b906122b2565b91610395836125c9565b9190936103ab836103a687846123a8565b6123a8565b936103d6867f0000000000000000000000000000000000000000000000000000000000000000612752565b610400847f0000000000000000000000000000000000000000000000000000000000000000612752565b602435851061046257508161042d6104379261042261045e969560065461239b565b6006556007546123a8565b60075530336127ad565b6104418333612752565b604051938493846040919493926060820195825260208201520152565b0390f35b630a1c173f60e41b8152600490fd5b63058aab2d60e21b8152600490fd5b630636a15760e11b8152600490fd5b50346102905780600319360112610290576020600754604051908152f35b503461029057806003193601126102905760206001600160801b03600c5416604051908152f35b50346102905760403660031901126102905760406104f06121d6565b916104f96121ec565b9260018060a01b031681526001602052209060018060a01b03165f52602052602060405f2054604051908152f35b50346102905780600319360112610290576020600954604051908152f35b503461029057806003193601126102905760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b50346102905780600319360112610290576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b503461029057806003193601126102905760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b503461029057806003193601126102905760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b5034610290576040366003190112610290576106556121d6565b9060ff600c5460881c1680610690575b6106815761067660243583336127ad565b602060405160018152f35b63fa375c4160e01b8152600490fd5b506008546001600160a01b0383811691169081149081156106b2575b50610665565b905033145f6106ac565b50346102905780600319360112610290576008546040516001600160a01b039091168152602090f35b50346102905780600319360112610290576040519080600454908160011c916001811680156107e0575b6020841081146107cc578386529081156107a55750600114610748575b61045e8461073c8186038261224f565b604051918291826121ac565b600481527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b939250905b80821061078b5750909150810160200161073c8261072c565b919260018160209254838588010152019101909291610772565b60ff191660208087019190915292151560051b8501909201925061073c915083905061072c565b634e487b7160e01b83526022600452602483fd5b92607f169261070f565b503461029057806003193601126102905760075490670de0b6b3a7640000820291808304670de0b6b3a7640000149015171561084d576020670de0b6b3a764000061084461083b856002549061229f565b600654906122b2565b04604051908152f35b634e487b7160e01b81526011600452602490fd5b50346102905780600319360112610290577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316330361048057600c805460ff60881b198116909155600b54919082151580610f36575b610d83575b50600d549091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610900828230612920565b7f000000000000000000000000000000000000000000000000000000000000000090610a1161095d6127106109557f00000000000000000000000000000000000000000000000000000000000000008661229f565b0480946123a8565b6103a67f0000000000000000000000000000000000000000000000000000000000000000946103a67f0000000000000000000000000000000000000000000000000000000000000000936109ba6109b4868361239b565b89612752565b6109e4837f0000000000000000000000000000000000000000000000000000000000000000612752565b6103a66007547f0000000000000000000000000000000000000000000000000000000000000000906123a8565b917f00000000000000000000000000000000000000000000000000000000000000006001600160a01b038116301015610d7d5730905b60405163c45a015560e01b815291602083600481885afa928315610d72578893610d51575b50604051630b4c774160e11b81526001600160a01b03828116600483015283811660248301527f000000000000000000000000000000000000000000000000000000000000000062ffffff811660448401529460209183916064918391165afa908115610d46578991610d17575b506001600160a01b031680610cf9575b506001600160a01b0316913083148015610cf25787905b15610ceb5786915b600e5490600a420194854211610cd75792610b9f959262ffffff608096938e9b9a999660405197610b3989612202565b885260018060a01b031660208801521660408601528060020b606086015260181c60020b8585015260a084015260c08301528660e0830152866101008301523061012083015261014082015260405180938192634418b22b60e11b835260048301612302565b038188875af1908115610c70578491610ca5575b50600955813b15610c6c57604051630910874560e11b8152838160048183875af1908115610c70578491610c90575b505047610c7f575b50803b15610c7b57819060646040518094819363df2ab5bb60e01b83523060048401528160248401523060448401525af18015610c7057610c57575b506040809330815280602052205480610c47575b5082519182526020820152f35b610c5190306126bb565b5f610c3a565b610c6284809261224f565b610c6c575f610c26565b8280fd5b6040513d86823e3d90fd5b5080fd5b610c8a904790612752565b5f610bea565b81610c9a9161224f565b610c6c57825f610be2565b610cc7915060803d608011610cd0575b610cbf818361224f565b8101906122d0565b5050505f610bb3565b503d610cb5565b634e487b7160e01b8c52601160045260248cfd5b8791610b09565b8690610b01565b6bffffffffffffffffffffffff60a01b60085416176008555f610aea565b610d39915060203d602011610d3f575b610d31818361224f565b810190612271565b5f610ada565b503d610d27565b6040513d8b823e3d90fd5b610d6b91935060203d602011610d3f57610d31818361224f565b915f610a6c565b6040513d8a823e3d90fd5b30610a47565b60405160a081019390917f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169167ffffffffffffffff861184871017610f2257849560405283526001600160801b0360208401911681526040830184815260608401908582526001600160801b03608086019342855260405196630624e65f60e11b88525160048801525116602486015251604485015251606484015251608483015260408260a48186855af1908115610f1757604092610e9792610efb575b50600b54835190610e5b82612233565b81523060208201526001600160801b03848201526001600160801b036060820152835194858094819363fc6f786560e01b835260048301612406565b03925af18015610ef057610ec2575b5080600b556001600160801b0319600c5416600c55805f6108c4565b610ee39060403d604011610ee9575b610edb818361224f565b8101906123f0565b50610ea6565b503d610ed1565b6040513d84823e3d90fd5b610f1190843d8611610ee957610edb818361224f565b50610e4b565b6040513d85823e3d90fd5b634e487b7160e01b85526041600452602485fd5b506001600160801b03811615156108bf565b50346102905780600319360112610290576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b50346102905780600319360112610290576020600b54604051908152f35b503461029057604036600319011261029057610fdc610fc86121d6565b60243590610fd7823383612857565b6126bb565b80f35b50346102905780600319360112610290576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b50346102905780600319360112610290576020600e5460020b604051908152f35b503461029057806003193601126102905760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b5034610290576020366003190112610290576020906040906001600160a01b036110a86121d6565b1681528083522054604051908152f35b503461029057806003193601126102905760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b50346102905780600319360112610290576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b50346102905780600319360112610290576020600f54604051908152f35b506020366003190112610290576004357f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316330361133e5760ff600c5460801c1661132f57308252816020528060408320541115611320576111bf34612633565b93916111ed8294927f0000000000000000000000000000000000000000000000000000000000000000612752565b611217857f0000000000000000000000000000000000000000000000000000000000000000612752565b600654611224818361229f565b9061123660075492610385858561239b565b9384106113115791611258916112508561126296956123a8565b60065561239b565b60075533306127ad565b61126a612443565b7f0000000000000000000000000000000000000000000000000000000000000000106112e9575b611299612443565b7f0000000000000000000000000000000000000000000000000000000000000000106112da5750604080513481526020810192909252810191909152606090f35b6353dfa97560e01b8152600490fd5b600c805460ff60801b1916600160801b17905530815260208190526040812054600d55611291565b630a1c173f60e41b8552600485fd5b63904db1ff60e01b8252600482fd5b63058aab2d60e21b8252600482fd5b630636a15760e11b8252600482fd5b503461029057806003193601126102905760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b50346102905780600319360112610290576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b503461029057602036600319011261029057610fdc600435336126bb565b5034610290578060031936011261029057602060405160128152f35b5034610290576020366003190112610290576114216121d6565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316330361133e576001600160a01b0316801561147b576bffffffffffffffffffffffff60a01b600a541617600a5580f35b60405162461bcd60e51b81526020600482015260126024820152716c704665655265636569766572207a65726f60701b6044820152606490fd5b5034610290576060366003190112610290576114cf6121d6565b6114d76121ec565b6044359160ff600c5460881c1680611512575b6115035761067693506114fe833383612857565b6127ad565b63fa375c4160e01b8452600484fd5b506008546001600160a01b038381169116908114908115611534575b506114ea565b6001600160a01b0383161490505f61152e565b5034610290576020366003190112610290576115616121d6565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316330361133e57819061159b6124a2565b80600954916115ab8315156123b5565b6001600160a01b031615611653575b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031691823b1561164e57604051632142170760e11b81523060048201526001600160a01b03909216602483015260448201529082908290606490829084905af18015610ef057611639575b50600955600160055580f35b816116439161224f565b61029057805f61162d565b505050fd5b507f00000000000000000000000000000000000000000000000000000000000000006115ba565b5034610290578060031936011261029057308152806020526116c060408220547f00000000000000000000000000000000000000000000000000000000000000006123a8565b612710810290808204612710149015171561173657611700907f0000000000000000000000000000000000000000000000000000000000000000906122b2565b90606482101561171857505060206064604051908152f35b5061271081111561172e575060206127106102d4565b6020906102d4565b634e487b7160e01b82526011600452602482fd5b503461029057604036600319011261029057600435906001600160801b038216809203610290576024356001600160801b038116809103610c7b577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316330361133e57611813926040916117c46124a2565b600954916117d38315156123b5565b60018060a01b03600a54168451936117ea85612233565b8452602084015283830152606082015281518094819263fc6f786560e01b835260048301612406565b0381847f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165af18015611883576040928291611864575b50600160055582519182526020820152f35b905061187d9150823d8411610ee957610edb818361224f565b5f611852565b50604051903d90823e3d90fd5b50346102905780600319360112610290576020600e5460181c60020b604051908152f35b503461029057806003193601126102905760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b50346102905780600319360112610290576020600254604051908152f35b50346102905780600319360112610290576020600654604051908152f35b50346102905760803660031901126102905760443560243560043560643580151581036119c8576040945015611995579061038561197a61198161197161198795612633565b9093919361239b565b958261229f565b9261239b565b905b82519182526020820152f35b806119816119a6946103859361229f565b6119c26119bb6119b5836125c9565b9061239b565b80926123a8565b90611989565b8480fd5b5034610290578060031936011261029057600a546040516001600160a01b039091168152602090f35b503461029057604036600319011261029057610676611a126121d6565b6024359033612920565b5034610290578060031936011261029057602060ff600c5460881c166040519015158152f35b5034610290578060031936011261029057602060405162ffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b50346102905780600319360112610290576040519080600354908160011c91600181168015611b35575b6020841081146107cc578386529081156107a55750600114611ad85761045e8461073c8186038261224f565b600381527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b939250905b808210611b1b5750909150810160200161073c8261072c565b919260018160209254838588010152019101909291611b02565b92607f1692611aac565b503461029057806003193601126102905760206040516127108152f35b50346102905780600319360112610290576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b505f366003190112611f05577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316330361219d57611be56124a2565b600f548015908161215857803403612107575f600f557f0000000000000000000000000000000000000000000000000000000000000000916001600160a01b038316301015612100573092915b60405163c45a015560e01b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116959081169291308414906020816004818b5afa908115611efa578793611cf7926020925f916120e3575b50604051630b4c774160e11b81526001600160a01b0392831660048201529990911660248a01527f000000000000000000000000000000000000000000000000000000000000000062ffffff811660448b01529892839190829081906064820190565b03916001600160a01b03165afa908115611efa5760049160e0915f916120c4575b50604051633850c7bd831b815292839182906001600160a01b03165afa8015611efa575f9061202f575b611d5691506001600160a01b03168061229f565b811561200857611d669084612521565b600b810290808204600b1490151715611ff457600a9004945b8515159081611feb575b5015611fad57305f525f6020528460405f205410611f5757611e5d9585611db36080978a30612920565b600c805460ff60881b19169055600e548315611f5057815b8415611f45575062ffffff86935b8515611f3e575f955b15611f375787965b60405199611df78b612202565b8a5260018060a01b031660208a01521660408801528060020b606088015260181c60020b8787015260a086015260c085015260e084015261010083015230610120830152426101408301526040518080958194634418b22b60e11b835260048301612302565b0391865af18015611efa575f915f91611f09575b506001600160801b03166001600160801b0319600c541617600c55600b55803b15611f05575f809160646040518094819363df2ab5bb60e01b83523060048401528160248401523060448401525af18015611efa57611ee7575b50600c805460ff60881b1916600160881b179055600160055580f35b611ef391505f9061224f565b5f5f611ecb565b6040513d5f823e3d90fd5b5f80fd5b6001600160801b039250611f2c915060803d608011610cd057610cbf818361224f565b505091909190611e71565b5f96611dea565b8795611de2565b62ffffff9093611dd9565b8591611dcb565b60405162461bcd60e51b815260206004820152602860248201527f496e73756666696369656e7420746f6b656e2062616c616e636520666f72206c604482015267697175696469747960c01b6064820152608490fd5b60405162461bcd60e51b815260206004820152601660248201527543616e6e6f74206164642030206c697175696469747960501b6044820152606490fd5b9050155f611d89565b634e487b7160e01b5f52601160045260245ffd5b61201290846124c2565b600b810290808204600b1490151715611ff457600a900494611d7f565b5060e0813d60e0116120bc575b8161204960e0938361224f565b81010312611f05578051906001600160a01b0382168203611f055760208101518060020b03611f055761207e60408201612290565b5061208b60608201612290565b5061209860808201612290565b5060a081015160ff811603611f055760c0015180151503611f0557611d5690611d42565b3d915061203c565b6120dd915060203d602011610d3f57610d31818361224f565b5f611d18565b6120fa9150833d8511610d3f57610d31818361224f565b5f611c94565b3091611c32565b60405162461bcd60e51b815260206004820152602360248201527f496e73756666696369656e742045544820666f7220746f6b656e20637265617460448201526234b7b760e91b6064820152608490fd5b60405162461bcd60e51b815260206004820152601d60248201527f4c697175696469747920616c726561647920696e697469616c697a65640000006044820152606490fd5b630636a15760e11b5f5260045ffd5b602060409281835280519182918282860152018484015e5f828201840152601f01601f1916010190565b600435906001600160a01b0382168203611f0557565b602435906001600160a01b0382168203611f0557565b610160810190811067ffffffffffffffff82111761221f57604052565b634e487b7160e01b5f52604160045260245ffd5b6080810190811067ffffffffffffffff82111761221f57604052565b90601f8019910116810190811067ffffffffffffffff82111761221f57604052565b90816020910312611f0557516001600160a01b0381168103611f055790565b519061ffff82168203611f0557565b81810292918115918404141715611ff457565b81156122bc570490565b634e487b7160e01b5f52601260045260245ffd5b9190826080910312611f055781519160208101516001600160801b0381168103611f0557916060604083015192015190565b9190916101408061016083019460018060a01b03815116845260018060a01b03602082015116602085015262ffffff6040820151166040850152606081015160020b6060850152608081015160020b608085015260a081015160a085015260c081015160c085015260e081015160e085015261010081015161010085015260018060a01b03610120820151166101208501520151910152565b91908201809211611ff457565b91908203918211611ff457565b156123bc57565b60405162461bcd60e51b815260206004820152600c60248201526b1b9bdd081b5a59dc985d195960a21b6044820152606490fd5b9190826040910312611f05576020825192015190565b91909160606001600160801b038160808401958051855260018060a01b036020820151166020860152826040820151166040860152015116910152565b600754670de0b6b3a7640000810290808204670de0b6b3a76400001490151715611ff45761249e61083b670de0b6b3a7640000927f00000000000000000000000000000000000000000000000000000000000000009061229f565b0490565b6002600554146124b3576002600555565b633ee5aeb560e01b5f5260045ffd5b5f91905f19828209918082029384808510940393808503941461251757600160c01b8410156125055750600160c01b910990828211900360401b910360c01c1790565b634e487b71905260116020526024601cfd5b5050505060c01c90565b5f19600160c01b8209918160c01b918280851094039380850394146125ba57838211156125a2578190600160c01b9009815f0382168092046002816003021880820260020302808202600203028082026002030280820260020302808202600203028091026002030293600183805f03040190848311900302920304170290565b50634e487b715f52156003026011186020526024601cfd5b50906125c692506122b2565b90565b6125f7612710917f00000000000000000000000000000000000000000000000000000000000000009061229f565b046126306127106126287f00000000000000000000000000000000000000000000000000000000000000008461229f565b0480926123a8565b91565b9061271082028281046127101483151715611ff4577f000000000000000000000000000000000000000000000000000000000000000061271001908161271011611ff45761268b91612684916122b2565b80936123a8565b6126306127106126287f00000000000000000000000000000000000000000000000000000000000000008461229f565b9091906001600160a01b0316801561273f57805f525f60205260405f2054838110612725576020845f94957fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef938587528684520360408620558060025403600255604051908152a3565b915063391434e360e21b5f5260045260245260445260645ffd5b634b637e8f60e11b5f525f60045260245ffd5b5f80809381935af13d156127a8573d67ffffffffffffffff811161221f5760405190612788601f8201601f19166020018361224f565b81525f60203d92013e5b1561279957565b6338822c1360e11b5f5260045ffd5b612792565b6001600160a01b031690811561273f576001600160a01b031691821561284457815f525f60205260405f205481811061282b57817fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92602092855f525f84520360405f2055845f525f825260405f20818154019055604051908152a3565b8263391434e360e21b5f5260045260245260445260645ffd5b63ec442f0560e01b5f525f60045260245ffd5b6001600160a01b039081165f818152600160209081526040808320948616835293905291909120549291905f198410612891575b50505050565b8284106128fd5780156128ea576001600160a01b038216156128d7575f52600160205260405f209060018060a01b03165f5260205260405f20910390555f80808061288b565b634a1406b160e11b5f525f60045260245ffd5b63e602df0560e01b5f525f60045260245ffd5b508290637dc7a0d960e11b5f5260018060a01b031660045260245260445260645ffd5b6001600160a01b03169081156128ea576001600160a01b03169182156128d75760207f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591835f526001825260405f20855f5282528060405f2055604051908152a356fea2646970667358221220af85bf2c42fda269039bd0eb11b603d3b324c45d0023c7ac234b06549bc9238764736f6c634300081b00330000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000026000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000d5d54760f829b0ac8dddc3763f351963db31544000000000000000000000000000000000000000000084595161401484a00000000000000000000000000000000000000000000000008c4a326c3490a110000000000000000000000000000000000000000000000000000000038d7ea4c680000000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008e1bc9bf04000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003782dace9d9000000000000000000000000000000000000000000000000000003bf3b91c95b0000000000000000000000000000000000000000000000069d16e3d1d123f13600000000000000000000000000000d5d54760f829b0ac8dddc3763f351963db315440000000000000000000000002659c6085d26144117d904c46b48b6d180393d270000000000000000000000000d5d54760f829b0ac8dddc3763f351963db315440000000000000000000000000000000000000000000000000000000000000bb80000000000000000000000000d5d54760f829b0ac8dddc3763f351963db3154400000000000000000000000000000000000000000000000000000000000f4240000000000000000000000000000000000000000000000000000000000000000a74656e746f75746573740000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037474740000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x6080604052600436101561001a575b3615610018575f80fd5b005b5f5f3560e01c80630210a83d14611ba157806302d05d3f14611b5c578063059f8b1614611b3f57806306fdde0314611a82578063089fe6aa14611a425780630955947114611a1c578063095ea7b3146119f557806309d2d0bc146119cc578063152044811461192b5780631655bc621461190d57806318160ddd146118ef5780631a1c6e53146118b45780631db3b6dd146118905780631f4db4e11461174a5780632368da321461167a57806323a682ef1461154757806323b872dd146114b55780632a2befd914611407578063313ce567146113eb57806342966c68146113cd5780634aa4a4fc146113885780634c7766b51461134d5780634fb3fbe714611156578063540a9f6f1461113857806361d027b3146110f35780636d04eb9f146110b857806370a082311461108057806371ea0d8e1461104557806372fcfbf814611024578063791b98bc14610fdf57806379cc679014610fab578063815eaa2014610f8d57806385f377ca14610f485780638fd3ab801461086157806390825c28146107ea57806395d89b41146106e5578063a8aa1b31146106bc578063a9059cbb1461063b578063b026a12114610600578063be74615f146105c5578063c45a015514610580578063c48afe1614610545578063ceefe5d114610527578063dd62ed3e146104d4578063dfe70ea7146104ad578063e8e70c4c1461048f578063e98d5cd514610317578063eb13a7d2146102dc578063ed4c639d146102b9578063fd62bcd7146102935763fe94c26914610256575061000e565b3461029057806003193601126102905760206040517f000000000000000000000000000000000000000000069d16e3d1d123f13600008152f35b80fd5b5034610290578060031936011261029057602060ff600c5460801c166040519015158152f35b503461029057806003193601126102905760206102d4612443565b604051908152f35b503461029057806003193601126102905760206040517f000000000000000000000000000000000000000000084595161401484a0000008152f35b503461029057604036600319011261029057600435907f0000000000000000000000008cb780ed7e3e2fba0477058e663c357c39fd56386001600160a01b031633036104805760ff600c5460801c166104715761038b6103796007548461229f565b6103858460065461239b565b906122b2565b91610395836125c9565b9190936103ab836103a687846123a8565b6123a8565b936103d6867f0000000000000000000000000d5d54760f829b0ac8dddc3763f351963db31544612752565b610400847f0000000000000000000000000d5d54760f829b0ac8dddc3763f351963db31544612752565b602435851061046257508161042d6104379261042261045e969560065461239b565b6006556007546123a8565b60075530336127ad565b6104418333612752565b604051938493846040919493926060820195825260208201520152565b0390f35b630a1c173f60e41b8152600490fd5b63058aab2d60e21b8152600490fd5b630636a15760e11b8152600490fd5b50346102905780600319360112610290576020600754604051908152f35b503461029057806003193601126102905760206001600160801b03600c5416604051908152f35b50346102905760403660031901126102905760406104f06121d6565b916104f96121ec565b9260018060a01b031681526001602052209060018060a01b03165f52602052602060405f2054604051908152f35b50346102905780600319360112610290576020600954604051908152f35b503461029057806003193601126102905760206040517f0000000000000000000000000000000000000000000000000008e1bc9bf040008152f35b50346102905780600319360112610290576040517f0000000000000000000000008cb780ed7e3e2fba0477058e663c357c39fd56386001600160a01b03168152602090f35b503461029057806003193601126102905760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b503461029057806003193601126102905760206040517f0000000000000000000000000000000000000000000000000038d7ea4c6800008152f35b5034610290576040366003190112610290576106556121d6565b9060ff600c5460881c1680610690575b6106815761067660243583336127ad565b602060405160018152f35b63fa375c4160e01b8152600490fd5b506008546001600160a01b0383811691169081149081156106b2575b50610665565b905033145f6106ac565b50346102905780600319360112610290576008546040516001600160a01b039091168152602090f35b50346102905780600319360112610290576040519080600454908160011c916001811680156107e0575b6020841081146107cc578386529081156107a55750600114610748575b61045e8461073c8186038261224f565b604051918291826121ac565b600481527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b939250905b80821061078b5750909150810160200161073c8261072c565b919260018160209254838588010152019101909291610772565b60ff191660208087019190915292151560051b8501909201925061073c915083905061072c565b634e487b7160e01b83526022600452602483fd5b92607f169261070f565b503461029057806003193601126102905760075490670de0b6b3a7640000820291808304670de0b6b3a7640000149015171561084d576020670de0b6b3a764000061084461083b856002549061229f565b600654906122b2565b04604051908152f35b634e487b7160e01b81526011600452602490fd5b50346102905780600319360112610290577f0000000000000000000000008cb780ed7e3e2fba0477058e663c357c39fd56386001600160a01b0316330361048057600c805460ff60881b198116909155600b54919082151580610f36575b610d83575b50600d549091507f0000000000000000000000002659c6085d26144117d904c46b48b6d180393d276001600160a01b0316610900828230612920565b7f0000000000000000000000000000000000000000000000000008e1bc9bf0400090610a1161095d6127106109557f00000000000000000000000000000000000000000000000000000000000000008661229f565b0480946123a8565b6103a67f0000000000000000000000000d5d54760f829b0ac8dddc3763f351963db31544946103a67f0000000000000000000000000000000000000000000000000000000000000000936109ba6109b4868361239b565b89612752565b6109e4837f0000000000000000000000000d5d54760f829b0ac8dddc3763f351963db31544612752565b6103a66007547f0000000000000000000000000000000000000000000000000038d7ea4c680000906123a8565b917f000000000000000000000000ee7d8bcfb72bc1880d0cf19822eb0a2e6577ab626001600160a01b038116301015610d7d5730905b60405163c45a015560e01b815291602083600481885afa928315610d72578893610d51575b50604051630b4c774160e11b81526001600160a01b03828116600483015283811660248301527f0000000000000000000000000000000000000000000000000000000000000bb862ffffff811660448401529460209183916064918391165afa908115610d46578991610d17575b506001600160a01b031680610cf9575b506001600160a01b0316913083148015610cf25787905b15610ceb5786915b600e5490600a420194854211610cd75792610b9f959262ffffff608096938e9b9a999660405197610b3989612202565b885260018060a01b031660208801521660408601528060020b606086015260181c60020b8585015260a084015260c08301528660e0830152866101008301523061012083015261014082015260405180938192634418b22b60e11b835260048301612302565b038188875af1908115610c70578491610ca5575b50600955813b15610c6c57604051630910874560e11b8152838160048183875af1908115610c70578491610c90575b505047610c7f575b50803b15610c7b57819060646040518094819363df2ab5bb60e01b83523060048401528160248401523060448401525af18015610c7057610c57575b506040809330815280602052205480610c47575b5082519182526020820152f35b610c5190306126bb565b5f610c3a565b610c6284809261224f565b610c6c575f610c26565b8280fd5b6040513d86823e3d90fd5b5080fd5b610c8a904790612752565b5f610bea565b81610c9a9161224f565b610c6c57825f610be2565b610cc7915060803d608011610cd0575b610cbf818361224f565b8101906122d0565b5050505f610bb3565b503d610cb5565b634e487b7160e01b8c52601160045260248cfd5b8791610b09565b8690610b01565b6bffffffffffffffffffffffff60a01b60085416176008555f610aea565b610d39915060203d602011610d3f575b610d31818361224f565b810190612271565b5f610ada565b503d610d27565b6040513d8b823e3d90fd5b610d6b91935060203d602011610d3f57610d31818361224f565b915f610a6c565b6040513d8a823e3d90fd5b30610a47565b60405160a081019390917f0000000000000000000000002659c6085d26144117d904c46b48b6d180393d276001600160a01b03169167ffffffffffffffff861184871017610f2257849560405283526001600160801b0360208401911681526040830184815260608401908582526001600160801b03608086019342855260405196630624e65f60e11b88525160048801525116602486015251604485015251606484015251608483015260408260a48186855af1908115610f1757604092610e9792610efb575b50600b54835190610e5b82612233565b81523060208201526001600160801b03848201526001600160801b036060820152835194858094819363fc6f786560e01b835260048301612406565b03925af18015610ef057610ec2575b5080600b556001600160801b0319600c5416600c55805f6108c4565b610ee39060403d604011610ee9575b610edb818361224f565b8101906123f0565b50610ea6565b503d610ed1565b6040513d84823e3d90fd5b610f1190843d8611610ee957610edb818361224f565b50610e4b565b6040513d85823e3d90fd5b634e487b7160e01b85526041600452602485fd5b506001600160801b03811615156108bf565b50346102905780600319360112610290576040517f0000000000000000000000000d5d54760f829b0ac8dddc3763f351963db315446001600160a01b03168152602090f35b50346102905780600319360112610290576020600b54604051908152f35b503461029057604036600319011261029057610fdc610fc86121d6565b60243590610fd7823383612857565b6126bb565b80f35b50346102905780600319360112610290576040517f0000000000000000000000002659c6085d26144117d904c46b48b6d180393d276001600160a01b03168152602090f35b50346102905780600319360112610290576020600e5460020b604051908152f35b503461029057806003193601126102905760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b5034610290576020366003190112610290576020906040906001600160a01b036110a86121d6565b1681528083522054604051908152f35b503461029057806003193601126102905760206040517f00000000000000000000000000000000000000000000000003782dace9d900008152f35b50346102905780600319360112610290576040517f0000000000000000000000000d5d54760f829b0ac8dddc3763f351963db315446001600160a01b03168152602090f35b50346102905780600319360112610290576020600f54604051908152f35b506020366003190112610290576004357f0000000000000000000000008cb780ed7e3e2fba0477058e663c357c39fd56386001600160a01b0316330361133e5760ff600c5460801c1661132f57308252816020528060408320541115611320576111bf34612633565b93916111ed8294927f0000000000000000000000000d5d54760f829b0ac8dddc3763f351963db31544612752565b611217857f0000000000000000000000000d5d54760f829b0ac8dddc3763f351963db31544612752565b600654611224818361229f565b9061123660075492610385858561239b565b9384106113115791611258916112508561126296956123a8565b60065561239b565b60075533306127ad565b61126a612443565b7f00000000000000000000000000000000000000000000000003782dace9d90000106112e9575b611299612443565b7f00000000000000000000000000000000000000000000000003bf3b91c95b0000106112da5750604080513481526020810192909252810191909152606090f35b6353dfa97560e01b8152600490fd5b600c805460ff60801b1916600160801b17905530815260208190526040812054600d55611291565b630a1c173f60e41b8552600485fd5b63904db1ff60e01b8252600482fd5b63058aab2d60e21b8252600482fd5b630636a15760e11b8252600482fd5b503461029057806003193601126102905760206040517f00000000000000000000000000000000000000000000000003bf3b91c95b00008152f35b50346102905780600319360112610290576040517f000000000000000000000000ee7d8bcfb72bc1880d0cf19822eb0a2e6577ab626001600160a01b03168152602090f35b503461029057602036600319011261029057610fdc600435336126bb565b5034610290578060031936011261029057602060405160128152f35b5034610290576020366003190112610290576114216121d6565b7f0000000000000000000000008cb780ed7e3e2fba0477058e663c357c39fd56386001600160a01b0316330361133e576001600160a01b0316801561147b576bffffffffffffffffffffffff60a01b600a541617600a5580f35b60405162461bcd60e51b81526020600482015260126024820152716c704665655265636569766572207a65726f60701b6044820152606490fd5b5034610290576060366003190112610290576114cf6121d6565b6114d76121ec565b6044359160ff600c5460881c1680611512575b6115035761067693506114fe833383612857565b6127ad565b63fa375c4160e01b8452600484fd5b506008546001600160a01b038381169116908114908115611534575b506114ea565b6001600160a01b0383161490505f61152e565b5034610290576020366003190112610290576115616121d6565b7f0000000000000000000000008cb780ed7e3e2fba0477058e663c357c39fd56386001600160a01b0316330361133e57819061159b6124a2565b80600954916115ab8315156123b5565b6001600160a01b031615611653575b7f0000000000000000000000002659c6085d26144117d904c46b48b6d180393d276001600160a01b031691823b1561164e57604051632142170760e11b81523060048201526001600160a01b03909216602483015260448201529082908290606490829084905af18015610ef057611639575b50600955600160055580f35b816116439161224f565b61029057805f61162d565b505050fd5b507f0000000000000000000000000d5d54760f829b0ac8dddc3763f351963db315446115ba565b5034610290578060031936011261029057308152806020526116c060408220547f000000000000000000000000000000000000000000084595161401484a0000006123a8565b612710810290808204612710149015171561173657611700907f000000000000000000000000000000000000000000069d16e3d1d123f1360000906122b2565b90606482101561171857505060206064604051908152f35b5061271081111561172e575060206127106102d4565b6020906102d4565b634e487b7160e01b82526011600452602482fd5b503461029057604036600319011261029057600435906001600160801b038216809203610290576024356001600160801b038116809103610c7b577f0000000000000000000000008cb780ed7e3e2fba0477058e663c357c39fd56386001600160a01b0316330361133e57611813926040916117c46124a2565b600954916117d38315156123b5565b60018060a01b03600a54168451936117ea85612233565b8452602084015283830152606082015281518094819263fc6f786560e01b835260048301612406565b0381847f0000000000000000000000002659c6085d26144117d904c46b48b6d180393d276001600160a01b03165af18015611883576040928291611864575b50600160055582519182526020820152f35b905061187d9150823d8411610ee957610edb818361224f565b5f611852565b50604051903d90823e3d90fd5b50346102905780600319360112610290576020600e5460181c60020b604051908152f35b503461029057806003193601126102905760206040517f00000000000000000000000000000000000000000000000000000000000000648152f35b50346102905780600319360112610290576020600254604051908152f35b50346102905780600319360112610290576020600654604051908152f35b50346102905760803660031901126102905760443560243560043560643580151581036119c8576040945015611995579061038561197a61198161197161198795612633565b9093919361239b565b958261229f565b9261239b565b905b82519182526020820152f35b806119816119a6946103859361229f565b6119c26119bb6119b5836125c9565b9061239b565b80926123a8565b90611989565b8480fd5b5034610290578060031936011261029057600a546040516001600160a01b039091168152602090f35b503461029057604036600319011261029057610676611a126121d6565b6024359033612920565b5034610290578060031936011261029057602060ff600c5460881c166040519015158152f35b5034610290578060031936011261029057602060405162ffffff7f0000000000000000000000000000000000000000000000000000000000000bb8168152f35b50346102905780600319360112610290576040519080600354908160011c91600181168015611b35575b6020841081146107cc578386529081156107a55750600114611ad85761045e8461073c8186038261224f565b600381527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b939250905b808210611b1b5750909150810160200161073c8261072c565b919260018160209254838588010152019101909291611b02565b92607f1692611aac565b503461029057806003193601126102905760206040516127108152f35b50346102905780600319360112610290576040517f0000000000000000000000000d5d54760f829b0ac8dddc3763f351963db315446001600160a01b03168152602090f35b505f366003190112611f05577f0000000000000000000000008cb780ed7e3e2fba0477058e663c357c39fd56386001600160a01b0316330361219d57611be56124a2565b600f548015908161215857803403612107575f600f557f000000000000000000000000ee7d8bcfb72bc1880d0cf19822eb0a2e6577ab62916001600160a01b038316301015612100573092915b60405163c45a015560e01b81526001600160a01b037f0000000000000000000000002659c6085d26144117d904c46b48b6d180393d278116959081169291308414906020816004818b5afa908115611efa578793611cf7926020925f916120e3575b50604051630b4c774160e11b81526001600160a01b0392831660048201529990911660248a01527f0000000000000000000000000000000000000000000000000000000000000bb862ffffff811660448b01529892839190829081906064820190565b03916001600160a01b03165afa908115611efa5760049160e0915f916120c4575b50604051633850c7bd831b815292839182906001600160a01b03165afa8015611efa575f9061202f575b611d5691506001600160a01b03168061229f565b811561200857611d669084612521565b600b810290808204600b1490151715611ff457600a9004945b8515159081611feb575b5015611fad57305f525f6020528460405f205410611f5757611e5d9585611db36080978a30612920565b600c805460ff60881b19169055600e548315611f5057815b8415611f45575062ffffff86935b8515611f3e575f955b15611f375787965b60405199611df78b612202565b8a5260018060a01b031660208a01521660408801528060020b606088015260181c60020b8787015260a086015260c085015260e084015261010083015230610120830152426101408301526040518080958194634418b22b60e11b835260048301612302565b0391865af18015611efa575f915f91611f09575b506001600160801b03166001600160801b0319600c541617600c55600b55803b15611f05575f809160646040518094819363df2ab5bb60e01b83523060048401528160248401523060448401525af18015611efa57611ee7575b50600c805460ff60881b1916600160881b179055600160055580f35b611ef391505f9061224f565b5f5f611ecb565b6040513d5f823e3d90fd5b5f80fd5b6001600160801b039250611f2c915060803d608011610cd057610cbf818361224f565b505091909190611e71565b5f96611dea565b8795611de2565b62ffffff9093611dd9565b8591611dcb565b60405162461bcd60e51b815260206004820152602860248201527f496e73756666696369656e7420746f6b656e2062616c616e636520666f72206c604482015267697175696469747960c01b6064820152608490fd5b60405162461bcd60e51b815260206004820152601660248201527543616e6e6f74206164642030206c697175696469747960501b6044820152606490fd5b9050155f611d89565b634e487b7160e01b5f52601160045260245ffd5b61201290846124c2565b600b810290808204600b1490151715611ff457600a900494611d7f565b5060e0813d60e0116120bc575b8161204960e0938361224f565b81010312611f05578051906001600160a01b0382168203611f055760208101518060020b03611f055761207e60408201612290565b5061208b60608201612290565b5061209860808201612290565b5060a081015160ff811603611f055760c0015180151503611f0557611d5690611d42565b3d915061203c565b6120dd915060203d602011610d3f57610d31818361224f565b5f611d18565b6120fa9150833d8511610d3f57610d31818361224f565b5f611c94565b3091611c32565b60405162461bcd60e51b815260206004820152602360248201527f496e73756666696369656e742045544820666f7220746f6b656e20637265617460448201526234b7b760e91b6064820152608490fd5b60405162461bcd60e51b815260206004820152601d60248201527f4c697175696469747920616c726561647920696e697469616c697a65640000006044820152606490fd5b630636a15760e11b5f5260045ffd5b602060409281835280519182918282860152018484015e5f828201840152601f01601f1916010190565b600435906001600160a01b0382168203611f0557565b602435906001600160a01b0382168203611f0557565b610160810190811067ffffffffffffffff82111761221f57604052565b634e487b7160e01b5f52604160045260245ffd5b6080810190811067ffffffffffffffff82111761221f57604052565b90601f8019910116810190811067ffffffffffffffff82111761221f57604052565b90816020910312611f0557516001600160a01b0381168103611f055790565b519061ffff82168203611f0557565b81810292918115918404141715611ff457565b81156122bc570490565b634e487b7160e01b5f52601260045260245ffd5b9190826080910312611f055781519160208101516001600160801b0381168103611f0557916060604083015192015190565b9190916101408061016083019460018060a01b03815116845260018060a01b03602082015116602085015262ffffff6040820151166040850152606081015160020b6060850152608081015160020b608085015260a081015160a085015260c081015160c085015260e081015160e085015261010081015161010085015260018060a01b03610120820151166101208501520151910152565b91908201809211611ff457565b91908203918211611ff457565b156123bc57565b60405162461bcd60e51b815260206004820152600c60248201526b1b9bdd081b5a59dc985d195960a21b6044820152606490fd5b9190826040910312611f05576020825192015190565b91909160606001600160801b038160808401958051855260018060a01b036020820151166020860152826040820151166040860152015116910152565b600754670de0b6b3a7640000810290808204670de0b6b3a76400001490151715611ff45761249e61083b670de0b6b3a7640000927f000000000000000000000000000000000000000000084595161401484a0000009061229f565b0490565b6002600554146124b3576002600555565b633ee5aeb560e01b5f5260045ffd5b5f91905f19828209918082029384808510940393808503941461251757600160c01b8410156125055750600160c01b910990828211900360401b910360c01c1790565b634e487b71905260116020526024601cfd5b5050505060c01c90565b5f19600160c01b8209918160c01b918280851094039380850394146125ba57838211156125a2578190600160c01b9009815f0382168092046002816003021880820260020302808202600203028082026002030280820260020302808202600203028091026002030293600183805f03040190848311900302920304170290565b50634e487b715f52156003026011186020526024601cfd5b50906125c692506122b2565b90565b6125f7612710917f00000000000000000000000000000000000000000000000000000000000000649061229f565b046126306127106126287f00000000000000000000000000000000000000000000000000000000000000008461229f565b0480926123a8565b91565b9061271082028281046127101483151715611ff4577f000000000000000000000000000000000000000000000000000000000000006461271001908161271011611ff45761268b91612684916122b2565b80936123a8565b6126306127106126287f00000000000000000000000000000000000000000000000000000000000000008461229f565b9091906001600160a01b0316801561273f57805f525f60205260405f2054838110612725576020845f94957fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef938587528684520360408620558060025403600255604051908152a3565b915063391434e360e21b5f5260045260245260445260645ffd5b634b637e8f60e11b5f525f60045260245ffd5b5f80809381935af13d156127a8573d67ffffffffffffffff811161221f5760405190612788601f8201601f19166020018361224f565b81525f60203d92013e5b1561279957565b6338822c1360e11b5f5260045ffd5b612792565b6001600160a01b031690811561273f576001600160a01b031691821561284457815f525f60205260405f205481811061282b57817fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92602092855f525f84520360405f2055845f525f825260405f20818154019055604051908152a3565b8263391434e360e21b5f5260045260245260445260645ffd5b63ec442f0560e01b5f525f60045260245ffd5b6001600160a01b039081165f818152600160209081526040808320948616835293905291909120549291905f198410612891575b50505050565b8284106128fd5780156128ea576001600160a01b038216156128d7575f52600160205260405f209060018060a01b03165f5260205260405f20910390555f80808061288b565b634a1406b160e11b5f525f60045260245ffd5b63e602df0560e01b5f525f60045260245ffd5b508290637dc7a0d960e11b5f5260018060a01b031660045260245260445260645ffd5b6001600160a01b03169081156128ea576001600160a01b03169182156128d75760207f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591835f526001825260405f20855f5282528060405f2055604051908152a356fea2646970667358221220af85bf2c42fda269039bd0eb11b603d3b324c45d0023c7ac234b06549bc9238764736f6c634300081b0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000026000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000d5d54760f829b0ac8dddc3763f351963db31544000000000000000000000000000000000000000000084595161401484a00000000000000000000000000000000000000000000000008c4a326c3490a110000000000000000000000000000000000000000000000000000000038d7ea4c680000000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008e1bc9bf04000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003782dace9d9000000000000000000000000000000000000000000000000000003bf3b91c95b0000000000000000000000000000000000000000000000069d16e3d1d123f13600000000000000000000000000000d5d54760f829b0ac8dddc3763f351963db315440000000000000000000000002659c6085d26144117d904c46b48b6d180393d270000000000000000000000000d5d54760f829b0ac8dddc3763f351963db315440000000000000000000000000000000000000000000000000000000000000bb80000000000000000000000000d5d54760f829b0ac8dddc3763f351963db3154400000000000000000000000000000000000000000000000000000000000f4240000000000000000000000000000000000000000000000000000000000000000a74656e746f75746573740000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037474740000000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _params (tuple):
Arg [1] : name (string): tentoutest
Arg [2] : symbol (string): ttt
Arg [3] : creator (address): 0x0d5d54760F829b0aC8DdDC3763f351963Db31544
Arg [4] : totalSupply (uint256): 10000000000000000000000000
Arg [5] : virtualTokenReserves (uint256): 10600000000000000000000000
Arg [6] : virtualCollateralReserves (uint256): 16000000000000000
Arg [7] : feeBasisPoints (uint256): 100
Arg [8] : dexFeeBasisPoints (uint256): 0
Arg [9] : migrationFeeFixed (uint256): 2500000000000000
Arg [10] : poolCreationFee (uint256): 0
Arg [11] : mcLowerLimit (uint256): 250000000000000000
Arg [12] : mcUpperLimit (uint256): 270000000000000000
Arg [13] : tokensMigrationThreshold (uint256): 7995388700000000000000000
Arg [14] : treasury (address): 0x0d5d54760F829b0aC8DdDC3763f351963Db31544
Arg [15] : positionManager (address): 0x2659C6085D26144117D904C46B48B6d180393d27
Arg [16] : dexTreasury (address): 0x0d5d54760F829b0aC8DdDC3763f351963Db31544
Arg [17] : poolFee (uint24): 3000
Arg [18] : lpFeeReceiver (address): 0x0d5d54760F829b0aC8DdDC3763f351963Db31544
Arg [19] : tokenCreationFee (uint256): 1000000
-----Encoded View---------------
24 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000020
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000260
Arg [2] : 00000000000000000000000000000000000000000000000000000000000002a0
Arg [3] : 0000000000000000000000000d5d54760f829b0ac8dddc3763f351963db31544
Arg [4] : 000000000000000000000000000000000000000000084595161401484a000000
Arg [5] : 00000000000000000000000000000000000000000008c4a326c3490a11000000
Arg [6] : 0000000000000000000000000000000000000000000000000038d7ea4c680000
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000064
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [9] : 0000000000000000000000000000000000000000000000000008e1bc9bf04000
Arg [10] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [11] : 00000000000000000000000000000000000000000000000003782dace9d90000
Arg [12] : 00000000000000000000000000000000000000000000000003bf3b91c95b0000
Arg [13] : 000000000000000000000000000000000000000000069d16e3d1d123f1360000
Arg [14] : 0000000000000000000000000d5d54760f829b0ac8dddc3763f351963db31544
Arg [15] : 0000000000000000000000002659c6085d26144117d904c46b48b6d180393d27
Arg [16] : 0000000000000000000000000d5d54760f829b0ac8dddc3763f351963db31544
Arg [17] : 0000000000000000000000000000000000000000000000000000000000000bb8
Arg [18] : 0000000000000000000000000d5d54760f829b0ac8dddc3763f351963db31544
Arg [19] : 00000000000000000000000000000000000000000000000000000000000f4240
Arg [20] : 000000000000000000000000000000000000000000000000000000000000000a
Arg [21] : 74656e746f757465737400000000000000000000000000000000000000000000
Arg [22] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [23] : 7474740000000000000000000000000000000000000000000000000000000000
Deployed Bytecode Sourcemap
810:21454:12:-:0;;;;;;;;;-1:-1:-1;810:21454:12;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1317:49;810:21454;;;;;;;;;;;;;;;;;;;;;2046:26;810:21454;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;953:43;810:21454;;;;;;;;;;-1:-1:-1;;810:21454:12;;;;;;;2981:7;-1:-1:-1;;;;;810:21454:12;2967:10;:21;2963:47;;810:21454;2867:14;810:21454;;;;2863:43;;10230:82;10231:40;10246:25;810:21454;10231:40;;:::i;:::-;10276:35;810:21454;10276:20;810:21454;10276:35;:::i;:::-;10230:82;;:::i;:::-;10343:34;;;;:::i;:::-;10417:30;;;:39;:30;;;;;:::i;:::-;:39;:::i;:::-;10486:8;10496;10486;;10496;:::i;:::-;10548:6;10535:11;;10548:6;:::i;:::-;810:21454;;10570:50;;10566:84;;810:21454;;10707:48;10803:12;810:21454;10661:36;810:21454;;;10276:20;810:21454;10661:36;:::i;:::-;10276:20;810:21454;10246:25;810:21454;10707:48;:::i;:::-;10246:25;810:21454;10796:4;2967:10;10803:12;:::i;:::-;10858:27;2967:10;;10858:27;:::i;:::-;810:21454;;;;;;;;;;;;;;;;;;;;;;;;;;;;10566:84;-1:-1:-1;;;10629:21:12;;810:21454;;10629:21;2863:43;-1:-1:-1;;;2890:16:12;;810:21454;;2890:16;2963:47;-1:-1:-1;;;2997:13:12;;810:21454;;2997:13;810:21454;;;;;;;;;;;;;;1043:40;810:21454;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;2006:33:12;810:21454;;;;;;;;;;;;;;;-1:-1:-1;;810:21454:12;;;;;;;:::i;:::-;;;;:::i;:::-;;;;;;;;;;3561:11:1;810:21454:12;;;3561:27:1;810:21454:12;;;;;;-1:-1:-1;810:21454:12;;;;;-1:-1:-1;810:21454:12;;;;;;;;;;;;;;;;;;;;;;1693:30;810:21454;;;;;;;;;;;;;;;;;;;;;;;1373:42;810:21454;;;;;;;;;;;;;;;;;;1655:32;-1:-1:-1;;;;;810:21454:12;;;;;;;;;;;;;;;;;;;;;;1421:40;810:21454;;;;;;;;;;;;;;;;;;;1089:57;810:21454;;;;;;;;;;-1:-1:-1;;810:21454:12;;;;;;:::i;:::-;;;18908:26;810:21454;;;;18908:64;;;810:21454;18904:147;;3388:5:1;810:21454:12;;;735:10:6;3388:5:1;:::i;:::-;810:21454:12;;;;;;;18904:147;-1:-1:-1;;;18995:45:12;;810:21454;;18995:45;18908:64;-1:-1:-1;18945:4:12;810:21454;-1:-1:-1;;;;;810:21454:12;;;;;18939:10;;;;:32;;;;18908:64;;;;18939:32;18953:10;;;:18;18939:32;;;810:21454;;;;;;;;;;;;;1506:19;810:21454;;;-1:-1:-1;;;;;810:21454:12;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;:::i;:::-;;;;;;;-1:-1:-1;810:21454:12;;;;;;;-1:-1:-1;810:21454:12;;-1:-1:-1;810:21454:12;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;810:21454:12;;;;;;;;;;;;;;;;;;;;-1:-1:-1;810:21454:12;;-1:-1:-1;810:21454:12;;-1:-1:-1;810:21454:12;;;-1:-1:-1;;;810:21454:12;;;;;;;;;;;;;;;;;;;;;;;;;;;;16302:25;810:21454;;16330:8;810:21454;;;;;;16330:8;810:21454;;;;;;;;16330:8;16301:77;16302:52;810:21454;2881:12:1;810:21454:12;16302:52;;:::i;:::-;16358:20;810:21454;16301:77;;:::i;:::-;810:21454;;;;;;;;-1:-1:-1;;;810:21454:12;;;;;;;;;;;;;;;;;;;;;2981:7;-1:-1:-1;;;;;810:21454:12;2967:10;:21;2963:47;;11750:34;810:21454;;-1:-1:-1;;;;810:21454:12;;;;;11842:16;810:21454;;;11842:21;;;;:48;;810:21454;11838:825;;810:21454;-1:-1:-1;12699:22:12;810:21454;;;-1:-1:-1;12763:15:12;-1:-1:-1;;;;;810:21454:12;8746:4:1;810:21454:12;;12748:4;8746::1;:::i;:::-;12902:17:12;18067:9;13082:101;18114:19;2294:6;18054:22;18067:9;18054:22;;:::i;:::-;810:21454;18114:19;;;:::i;:::-;13082:83;12950:8;12974:15;13082:74;12974:15;12960:29;;;;;;:::i;:::-;;;:::i;:::-;13033:6;13020:11;;13033:6;:::i;:::-;13082:60;:25;810:21454;13110:32;13082:60;;:::i;:101::-;13281:5;;-1:-1:-1;;;;;810:21454:12;;12748:4;13265:21;810:21454;;;12748:4;13265:71;;810:21454;;-1:-1:-1;;;13412:25:12;;810:21454;13412:25;810:21454;;;13412:25;;;;;;;;;;;;13265:71;-1:-1:-1;810:21454:12;;-1:-1:-1;;;13394:77:12;;-1:-1:-1;;;;;810:21454:12;;;;13394:77;;810:21454;;;;;;;;13463:7;810:21454;;;;;;;13463:7;13412:25;;810:21454;;;;;;;13394:77;;;;;;;;;;;13265:71;-1:-1:-1;;;;;;810:21454:12;;13481:68;;13265:71;-1:-1:-1;;;;;;810:21454:12;;12748:4;13584:23;;:60;;;;;;;13679;;;;;;13951:7;810:21454;14194:15;14212:2;14194:15;810:21454;14194:15;;;810:21454;;;;14259:53;810:21454;;;13805:420;810:21454;;;;;;;;;;;;;:::i;:::-;;;;;;;;;13412:25;13805:420;;810:21454;;;13805:420;;810:21454;;;;13805:420;;;810:21454;;;;;13805:420;;;810:21454;13805:420;;;810:21454;13805:420;;;810:21454;13805:420;810:21454;13805:420;;810:21454;13805:420;;;;810:21454;12748:4;13805:420;;;810:21454;13805:420;;;810:21454;;;;;;;;;;14259:53;;810:21454;14259:53;;;:::i;:::-;;;;;;;;;;;;;;;;13679:60;810:21454;14322:25;810:21454;14404:27;;;;;810:21454;;-1:-1:-1;;;14404:27:12;;;810:21454;;;14404:27;;;;;;;;;;;;;13679:60;14445:21;;;14441:108;;13679:60;14637:59;;;;;;810:21454;;14637:59;810:21454;;;;;;;;;14637:59;;12748:4;810:21454;14637:59;;810:21454;;;;;;12748:4;810:21454;;;;14637:59;;;;;;;;13679:60;12748:4;810:21454;12748:4;;;810:21454;;;13412:25;810:21454;;;14829:25;14825:99;;13679:60;810:21454;;;;;;13412:25;810:21454;;;;14825:99;14891:21;12748:4;;14891:21;:::i;:::-;14825:99;;;14637:59;;;;;;:::i;:::-;810:21454;;14637:59;;;810:21454;;;;14637:59;810:21454;;;;;;;;;14637:59;810:21454;;;14441:108;14516:21;;;;;:::i;:::-;14441:108;;;14404:27;;;;;:::i;:::-;810:21454;;14404:27;;;;14259:53;;;;13805:420;14259:53;13805:420;14259:53;;;;;;;;:::i;:::-;;;;;:::i;:::-;;;;;;;;;;;;810:21454;-1:-1:-1;;;810:21454:12;;;;;;;;13679:60;;;;;13584;;;;;13481:68;810:21454;;;13523:15;810:21454;;;13523:15;810:21454;13481:68;;;13394:77;;;;13412:25;13394:77;13412:25;13394:77;;;;;;;;:::i;:::-;;;;;:::i;:::-;;;;;;;;;;810:21454;;;;;;;;;13412:25;;;;;;;;;;;;;;;:::i;:::-;;;;;;810:21454;;;;;;;;;13265:71;12748:4;13265:71;;11838:825;810:21454;;;;;;;;11906:15;-1:-1:-1;;;;;810:21454:12;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;11957:286:12;;;810:21454;;;;;11957:286;;810:21454;;;11957:286;;;810:21454;;;;-1:-1:-1;;;;;11957:286:12;;;12209:15;;810:21454;;;;;;;;11906:351;;810:21454;;11906:351;;810:21454;;;;;;;;;;;;;;;;;;;;;;;11906:351;;;;;;;;;;;;810:21454;11906:351;12271:311;11906:351;;;11838:825;810:21454;11842:16;810:21454;;;;;;;:::i;:::-;;;12442:4;11957:286;12312:256;;810:21454;-1:-1:-1;;;;;12312:256:12;;;810:21454;-1:-1:-1;;;;;11957:286:12;12312:256;;810:21454;;;;;;;;;;;;12271:311;;810:21454;12271:311;;;:::i;:::-;;;;;;;;;;;11838:825;810:21454;;11842:16;810:21454;-1:-1:-1;;;;;810:21454:12;11750:34;810:21454;;11750:34;810:21454;11838:825;;;;12271:311;;;810:21454;12271:311;810:21454;12271:311;;;;;;;;:::i;:::-;;;;;:::i;:::-;;;;;;;;;;810:21454;;;;;;;;;11906:351;;;;;;;;;;;;;:::i;:::-;;;;;810:21454;;;;;;;;;;-1:-1:-1;;;810:21454:12;;;;;;;;11842:48;810:21454;-1:-1:-1;;;;;810:21454:12;;11867:23;;11842:48;;810:21454;;;;;;;;;;;;;;;1613:36;-1:-1:-1;;;;;810:21454:12;;;;;;;;;;;;;;;;;;;;1969:31;810:21454;;;;;;;;;;;;;;-1:-1:-1;;810:21454:12;;;;1166:5:3;810:21454:12;;:::i;:::-;;;735:10:6;1135:5:3;735:10:6;;1135:5:3;;:::i;:::-;1166;:::i;:::-;810:21454:12;;;;;;;;;;;;;;;;;2307:60;-1:-1:-1;;;;;810:21454:12;;;;;;;;;;;;;;;;;;;;2543:20;810:21454;;;;;;;;;;;;;;;;;;;;;;;;;1190:34;810:21454;;;;;;;;;;-1:-1:-1;;810:21454:12;;;;;;;;-1:-1:-1;;;;;810:21454:12;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1231:37;810:21454;;;;;;;;;;;;;;;;;;1574:33;-1:-1:-1;;;;;810:21454:12;;;;;;;;;;;;;;;;;;;;2596:31;810:21454;;;;;;;;-1:-1:-1;810:21454:12;;-1:-1:-1;;810:21454:12;;;;;;2981:7;-1:-1:-1;;;;;810:21454:12;2967:10;:21;2963:47;;810:21454;2713:14;810:21454;;;;2709:43;;9212:4;810:21454;;;;;;;;;;9194:41;;9190:81;;9417:52;9307:9;9417:52;:::i;:::-;9500:8;;9510;9500;;;;9510;:::i;:::-;9562:6;9549:11;;9562:6;:::i;:::-;9641:20;810:21454;9613:48;;;;:::i;:::-;810:21454;9612:108;9666:25;810:21454;9666:53;;;;;:::i;9612:108::-;9735:25;;;9731:59;;9801:33;9844:54;9801:33;;;9946:9;9801:33;;;:::i;:::-;9641:20;810:21454;9844:54;:::i;:::-;9666:25;810:21454;2967:10;9212:4;9946:9;:::i;:::-;18547:17;;:::i;:::-;18584:12;-1:-1:-1;18575:215:12;;810:21454;18392:17;;:::i;:::-;18429:12;-1:-1:-1;18420:57:12;;-1:-1:-1;810:21454:12;;;9307:9;810:21454;;;;;;;;;;;;;;;;;;18420:57;-1:-1:-1;;;18450:27:12;;810:21454;;18450:27;18575:215;2713:14;810:21454;;-1:-1:-1;;;;810:21454:12;-1:-1:-1;;;810:21454:12;;;9212:4;810:21454;;;;;;;;;;18730:49;810:21454;18575:215;;9731:59;-1:-1:-1;;;9769:21:12;;810:21454;9769:21;;9190:81;-1:-1:-1;;;9244:27:12;;810:21454;9244:27;;2709:43;-1:-1:-1;;;2736:16:12;;810:21454;2736:16;;2963:47;-1:-1:-1;;;2997:13:12;;810:21454;2997:13;;810:21454;;;;;;;;;;;;;;;;1274:37;810:21454;;;;;;;;;;;;;;;;;;2373:30;-1:-1:-1;;;;;810:21454:12;;;;;;;;;;;;;-1:-1:-1;;810:21454:12;;;;692:5:3;810:21454:12;;735:10:6;692:5:3;:::i;810:21454:12:-;;;;;;;;;;;;;;;;2761:2:1;810:21454:12;;;;;;;;;;-1:-1:-1;;810:21454:12;;;;;;:::i;:::-;2981:7;-1:-1:-1;;;;;810:21454:12;2967:10;:21;2963:47;;-1:-1:-1;;;;;810:21454:12;15112:23;;810:21454;;;;;15168:25;810:21454;;;15168:25;810:21454;;;;;;-1:-1:-1;;;810:21454:12;;;;;;;;;;;;-1:-1:-1;;;810:21454:12;;;;;;;;;;;;;;-1:-1:-1;;810:21454:12;;;;;;:::i;:::-;;;:::i;:::-;;;;;19230:26;810:21454;;;;19230:58;;;810:21454;19226:141;;4890:5:1;735:10:6;;4854:5:1;735:10:6;;4854:5:1;;:::i;:::-;4890;:::i;19226:141:12:-;-1:-1:-1;;;19311:45:12;;810:21454;19311:45;;19230:58;-1:-1:-1;19267:4:12;810:21454;-1:-1:-1;;;;;810:21454:12;;;;;19261:10;;;;:26;;;;19230:58;;;;19261:26;-1:-1:-1;;;;;810:21454:12;;19275:12;;-1:-1:-1;19261:26:12;;;810:21454;;;;;;;-1:-1:-1;;810:21454:12;;;;;;:::i;:::-;2981:7;-1:-1:-1;;;;;810:21454:12;2967:10;:21;2963:47;;2466:103:8;;;;:::i;:::-;2531:1;15947:15:12;810:21454;15947:20;15939:45;15947:20;;;15939:45;:::i;:::-;-1:-1:-1;;;;;810:21454:12;15998:23;15994:49;;810:21454;16113:15;-1:-1:-1;;;;;810:21454:12;;16097:85;;;;;810:21454;;-1:-1:-1;;;16097:85:12;;16156:4;810:21454;16097:85;;810:21454;-1:-1:-1;;;;;810:21454:12;;;;;;;;;;;;;;;;16097:85;;810:21454;;;;16097:85;;;;;;;;810:21454;;15947:15;810:21454;1857:1:8;3068:21;810:21454:12;;;16097:85;;;;;:::i;:::-;810:21454;;16097:85;;;;;810:21454;;;;15994:49;16035:8;;15994:49;;810:21454;;;;;;;;;;;;;16759:4;810:21454;;;;;16720:45;810:21454;;;;16720:18;:45;:::i;:::-;2294:6;810:21454;;;;;;2294:6;810:21454;;;;;;;16718:89;16783:24;;16718:89;;:::i;:::-;16824:70;16835:3;16824:14;;16835:3;;;16824:70;;810:21454;16835:3;810:21454;;;;;;16824:70;-1:-1:-1;2294:6:12;16848:21;;2294:6;;;16848:45;810:21454;2294:6;16824:70;;16848:45;810:21454;16848:45;16824:70;;810:21454;-1:-1:-1;;;810:21454:12;;;;;;;;;;;;;;;-1:-1:-1;;810:21454:12;;;;;;;-1:-1:-1;;;;;810:21454:12;;;;;;;;;-1:-1:-1;;;;;810:21454:12;;;;;;;2981:7;-1:-1:-1;;;;;810:21454:12;2967:10;:21;2963:47;;15469:268;2466:103:8;810:21454:12;2466:103:8;;;:::i;:::-;15400:15:12;810:21454;15400:20;15392:45;15400:20;;;15392:45;:::i;:::-;810:21454;;;;;15619:13;810:21454;;;;;;;;:::i;:::-;;;;15506:221;;810:21454;15506:221;;;810:21454;15506:221;;;810:21454;;;;;;;;;;15469:268;;810:21454;15469:268;;;:::i;:::-;;810:21454;;15469:15;-1:-1:-1;;;;;810:21454:12;15469:268;;;;;;810:21454;15469:268;;;;;810:21454;;1857:1:8;3068:21;810:21454:12;;;;;;;;;;;15469:268;;;;;;;;;;;;;;;;:::i;:::-;;;;;810:21454;;;;;;;;;;;;;;;;;;;;;;;;;2569:20;810:21454;;;;;;;;;;;;;;;;;;;;;;;;;;;1153:31;810:21454;;;;;;;;;;;;;;;;;2881:12:1;810:21454:12;;;;;;;;;;;;;;;;;;;;;1002:35;810:21454;;;;;;;;;;;;;;-1:-1:-1;;810:21454:12;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;11104:524:12;;;11206:39;11347:31;11265:17;11310:32;11206:39;11309:70;11206:39;;:::i;:::-;11265:17;;;;;:::i;:::-;11310:32;;;:::i;:::-;11347:31;;:::i;11309:70::-;11104:524;;810:21454;;;;;;;;;;11104:524;11423:23;;11422:52;11423:23;11451:22;11423:23;;:::i;11422:52::-;11601:16;11570:17;11526:24;;;:::i;:::-;11570:17;;:::i;:::-;11601:16;;;:::i;:::-;11104:524;;;810:21454;;;;;;;;;;;;;;;;;1800:28;810:21454;;;-1:-1:-1;;;;;810:21454:12;;;;;;;;;;;;;;;-1:-1:-1;;810:21454:12;;;;8746:4:1;810:21454:12;;:::i;:::-;;;735:10:6;;8746:4:1;:::i;810:21454:12:-;;;;;;;;;;;;;;;2078:45;810:21454;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2409:31;810:21454;;;;;;;;;;;;;;;;;;;;;1837:5:1;810:21454:12;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;1837:5:1;810:21454:12;;;;;-1:-1:-1;810:21454:12;;;;;;;-1:-1:-1;810:21454:12;;-1:-1:-1;810:21454:12;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2294:6;810:21454;;;;;;;;;;;;;;;;;;1468:32;-1:-1:-1;;;;;810:21454:12;;;;;;;-1:-1:-1;810:21454:12;;-1:-1:-1;;810:21454:12;;;;2981:7;-1:-1:-1;;;;;810:21454:12;2967:10;:21;2963:47;;2466:103:8;;:::i;:::-;5671:16:12;810:21454;5671:20;;810:21454;;;;5790:9;;:22;810:21454;;;5671:16;810:21454;5968:5;;-1:-1:-1;;;;;810:21454:12;;5960:4;5952:21;810:21454;;;5960:4;5952:71;;;810:21454;;-1:-1:-1;;;6213:25:12;;-1:-1:-1;;;;;6213:15:12;810:21454;;;;;;;;5960:4;6053:23;;;6213:25;810:21454;;;;6213:25;;;;;;;;;6195:77;6213:25;;;810:21454;6213:25;;;5952:71;-1:-1:-1;810:21454:12;;-1:-1:-1;;;6195:77:12;;-1:-1:-1;;;;;810:21454:12;;;;6195:77;;810:21454;;;;;;;;;6264:7;810:21454;;;;;;;6264:7;810:21454;;;;;;;;;;;;;6195:77;;;-1:-1:-1;;;;;810:21454:12;6195:77;;;;;;;810:21454;6195:77;810:21454;6195:77;810:21454;6195:77;;;5952:71;-1:-1:-1;810:21454:12;;;;;6313:28;;810:21454;;;;;-1:-1:-1;;;;;810:21454:12;6313:28;;;;;;810:21454;6313:28;;;5952:71;6371:45;;-1:-1:-1;;;;;;810:21454:12;;6371:45;:::i;:::-;6622:544;;;;6836:43;;;;:::i;:::-;6882:2;810:21454;;;;;;6882:2;810:21454;;;;;;;6887:2;810:21454;;6622:544;;7241:15;;;:32;;;;6622:544;810:21454;;;;5960:4;810:21454;;;6213:25;810:21454;;;;;;7319:39;810:21454;;7653:627;5960:4;;8746::1;7705:565:12;5960:4;;;8746::1;:::i;:::-;7565:34:12;810:21454;;-1:-1:-1;;;;810:21454:12;;;7867:7;810:21454;7944:38;;;;;;8016;;;;;810:21454;8016:38;;;8084:28;;;;810:21454;8084:28;;8142;;;;;;810:21454;;;;;;:::i;:::-;;;;;;;;;6213:25;7705:565;;810:21454;;;7705:565;;810:21454;;;;7705:565;;;810:21454;;;;;7705:565;;;810:21454;7705:565;;;810:21454;7705:565;;;810:21454;;7705:565;;810:21454;7705:565;;;810:21454;5960:4;7705:565;;;810:21454;8240:15;7705:565;;;810:21454;;;;;;;;;;;7653:627;;810:21454;7653:627;;;:::i;:::-;;;;;;;;;;810:21454;;;7653:627;;;8142:28;810:21454;-1:-1:-1;;;;;810:21454:12;-1:-1:-1;;;;;810:21454:12;7565:34;810:21454;;;7565:34;810:21454;7610:670;810:21454;8369:59;;;;;810:21454;;;8369:59;810:21454;;;;;;;;;8369:59;;5960:4;810:21454;8369:59;;810:21454;;;;;;5960:4;810:21454;;;;8369:59;;;;;;;;8142:28;-1:-1:-1;7565:34:12;810:21454;;-1:-1:-1;;;;810:21454:12;-1:-1:-1;;;810:21454:12;;;;3068:21:8;810:21454:12;;;8369:59;;;;810:21454;8369:59;;:::i;:::-;810:21454;8369:59;;;;810:21454;;;;;;;;;8369:59;810:21454;;;7653:627;-1:-1:-1;;;;;7653:627:12;;;;;7705:565;7653:627;7705:565;7653:627;;;;;;;:::i;:::-;;;;;;;;;8142:28;810:21454;8142:28;;;8084;;;;;8016:38;810:21454;8016:38;;;;7944;;;;;810:21454;;;-1:-1:-1;;;810:21454:12;;6213:25;810:21454;;;;;;;;;;;;;;-1:-1:-1;;;810:21454:12;;;;;;;;;;-1:-1:-1;;;810:21454:12;;6213:25;810:21454;;;;;;;;;-1:-1:-1;;;810:21454:12;;;;;;;7241:32;5671:20;;;7241:32;;;810:21454;;;;;;;;;;;;6622:544;7102:43;;;;:::i;:::-;7148:2;810:21454;;;;;;7148:2;810:21454;;;;;;;7153:2;810:21454;;6622:544;;;6313:28;;810:21454;6313:28;;810:21454;6313:28;;;;;;810:21454;6313:28;;;:::i;:::-;;;810:21454;;;;;;;-1:-1:-1;;;;;810:21454:12;;;;;;6213:25;810:21454;;;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;6371:45;6313:28;;;;;;-1:-1:-1;6313:28:12;;6195:77;;;;6213:25;6195:77;6213:25;6195:77;;;;;;;:::i;:::-;;;;6213:25;;;;;;;;;;;;;;:::i;:::-;;;;5952:71;5960:4;5952:71;;;810:21454;;;-1:-1:-1;;;810:21454:12;;;;;;;;;;;;;;;;;-1:-1:-1;;;810:21454:12;;;;;;;;;;-1:-1:-1;;;810:21454:12;;;;;;;;;;;;;;;;;;;;2963:47;2997:13;;;810:21454;2997:13;810:21454;;2997:13;810:21454;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;810:21454:12;;;;:::o;:::-;;;;-1:-1:-1;;;;;810:21454:12;;;;;;:::o;:::-;;;;-1:-1:-1;;;;;810:21454:12;;;;;;:::o;:::-;;;;;;;;;;;;;;;:::o;:::-;;;;-1:-1:-1;810:21454:12;;;;;-1:-1:-1;810:21454:12;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;-1:-1:-1;;;;;810:21454:12;;;;;;;:::o;:::-;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;810:21454:12;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;:::o;:::-;;;;;;;;;;:::o;:::-;;;;:::o;:::-;;;-1:-1:-1;;;810:21454:12;;;;;;;;;;;;-1:-1:-1;;;810:21454:12;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;-1:-1:-1;;;;;810:21454:12;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;16421:199::-;16502:25;810:21454;16530:8;810:21454;;;;;;16530:8;810:21454;;;;;;;16501:82;16502:57;16530:8;16541:18;;16502:57;;:::i;16501:82::-;810:21454;16421:199;:::o;2575:307:8:-;1899:1;2702:7;810:21454:12;2702:18:8;2698:86;;1899:1;2702:7;810:21454:12;2575:307:8:o;2698:86::-;2743:30;;;-1:-1:-1;2743:30:8;;-1:-1:-1;2743:30:8;7242:3683:10;810:21454:12;;7242:3683:10;-1:-1:-1;;7242:3683:10;;1412:159;;;;;;;;;;;;;;;;7498:9;;7494:365;;-1:-1:-1;;;7969:19:10;-1:-1:-1;7969:19:10;7965:142;;-1:-1:-1;;;;7136:8:12;8390:308:10;;;;;;;940:4:7;;8390:308:10;;8962:384;;9409:18;7242:3683;:::o;7965:142::-;1829:135:7;;;940:4;1829:135;;;;;7494:365:10;7827:17;;;;810:21454:12;;7820:24:10;:::o;7242:3683::-;-1:-1:-1;;;;;1412:159:10;;;;;;;;;;;;;;;;;7498:9;;7494:365;;7969:19;;;;7965:142;;7136:8:12;;-1:-1:-1;;;7136:8:12;8390:308:10;940:4:7;810:21454:12;940:4:7;8917:31:10;;8962:384;;;9800:1;940:4:7;9781:1:10;940:4:7;9780:21:10;940:4:7;;;9800:1:10;940:4:7;;;;;9800:1:10;940:4:7;;;;;9800:1:10;940:4:7;;;;;9800:1:10;940:4:7;;;;;9800:1:10;940:4:7;;;;;9800:1:10;940:4:7;;8962:384:10;;;;810:21454:12;8962:384:10;;;8390:308;;;;;;940:4:7;8390:308:10;;8962:384;9409:18;940:4:7;7242:3683:10;:::o;7965:142::-;1829:135:7;;810:21454:12;1829:135:7;8028:16:10;5312:5;940:4:7;;5306:42:10;1829:135:7;;;;;7494:365:10;7827:17;;;;;;:::i;:::-;7820:24;:::o;16907:250:12:-;17032:16;2294:6;16907:250;17042:6;17032:16;;:::i;:::-;810:21454;17129:21;2294:6;17082:23;17096:9;17082:23;;:::i;:::-;810:21454;17129:21;;;:::i;:::-;16907:250;:::o;17163:766::-;;2294:6;810:21454;;;;;2294:6;810:21454;;;;;;;17778:6;2294;810:21454;;;2294:6;810:21454;;;17810:24;17735:50;;;;:::i;:::-;17810:24;;;:::i;:::-;17901:21;2294:6;17854:23;17868:9;17854:23;;:::i;7888:206:1:-;;;;-1:-1:-1;;;;;810:21454:12;7958:21:1;;7954:89;;810:21454:12;7977:1:1;810:21454:12;7977:1:1;810:21454:12;;;7977:1:1;810:21454:12;;6244:19:1;;;6240:115;;810:21454:12;;7977:1:1;810:21454:12;;6987:25:1;810:21454:12;;;;;;;940:4:7;810:21454:12;;;;;6714:21:1;810:21454:12;940:4:7;6714:21:1;810:21454:12;;;;;;6987:25:1;7888:206::o;6240:115::-;6290:50;;;;;7977:1;6290:50;;810:21454:12;;;;;;7977:1:1;6290:50;7954:89;8002:30;;;7977:1;8002:30;7977:1;8002:30;810:21454:12;;7977:1:1;8002:30;18146:173:12;18239:28;18146:173;;;;;18239:28;;810:21454;;;;;;;;;;;;;;;;;-1:-1:-1;;810:21454:12;;;;;:::i;:::-;;;18239:28;810:21454;;;;;;18281:5;18277:35;;18146:173::o;18277:35::-;18295:17;;;18239:28;18295:17;;18239:28;18295:17;810:21454;;;5297:300:1;-1:-1:-1;;;;;810:21454:12;;5380:18:1;;5376:86;;-1:-1:-1;;;;;810:21454:12;;5475:16:1;;5471:86;;810:21454:12;5396:1:1;810:21454:12;5396:1:1;810:21454:12;;;5396:1:1;810:21454:12;;6244:19:1;;;6240:115;;810:21454:12;6987:25:1;810:21454:12;;;;5396:1:1;810:21454:12;5396:1:1;810:21454:12;;940:4:7;810:21454:12;5396:1:1;810:21454:12;;;5396:1:1;810:21454:12;5396:1:1;810:21454:12;;;5396:1:1;810:21454:12;;;;;;;;;;;;6987:25:1;5297:300::o;6240:115::-;6290:50;;;;5396:1;6290:50;;810:21454:12;;;;;;5396:1:1;6290:50;5471:86;5514:32;;;5396:1;5514:32;5396:1;5514:32;810:21454:12;;5396:1:1;5514:32;10319:476;-1:-1:-1;;;;;810:21454:12;;;-1:-1:-1;810:21454:12;;;;;;;;;;;;;;;;;;;;;;;;;;10319:476:1;;-1:-1:-1;;10484:36:1;;10480:309;;10319:476;;;;;:::o;10480:309::-;10540:24;;;10536:130;;9717:19;;9713:89;;-1:-1:-1;;;;;810:21454:12;;9815:21:1;9811:90;;-1:-1:-1;810:21454:12;3561:11:1;810:21454:12;;;-1:-1:-1;810:21454:12;9910:27:1;810:21454:12;;;;;;-1:-1:-1;810:21454:12;;;;-1:-1:-1;810:21454:12;940:4:7;;810:21454:12;;10480:309:1;;;;;;9811:90;9859:31;;;-1:-1:-1;9859:31:1;-1:-1:-1;9859:31:1;810:21454:12;;-1:-1:-1;9859:31:1;9713:89;9759:32;;;-1:-1:-1;9759:32:1;-1:-1:-1;9759:32:1;810:21454:12;;-1:-1:-1;9759:32:1;10536:130;10591:60;;;;;;-1:-1:-1;10591:60:1;810:21454:12;;;;;;10591:60:1;810:21454:12;;;;;;-1:-1:-1;10591:60:1;9605:432;-1:-1:-1;;;;;810:21454:12;;9717:19:1;;9713:89;;-1:-1:-1;;;;;810:21454:12;;9815:21:1;;9811:90;;810:21454:12;9989:31:1;810:21454:12;;9734:1:1;810:21454:12;8746:4:1;810:21454:12;;;9734:1:1;810:21454:12;;-1:-1:-1;810:21454:12;;;;;-1:-1:-1;810:21454:12;;;;;;;9989:31:1;9605:432::o
Swarm Source
ipfs://af85bf2c42fda269039bd0eb11b603d3b324c45d0023c7ac234b06549bc92387
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.