Verified contractPartialMIT
DualPoolHook
Address0x0000005bb4df4109bf356a585c8b8ea70fcbaac0
- Balance
0 ETH
- Transactions
11
- Compiler
solc 0.8.26
- Same code
3 more contracts
Details
- Compiler
- solc 0.8.26+commit.8a97fa7a
- Language
- solidity
- Optimization
- Yes, 200 runs
- EVM version
- cancun
- Via IR
- yes
- License
- MIT
- Match
- Partialcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 25,589,269
- Creation transaction
- 0xdf805db7ff…943fbeee71
74 files
The source code is large: one file is shown at a time. Choose a file in the list.
- src/alf/DualPoolHook.solmain61.45 KB
- lib/blocknumberish/src/BlockNumberish.sol3.12 KB
- lib/openzeppelin-contracts/contracts/access/Ownable.sol3.1 KB
- lib/openzeppelin-contracts/contracts/access/Ownable2Step.sol2.48 KB
- lib/openzeppelin-contracts/contracts/interfaces/IERC1363.sol4.45 KB
- lib/openzeppelin-contracts/contracts/interfaces/IERC165.sol193 B
- lib/openzeppelin-contracts/contracts/interfaces/IERC20.sol182 B
- lib/openzeppelin-contracts/contracts/interfaces/IERC4626.sol12.21 KB
- lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol2.78 KB
- lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol684 B
- lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol13.31 KB
- lib/openzeppelin-contracts/contracts/utils/Context.sol963 B
- lib/openzeppelin-contracts/contracts/utils/ReentrancyGuardTransient.sol2.85 KB
- lib/openzeppelin-contracts/contracts/utils/TransientSlot.sol5.08 KB
- lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol871 B
- lib/solady/src/utils/FixedPointMathLib.sol55.69 KB
- lib/v4-core/src/interfaces/IExtsload.sol1.02 KB
- lib/v4-core/src/interfaces/IExttload.sol699 B
- lib/v4-core/src/interfaces/IHooks.sol8.23 KB
- lib/v4-core/src/interfaces/IPoolManager.sol12.84 KB
- lib/v4-core/src/interfaces/IProtocolFees.sol2.49 KB
- lib/v4-core/src/interfaces/callback/IUnlockCallback.sol488 B
- lib/v4-core/src/interfaces/external/IERC20Minimal.sol3.04 KB
- lib/v4-core/src/interfaces/external/IERC6909Claims.sol3.16 KB
- lib/v4-core/src/libraries/BitMath.sol2.61 KB
- lib/v4-core/src/libraries/CurrencyReserves.sol1.29 KB
- lib/v4-core/src/libraries/CustomRevert.sol5.17 KB
- lib/v4-core/src/libraries/FixedPoint128.sol297 B
- lib/v4-core/src/libraries/FixedPoint96.sol366 B
- lib/v4-core/src/libraries/FullMath.sol5.46 KB
- lib/v4-core/src/libraries/Hooks.sol16.51 KB
- lib/v4-core/src/libraries/LPFeeLibrary.sol3.6 KB
- lib/v4-core/src/libraries/LiquidityMath.sol742 B
- lib/v4-core/src/libraries/Lock.sol930 B
- lib/v4-core/src/libraries/NonzeroDeltaCount.sol1.46 KB
- lib/v4-core/src/libraries/ParseBytes.sol1.2 KB
- lib/v4-core/src/libraries/Position.sol4.81 KB
- lib/v4-core/src/libraries/ProtocolFeeLibrary.sol2.11 KB
- lib/v4-core/src/libraries/SafeCast.sol2.27 KB
- lib/v4-core/src/libraries/SqrtPriceMath.sol14.08 KB
- lib/v4-core/src/libraries/StateLibrary.sol16.03 KB
- lib/v4-core/src/libraries/SwapMath.sol6.97 KB
- lib/v4-core/src/libraries/TickMath.sol12.38 KB
- lib/v4-core/src/libraries/TransientStateLibrary.sol2.36 KB
- lib/v4-core/src/libraries/UnsafeMath.sol1.17 KB
- lib/v4-core/src/types/BalanceDelta.sol2.34 KB
- lib/v4-core/src/types/BeforeSwapDelta.sol1.47 KB
- lib/v4-core/src/types/Currency.sol5.46 KB
- lib/v4-core/src/types/PoolId.sol539 B
- lib/v4-core/src/types/PoolKey.sol805 B
- lib/v4-core/src/types/PoolOperation.sol907 B
- lib/v4-periphery/src/base/DeltaResolver.sol5.8 KB
- lib/v4-periphery/src/base/ImmutableState.sol818 B
- lib/v4-periphery/src/interfaces/IImmutableState.sol365 B
- lib/v4-periphery/src/libraries/ActionConstants.sol1.04 KB
- lib/v4-periphery/src/libraries/LiquidityAmounts.sol3.8 KB
- src/alf/base/BaseALFHook.sol5.8 KB
- src/alf/base/OwnedALFHook.sol4.44 KB
- src/alf/base/PoolVault.sol59.85 KB
- src/alf/base/vault/MultiAssetShareMath.sol4.07 KB
- src/alf/interfaces/IALFHook.sol3.77 KB
- src/alf/interfaces/IHookStats.sol3.16 KB
- src/alf/libraries/FeeLib.sol1.55 KB
- src/alf/libraries/InventoryLib.sol20.51 KB
- src/alf/libraries/SettlementLib.sol4.95 KB
- src/alf/types/ActiveLiquidity.sol4.4 KB
- src/alf/types/DepositGate.sol1.75 KB
- src/alf/types/Distribution.sol8.33 KB
- src/alf/types/Inventory.sol11.04 KB
- src/alf/types/JITLock.sol5.38 KB
- src/alf/types/Liveness.sol2.19 KB
- src/alf/types/Shares.sol14.9 KB
- src/alf/types/VaultId.sol981 B
- src/base/BaseHook.sol7.13 KB
src/alf/base/BaseALFHook.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;
import {Currency} from "@uniswap/v4-core/src/types/Currency.sol";
import {PoolKey} from "@uniswap/v4-core/src/types/PoolKey.sol";
import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol";
import {IHooks} from "@uniswap/v4-core/src/interfaces/IHooks.sol";
import {BaseHook} from "../../base/BaseHook.sol";
import {DeltaResolver} from "@uniswap/v4-periphery/src/base/DeltaResolver.sol";
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import {IALFHook, ALFHookData} from "../interfaces/IALFHook.sol";
import {IHookStats} from "../interfaces/IHookStats.sol";
/// @title BaseALFHook
/// @author Uniswap Labs
/// @notice Abstract base contract for ALF hooks. Provides hookData resolution, settlement
/// helpers, and the IALFHook interface. Quoters extend this and implement _price()
/// with their pricing logic.
/// @dev Follows the same BaseHook + DeltaResolver dual-inheritance pattern as BaseTokenWrapperHook.
/// @custom:security-contact [email protected]
abstract contract BaseALFHook is BaseHook, DeltaResolver, IALFHook {
/// @dev Gas budget declared for `getIndicativeQuote` staticcalls. Returned by `maxGas()`.
uint32 private immutable _maxGas;
/// @param _poolManager The Uniswap v4 PoolManager.
/// @param maxGas_ Gas budget declared for `getIndicativeQuote` staticcalls.
constructor(IPoolManager _poolManager, uint32 maxGas_) BaseHook(_poolManager) {
_maxGas = maxGas_;
}
// ──── IALFHook ────
/// @inheritdoc IALFHook
function maxGas() external view override returns (uint32) {
return _maxGas;
}
/// @notice ERC-165 advertisement for the interfaces this contract implements.
/// @dev Stateless implementation (no inherited `ERC165` storage). Advertises `IALFHook`,
/// `IHooks` (implemented via `BaseHook`), and `IERC165`. Subclasses that implement
/// additional interfaces should override this and OR-in their own selectors.
function supportsInterface(bytes4 interfaceId) public pure virtual returns (bool) {
return interfaceId == type(IALFHook).interfaceId || interfaceId == type(IHooks).interfaceId
|| interfaceId == type(IERC165).interfaceId;
}
/// @inheritdoc IALFHook
function getIndicativeQuote(PoolKey calldata key, bool zeroForOne, int256 amountSpecified, bytes calldata hookData)
external
view
virtual
override
returns (uint256 outputAmount)
{
(bool isAttested, address attester) = _resolveHookData(hookData);
return _price(key, zeroForOne, amountSpecified, isAttested, attester);
}
/// @inheritdoc IALFHook
function isLive() external view virtual override returns (bool);
// ──── Reserves (default: no off-pool reserves) ────
/// @inheritdoc IHookStats
function getReserves(PoolKey calldata) external view virtual override returns (uint256, uint256) {
return (0, 0);
}
/// @inheritdoc IHookStats
function getEffectiveLiquidity(PoolKey calldata) external view virtual override returns (uint256, uint256) {
return (0, 0);
}
// ──── Price-bounded simulation (default: unsupported) ────
/// @inheritdoc IALFHook
function swapToPrice(PoolKey calldata, bool, int256, uint160, bytes calldata)
external
view
virtual
override
returns (uint256, uint256)
{
return (0, 0);
}
// ──── Internal: HookData Resolution ────
/// @dev Decode ALFHookData and resolve attestation. The base implementation does not
/// verify attestations; subclasses that want attestation support override
/// `_resolveAttestation` with their own verification logic.
function _resolveHookData(bytes calldata hookData) internal view returns (bool isAttested, address attester) {
if (hookData.length == 0) return (false, address(0));
ALFHookData memory hd = abi.decode(hookData, (ALFHookData));
(isAttested, attester) = _resolveAttestation(hd.attestationData);
}
/// @dev Resolve attestation from raw bytes. Default returns (false, address(0)).
/// Subclasses can override to verify attestationData against their own signer.
function _resolveAttestation(bytes memory) internal view virtual returns (bool isAttested, address attester) {
return (false, address(0));
}
// ──── Pricing extension point (default: no indicative quote) ────
/// @dev Indicative pricing backing the default {getIndicativeQuote}. Defaults to 0: the
/// IALFHook "cannot price this swap" path. Quoter subclasses override with their curve
/// (e.g. `SpreadQuoterBase` simulates against the pool's static fee). Hooks that price
/// against bespoke liquidity (e.g. `DualPoolHook`) override `getIndicativeQuote`
/// directly instead, leaving this dormant.
function _price(PoolKey calldata, bool, int256, bool, address) internal view virtual returns (uint256) {
return 0;
}
// ──── DeltaResolver: _pay ────
/// @inheritdoc DeltaResolver
/// @dev Pays the PoolManager using v4's `Currency.transfer` rather than OZ `SafeERC20`, by
/// design: this matches v4 periphery's `DeltaResolver` convention (the destination is the
/// trusted PoolManager during an unlock, and `Currency.transfer` handles native ETH and
/// the no-return-value ERC-20 quirk in the same path).
function _pay(Currency token, address, uint256 amount) internal virtual override {
token.transfer(address(poolManager), amount);
}
}
Compiler settingsShow
{
"viaIR": true,
"metadata": {
"appendCBOR": true,
"bytecodeHash": "none",
"useLiteralContent": false
},
"optimizer": {
"runs": 200,
"enabled": true
},
"evmVersion": "cancun",
"remappings": [
"@uniswap/v4-core/=lib/v4-core/",
"@uniswap/v4-periphery/=lib/v4-periphery/",
"@uniswap/blocknumberish/=lib/blocknumberish/",
"@openzeppelin/=lib/openzeppelin-contracts/",
"@protocol-fees/=lib/protocol-fees/src/",
"forge-std/=lib/forge-std/src/",
"solmate/=lib/v4-core/lib/solmate/",
"solady/=lib/solady/src/",
"v4-core/=lib/v4-core/src/",
"permit2/=lib/v4-periphery/lib/permit2/",
"lib/fluid-contracts-public/:lib/openzeppelin-contracts/=lib/fluid-contracts-public/lib/openzeppelin-contracts/",
"@ensdomains/=lib/v4-core/node_modules/@ensdomains/",
"@eth-optimism-bedrock/=lib/protocol-fees/lib/optimism/packages/contracts-bedrock/",
"BokkyPooBahsDateTimeLibrary/=lib/protocol-fees/lib/BokkyPooBahsDateTimeLibrary/",
"blocknumberish/=lib/blocknumberish/src/",
"briefcase/=lib/briefcase/src/",
"dao-signer/=lib/protocol-fees/lib/dao-signer/",
"ds-test/=lib/protocol-fees/lib/solmate/lib/ds-test/src/",
"eas-contracts/=lib/protocol-fees/lib/dao-signer/lib/eas-contracts/contracts/",
"erc4626-tests/=lib/fluid-contracts-public/lib/erc4626-tests/",
"fluid-contracts-public/=lib/fluid-contracts-public/contracts/",
"forge-gas-snapshot/=lib/v4-periphery/lib/permit2/lib/forge-gas-snapshot/src/",
"halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"hardhat/=lib/v4-core/node_modules/hardhat/",
"kontrol-cheatcodes/=lib/protocol-fees/lib/optimism/packages/contracts-bedrock/lib/kontrol-cheatcodes/src/",
"lib-keccak/=lib/protocol-fees/lib/optimism/packages/contracts-bedrock/lib/lib-keccak/contracts/",
"murky/=lib/protocol-fees/lib/murky/",
"openzeppelin-contracts-upgradeable/=lib/fluid-contracts-public/lib/openzeppelin-contracts-upgradeable/",
"openzeppelin-contracts-v5/=lib/protocol-fees/lib/optimism/packages/contracts-bedrock/lib/openzeppelin-contracts-v5/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/",
"optimism/=lib/protocol-fees/lib/optimism/",
"pancake-v3-contracts/=lib/pancake-v3-contracts/",
"protocol-fees/=lib/protocol-fees/",
"safe-contracts/=lib/protocol-fees/lib/optimism/packages/contracts-bedrock/lib/safe-contracts/",
"scripts/libraries/Config.sol=lib/protocol-fees/lib/optimism/packages/contracts-bedrock/scripts/libraries/Config.sol",
"solady-v0.0.245/=lib/protocol-fees/lib/optimism/packages/contracts-bedrock/lib/solady-v0.0.245/src/",
"src/AgreementAnchor.sol=lib/protocol-fees/lib/dao-signer/src/AgreementAnchor.sol",
"src/AgreementAnchorFactory.sol=lib/protocol-fees/lib/dao-signer/src/AgreementAnchorFactory.sol",
"src/interfaces/IAgreementAnchorFactory.sol=lib/protocol-fees/lib/dao-signer/src/interfaces/IAgreementAnchorFactory.sol",
"tstorish/=lib/tstorish/src/",
"v2-core/=lib/v2-core/contracts/",
"v3-core/=lib/v3-core/",
"v4-periphery/=lib/v4-periphery/"
]
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.