Source Code
Overview
ETH Balance
0 ETH
ETH Value
$0.00| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
Latest 1 internal transaction
Advanced mode:
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 42080704 | 36 days ago | Contract Creation | 0 ETH |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
AegisDFFDependencies
Compiler Version
v0.8.26+commit.8a97fa7a
Optimization Enabled:
Yes with 1 runs
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.25;
import { IPoolManager } from "@uniswap/v4-core/src/interfaces/IPoolManager.sol";
import { IHooks } from "@uniswap/v4-core/src/interfaces/IHooks.sol";
import { IPositionManager } from "@uniswap/v4-periphery/src/interfaces/IPositionManager.sol";
import { IAllowanceTransfer } from "permit2/src/interfaces/IAllowanceTransfer.sol";
import { IUniversalRouter } from "./interfaces/external/IUniversalRouter.sol";
import { IAegisDFFDependencies } from "./interfaces/IAegisDFFDependencies.sol";
/// @title AegisDFFDependencies
/// @notice Stores ALL chain-specific configuration for deterministic cross-chain deployment of AEGIS DFF contracts
/// @dev Deploy via CREATE2 (e.g., Nick's factory) for identical address across chains.
/// Anyone can deploy this contract - the deployer EOA does not need any special privileges.
/// All AEGIS DFF contracts use AEGIS_INITIALIZER as their owner, which can be an EOA or a
/// GnosisSafe deployed at the same deterministic address across chains.
/// The contract has an empty constructor to ensure identical bytecode. Chain-specific
/// addresses are set via the one-time initialize() function called by AEGIS_INITIALIZER.
contract AegisDFFDependencies is IAegisDFFDependencies {
// -------------------------------------------------------------------------
// Constants
// -------------------------------------------------------------------------
/// @inheritdoc IAegisDFFDependencies
address public constant override AEGIS_INITIALIZER = 0x6CB1C9A1A31186170F6e6746640A1D5fCa8cc032;
// -------------------------------------------------------------------------
// State Variables
// -------------------------------------------------------------------------
/// @inheritdoc IAegisDFFDependencies
bool public override initialized;
// External protocol addresses
address public override agToken;
IPoolManager public override poolManager;
IPositionManager public override positionManager;
IAllowanceTransfer public override permit2;
IUniversalRouter public override universalRouter;
IHooks public override aegisV1Hook;
// Admin addresses
address public override emergencyOwner;
address public override protocolOwner;
// String configuration
string public override chainName;
string public override dffName;
string public override dffSymbol;
string public override sharesName;
string public override sharesSymbol;
// Numeric configuration
uint256 public override rebalanceDelaySeconds;
uint32 public override twapPeriod;
uint32 public override twapAuxPeriod;
uint24 public override rebalanceTwapMaxTicks;
uint24 public override redeemTwapMaxTicks;
// Vesting configuration
uint256 public override vestingDurationDays;
// -------------------------------------------------------------------------
// Constructor
// -------------------------------------------------------------------------
/// @notice Empty constructor for deterministic CREATE2 deployment
/// @dev No initialization here - use initialize() after deployment
constructor() { }
// -------------------------------------------------------------------------
// Initialization
// -------------------------------------------------------------------------
/// @inheritdoc IAegisDFFDependencies
function initialize(InitParams calldata params) external override {
if (msg.sender != AEGIS_INITIALIZER) revert UnauthorizedInitializer();
if (initialized) revert AlreadyInitialized();
// Validate required addresses
if (params.agToken == address(0)) revert ZeroAddress();
if (params.poolManager == address(0)) revert ZeroAddress();
if (params.positionManager == address(0)) revert ZeroAddress();
if (params.permit2 == address(0)) revert ZeroAddress();
if (params.universalRouter == address(0)) revert ZeroAddress();
if (params.aegisV1Hook == address(0)) revert ZeroAddress();
if (params.emergencyOwner == address(0)) revert ZeroAddress();
if (params.protocolOwner == address(0)) revert ZeroAddress();
// Set external protocol addresses
agToken = params.agToken;
poolManager = IPoolManager(params.poolManager);
positionManager = IPositionManager(params.positionManager);
permit2 = IAllowanceTransfer(params.permit2);
universalRouter = IUniversalRouter(params.universalRouter);
aegisV1Hook = IHooks(params.aegisV1Hook);
// Set admin addresses
emergencyOwner = params.emergencyOwner;
protocolOwner = params.protocolOwner;
// Set string configuration - derive names from chainName
chainName = params.chainName;
dffName = string.concat("Aegis DFF-", params.chainName);
dffSymbol = string.concat("AGFF-", params.chainName);
sharesName = string.concat("Aegis Shares-", params.chainName);
sharesSymbol = "AGS";
// Set numeric configuration
rebalanceDelaySeconds = params.rebalanceDelaySeconds;
twapPeriod = params.twapPeriod;
twapAuxPeriod = params.twapAuxPeriod;
rebalanceTwapMaxTicks = params.rebalanceTwapMaxTicks;
redeemTwapMaxTicks = params.redeemTwapMaxTicks;
// Set vesting configuration
vestingDurationDays = params.vestingDurationDays;
// Mark as initialized
initialized = true;
emit Initialized(block.chainid, params.chainName);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import {Currency} from "../types/Currency.sol";
import {PoolKey} from "../types/PoolKey.sol";
import {IHooks} from "./IHooks.sol";
import {IERC6909Claims} from "./external/IERC6909Claims.sol";
import {IProtocolFees} from "./IProtocolFees.sol";
import {BalanceDelta} from "../types/BalanceDelta.sol";
import {PoolId} from "../types/PoolId.sol";
import {IExtsload} from "./IExtsload.sol";
import {IExttload} from "./IExttload.sol";
import {ModifyLiquidityParams, SwapParams} from "../types/PoolOperation.sol";
/// @notice Interface for the PoolManager
interface IPoolManager is IProtocolFees, IERC6909Claims, IExtsload, IExttload {
/// @notice Thrown when a currency is not netted out after the contract is unlocked
error CurrencyNotSettled();
/// @notice Thrown when trying to interact with a non-initialized pool
error PoolNotInitialized();
/// @notice Thrown when unlock is called, but the contract is already unlocked
error AlreadyUnlocked();
/// @notice Thrown when a function is called that requires the contract to be unlocked, but it is not
error ManagerLocked();
/// @notice Pools are limited to type(int16).max tickSpacing in #initialize, to prevent overflow
error TickSpacingTooLarge(int24 tickSpacing);
/// @notice Pools must have a positive non-zero tickSpacing passed to #initialize
error TickSpacingTooSmall(int24 tickSpacing);
/// @notice PoolKey must have currencies where address(currency0) < address(currency1)
error CurrenciesOutOfOrderOrEqual(address currency0, address currency1);
/// @notice Thrown when a call to updateDynamicLPFee is made by an address that is not the hook,
/// or on a pool that does not have a dynamic swap fee.
error UnauthorizedDynamicLPFeeUpdate();
/// @notice Thrown when trying to swap amount of 0
error SwapAmountCannotBeZero();
///@notice Thrown when native currency is passed to a non native settlement
error NonzeroNativeValue();
/// @notice Thrown when `clear` is called with an amount that is not exactly equal to the open currency delta.
error MustClearExactPositiveDelta();
/// @notice Emitted when a new pool is initialized
/// @param id The abi encoded hash of the pool key struct for the new pool
/// @param currency0 The first currency of the pool by address sort order
/// @param currency1 The second currency of the pool by address sort order
/// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip
/// @param tickSpacing The minimum number of ticks between initialized ticks
/// @param hooks The hooks contract address for the pool, or address(0) if none
/// @param sqrtPriceX96 The price of the pool on initialization
/// @param tick The initial tick of the pool corresponding to the initialized price
event Initialize(
PoolId indexed id,
Currency indexed currency0,
Currency indexed currency1,
uint24 fee,
int24 tickSpacing,
IHooks hooks,
uint160 sqrtPriceX96,
int24 tick
);
/// @notice Emitted when a liquidity position is modified
/// @param id The abi encoded hash of the pool key struct for the pool that was modified
/// @param sender The address that modified the pool
/// @param tickLower The lower tick of the position
/// @param tickUpper The upper tick of the position
/// @param liquidityDelta The amount of liquidity that was added or removed
/// @param salt The extra data to make positions unique
event ModifyLiquidity(
PoolId indexed id, address indexed sender, int24 tickLower, int24 tickUpper, int256 liquidityDelta, bytes32 salt
);
/// @notice Emitted for swaps between currency0 and currency1
/// @param id The abi encoded hash of the pool key struct for the pool that was modified
/// @param sender The address that initiated the swap call, and that received the callback
/// @param amount0 The delta of the currency0 balance of the pool
/// @param amount1 The delta of the currency1 balance of the pool
/// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96
/// @param liquidity The liquidity of the pool after the swap
/// @param tick The log base 1.0001 of the price of the pool after the swap
/// @param fee The swap fee in hundredths of a bip
event Swap(
PoolId indexed id,
address indexed sender,
int128 amount0,
int128 amount1,
uint160 sqrtPriceX96,
uint128 liquidity,
int24 tick,
uint24 fee
);
/// @notice Emitted for donations
/// @param id The abi encoded hash of the pool key struct for the pool that was donated to
/// @param sender The address that initiated the donate call
/// @param amount0 The amount donated in currency0
/// @param amount1 The amount donated in currency1
event Donate(PoolId indexed id, address indexed sender, uint256 amount0, uint256 amount1);
/// @notice All interactions on the contract that account deltas require unlocking. A caller that calls `unlock` must implement
/// `IUnlockCallback(msg.sender).unlockCallback(data)`, where they interact with the remaining functions on this contract.
/// @dev The only functions callable without an unlocking are `initialize` and `updateDynamicLPFee`
/// @param data Any data to pass to the callback, via `IUnlockCallback(msg.sender).unlockCallback(data)`
/// @return The data returned by the call to `IUnlockCallback(msg.sender).unlockCallback(data)`
function unlock(bytes calldata data) external returns (bytes memory);
/// @notice Initialize the state for a given pool ID
/// @dev A swap fee totaling MAX_SWAP_FEE (100%) makes exact output swaps impossible since the input is entirely consumed by the fee
/// @param key The pool key for the pool to initialize
/// @param sqrtPriceX96 The initial square root price
/// @return tick The initial tick of the pool
function initialize(PoolKey memory key, uint160 sqrtPriceX96) external returns (int24 tick);
/// @notice Modify the liquidity for the given pool
/// @dev Poke by calling with a zero liquidityDelta
/// @param key The pool to modify liquidity in
/// @param params The parameters for modifying the liquidity
/// @param hookData The data to pass through to the add/removeLiquidity hooks
/// @return callerDelta The balance delta of the caller of modifyLiquidity. This is the total of both principal, fee deltas, and hook deltas if applicable
/// @return feesAccrued The balance delta of the fees generated in the liquidity range. Returned for informational purposes
/// @dev Note that feesAccrued can be artificially inflated by a malicious actor and integrators should be careful using the value
/// For pools with a single liquidity position, actors can donate to themselves to inflate feeGrowthGlobal (and consequently feesAccrued)
/// atomically donating and collecting fees in the same unlockCallback may make the inflated value more extreme
function modifyLiquidity(PoolKey memory key, ModifyLiquidityParams memory params, bytes calldata hookData)
external
returns (BalanceDelta callerDelta, BalanceDelta feesAccrued);
/// @notice Swap against the given pool
/// @param key The pool to swap in
/// @param params The parameters for swapping
/// @param hookData The data to pass through to the swap hooks
/// @return swapDelta The balance delta of the address swapping
/// @dev Swapping on low liquidity pools may cause unexpected swap amounts when liquidity available is less than amountSpecified.
/// Additionally note that if interacting with hooks that have the BEFORE_SWAP_RETURNS_DELTA_FLAG or AFTER_SWAP_RETURNS_DELTA_FLAG
/// the hook may alter the swap input/output. Integrators should perform checks on the returned swapDelta.
function swap(PoolKey memory key, SwapParams memory params, bytes calldata hookData)
external
returns (BalanceDelta swapDelta);
/// @notice Donate the given currency amounts to the in-range liquidity providers of a pool
/// @dev Calls to donate can be frontrun adding just-in-time liquidity, with the aim of receiving a portion donated funds.
/// Donors should keep this in mind when designing donation mechanisms.
/// @dev This function donates to in-range LPs at slot0.tick. In certain edge-cases of the swap algorithm, the `sqrtPrice` of
/// a pool can be at the lower boundary of tick `n`, but the `slot0.tick` of the pool is already `n - 1`. In this case a call to
/// `donate` would donate to tick `n - 1` (slot0.tick) not tick `n` (getTickAtSqrtPrice(slot0.sqrtPriceX96)).
/// Read the comments in `Pool.swap()` for more information about this.
/// @param key The key of the pool to donate to
/// @param amount0 The amount of currency0 to donate
/// @param amount1 The amount of currency1 to donate
/// @param hookData The data to pass through to the donate hooks
/// @return BalanceDelta The delta of the caller after the donate
function donate(PoolKey memory key, uint256 amount0, uint256 amount1, bytes calldata hookData)
external
returns (BalanceDelta);
/// @notice Writes the current ERC20 balance of the specified currency to transient storage
/// This is used to checkpoint balances for the manager and derive deltas for the caller.
/// @dev This MUST be called before any ERC20 tokens are sent into the contract, but can be skipped
/// for native tokens because the amount to settle is determined by the sent value.
/// However, if an ERC20 token has been synced and not settled, and the caller instead wants to settle
/// native funds, this function can be called with the native currency to then be able to settle the native currency
function sync(Currency currency) external;
/// @notice Called by the user to net out some value owed to the user
/// @dev Will revert if the requested amount is not available, consider using `mint` instead
/// @dev Can also be used as a mechanism for free flash loans
/// @param currency The currency to withdraw from the pool manager
/// @param to The address to withdraw to
/// @param amount The amount of currency to withdraw
function take(Currency currency, address to, uint256 amount) external;
/// @notice Called by the user to pay what is owed
/// @return paid The amount of currency settled
function settle() external payable returns (uint256 paid);
/// @notice Called by the user to pay on behalf of another address
/// @param recipient The address to credit for the payment
/// @return paid The amount of currency settled
function settleFor(address recipient) external payable returns (uint256 paid);
/// @notice WARNING - Any currency that is cleared, will be non-retrievable, and locked in the contract permanently.
/// A call to clear will zero out a positive balance WITHOUT a corresponding transfer.
/// @dev This could be used to clear a balance that is considered dust.
/// Additionally, the amount must be the exact positive balance. This is to enforce that the caller is aware of the amount being cleared.
function clear(Currency currency, uint256 amount) external;
/// @notice Called by the user to move value into ERC6909 balance
/// @param to The address to mint the tokens to
/// @param id The currency address to mint to ERC6909s, as a uint256
/// @param amount The amount of currency to mint
/// @dev The id is converted to a uint160 to correspond to a currency address
/// If the upper 12 bytes are not 0, they will be 0-ed out
function mint(address to, uint256 id, uint256 amount) external;
/// @notice Called by the user to move value from ERC6909 balance
/// @param from The address to burn the tokens from
/// @param id The currency address to burn from ERC6909s, as a uint256
/// @param amount The amount of currency to burn
/// @dev The id is converted to a uint160 to correspond to a currency address
/// If the upper 12 bytes are not 0, they will be 0-ed out
function burn(address from, uint256 id, uint256 amount) external;
/// @notice Updates the pools lp fees for the a pool that has enabled dynamic lp fees.
/// @dev A swap fee totaling MAX_SWAP_FEE (100%) makes exact output swaps impossible since the input is entirely consumed by the fee
/// @param key The key of the pool to update dynamic LP fees for
/// @param newDynamicLPFee The new dynamic pool LP fee
function updateDynamicLPFee(PoolKey memory key, uint24 newDynamicLPFee) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {PoolKey} from "../types/PoolKey.sol";
import {BalanceDelta} from "../types/BalanceDelta.sol";
import {ModifyLiquidityParams, SwapParams} from "../types/PoolOperation.sol";
import {BeforeSwapDelta} from "../types/BeforeSwapDelta.sol";
/// @notice V4 decides whether to invoke specific hooks by inspecting the least significant bits
/// of the address that the hooks contract is deployed to.
/// For example, a hooks contract deployed to address: 0x0000000000000000000000000000000000002400
/// has the lowest bits '10 0100 0000 0000' which would cause the 'before initialize' and 'after add liquidity' hooks to be used.
/// See the Hooks library for the full spec.
/// @dev Should only be callable by the v4 PoolManager.
interface IHooks {
/// @notice The hook called before the state of a pool is initialized
/// @param sender The initial msg.sender for the initialize call
/// @param key The key for the pool being initialized
/// @param sqrtPriceX96 The sqrt(price) of the pool as a Q64.96
/// @return bytes4 The function selector for the hook
function beforeInitialize(address sender, PoolKey calldata key, uint160 sqrtPriceX96) external returns (bytes4);
/// @notice The hook called after the state of a pool is initialized
/// @param sender The initial msg.sender for the initialize call
/// @param key The key for the pool being initialized
/// @param sqrtPriceX96 The sqrt(price) of the pool as a Q64.96
/// @param tick The current tick after the state of a pool is initialized
/// @return bytes4 The function selector for the hook
function afterInitialize(address sender, PoolKey calldata key, uint160 sqrtPriceX96, int24 tick)
external
returns (bytes4);
/// @notice The hook called before liquidity is added
/// @param sender The initial msg.sender for the add liquidity call
/// @param key The key for the pool
/// @param params The parameters for adding liquidity
/// @param hookData Arbitrary data handed into the PoolManager by the liquidity provider to be passed on to the hook
/// @return bytes4 The function selector for the hook
function beforeAddLiquidity(
address sender,
PoolKey calldata key,
ModifyLiquidityParams calldata params,
bytes calldata hookData
) external returns (bytes4);
/// @notice The hook called after liquidity is added
/// @param sender The initial msg.sender for the add liquidity call
/// @param key The key for the pool
/// @param params The parameters for adding liquidity
/// @param delta The caller's balance delta after adding liquidity; the sum of principal delta, fees accrued, and hook delta
/// @param feesAccrued The fees accrued since the last time fees were collected from this position
/// @param hookData Arbitrary data handed into the PoolManager by the liquidity provider to be passed on to the hook
/// @return bytes4 The function selector for the hook
/// @return BalanceDelta The hook's delta in token0 and token1. Positive: the hook is owed/took currency, negative: the hook owes/sent currency
function afterAddLiquidity(
address sender,
PoolKey calldata key,
ModifyLiquidityParams calldata params,
BalanceDelta delta,
BalanceDelta feesAccrued,
bytes calldata hookData
) external returns (bytes4, BalanceDelta);
/// @notice The hook called before liquidity is removed
/// @param sender The initial msg.sender for the remove liquidity call
/// @param key The key for the pool
/// @param params The parameters for removing liquidity
/// @param hookData Arbitrary data handed into the PoolManager by the liquidity provider to be be passed on to the hook
/// @return bytes4 The function selector for the hook
function beforeRemoveLiquidity(
address sender,
PoolKey calldata key,
ModifyLiquidityParams calldata params,
bytes calldata hookData
) external returns (bytes4);
/// @notice The hook called after liquidity is removed
/// @param sender The initial msg.sender for the remove liquidity call
/// @param key The key for the pool
/// @param params The parameters for removing liquidity
/// @param delta The caller's balance delta after removing liquidity; the sum of principal delta, fees accrued, and hook delta
/// @param feesAccrued The fees accrued since the last time fees were collected from this position
/// @param hookData Arbitrary data handed into the PoolManager by the liquidity provider to be be passed on to the hook
/// @return bytes4 The function selector for the hook
/// @return BalanceDelta The hook's delta in token0 and token1. Positive: the hook is owed/took currency, negative: the hook owes/sent currency
function afterRemoveLiquidity(
address sender,
PoolKey calldata key,
ModifyLiquidityParams calldata params,
BalanceDelta delta,
BalanceDelta feesAccrued,
bytes calldata hookData
) external returns (bytes4, BalanceDelta);
/// @notice The hook called before a swap
/// @param sender The initial msg.sender for the swap call
/// @param key The key for the pool
/// @param params The parameters for the swap
/// @param hookData Arbitrary data handed into the PoolManager by the swapper to be be passed on to the hook
/// @return bytes4 The function selector for the hook
/// @return BeforeSwapDelta The hook's delta in specified and unspecified currencies. Positive: the hook is owed/took currency, negative: the hook owes/sent currency
/// @return uint24 Optionally override the lp fee, only used if three conditions are met: 1. the Pool has a dynamic fee, 2. the value's 2nd highest bit is set (23rd bit, 0x400000), and 3. the value is less than or equal to the maximum fee (1 million)
function beforeSwap(address sender, PoolKey calldata key, SwapParams calldata params, bytes calldata hookData)
external
returns (bytes4, BeforeSwapDelta, uint24);
/// @notice The hook called after a swap
/// @param sender The initial msg.sender for the swap call
/// @param key The key for the pool
/// @param params The parameters for the swap
/// @param delta The amount owed to the caller (positive) or owed to the pool (negative)
/// @param hookData Arbitrary data handed into the PoolManager by the swapper to be be passed on to the hook
/// @return bytes4 The function selector for the hook
/// @return int128 The hook's delta in unspecified currency. Positive: the hook is owed/took currency, negative: the hook owes/sent currency
function afterSwap(
address sender,
PoolKey calldata key,
SwapParams calldata params,
BalanceDelta delta,
bytes calldata hookData
) external returns (bytes4, int128);
/// @notice The hook called before donate
/// @param sender The initial msg.sender for the donate call
/// @param key The key for the pool
/// @param amount0 The amount of token0 being donated
/// @param amount1 The amount of token1 being donated
/// @param hookData Arbitrary data handed into the PoolManager by the donor to be be passed on to the hook
/// @return bytes4 The function selector for the hook
function beforeDonate(
address sender,
PoolKey calldata key,
uint256 amount0,
uint256 amount1,
bytes calldata hookData
) external returns (bytes4);
/// @notice The hook called after donate
/// @param sender The initial msg.sender for the donate call
/// @param key The key for the pool
/// @param amount0 The amount of token0 being donated
/// @param amount1 The amount of token1 being donated
/// @param hookData Arbitrary data handed into the PoolManager by the donor to be be passed on to the hook
/// @return bytes4 The function selector for the hook
function afterDonate(
address sender,
PoolKey calldata key,
uint256 amount0,
uint256 amount1,
bytes calldata hookData
) external returns (bytes4);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {PoolKey} from "@uniswap/v4-core/src/types/PoolKey.sol";
import {PositionInfo} from "../libraries/PositionInfoLibrary.sol";
import {INotifier} from "./INotifier.sol";
import {IImmutableState} from "./IImmutableState.sol";
import {IERC721Permit_v4} from "./IERC721Permit_v4.sol";
import {IEIP712_v4} from "./IEIP712_v4.sol";
import {IMulticall_v4} from "./IMulticall_v4.sol";
import {IPoolInitializer_v4} from "./IPoolInitializer_v4.sol";
import {IUnorderedNonce} from "./IUnorderedNonce.sol";
import {IPermit2Forwarder} from "./IPermit2Forwarder.sol";
/// @title IPositionManager
/// @notice Interface for the PositionManager contract
interface IPositionManager is
INotifier,
IImmutableState,
IERC721Permit_v4,
IEIP712_v4,
IMulticall_v4,
IPoolInitializer_v4,
IUnorderedNonce,
IPermit2Forwarder
{
/// @notice Thrown when the caller is not approved to modify a position
error NotApproved(address caller);
/// @notice Thrown when the block.timestamp exceeds the user-provided deadline
error DeadlinePassed(uint256 deadline);
/// @notice Thrown when calling transfer, subscribe, or unsubscribe when the PoolManager is unlocked.
/// @dev This is to prevent hooks from being able to trigger notifications at the same time the position is being modified.
error PoolManagerMustBeLocked();
/// @notice Unlocks Uniswap v4 PoolManager and batches actions for modifying liquidity
/// @dev This is the standard entrypoint for the PositionManager
/// @param unlockData is an encoding of actions, and parameters for those actions
/// @param deadline is the deadline for the batched actions to be executed
function modifyLiquidities(bytes calldata unlockData, uint256 deadline) external payable;
/// @notice Batches actions for modifying liquidity without unlocking v4 PoolManager
/// @dev This must be called by a contract that has already unlocked the v4 PoolManager
/// @param actions the actions to perform
/// @param params the parameters to provide for the actions
function modifyLiquiditiesWithoutUnlock(bytes calldata actions, bytes[] calldata params) external payable;
/// @notice Used to get the ID that will be used for the next minted liquidity position
/// @return uint256 The next token ID
function nextTokenId() external view returns (uint256);
/// @notice Returns the liquidity of a position
/// @param tokenId the ERC721 tokenId
/// @return liquidity the position's liquidity, as a liquidityAmount
/// @dev this value can be processed as an amount0 and amount1 by using the LiquidityAmounts library
function getPositionLiquidity(uint256 tokenId) external view returns (uint128 liquidity);
/// @notice Returns the pool key and position info of a position
/// @param tokenId the ERC721 tokenId
/// @return poolKey the pool key of the position
/// @return PositionInfo a uint256 packed value holding information about the position including the range (tickLower, tickUpper)
function getPoolAndPositionInfo(uint256 tokenId) external view returns (PoolKey memory, PositionInfo);
/// @notice Returns the position info of a position
/// @param tokenId the ERC721 tokenId
/// @return a uint256 packed value holding information about the position including the range (tickLower, tickUpper)
function positionInfo(uint256 tokenId) external view returns (PositionInfo);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {IEIP712} from "./IEIP712.sol";
/// @title AllowanceTransfer
/// @notice Handles ERC20 token permissions through signature based allowance setting and ERC20 token transfers by checking allowed amounts
/// @dev Requires user's token approval on the Permit2 contract
interface IAllowanceTransfer is IEIP712 {
/// @notice Thrown when an allowance on a token has expired.
/// @param deadline The timestamp at which the allowed amount is no longer valid
error AllowanceExpired(uint256 deadline);
/// @notice Thrown when an allowance on a token has been depleted.
/// @param amount The maximum amount allowed
error InsufficientAllowance(uint256 amount);
/// @notice Thrown when too many nonces are invalidated.
error ExcessiveInvalidation();
/// @notice Emits an event when the owner successfully invalidates an ordered nonce.
event NonceInvalidation(
address indexed owner, address indexed token, address indexed spender, uint48 newNonce, uint48 oldNonce
);
/// @notice Emits an event when the owner successfully sets permissions on a token for the spender.
event Approval(
address indexed owner, address indexed token, address indexed spender, uint160 amount, uint48 expiration
);
/// @notice Emits an event when the owner successfully sets permissions using a permit signature on a token for the spender.
event Permit(
address indexed owner,
address indexed token,
address indexed spender,
uint160 amount,
uint48 expiration,
uint48 nonce
);
/// @notice Emits an event when the owner sets the allowance back to 0 with the lockdown function.
event Lockdown(address indexed owner, address token, address spender);
/// @notice The permit data for a token
struct PermitDetails {
// ERC20 token address
address token;
// the maximum amount allowed to spend
uint160 amount;
// timestamp at which a spender's token allowances become invalid
uint48 expiration;
// an incrementing value indexed per owner,token,and spender for each signature
uint48 nonce;
}
/// @notice The permit message signed for a single token allowance
struct PermitSingle {
// the permit data for a single token alownce
PermitDetails details;
// address permissioned on the allowed tokens
address spender;
// deadline on the permit signature
uint256 sigDeadline;
}
/// @notice The permit message signed for multiple token allowances
struct PermitBatch {
// the permit data for multiple token allowances
PermitDetails[] details;
// address permissioned on the allowed tokens
address spender;
// deadline on the permit signature
uint256 sigDeadline;
}
/// @notice The saved permissions
/// @dev This info is saved per owner, per token, per spender and all signed over in the permit message
/// @dev Setting amount to type(uint160).max sets an unlimited approval
struct PackedAllowance {
// amount allowed
uint160 amount;
// permission expiry
uint48 expiration;
// an incrementing value indexed per owner,token,and spender for each signature
uint48 nonce;
}
/// @notice A token spender pair.
struct TokenSpenderPair {
// the token the spender is approved
address token;
// the spender address
address spender;
}
/// @notice Details for a token transfer.
struct AllowanceTransferDetails {
// the owner of the token
address from;
// the recipient of the token
address to;
// the amount of the token
uint160 amount;
// the token to be transferred
address token;
}
/// @notice A mapping from owner address to token address to spender address to PackedAllowance struct, which contains details and conditions of the approval.
/// @notice The mapping is indexed in the above order see: allowance[ownerAddress][tokenAddress][spenderAddress]
/// @dev The packed slot holds the allowed amount, expiration at which the allowed amount is no longer valid, and current nonce thats updated on any signature based approvals.
function allowance(address user, address token, address spender)
external
view
returns (uint160 amount, uint48 expiration, uint48 nonce);
/// @notice Approves the spender to use up to amount of the specified token up until the expiration
/// @param token The token to approve
/// @param spender The spender address to approve
/// @param amount The approved amount of the token
/// @param expiration The timestamp at which the approval is no longer valid
/// @dev The packed allowance also holds a nonce, which will stay unchanged in approve
/// @dev Setting amount to type(uint160).max sets an unlimited approval
function approve(address token, address spender, uint160 amount, uint48 expiration) external;
/// @notice Permit a spender to a given amount of the owners token via the owner's EIP-712 signature
/// @dev May fail if the owner's nonce was invalidated in-flight by invalidateNonce
/// @param owner The owner of the tokens being approved
/// @param permitSingle Data signed over by the owner specifying the terms of approval
/// @param signature The owner's signature over the permit data
function permit(address owner, PermitSingle memory permitSingle, bytes calldata signature) external;
/// @notice Permit a spender to the signed amounts of the owners tokens via the owner's EIP-712 signature
/// @dev May fail if the owner's nonce was invalidated in-flight by invalidateNonce
/// @param owner The owner of the tokens being approved
/// @param permitBatch Data signed over by the owner specifying the terms of approval
/// @param signature The owner's signature over the permit data
function permit(address owner, PermitBatch memory permitBatch, bytes calldata signature) external;
/// @notice Transfer approved tokens from one address to another
/// @param from The address to transfer from
/// @param to The address of the recipient
/// @param amount The amount of the token to transfer
/// @param token The token address to transfer
/// @dev Requires the from address to have approved at least the desired amount
/// of tokens to msg.sender.
function transferFrom(address from, address to, uint160 amount, address token) external;
/// @notice Transfer approved tokens in a batch
/// @param transferDetails Array of owners, recipients, amounts, and tokens for the transfers
/// @dev Requires the from addresses to have approved at least the desired amount
/// of tokens to msg.sender.
function transferFrom(AllowanceTransferDetails[] calldata transferDetails) external;
/// @notice Enables performing a "lockdown" of the sender's Permit2 identity
/// by batch revoking approvals
/// @param approvals Array of approvals to revoke.
function lockdown(TokenSpenderPair[] calldata approvals) external;
/// @notice Invalidate nonces for a given (token, spender) pair
/// @param token The token to invalidate nonces for
/// @param spender The spender to invalidate nonces for
/// @param newNonce The new nonce to set. Invalidates all nonces less than it.
/// @dev Can't invalidate more than 2**16 nonces per transaction.
function invalidateNonces(address token, address spender, uint48 newNonce) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.25;
/// @notice Minimal interface for the Uniswap Universal Router
interface IUniversalRouter {
/// @notice Executes a set of encoded commands
/// @param commands Packed command identifiers (one byte per command)
/// @param inputs ABI-encoded inputs for each command
function execute(bytes calldata commands, bytes[] calldata inputs) external payable;
/// @notice Executes a set of encoded commands with a deadline
/// @param commands Packed command identifiers (one byte per command)
/// @param inputs ABI-encoded inputs for each command
/// @param deadline Timestamp after which the call should revert
function execute(bytes calldata commands, bytes[] calldata inputs, uint256 deadline) external payable;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.25;
import { IPoolManager } from "@uniswap/v4-core/src/interfaces/IPoolManager.sol";
import { IHooks } from "@uniswap/v4-core/src/interfaces/IHooks.sol";
import { IPositionManager } from "@uniswap/v4-periphery/src/interfaces/IPositionManager.sol";
import { IAllowanceTransfer } from "permit2/src/interfaces/IAllowanceTransfer.sol";
import { IUniversalRouter } from "./external/IUniversalRouter.sol";
/// @title IAegisDFFDependencies
/// @notice Interface for chain-specific configuration used by AEGIS DFF contracts
/// @dev Deployed via CREATE2 for identical address across chains.
/// Anyone can deploy this contract - the deployer EOA does not need any special privileges.
/// All AEGIS DFF contracts use AEGIS_INITIALIZER as their owner, which can be an EOA or a
/// GnosisSafe deployed at the same deterministic address across chains.
/// The contract has an empty constructor to ensure identical bytecode. Chain-specific
/// addresses are set via the one-time initialize() function called by AEGIS_INITIALIZER.
interface IAegisDFFDependencies {
// -------------------------------------------------------------------------
// Errors
// -------------------------------------------------------------------------
/// @notice Thrown when caller is not the authorized initializer
error UnauthorizedInitializer();
/// @notice Thrown when contract is already initialized
error AlreadyInitialized();
/// @notice Thrown when a zero address is provided for a required field
error ZeroAddress();
// -------------------------------------------------------------------------
// Events
// -------------------------------------------------------------------------
/// @notice Emitted when dependencies are initialized
/// @param chainId The chain ID where initialization occurred
/// @param chainName The human-readable chain name
event Initialized(uint256 indexed chainId, string chainName);
// -------------------------------------------------------------------------
// Initialization Parameters
// -------------------------------------------------------------------------
/// @notice Parameters for initializing chain-specific dependencies
struct InitParams {
// External protocol addresses
address agToken;
address poolManager;
address positionManager;
address permit2;
address universalRouter;
address aegisV1Hook;
// Admin addresses
address emergencyOwner;
address protocolOwner;
// Chain identification
string chainName;
// Numeric configuration
uint256 rebalanceDelaySeconds;
uint32 twapPeriod;
uint32 twapAuxPeriod;
uint24 rebalanceTwapMaxTicks;
uint24 redeemTwapMaxTicks;
// Vesting configuration
uint256 vestingDurationDays;
}
// -------------------------------------------------------------------------
// Constants
// -------------------------------------------------------------------------
/// @notice Returns the privileged address that can call initialize() and owns all AEGIS DFF contracts
/// @dev Can be an EOA or a GnosisSafe deployed at the same address across chains.
/// This address is hardcoded to enable deterministic CREATE2 deployment by anyone.
// solhint-disable-next-line func-name-mixedcase
function AEGIS_INITIALIZER() external pure returns (address);
// -------------------------------------------------------------------------
// State Queries
// -------------------------------------------------------------------------
/// @notice Returns whether the contract has been initialized
function initialized() external view returns (bool);
// -------------------------------------------------------------------------
// External Protocol Addresses
// -------------------------------------------------------------------------
/// @notice Returns the AG token address
function agToken() external view returns (address);
/// @notice Returns the Uniswap V4 PoolManager
function poolManager() external view returns (IPoolManager);
/// @notice Returns the Uniswap V4 PositionManager
function positionManager() external view returns (IPositionManager);
/// @notice Returns the Permit2 contract
function permit2() external view returns (IAllowanceTransfer);
/// @notice Returns the Universal Router contract
function universalRouter() external view returns (IUniversalRouter);
/// @notice Returns the Aegis V1 Hook address
function aegisV1Hook() external view returns (IHooks);
// -------------------------------------------------------------------------
// Admin Addresses
// -------------------------------------------------------------------------
/// @notice Returns the emergency owner address (for emergency withdrawals)
function emergencyOwner() external view returns (address);
/// @notice Returns the protocol owner address (receives ownership of deployed contracts)
function protocolOwner() external view returns (address);
// -------------------------------------------------------------------------
// String Configuration
// -------------------------------------------------------------------------
/// @notice Returns the chain name (e.g., "Unichain", "Base")
function chainName() external view returns (string memory);
/// @notice Returns the DFF token name (e.g., "Aegis DFF-Unichain")
function dffName() external view returns (string memory);
/// @notice Returns the DFF token symbol (e.g., "AGFF-Unichain")
function dffSymbol() external view returns (string memory);
/// @notice Returns the Shares token name (e.g., "Aegis Shares-Unichain")
function sharesName() external view returns (string memory);
/// @notice Returns the Shares token symbol
function sharesSymbol() external view returns (string memory);
// -------------------------------------------------------------------------
// Numeric Configuration
// -------------------------------------------------------------------------
/// @notice Returns the delay in seconds before rebalancing is enabled
function rebalanceDelaySeconds() external view returns (uint256);
/// @notice Returns the primary TWAP period in seconds
function twapPeriod() external view returns (uint32);
/// @notice Returns the auxiliary TWAP period in seconds
function twapAuxPeriod() external view returns (uint32);
/// @notice Returns the maximum tick deviation for rebalance TWAP guard
function rebalanceTwapMaxTicks() external view returns (uint24);
/// @notice Returns the maximum tick deviation for redeem TWAP guard
function redeemTwapMaxTicks() external view returns (uint24);
// -------------------------------------------------------------------------
// Vesting Configuration
// -------------------------------------------------------------------------
/// @notice Returns the vesting duration in days
function vestingDurationDays() external view returns (uint256);
// -------------------------------------------------------------------------
// Initialization
// -------------------------------------------------------------------------
/// @notice Initialize with chain-specific addresses and configuration (one-time only)
/// @dev Can only be called by AEGIS_INITIALIZER and only once
/// @param params The initialization parameters
function initialize(InitParams calldata params) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {IERC20Minimal} from "../interfaces/external/IERC20Minimal.sol";
import {CustomRevert} from "../libraries/CustomRevert.sol";
type Currency is address;
using {greaterThan as >, lessThan as <, greaterThanOrEqualTo as >=, equals as ==} for Currency global;
using CurrencyLibrary for Currency global;
function equals(Currency currency, Currency other) pure returns (bool) {
return Currency.unwrap(currency) == Currency.unwrap(other);
}
function greaterThan(Currency currency, Currency other) pure returns (bool) {
return Currency.unwrap(currency) > Currency.unwrap(other);
}
function lessThan(Currency currency, Currency other) pure returns (bool) {
return Currency.unwrap(currency) < Currency.unwrap(other);
}
function greaterThanOrEqualTo(Currency currency, Currency other) pure returns (bool) {
return Currency.unwrap(currency) >= Currency.unwrap(other);
}
/// @title CurrencyLibrary
/// @dev This library allows for transferring and holding native tokens and ERC20 tokens
library CurrencyLibrary {
/// @notice Additional context for ERC-7751 wrapped error when a native transfer fails
error NativeTransferFailed();
/// @notice Additional context for ERC-7751 wrapped error when an ERC20 transfer fails
error ERC20TransferFailed();
/// @notice A constant to represent the native currency
Currency public constant ADDRESS_ZERO = Currency.wrap(address(0));
function transfer(Currency currency, address to, uint256 amount) internal {
// altered from https://github.com/transmissions11/solmate/blob/44a9963d4c78111f77caa0e65d677b8b46d6f2e6/src/utils/SafeTransferLib.sol
// modified custom error selectors
bool success;
if (currency.isAddressZero()) {
assembly ("memory-safe") {
// Transfer the ETH and revert if it fails.
success := call(gas(), to, amount, 0, 0, 0, 0)
}
// revert with NativeTransferFailed, containing the bubbled up error as an argument
if (!success) {
CustomRevert.bubbleUpAndRevertWith(to, bytes4(0), NativeTransferFailed.selector);
}
} else {
assembly ("memory-safe") {
// Get a pointer to some free memory.
let fmp := mload(0x40)
// Write the abi-encoded calldata into memory, beginning with the function selector.
mstore(fmp, 0xa9059cbb00000000000000000000000000000000000000000000000000000000)
mstore(add(fmp, 4), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the "to" argument.
mstore(add(fmp, 36), amount) // Append the "amount" argument. Masking not required as it's a full 32 byte type.
success :=
and(
// Set success to whether the call reverted, if not we check it either
// returned exactly 1 (can't just be non-zero data), or had no return data.
or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),
// We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.
// We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.
// Counterintuitively, this call must be positioned second to the or() call in the
// surrounding and() call or else returndatasize() will be zero during the computation.
call(gas(), currency, 0, fmp, 68, 0, 32)
)
// Now clean the memory we used
mstore(fmp, 0) // 4 byte `selector` and 28 bytes of `to` were stored here
mstore(add(fmp, 0x20), 0) // 4 bytes of `to` and 28 bytes of `amount` were stored here
mstore(add(fmp, 0x40), 0) // 4 bytes of `amount` were stored here
}
// revert with ERC20TransferFailed, containing the bubbled up error as an argument
if (!success) {
CustomRevert.bubbleUpAndRevertWith(
Currency.unwrap(currency), IERC20Minimal.transfer.selector, ERC20TransferFailed.selector
);
}
}
}
function balanceOfSelf(Currency currency) internal view returns (uint256) {
if (currency.isAddressZero()) {
return address(this).balance;
} else {
return IERC20Minimal(Currency.unwrap(currency)).balanceOf(address(this));
}
}
function balanceOf(Currency currency, address owner) internal view returns (uint256) {
if (currency.isAddressZero()) {
return owner.balance;
} else {
return IERC20Minimal(Currency.unwrap(currency)).balanceOf(owner);
}
}
function isAddressZero(Currency currency) internal pure returns (bool) {
return Currency.unwrap(currency) == Currency.unwrap(ADDRESS_ZERO);
}
function toId(Currency currency) internal pure returns (uint256) {
return uint160(Currency.unwrap(currency));
}
// If the upper 12 bytes are non-zero, they will be zero-ed out
// Therefore, fromId() and toId() are not inverses of each other
function fromId(uint256 id) internal pure returns (Currency) {
return Currency.wrap(address(uint160(id)));
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {Currency} from "./Currency.sol";
import {IHooks} from "../interfaces/IHooks.sol";
import {PoolIdLibrary} from "./PoolId.sol";
using PoolIdLibrary for PoolKey global;
/// @notice Returns the key for identifying a pool
struct PoolKey {
/// @notice The lower currency of the pool, sorted numerically
Currency currency0;
/// @notice The higher currency of the pool, sorted numerically
Currency currency1;
/// @notice The pool LP fee, capped at 1_000_000. If the highest bit is 1, the pool has a dynamic fee and must be exactly equal to 0x800000
uint24 fee;
/// @notice Ticks that involve positions must be a multiple of tick spacing
int24 tickSpacing;
/// @notice The hooks of the pool
IHooks hooks;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @notice Interface for claims over a contract balance, wrapped as a ERC6909
interface IERC6909Claims {
/*//////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////*/
event OperatorSet(address indexed owner, address indexed operator, bool approved);
event Approval(address indexed owner, address indexed spender, uint256 indexed id, uint256 amount);
event Transfer(address caller, address indexed from, address indexed to, uint256 indexed id, uint256 amount);
/*//////////////////////////////////////////////////////////////
FUNCTIONS
//////////////////////////////////////////////////////////////*/
/// @notice Owner balance of an id.
/// @param owner The address of the owner.
/// @param id The id of the token.
/// @return amount The balance of the token.
function balanceOf(address owner, uint256 id) external view returns (uint256 amount);
/// @notice Spender allowance of an id.
/// @param owner The address of the owner.
/// @param spender The address of the spender.
/// @param id The id of the token.
/// @return amount The allowance of the token.
function allowance(address owner, address spender, uint256 id) external view returns (uint256 amount);
/// @notice Checks if a spender is approved by an owner as an operator
/// @param owner The address of the owner.
/// @param spender The address of the spender.
/// @return approved The approval status.
function isOperator(address owner, address spender) external view returns (bool approved);
/// @notice Transfers an amount of an id from the caller to a receiver.
/// @param receiver The address of the receiver.
/// @param id The id of the token.
/// @param amount The amount of the token.
/// @return bool True, always, unless the function reverts
function transfer(address receiver, uint256 id, uint256 amount) external returns (bool);
/// @notice Transfers an amount of an id from a sender to a receiver.
/// @param sender The address of the sender.
/// @param receiver The address of the receiver.
/// @param id The id of the token.
/// @param amount The amount of the token.
/// @return bool True, always, unless the function reverts
function transferFrom(address sender, address receiver, uint256 id, uint256 amount) external returns (bool);
/// @notice Approves an amount of an id to a spender.
/// @param spender The address of the spender.
/// @param id The id of the token.
/// @param amount The amount of the token.
/// @return bool True, always
function approve(address spender, uint256 id, uint256 amount) external returns (bool);
/// @notice Sets or removes an operator for the caller.
/// @param operator The address of the operator.
/// @param approved The approval status.
/// @return bool True, always
function setOperator(address operator, bool approved) external returns (bool);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {Currency} from "../types/Currency.sol";
import {PoolId} from "../types/PoolId.sol";
import {PoolKey} from "../types/PoolKey.sol";
/// @notice Interface for all protocol-fee related functions in the pool manager
interface IProtocolFees {
/// @notice Thrown when protocol fee is set too high
error ProtocolFeeTooLarge(uint24 fee);
/// @notice Thrown when collectProtocolFees or setProtocolFee is not called by the controller.
error InvalidCaller();
/// @notice Thrown when collectProtocolFees is attempted on a token that is synced.
error ProtocolFeeCurrencySynced();
/// @notice Emitted when the protocol fee controller address is updated in setProtocolFeeController.
event ProtocolFeeControllerUpdated(address indexed protocolFeeController);
/// @notice Emitted when the protocol fee is updated for a pool.
event ProtocolFeeUpdated(PoolId indexed id, uint24 protocolFee);
/// @notice Given a currency address, returns the protocol fees accrued in that currency
/// @param currency The currency to check
/// @return amount The amount of protocol fees accrued in the currency
function protocolFeesAccrued(Currency currency) external view returns (uint256 amount);
/// @notice Sets the protocol fee for the given pool
/// @param key The key of the pool to set a protocol fee for
/// @param newProtocolFee The fee to set
function setProtocolFee(PoolKey memory key, uint24 newProtocolFee) external;
/// @notice Sets the protocol fee controller
/// @param controller The new protocol fee controller
function setProtocolFeeController(address controller) external;
/// @notice Collects the protocol fees for a given recipient and currency, returning the amount collected
/// @dev This will revert if the contract is unlocked
/// @param recipient The address to receive the protocol fees
/// @param currency The currency to withdraw
/// @param amount The amount of currency to withdraw
/// @return amountCollected The amount of currency successfully withdrawn
function collectProtocolFees(address recipient, Currency currency, uint256 amount)
external
returns (uint256 amountCollected);
/// @notice Returns the current protocol fee controller address
/// @return address The current protocol fee controller address
function protocolFeeController() external view returns (address);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {SafeCast} from "../libraries/SafeCast.sol";
/// @dev Two `int128` values packed into a single `int256` where the upper 128 bits represent the amount0
/// and the lower 128 bits represent the amount1.
type BalanceDelta is int256;
using {add as +, sub as -, eq as ==, neq as !=} for BalanceDelta global;
using BalanceDeltaLibrary for BalanceDelta global;
using SafeCast for int256;
function toBalanceDelta(int128 _amount0, int128 _amount1) pure returns (BalanceDelta balanceDelta) {
assembly ("memory-safe") {
balanceDelta := or(shl(128, _amount0), and(sub(shl(128, 1), 1), _amount1))
}
}
function add(BalanceDelta a, BalanceDelta b) pure returns (BalanceDelta) {
int256 res0;
int256 res1;
assembly ("memory-safe") {
let a0 := sar(128, a)
let a1 := signextend(15, a)
let b0 := sar(128, b)
let b1 := signextend(15, b)
res0 := add(a0, b0)
res1 := add(a1, b1)
}
return toBalanceDelta(res0.toInt128(), res1.toInt128());
}
function sub(BalanceDelta a, BalanceDelta b) pure returns (BalanceDelta) {
int256 res0;
int256 res1;
assembly ("memory-safe") {
let a0 := sar(128, a)
let a1 := signextend(15, a)
let b0 := sar(128, b)
let b1 := signextend(15, b)
res0 := sub(a0, b0)
res1 := sub(a1, b1)
}
return toBalanceDelta(res0.toInt128(), res1.toInt128());
}
function eq(BalanceDelta a, BalanceDelta b) pure returns (bool) {
return BalanceDelta.unwrap(a) == BalanceDelta.unwrap(b);
}
function neq(BalanceDelta a, BalanceDelta b) pure returns (bool) {
return BalanceDelta.unwrap(a) != BalanceDelta.unwrap(b);
}
/// @notice Library for getting the amount0 and amount1 deltas from the BalanceDelta type
library BalanceDeltaLibrary {
/// @notice A BalanceDelta of 0
BalanceDelta public constant ZERO_DELTA = BalanceDelta.wrap(0);
function amount0(BalanceDelta balanceDelta) internal pure returns (int128 _amount0) {
assembly ("memory-safe") {
_amount0 := sar(128, balanceDelta)
}
}
function amount1(BalanceDelta balanceDelta) internal pure returns (int128 _amount1) {
assembly ("memory-safe") {
_amount1 := signextend(15, balanceDelta)
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {PoolKey} from "./PoolKey.sol";
type PoolId is bytes32;
/// @notice Library for computing the ID of a pool
library PoolIdLibrary {
/// @notice Returns value equal to keccak256(abi.encode(poolKey))
function toId(PoolKey memory poolKey) internal pure returns (PoolId poolId) {
assembly ("memory-safe") {
// 0xa0 represents the total size of the poolKey struct (5 slots of 32 bytes)
poolId := keccak256(poolKey, 0xa0)
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @notice Interface for functions to access any storage slot in a contract
interface IExtsload {
/// @notice Called by external contracts to access granular pool state
/// @param slot Key of slot to sload
/// @return value The value of the slot as bytes32
function extsload(bytes32 slot) external view returns (bytes32 value);
/// @notice Called by external contracts to access granular pool state
/// @param startSlot Key of slot to start sloading from
/// @param nSlots Number of slots to load into return value
/// @return values List of loaded values.
function extsload(bytes32 startSlot, uint256 nSlots) external view returns (bytes32[] memory values);
/// @notice Called by external contracts to access sparse pool state
/// @param slots List of slots to SLOAD from.
/// @return values List of loaded values.
function extsload(bytes32[] calldata slots) external view returns (bytes32[] memory values);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
/// @notice Interface for functions to access any transient storage slot in a contract
interface IExttload {
/// @notice Called by external contracts to access transient storage of the contract
/// @param slot Key of slot to tload
/// @return value The value of the slot as bytes32
function exttload(bytes32 slot) external view returns (bytes32 value);
/// @notice Called by external contracts to access sparse transient pool state
/// @param slots List of slots to tload
/// @return values List of loaded values
function exttload(bytes32[] calldata slots) external view returns (bytes32[] memory values);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import {PoolKey} from "../types/PoolKey.sol";
import {BalanceDelta} from "../types/BalanceDelta.sol";
/// @notice Parameter struct for `ModifyLiquidity` pool operations
struct ModifyLiquidityParams {
// the lower and upper tick of the position
int24 tickLower;
int24 tickUpper;
// how to modify the liquidity
int256 liquidityDelta;
// a value to set if you want unique liquidity positions at the same range
bytes32 salt;
}
/// @notice Parameter struct for `Swap` pool operations
struct SwapParams {
/// Whether to swap token0 for token1 or vice versa
bool zeroForOne;
/// The desired input amount if negative (exactIn), or the desired output amount if positive (exactOut)
int256 amountSpecified;
/// The sqrt price at which, if reached, the swap will stop executing
uint160 sqrtPriceLimitX96;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// Return type of the beforeSwap hook.
// Upper 128 bits is the delta in specified tokens. Lower 128 bits is delta in unspecified tokens (to match the afterSwap hook)
type BeforeSwapDelta is int256;
// Creates a BeforeSwapDelta from specified and unspecified
function toBeforeSwapDelta(int128 deltaSpecified, int128 deltaUnspecified)
pure
returns (BeforeSwapDelta beforeSwapDelta)
{
assembly ("memory-safe") {
beforeSwapDelta := or(shl(128, deltaSpecified), and(sub(shl(128, 1), 1), deltaUnspecified))
}
}
/// @notice Library for getting the specified and unspecified deltas from the BeforeSwapDelta type
library BeforeSwapDeltaLibrary {
/// @notice A BeforeSwapDelta of 0
BeforeSwapDelta public constant ZERO_DELTA = BeforeSwapDelta.wrap(0);
/// extracts int128 from the upper 128 bits of the BeforeSwapDelta
/// returned by beforeSwap
function getSpecifiedDelta(BeforeSwapDelta delta) internal pure returns (int128 deltaSpecified) {
assembly ("memory-safe") {
deltaSpecified := sar(128, delta)
}
}
/// extracts int128 from the lower 128 bits of the BeforeSwapDelta
/// returned by beforeSwap and afterSwap
function getUnspecifiedDelta(BeforeSwapDelta delta) internal pure returns (int128 deltaUnspecified) {
assembly ("memory-safe") {
deltaUnspecified := signextend(15, delta)
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import {PoolKey} from "@uniswap/v4-core/src/types/PoolKey.sol";
import {PoolId} from "@uniswap/v4-core/src/types/PoolId.sol";
/**
* @dev PositionInfo is a packed version of solidity structure.
* Using the packaged version saves gas and memory by not storing the structure fields in memory slots.
*
* Layout:
* 200 bits poolId | 24 bits tickUpper | 24 bits tickLower | 8 bits hasSubscriber
*
* Fields in the direction from the least significant bit:
*
* A flag to know if the tokenId is subscribed to an address
* uint8 hasSubscriber;
*
* The tickUpper of the position
* int24 tickUpper;
*
* The tickLower of the position
* int24 tickLower;
*
* The truncated poolId. Truncates a bytes32 value so the most signifcant (highest) 200 bits are used.
* bytes25 poolId;
*
* Note: If more bits are needed, hasSubscriber can be a single bit.
*
*/
type PositionInfo is uint256;
using PositionInfoLibrary for PositionInfo global;
library PositionInfoLibrary {
PositionInfo internal constant EMPTY_POSITION_INFO = PositionInfo.wrap(0);
uint256 internal constant MASK_UPPER_200_BITS = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000;
uint256 internal constant MASK_8_BITS = 0xFF;
uint24 internal constant MASK_24_BITS = 0xFFFFFF;
uint256 internal constant SET_UNSUBSCRIBE = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00;
uint256 internal constant SET_SUBSCRIBE = 0x01;
uint8 internal constant TICK_LOWER_OFFSET = 8;
uint8 internal constant TICK_UPPER_OFFSET = 32;
/// @dev This poolId is NOT compatible with the poolId used in UniswapV4 core. It is truncated to 25 bytes, and just used to lookup PoolKey in the poolKeys mapping.
function poolId(PositionInfo info) internal pure returns (bytes25 _poolId) {
assembly ("memory-safe") {
_poolId := and(MASK_UPPER_200_BITS, info)
}
}
function tickLower(PositionInfo info) internal pure returns (int24 _tickLower) {
assembly ("memory-safe") {
_tickLower := signextend(2, shr(TICK_LOWER_OFFSET, info))
}
}
function tickUpper(PositionInfo info) internal pure returns (int24 _tickUpper) {
assembly ("memory-safe") {
_tickUpper := signextend(2, shr(TICK_UPPER_OFFSET, info))
}
}
function hasSubscriber(PositionInfo info) internal pure returns (bool _hasSubscriber) {
assembly ("memory-safe") {
_hasSubscriber := and(MASK_8_BITS, info)
}
}
/// @dev this does not actually set any storage
function setSubscribe(PositionInfo info) internal pure returns (PositionInfo _info) {
assembly ("memory-safe") {
_info := or(info, SET_SUBSCRIBE)
}
}
/// @dev this does not actually set any storage
function setUnsubscribe(PositionInfo info) internal pure returns (PositionInfo _info) {
assembly ("memory-safe") {
_info := and(info, SET_UNSUBSCRIBE)
}
}
/// @notice Creates the default PositionInfo struct
/// @dev Called when minting a new position
/// @param _poolKey the pool key of the position
/// @param _tickLower the lower tick of the position
/// @param _tickUpper the upper tick of the position
/// @return info packed position info, with the truncated poolId and the hasSubscriber flag set to false
function initialize(PoolKey memory _poolKey, int24 _tickLower, int24 _tickUpper)
internal
pure
returns (PositionInfo info)
{
bytes25 _poolId = bytes25(PoolId.unwrap(_poolKey.toId()));
assembly {
info := or(
or(and(MASK_UPPER_200_BITS, _poolId), shl(TICK_UPPER_OFFSET, and(MASK_24_BITS, _tickUpper))),
shl(TICK_LOWER_OFFSET, and(MASK_24_BITS, _tickLower))
)
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {ISubscriber} from "./ISubscriber.sol";
/// @title INotifier
/// @notice Interface for the Notifier contract
interface INotifier {
/// @notice Thrown when unsubscribing without a subscriber
error NotSubscribed();
/// @notice Thrown when a subscriber does not have code
error NoCodeSubscriber();
/// @notice Thrown when a user specifies a gas limit too low to avoid valid unsubscribe notifications
error GasLimitTooLow();
/// @notice Wraps the revert message of the subscriber contract on a reverting subscription
error SubscriptionReverted(address subscriber, bytes reason);
/// @notice Wraps the revert message of the subscriber contract on a reverting modify liquidity notification
error ModifyLiquidityNotificationReverted(address subscriber, bytes reason);
/// @notice Wraps the revert message of the subscriber contract on a reverting burn notification
error BurnNotificationReverted(address subscriber, bytes reason);
/// @notice Thrown when a tokenId already has a subscriber
error AlreadySubscribed(uint256 tokenId, address subscriber);
/// @notice Emitted on a successful call to subscribe
event Subscription(uint256 indexed tokenId, address indexed subscriber);
/// @notice Emitted on a successful call to unsubscribe
event Unsubscription(uint256 indexed tokenId, address indexed subscriber);
/// @notice Returns the subscriber for a respective position
/// @param tokenId the ERC721 tokenId
/// @return subscriber the subscriber contract
function subscriber(uint256 tokenId) external view returns (ISubscriber subscriber);
/// @notice Enables the subscriber to receive notifications for a respective position
/// @param tokenId the ERC721 tokenId
/// @param newSubscriber the address of the subscriber contract
/// @param data caller-provided data that's forwarded to the subscriber contract
/// @dev Calling subscribe when a position is already subscribed will revert
/// @dev payable so it can be multicalled with NATIVE related actions
/// @dev will revert if pool manager is locked
function subscribe(uint256 tokenId, address newSubscriber, bytes calldata data) external payable;
/// @notice Removes the subscriber from receiving notifications for a respective position
/// @param tokenId the ERC721 tokenId
/// @dev Callers must specify a high gas limit (remaining gas should be higher than unsubscriberGasLimit) such that the subscriber can be notified
/// @dev payable so it can be multicalled with NATIVE related actions
/// @dev Must always allow a user to unsubscribe. In the case of a malicious subscriber, a user can always unsubscribe safely, ensuring liquidity is always modifiable.
/// @dev will revert if pool manager is locked
function unsubscribe(uint256 tokenId) external payable;
/// @notice Returns and determines the maximum allowable gas-used for notifying unsubscribe
/// @return uint256 the maximum gas limit when notifying a subscriber's `notifyUnsubscribe` function
function unsubscribeGasLimit() external view returns (uint256);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol";
/// @title IImmutableState
/// @notice Interface for the ImmutableState contract
interface IImmutableState {
/// @notice The Uniswap v4 PoolManager contract
function poolManager() external view returns (IPoolManager);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @title IERC721Permit_v4
/// @notice Interface for the ERC721Permit_v4 contract
interface IERC721Permit_v4 {
error SignatureDeadlineExpired();
error NoSelfPermit();
error Unauthorized();
/// @notice Approve of a specific token ID for spending by spender via signature
/// @param spender The account that is being approved
/// @param tokenId The ID of the token that is being approved for spending
/// @param deadline The deadline timestamp by which the call must be mined for the approve to work
/// @param nonce a unique value, for an owner, to prevent replay attacks; an unordered nonce where the top 248 bits correspond to a word and the bottom 8 bits calculate the bit position of the word
/// @param signature Concatenated data from a valid secp256k1 signature from the holder, i.e. abi.encodePacked(r, s, v)
/// @dev payable so it can be multicalled with NATIVE related actions
function permit(address spender, uint256 tokenId, uint256 deadline, uint256 nonce, bytes calldata signature)
external
payable;
/// @notice Set an operator with full permission to an owner's tokens via signature
/// @param owner The address that is setting the operator
/// @param operator The address that will be set as an operator for the owner
/// @param approved The permission to set on the operator
/// @param deadline The deadline timestamp by which the call must be mined for the approve to work
/// @param nonce a unique value, for an owner, to prevent replay attacks; an unordered nonce where the top 248 bits correspond to a word and the bottom 8 bits calculate the bit position of the word
/// @param signature Concatenated data from a valid secp256k1 signature from the holder, i.e. abi.encodePacked(r, s, v)
/// @dev payable so it can be multicalled with NATIVE related actions
function permitForAll(
address owner,
address operator,
bool approved,
uint256 deadline,
uint256 nonce,
bytes calldata signature
) external payable;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @title IEIP712_v4
/// @notice Interface for the EIP712 contract
interface IEIP712_v4 {
/// @notice Returns the domain separator for the current chain.
/// @return bytes32 The domain separator
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @title IMulticall_v4
/// @notice Interface for the Multicall_v4 contract
interface IMulticall_v4 {
/// @notice Call multiple functions in the current contract and return the data from all of them if they all succeed
/// @dev The `msg.value` is passed onto all subcalls, even if a previous subcall has consumed the ether.
/// Subcalls can instead use `address(this).value` to see the available ETH, and consume it using {value: x}.
/// @param data The encoded function data for each of the calls to make to this contract
/// @return results The results from each of the calls passed in via data
function multicall(bytes[] calldata data) external payable returns (bytes[] memory results);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {PoolKey} from "@uniswap/v4-core/src/types/PoolKey.sol";
/// @title IPoolInitializer_v4
/// @notice Interface for the PoolInitializer_v4 contract
interface IPoolInitializer_v4 {
/// @notice Initialize a Uniswap v4 Pool
/// @dev If the pool is already initialized, this function will not revert and just return type(int24).max
/// @param key The PoolKey of the pool to initialize
/// @param sqrtPriceX96 The initial starting price of the pool, expressed as a sqrtPriceX96
/// @return The current tick of the pool, or type(int24).max if the pool creation failed, or the pool already existed
function initializePool(PoolKey calldata key, uint160 sqrtPriceX96) external payable returns (int24);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @title IUnorderedNonce
/// @notice Interface for the UnorderedNonce contract
interface IUnorderedNonce {
error NonceAlreadyUsed();
/// @notice mapping of nonces consumed by each address, where a nonce is a single bit on the 256-bit bitmap
/// @dev word is at most type(uint248).max
function nonces(address owner, uint256 word) external view returns (uint256);
/// @notice Revoke a nonce by spending it, preventing it from being used again
/// @dev Used in cases where a valid nonce has not been broadcasted onchain, and the owner wants to revoke the validity of the nonce
/// @dev payable so it can be multicalled with native-token related actions
function revokeNonce(uint256 nonce) external payable;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {IAllowanceTransfer} from "permit2/src/interfaces/IAllowanceTransfer.sol";
/// @title IPermit2Forwarder
/// @notice Interface for the Permit2Forwarder contract
interface IPermit2Forwarder {
/// @notice allows forwarding a single permit to permit2
/// @dev this function is payable to allow multicall with NATIVE based actions
/// @param owner the owner of the tokens
/// @param permitSingle the permit data
/// @param signature the signature of the permit; abi.encodePacked(r, s, v)
/// @return err the error returned by a reverting permit call, empty if successful
function permit(address owner, IAllowanceTransfer.PermitSingle calldata permitSingle, bytes calldata signature)
external
payable
returns (bytes memory err);
/// @notice allows forwarding batch permits to permit2
/// @dev this function is payable to allow multicall with NATIVE based actions
/// @param owner the owner of the tokens
/// @param _permitBatch a batch of approvals
/// @param signature the signature of the permit; abi.encodePacked(r, s, v)
/// @return err the error returned by a reverting permit call, empty if successful
function permitBatch(address owner, IAllowanceTransfer.PermitBatch calldata _permitBatch, bytes calldata signature)
external
payable
returns (bytes memory err);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IEIP712 {
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @title Minimal ERC20 interface for Uniswap
/// @notice Contains a subset of the full ERC20 interface that is used in Uniswap V3
interface IERC20Minimal {
/// @notice Returns an account's balance in the token
/// @param account The account for which to look up the number of tokens it has, i.e. its balance
/// @return The number of tokens held by the account
function balanceOf(address account) external view returns (uint256);
/// @notice Transfers the amount of token from the `msg.sender` to the recipient
/// @param recipient The account that will receive the amount transferred
/// @param amount The number of tokens to send from the sender to the recipient
/// @return Returns true for a successful transfer, false for an unsuccessful transfer
function transfer(address recipient, uint256 amount) external returns (bool);
/// @notice Returns the current allowance given to a spender by an owner
/// @param owner The account of the token owner
/// @param spender The account of the token spender
/// @return The current allowance granted by `owner` to `spender`
function allowance(address owner, address spender) external view returns (uint256);
/// @notice Sets the allowance of a spender from the `msg.sender` to the value `amount`
/// @param spender The account which will be allowed to spend a given amount of the owners tokens
/// @param amount The amount of tokens allowed to be used by `spender`
/// @return Returns true for a successful approval, false for unsuccessful
function approve(address spender, uint256 amount) external returns (bool);
/// @notice Transfers `amount` tokens from `sender` to `recipient` up to the allowance given to the `msg.sender`
/// @param sender The account from which the transfer will be initiated
/// @param recipient The recipient of the transfer
/// @param amount The amount of the transfer
/// @return Returns true for a successful transfer, false for unsuccessful
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/// @notice Event emitted when tokens are transferred from one address to another, either via `#transfer` or `#transferFrom`.
/// @param from The account from which the tokens were sent, i.e. the balance decreased
/// @param to The account to which the tokens were sent, i.e. the balance increased
/// @param value The amount of tokens that were transferred
event Transfer(address indexed from, address indexed to, uint256 value);
/// @notice Event emitted when the approval amount for the spender of a given owner's tokens changes.
/// @param owner The account that approved spending of its tokens
/// @param spender The account for which the spending allowance was modified
/// @param value The new allowance from the owner to the spender
event Approval(address indexed owner, address indexed spender, uint256 value);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @title Library for reverting with custom errors efficiently
/// @notice Contains functions for reverting with custom errors with different argument types efficiently
/// @dev To use this library, declare `using CustomRevert for bytes4;` and replace `revert CustomError()` with
/// `CustomError.selector.revertWith()`
/// @dev The functions may tamper with the free memory pointer but it is fine since the call context is exited immediately
library CustomRevert {
/// @dev ERC-7751 error for wrapping bubbled up reverts
error WrappedError(address target, bytes4 selector, bytes reason, bytes details);
/// @dev Reverts with the selector of a custom error in the scratch space
function revertWith(bytes4 selector) internal pure {
assembly ("memory-safe") {
mstore(0, selector)
revert(0, 0x04)
}
}
/// @dev Reverts with a custom error with an address argument in the scratch space
function revertWith(bytes4 selector, address addr) internal pure {
assembly ("memory-safe") {
mstore(0, selector)
mstore(0x04, and(addr, 0xffffffffffffffffffffffffffffffffffffffff))
revert(0, 0x24)
}
}
/// @dev Reverts with a custom error with an int24 argument in the scratch space
function revertWith(bytes4 selector, int24 value) internal pure {
assembly ("memory-safe") {
mstore(0, selector)
mstore(0x04, signextend(2, value))
revert(0, 0x24)
}
}
/// @dev Reverts with a custom error with a uint160 argument in the scratch space
function revertWith(bytes4 selector, uint160 value) internal pure {
assembly ("memory-safe") {
mstore(0, selector)
mstore(0x04, and(value, 0xffffffffffffffffffffffffffffffffffffffff))
revert(0, 0x24)
}
}
/// @dev Reverts with a custom error with two int24 arguments
function revertWith(bytes4 selector, int24 value1, int24 value2) internal pure {
assembly ("memory-safe") {
let fmp := mload(0x40)
mstore(fmp, selector)
mstore(add(fmp, 0x04), signextend(2, value1))
mstore(add(fmp, 0x24), signextend(2, value2))
revert(fmp, 0x44)
}
}
/// @dev Reverts with a custom error with two uint160 arguments
function revertWith(bytes4 selector, uint160 value1, uint160 value2) internal pure {
assembly ("memory-safe") {
let fmp := mload(0x40)
mstore(fmp, selector)
mstore(add(fmp, 0x04), and(value1, 0xffffffffffffffffffffffffffffffffffffffff))
mstore(add(fmp, 0x24), and(value2, 0xffffffffffffffffffffffffffffffffffffffff))
revert(fmp, 0x44)
}
}
/// @dev Reverts with a custom error with two address arguments
function revertWith(bytes4 selector, address value1, address value2) internal pure {
assembly ("memory-safe") {
let fmp := mload(0x40)
mstore(fmp, selector)
mstore(add(fmp, 0x04), and(value1, 0xffffffffffffffffffffffffffffffffffffffff))
mstore(add(fmp, 0x24), and(value2, 0xffffffffffffffffffffffffffffffffffffffff))
revert(fmp, 0x44)
}
}
/// @notice bubble up the revert message returned by a call and revert with a wrapped ERC-7751 error
/// @dev this method can be vulnerable to revert data bombs
function bubbleUpAndRevertWith(
address revertingContract,
bytes4 revertingFunctionSelector,
bytes4 additionalContext
) internal pure {
bytes4 wrappedErrorSelector = WrappedError.selector;
assembly ("memory-safe") {
// Ensure the size of the revert data is a multiple of 32 bytes
let encodedDataSize := mul(div(add(returndatasize(), 31), 32), 32)
let fmp := mload(0x40)
// Encode wrapped error selector, address, function selector, offset, additional context, size, revert reason
mstore(fmp, wrappedErrorSelector)
mstore(add(fmp, 0x04), and(revertingContract, 0xffffffffffffffffffffffffffffffffffffffff))
mstore(
add(fmp, 0x24),
and(revertingFunctionSelector, 0xffffffff00000000000000000000000000000000000000000000000000000000)
)
// offset revert reason
mstore(add(fmp, 0x44), 0x80)
// offset additional context
mstore(add(fmp, 0x64), add(0xa0, encodedDataSize))
// size revert reason
mstore(add(fmp, 0x84), returndatasize())
// revert reason
returndatacopy(add(fmp, 0xa4), 0, returndatasize())
// size additional context
mstore(add(fmp, add(0xa4, encodedDataSize)), 0x04)
// additional context
mstore(
add(fmp, add(0xc4, encodedDataSize)),
and(additionalContext, 0xffffffff00000000000000000000000000000000000000000000000000000000)
)
revert(fmp, add(0xe4, encodedDataSize))
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {CustomRevert} from "./CustomRevert.sol";
/// @title Safe casting methods
/// @notice Contains methods for safely casting between types
library SafeCast {
using CustomRevert for bytes4;
error SafeCastOverflow();
/// @notice Cast a uint256 to a uint160, revert on overflow
/// @param x The uint256 to be downcasted
/// @return y The downcasted integer, now type uint160
function toUint160(uint256 x) internal pure returns (uint160 y) {
y = uint160(x);
if (y != x) SafeCastOverflow.selector.revertWith();
}
/// @notice Cast a uint256 to a uint128, revert on overflow
/// @param x The uint256 to be downcasted
/// @return y The downcasted integer, now type uint128
function toUint128(uint256 x) internal pure returns (uint128 y) {
y = uint128(x);
if (x != y) SafeCastOverflow.selector.revertWith();
}
/// @notice Cast a int128 to a uint128, revert on overflow or underflow
/// @param x The int128 to be casted
/// @return y The casted integer, now type uint128
function toUint128(int128 x) internal pure returns (uint128 y) {
if (x < 0) SafeCastOverflow.selector.revertWith();
y = uint128(x);
}
/// @notice Cast a int256 to a int128, revert on overflow or underflow
/// @param x The int256 to be downcasted
/// @return y The downcasted integer, now type int128
function toInt128(int256 x) internal pure returns (int128 y) {
y = int128(x);
if (y != x) SafeCastOverflow.selector.revertWith();
}
/// @notice Cast a uint256 to a int256, revert on overflow
/// @param x The uint256 to be casted
/// @return y The casted integer, now type int256
function toInt256(uint256 x) internal pure returns (int256 y) {
y = int256(x);
if (y < 0) SafeCastOverflow.selector.revertWith();
}
/// @notice Cast a uint256 to a int128, revert on overflow
/// @param x The uint256 to be downcasted
/// @return The downcasted integer, now type int128
function toInt128(uint256 x) internal pure returns (int128) {
if (x >= 1 << 127) SafeCastOverflow.selector.revertWith();
return int128(int256(x));
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {BalanceDelta} from "@uniswap/v4-core/src/types/BalanceDelta.sol";
import {PositionInfo} from "../libraries/PositionInfoLibrary.sol";
/// @title ISubscriber
/// @notice Interface that a Subscriber contract should implement to receive updates from the v4 position manager
interface ISubscriber {
/// @notice Called when a position subscribes to this subscriber contract
/// @param tokenId the token ID of the position
/// @param data additional data passed in by the caller
function notifySubscribe(uint256 tokenId, bytes memory data) external;
/// @notice Called when a position unsubscribes from the subscriber
/// @dev This call's gas is capped at `unsubscribeGasLimit` (set at deployment)
/// @dev Because of EIP-150, solidity may only allocate 63/64 of gasleft()
/// @param tokenId the token ID of the position
function notifyUnsubscribe(uint256 tokenId) external;
/// @notice Called when a position is burned
/// @param tokenId the token ID of the position
/// @param owner the current owner of the tokenId
/// @param info information about the position
/// @param liquidity the amount of liquidity decreased in the position, may be 0
/// @param feesAccrued the fees accrued by the position if liquidity was decreased
function notifyBurn(uint256 tokenId, address owner, PositionInfo info, uint256 liquidity, BalanceDelta feesAccrued)
external;
/// @notice Called when a position modifies its liquidity or collects fees
/// @param tokenId the token ID of the position
/// @param liquidityChange the change in liquidity on the underlying position
/// @param feesAccrued the fees to be collected from the position as a result of the modifyLiquidity call
/// @dev Note that feesAccrued can be artificially inflated by a malicious user
/// Pools with a single liquidity position can inflate feeGrowthGlobal (and consequently feesAccrued) by donating to themselves;
/// atomically donating and collecting fees within the same unlockCallback may further inflate feeGrowthGlobal/feesAccrued
function notifyModifyLiquidity(uint256 tokenId, int256 liquidityChange, BalanceDelta feesAccrued) external;
}{
"remappings": [
"@openzeppelin/contracts/=dependencies/@openzeppelin-contracts-5.3.0/contracts/",
"openzeppelin-contracts/contracts/=dependencies/@openzeppelin-contracts-5.3.0/contracts/",
"@layerzerolabs/oft-evm/=dependencies/@layerzerolabs-oft-evm-4.0.1/",
"@layerzerolabs/oapp-evm/=dependencies/@layerzerolabs-oapp-evm-0.4.1/",
"@layerzerolabs/lz-evm-protocol-v2/=dependencies/@layerzerolabs-lz-evm-protocol-v2-3.0.160/",
"@layerzerolabs/lz-evm-messagelib-v2/=dependencies/@layerzerolabs-lz-evm-messagelib-v2-3.0.160/",
"solidity-bytes-utils/=dependencies/solidity-bytes-utils-master/",
"v4-core/=dependencies/v4-core-main/",
"@uniswap/v4-core/=dependencies/v4-core-main/",
"v4-periphery/=dependencies/v4-periphery-main/",
"@uniswap/v4-periphery/=dependencies/v4-periphery-main/",
"aegis-dfm-test/=dependencies/aegis-dfm-1.0.0/test/",
"aegis-dfm/=dependencies/aegis-dfm-1.0.0/src/",
"src/=dependencies/aegis-dfm-1.0.0/src/",
"@solo-labs/aegis-engine/=dependencies/@solo-labs-aegis-engine-1.0.0/",
"@uniswap/universal-router/=dependencies/@uniswap-universal-router-main/",
"@uniswap/v2-core/=dependencies/@uniswap-v2-core-1.0.1/",
"@uniswap/v3-core/=dependencies/@uniswap-v3-core-1.0.0/",
"@uniswap/v3-periphery/=dependencies/@uniswap-universal-router-main/lib/v3-periphery/",
"@solady-v0.0.245/=dependencies/@solady-0.0.245/src/",
"forge-std/=dependencies/forge-std-1.10.0/src/",
"permit2/=dependencies/permit2-main/",
"solmate/=dependencies/solmate-main/",
"utils/=test/utils/",
"mocks/=test/mocks/",
"@ensdomains/=dependencies/v4-core-main/node_modules/@ensdomains/",
"@ethereum-optimism-optimism-develop/=dependencies/@ethereum-optimism-optimism-develop/",
"@layerzerolabs-lz-evm-messagelib-v2-3.0.160/=dependencies/@layerzerolabs-lz-evm-messagelib-v2-3.0.160/contracts/",
"@layerzerolabs-lz-evm-protocol-v2-3.0.160/=dependencies/@layerzerolabs-lz-evm-protocol-v2-3.0.160/contracts/",
"@layerzerolabs-oapp-evm-0.4.1/=dependencies/@layerzerolabs-oapp-evm-0.4.1/contracts/",
"@layerzerolabs-oft-evm-4.0.1/=dependencies/@layerzerolabs-oft-evm-4.0.1/contracts/",
"@openzeppelin-contracts-5.1.0/=dependencies/@solo-labs-aegis-engine-1.0.0/dependencies/@openzeppelin-contracts-5.1.0/",
"@openzeppelin-contracts-5.3.0/=dependencies/@openzeppelin-contracts-5.3.0/",
"@solady-0.0.245/=dependencies/@solady-0.0.245/src/",
"@solo-labs-aegis-engine-1.0.0/=dependencies/@solo-labs-aegis-engine-1.0.0/",
"@uniswap-universal-router-main/=dependencies/@uniswap-universal-router-main/",
"@uniswap-v2-core-1.0.1/=dependencies/@uniswap-v2-core-1.0.1/contracts/",
"@uniswap-v3-core-1.0.0/=dependencies/@uniswap-v3-core-1.0.0/",
"aegis-dfm-1.0.0/=dependencies/aegis-dfm-1.0.0/",
"ds-test/=dependencies/solmate-main/lib/ds-test/src/",
"erc4626-tests/=dependencies/@openzeppelin-contracts-5.3.0/lib/erc4626-tests/",
"forge-gas-snapshot/=dependencies/permit2-main/lib/forge-gas-snapshot/src/",
"forge-std-1.10.0/=dependencies/forge-std-1.10.0/src/",
"forge-std-1.9.7/=dependencies/aegis-dfm-1.0.0/dependencies/forge-std-1.9.7/src/",
"halmos-cheatcodes/=dependencies/@openzeppelin-contracts-5.3.0/lib/halmos-cheatcodes/src/",
"hardhat/=dependencies/v4-core-main/node_modules/hardhat/",
"kontrol-cheatcodes/=dependencies/@ethereum-optimism-optimism-develop/packages/contracts-bedrock/lib/kontrol-cheatcodes/src/",
"lib-keccak/=dependencies/@ethereum-optimism-optimism-develop/packages/contracts-bedrock/lib/lib-keccak/contracts/",
"openzeppelin-contracts-upgradeable/=dependencies/@ethereum-optimism-optimism-develop/packages/contracts-bedrock/lib/openzeppelin-contracts-upgradeable/",
"openzeppelin-contracts-v5/=dependencies/@ethereum-optimism-optimism-develop/packages/contracts-bedrock/lib/openzeppelin-contracts-v5/",
"permit2-main/=dependencies/permit2-main/",
"safe-contracts/=dependencies/@ethereum-optimism-optimism-develop/packages/contracts-bedrock/lib/safe-contracts/",
"solady-v0.0.245/=dependencies/@ethereum-optimism-optimism-develop/packages/contracts-bedrock/lib/solady-v0.0.245/src/",
"solady/=dependencies/@ethereum-optimism-optimism-develop/packages/contracts-bedrock/lib/solady/",
"solidity-bytes-utils-master/=dependencies/solidity-bytes-utils-master/contracts/",
"solmate-main/=dependencies/solmate-main/src/",
"uniswap-hooks-master/=dependencies/aegis-dfm-1.0.0/dependencies/uniswap-hooks-master/src/",
"uniswap-hooks/=dependencies/aegis-dfm-1.0.0/dependencies/uniswap-hooks-master/src/",
"v3-periphery/=dependencies/@uniswap-universal-router-main/lib/v3-periphery/contracts/",
"v4-core-main/=dependencies/v4-core-main/src/",
"v4-periphery-main/=dependencies/v4-periphery-main/"
],
"optimizer": {
"enabled": true,
"runs": 1
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "none",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "cancun",
"viaIR": true
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyInitialized","type":"error"},{"inputs":[],"name":"UnauthorizedInitializer","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"chainId","type":"uint256"},{"indexed":false,"internalType":"string","name":"chainName","type":"string"}],"name":"Initialized","type":"event"},{"inputs":[],"name":"AEGIS_INITIALIZER","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"aegisV1Hook","outputs":[{"internalType":"contract IHooks","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"agToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"chainName","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dffName","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dffSymbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"emergencyOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"agToken","type":"address"},{"internalType":"address","name":"poolManager","type":"address"},{"internalType":"address","name":"positionManager","type":"address"},{"internalType":"address","name":"permit2","type":"address"},{"internalType":"address","name":"universalRouter","type":"address"},{"internalType":"address","name":"aegisV1Hook","type":"address"},{"internalType":"address","name":"emergencyOwner","type":"address"},{"internalType":"address","name":"protocolOwner","type":"address"},{"internalType":"string","name":"chainName","type":"string"},{"internalType":"uint256","name":"rebalanceDelaySeconds","type":"uint256"},{"internalType":"uint32","name":"twapPeriod","type":"uint32"},{"internalType":"uint32","name":"twapAuxPeriod","type":"uint32"},{"internalType":"uint24","name":"rebalanceTwapMaxTicks","type":"uint24"},{"internalType":"uint24","name":"redeemTwapMaxTicks","type":"uint24"},{"internalType":"uint256","name":"vestingDurationDays","type":"uint256"}],"internalType":"struct IAegisDFFDependencies.InitParams","name":"params","type":"tuple"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"initialized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"permit2","outputs":[{"internalType":"contract IAllowanceTransfer","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolManager","outputs":[{"internalType":"contract IPoolManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"positionManager","outputs":[{"internalType":"contract IPositionManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"protocolOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rebalanceDelaySeconds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rebalanceTwapMaxTicks","outputs":[{"internalType":"uint24","name":"","type":"uint24"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"redeemTwapMaxTicks","outputs":[{"internalType":"uint24","name":"","type":"uint24"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sharesName","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sharesSymbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"twapAuxPeriod","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"twapPeriod","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"universalRouter","outputs":[{"internalType":"contract IUniversalRouter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vestingDurationDays","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]Contract Creation Code
60808060405234601557611116908161001a8239f35b5f80fdfe6080806040526004361015610012575f80fd5b5f3560e01c9081625d527414610f135750806307e9729914610ef65780630c43333714610ece5780631169dff414610eb157806312261ee714610e89578063158ef93e14610e6857806319618f1e14610dd65780631c93b03a14610d4457806335a9e4df14610d1c57806341fd580114610c8a578063517c864c146103d0578063568097d11461033e57806370c33c8014610277578063791b98bc1461024f57806381a7f6841461022a5780639d60558214610205578063c1d6ba69146101dd578063d53bd324146101af578063dc4c90d314610187578063ee565a631461015c578063f170c85c146101345763f62073261461010d575f80fd5b34610130575f36600319011261013057602063ffffffff600e5416604051908152f35b5f80fd5b34610130575f366003190112610130576006546040516001600160a01b039091168152602090f35b34610130575f366003190112610130575f5460405160089190911c6001600160a01b03168152602090f35b34610130575f366003190112610130576001546040516001600160a01b039091168152602090f35b34610130575f366003190112610130576020604051736cb1c9a1a31186170f6e6746640a1d5fca8cc0328152f35b34610130575f366003190112610130576007546040516001600160a01b039091168152602090f35b34610130575f36600319011261013057602062ffffff600e5460581c16604051908152f35b34610130575f36600319011261013057602062ffffff600e5460401c16604051908152f35b34610130575f366003190112610130576002546040516001600160a01b039091168152602090f35b34610130575f366003190112610130576040515f600b5461029781610f35565b808452906001811690811561031a57506001146102cf575b6102cb836102bf81850382610f6d565b60405191829182610f90565b0390f35b600b5f9081525f805160206110ea833981519152939250905b808210610300575090915081016020016102bf6102af565b9192600181602092548385880101520191019092916102e8565b60ff191660208086019190915291151560051b840190910191506102bf90506102af565b34610130575f366003190112610130576040515f600c5461035e81610f35565b808452906001811690811561031a5750600114610385576102cb836102bf81850382610f6d565b600c5f9081525f8051602061104a833981519152939250905b8082106103b6575090915081016020016102bf6102af565b91926001816020925483858801015201910190929161039e565b34610130576020366003190112610130576004356001600160401b03811161013057806004016101e0600319833603011261013057736cb1c9a1a31186170f6e6746640a1d5fca8cc0323303610c7b575f5460ff8116610c6d576001600160a01b0361043b83610fba565b1615610c5e57602483016001600160a01b0361045682610fba565b1615610c5e57604484016001600160a01b0361047182610fba565b1615610c5e57606485016001600160a01b0361048c82610fba565b1615610c5e5760848601906001600160a01b036104a883610fba565b1615610c5e5760a48701926001600160a01b036104c485610fba565b1615610c5e5760c48801946001600160a01b036104e087610fba565b1615610c5e5760e48901966001600160a01b036104fc89610fba565b1615610c5e57610100600160a81b036105148a610fba565b60081b16610100600160a81b031991909116175f556001600160a01b039061053b90610fba565b60018054919092166001600160a01b03199091161790556001600160a01b039061056490610fba565b60028054919092166001600160a01b03199091161790556001600160a01b039061058d90610fba565b60038054919092166001600160a01b03199091161790556001600160a01b03906105b690610fba565b60048054919092166001600160a01b03199091161790556001600160a01b03906105df90610fba565b60058054919092166001600160a01b03199091161790556001600160a01b039061060890610fba565b60068054919092166001600160a01b03199091161790556001600160a01b039061063190610fba565b1660018060a01b031960075416176007556101048201906106528282610fce565b9093906001600160401b038111610a435761066e600854610f35565b601f8111610c23575b505f601f8211600114610baf57908061069b92602a975f92610ba4575b5050611016565b6008555b6106e26106ac8484610fce565b959086604051978892694165676973204446462d60b01b60208501528484013781015f838201520301601f198101865285610f6d565b83516001600160401b038111610a43576106fd600954610f35565b601f8111610b69575b506020601f8211600114610b0357908061072a926025975f92610a57575050611016565b6009555b61076c61073b8484610fce565b95908660405197889264414746462d60d81b60208501528484013781015f838201520301601f198101865285610f6d565b83516001600160401b038111610a4357610787600a54610f35565b601f8111610ac8575b506020601f8211600114610a625790806107b492602d975f92610a57575050611016565b600a555b6107fe6107c58484610fce565b9590866040519788926c4165676973205368617265732d60981b60208501528484013781015f838201520301601f198101865285610f6d565b83516001600160401b038111610a4357610819600b54610f35565b601f81116109fd575b506020601f8211600114610982579161085b826101c49361091a9796955f8051602061108a833981519152995f92610977575050611016565b600b555b61086a600c54610f35565b601f811161094c575b5060066241475360e81b01600c55610124810135600d5563ffffffff61089c6101448301611028565b16600e5463ffffffff60201b6108b56101648501611028565b60201b1662ffffff60401b6108cd6101848601611039565b60401b169162ffffff60581b6108e66101a48701611039565b60581b169362ffffff60581b199160018060581b0319161716171717600e550135600f55600160ff195f5416175f55610fce565b919082604051916020835281602084015260408301375f604084830101526040814694601f80199101168101030190a2005b600c5f5261097190601f0160051c5f8051602061104a83398151915290810190611000565b86610873565b015190508980610694565b601f19821695600b5f52815f20965f5b8181106109e55750925f8051602061108a8339815191529761091a97969593600193836101c497106109cd575b505050811b01600b5561085f565b01515f1960f88460031b161c191690558880806109bf565b83830151895560019098019760209384019301610992565b600b5f52610a33905f805160206110ea833981519152601f840160051c81019160208510610a39575b601f0160051c0190611000565b85610822565b9091508190610a26565b634e487b7160e01b5f52604160045260245ffd5b015190508780610694565b601f19821695600a5f52815f20965f5b818110610ab0575091602d9791846001959410610a98575b505050811b01600a556107b8565b01515f1960f88460031b161c19169055868080610a8a565b83830151895560019098019760209384019301610a72565b600a5f52610afd905f8051602061106a833981519152601f840160051c81019160208510610a3957601f0160051c0190611000565b85610790565b601f1982169560095f52815f20965f5b818110610b5157509160259791846001959410610b39575b505050811b0160095561072e565b01515f1960f88460031b161c19169055868080610b2b565b83830151895560019098019760209384019301610b13565b60095f52610b9e905f805160206110ca833981519152601f840160051c81019160208510610a3957601f0160051c0190611000565b85610706565b013590508780610694565b60085f9081525f805160206110aa8339815191529190601f198416905b818110610c0b575096839291600194602a9910610bf2575b505050811b0160085561069f565b01355f19600384901b60f8161c19169055868080610be4565b9192602060018192868c013581550194019201610bcc565b60085f52610c58905f805160206110aa833981519152601f840160051c81019160208510610a3957601f0160051c0190611000565b85610677565b63d92e233d60e01b5f5260045ffd5b62dc149f60e41b5f5260045ffd5b630d622feb60e01b5f5260045ffd5b34610130575f366003190112610130576040515f600954610caa81610f35565b808452906001811690811561031a5750600114610cd1576102cb836102bf81850382610f6d565b60095f9081525f805160206110ca833981519152939250905b808210610d02575090915081016020016102bf6102af565b919260018160209254838588010152019101909291610cea565b34610130575f366003190112610130576004546040516001600160a01b039091168152602090f35b34610130575f366003190112610130576040515f600854610d6481610f35565b808452906001811690811561031a5750600114610d8b576102cb836102bf81850382610f6d565b60085f9081525f805160206110aa833981519152939250905b808210610dbc575090915081016020016102bf6102af565b919260018160209254838588010152019101909291610da4565b34610130575f366003190112610130576040515f600a54610df681610f35565b808452906001811690811561031a5750600114610e1d576102cb836102bf81850382610f6d565b600a5f9081525f8051602061106a833981519152939250905b808210610e4e575090915081016020016102bf6102af565b919260018160209254838588010152019101909291610e36565b34610130575f36600319011261013057602060ff5f54166040519015158152f35b34610130575f366003190112610130576003546040516001600160a01b039091168152602090f35b34610130575f366003190112610130576020600d54604051908152f35b34610130575f366003190112610130576005546040516001600160a01b039091168152602090f35b34610130575f366003190112610130576020600f54604051908152f35b34610130575f3660031901126101305760209063ffffffff600e54831c168152f35b90600182811c92168015610f63575b6020831014610f4f57565b634e487b7160e01b5f52602260045260245ffd5b91607f1691610f44565b601f909101601f19168101906001600160401b03821190821017610a4357604052565b602060409281835280519182918282860152018484015e5f828201840152601f01601f1916010190565b356001600160a01b03811681036101305790565b903590601e198136030182121561013057018035906001600160401b0382116101305760200191813603831361013057565b81811061100b575050565b5f8155600101611000565b8160011b915f199060031b1c19161790565b3563ffffffff811681036101305790565b3562ffffff81168103610130579056fedf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c7c65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a8a58e619868102cec9682744dbf06f0cc0b450e67fd4b6c795a6b1b3660e9cf07f3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee36e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db9a164736f6c634300081a000a
Deployed Bytecode
0x6080806040526004361015610012575f80fd5b5f3560e01c9081625d527414610f135750806307e9729914610ef65780630c43333714610ece5780631169dff414610eb157806312261ee714610e89578063158ef93e14610e6857806319618f1e14610dd65780631c93b03a14610d4457806335a9e4df14610d1c57806341fd580114610c8a578063517c864c146103d0578063568097d11461033e57806370c33c8014610277578063791b98bc1461024f57806381a7f6841461022a5780639d60558214610205578063c1d6ba69146101dd578063d53bd324146101af578063dc4c90d314610187578063ee565a631461015c578063f170c85c146101345763f62073261461010d575f80fd5b34610130575f36600319011261013057602063ffffffff600e5416604051908152f35b5f80fd5b34610130575f366003190112610130576006546040516001600160a01b039091168152602090f35b34610130575f366003190112610130575f5460405160089190911c6001600160a01b03168152602090f35b34610130575f366003190112610130576001546040516001600160a01b039091168152602090f35b34610130575f366003190112610130576020604051736cb1c9a1a31186170f6e6746640a1d5fca8cc0328152f35b34610130575f366003190112610130576007546040516001600160a01b039091168152602090f35b34610130575f36600319011261013057602062ffffff600e5460581c16604051908152f35b34610130575f36600319011261013057602062ffffff600e5460401c16604051908152f35b34610130575f366003190112610130576002546040516001600160a01b039091168152602090f35b34610130575f366003190112610130576040515f600b5461029781610f35565b808452906001811690811561031a57506001146102cf575b6102cb836102bf81850382610f6d565b60405191829182610f90565b0390f35b600b5f9081525f805160206110ea833981519152939250905b808210610300575090915081016020016102bf6102af565b9192600181602092548385880101520191019092916102e8565b60ff191660208086019190915291151560051b840190910191506102bf90506102af565b34610130575f366003190112610130576040515f600c5461035e81610f35565b808452906001811690811561031a5750600114610385576102cb836102bf81850382610f6d565b600c5f9081525f8051602061104a833981519152939250905b8082106103b6575090915081016020016102bf6102af565b91926001816020925483858801015201910190929161039e565b34610130576020366003190112610130576004356001600160401b03811161013057806004016101e0600319833603011261013057736cb1c9a1a31186170f6e6746640a1d5fca8cc0323303610c7b575f5460ff8116610c6d576001600160a01b0361043b83610fba565b1615610c5e57602483016001600160a01b0361045682610fba565b1615610c5e57604484016001600160a01b0361047182610fba565b1615610c5e57606485016001600160a01b0361048c82610fba565b1615610c5e5760848601906001600160a01b036104a883610fba565b1615610c5e5760a48701926001600160a01b036104c485610fba565b1615610c5e5760c48801946001600160a01b036104e087610fba565b1615610c5e5760e48901966001600160a01b036104fc89610fba565b1615610c5e57610100600160a81b036105148a610fba565b60081b16610100600160a81b031991909116175f556001600160a01b039061053b90610fba565b60018054919092166001600160a01b03199091161790556001600160a01b039061056490610fba565b60028054919092166001600160a01b03199091161790556001600160a01b039061058d90610fba565b60038054919092166001600160a01b03199091161790556001600160a01b03906105b690610fba565b60048054919092166001600160a01b03199091161790556001600160a01b03906105df90610fba565b60058054919092166001600160a01b03199091161790556001600160a01b039061060890610fba565b60068054919092166001600160a01b03199091161790556001600160a01b039061063190610fba565b1660018060a01b031960075416176007556101048201906106528282610fce565b9093906001600160401b038111610a435761066e600854610f35565b601f8111610c23575b505f601f8211600114610baf57908061069b92602a975f92610ba4575b5050611016565b6008555b6106e26106ac8484610fce565b959086604051978892694165676973204446462d60b01b60208501528484013781015f838201520301601f198101865285610f6d565b83516001600160401b038111610a43576106fd600954610f35565b601f8111610b69575b506020601f8211600114610b0357908061072a926025975f92610a57575050611016565b6009555b61076c61073b8484610fce565b95908660405197889264414746462d60d81b60208501528484013781015f838201520301601f198101865285610f6d565b83516001600160401b038111610a4357610787600a54610f35565b601f8111610ac8575b506020601f8211600114610a625790806107b492602d975f92610a57575050611016565b600a555b6107fe6107c58484610fce565b9590866040519788926c4165676973205368617265732d60981b60208501528484013781015f838201520301601f198101865285610f6d565b83516001600160401b038111610a4357610819600b54610f35565b601f81116109fd575b506020601f8211600114610982579161085b826101c49361091a9796955f8051602061108a833981519152995f92610977575050611016565b600b555b61086a600c54610f35565b601f811161094c575b5060066241475360e81b01600c55610124810135600d5563ffffffff61089c6101448301611028565b16600e5463ffffffff60201b6108b56101648501611028565b60201b1662ffffff60401b6108cd6101848601611039565b60401b169162ffffff60581b6108e66101a48701611039565b60581b169362ffffff60581b199160018060581b0319161716171717600e550135600f55600160ff195f5416175f55610fce565b919082604051916020835281602084015260408301375f604084830101526040814694601f80199101168101030190a2005b600c5f5261097190601f0160051c5f8051602061104a83398151915290810190611000565b86610873565b015190508980610694565b601f19821695600b5f52815f20965f5b8181106109e55750925f8051602061108a8339815191529761091a97969593600193836101c497106109cd575b505050811b01600b5561085f565b01515f1960f88460031b161c191690558880806109bf565b83830151895560019098019760209384019301610992565b600b5f52610a33905f805160206110ea833981519152601f840160051c81019160208510610a39575b601f0160051c0190611000565b85610822565b9091508190610a26565b634e487b7160e01b5f52604160045260245ffd5b015190508780610694565b601f19821695600a5f52815f20965f5b818110610ab0575091602d9791846001959410610a98575b505050811b01600a556107b8565b01515f1960f88460031b161c19169055868080610a8a565b83830151895560019098019760209384019301610a72565b600a5f52610afd905f8051602061106a833981519152601f840160051c81019160208510610a3957601f0160051c0190611000565b85610790565b601f1982169560095f52815f20965f5b818110610b5157509160259791846001959410610b39575b505050811b0160095561072e565b01515f1960f88460031b161c19169055868080610b2b565b83830151895560019098019760209384019301610b13565b60095f52610b9e905f805160206110ca833981519152601f840160051c81019160208510610a3957601f0160051c0190611000565b85610706565b013590508780610694565b60085f9081525f805160206110aa8339815191529190601f198416905b818110610c0b575096839291600194602a9910610bf2575b505050811b0160085561069f565b01355f19600384901b60f8161c19169055868080610be4565b9192602060018192868c013581550194019201610bcc565b60085f52610c58905f805160206110aa833981519152601f840160051c81019160208510610a3957601f0160051c0190611000565b85610677565b63d92e233d60e01b5f5260045ffd5b62dc149f60e41b5f5260045ffd5b630d622feb60e01b5f5260045ffd5b34610130575f366003190112610130576040515f600954610caa81610f35565b808452906001811690811561031a5750600114610cd1576102cb836102bf81850382610f6d565b60095f9081525f805160206110ca833981519152939250905b808210610d02575090915081016020016102bf6102af565b919260018160209254838588010152019101909291610cea565b34610130575f366003190112610130576004546040516001600160a01b039091168152602090f35b34610130575f366003190112610130576040515f600854610d6481610f35565b808452906001811690811561031a5750600114610d8b576102cb836102bf81850382610f6d565b60085f9081525f805160206110aa833981519152939250905b808210610dbc575090915081016020016102bf6102af565b919260018160209254838588010152019101909291610da4565b34610130575f366003190112610130576040515f600a54610df681610f35565b808452906001811690811561031a5750600114610e1d576102cb836102bf81850382610f6d565b600a5f9081525f8051602061106a833981519152939250905b808210610e4e575090915081016020016102bf6102af565b919260018160209254838588010152019101909291610e36565b34610130575f36600319011261013057602060ff5f54166040519015158152f35b34610130575f366003190112610130576003546040516001600160a01b039091168152602090f35b34610130575f366003190112610130576020600d54604051908152f35b34610130575f366003190112610130576005546040516001600160a01b039091168152602090f35b34610130575f366003190112610130576020600f54604051908152f35b34610130575f3660031901126101305760209063ffffffff600e54831c168152f35b90600182811c92168015610f63575b6020831014610f4f57565b634e487b7160e01b5f52602260045260245ffd5b91607f1691610f44565b601f909101601f19168101906001600160401b03821190821017610a4357604052565b602060409281835280519182918282860152018484015e5f828201840152601f01601f1916010190565b356001600160a01b03811681036101305790565b903590601e198136030182121561013057018035906001600160401b0382116101305760200191813603831361013057565b81811061100b575050565b5f8155600101611000565b8160011b915f199060031b1c19161790565b3563ffffffff811681036101305790565b3562ffffff81168103610130579056fedf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c7c65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a8a58e619868102cec9682744dbf06f0cc0b450e67fd4b6c795a6b1b3660e9cf07f3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee36e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db9a164736f6c634300081a000a
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 32 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ 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.