diff --git a/packages/liquidity-sdk-viem/.env.example b/.env.example similarity index 56% rename from packages/liquidity-sdk-viem/.env.example rename to .env.example index cb099cf1..d18a579b 100644 --- a/packages/liquidity-sdk-viem/.env.example +++ b/.env.example @@ -1 +1,2 @@ MAINNET_RPC_URL= +BASE_RPC_URL= \ No newline at end of file diff --git a/.vscode/extensions.json b/.vscode/extensions.json index cf3f8bbe..83e10661 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,6 +1,7 @@ { "recommendations": [ "esbenp.prettier-vscode", + "JuanBlanco.solidity", "biomejs.biome" ] } diff --git a/.vscode/settings.json b/.vscode/settings.json index 2756c224..20e15a4b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,7 +7,11 @@ "[markdown]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, + "[solidity]": { + "editor.defaultFormatter": "JuanBlanco.solidity" + }, "[typescript]": { "editor.defaultFormatter": "biomejs.biome" - } + }, + "solidity.formatter": "forge" } diff --git a/package.json b/package.json index 9e740595..928e1ad9 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "lint-staged": "^15.4.3", "semver": "^7.7.1", "typescript": "^5.7.2", - "viem": "^2.23.0", + "viem": "^2.33.3", "vitest": "^3.0.5" }, "lint-staged": { diff --git a/packages/blue-sdk-viem/contracts/interfaces/IERC2612.sol b/packages/blue-sdk-viem/contracts/interfaces/IERC2612.sol new file mode 100644 index 00000000..c0d2b3f8 --- /dev/null +++ b/packages/blue-sdk-viem/contracts/interfaces/IERC2612.sol @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright (c) 2025 Morpho Association +pragma solidity >=0.5.0; + +interface IERC2612 { + function permit(address owner, address spender, uint256 shares, uint256 deadline, uint8 v, bytes32 r, bytes32 s) + external; + function nonces(address owner) external view returns (uint256); + function DOMAIN_SEPARATOR() external view returns (bytes32); +} diff --git a/packages/blue-sdk-viem/contracts/vault-v2/GetVaultV2.sol b/packages/blue-sdk-viem/contracts/vault-v2/GetVaultV2.sol new file mode 100644 index 00000000..65b5d195 --- /dev/null +++ b/packages/blue-sdk-viem/contracts/vault-v2/GetVaultV2.sol @@ -0,0 +1,90 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.0; + +import {IVaultV2, Caps} from "./interfaces/IVaultV2.sol"; +import {IMorphoVaultV1AdapterFactory} from "./interfaces/IMorphoVaultV1AdapterFactory.sol"; + +struct Token { + address asset; + string symbol; + string name; + uint256 decimals; +} + +struct VaultV2Allocation { + bytes32 id; + uint256 absoluteCap; + uint256 relativeCap; + uint256 allocation; +} + +struct VaultV2Response { + Token token; + address asset; + uint256 totalAssets; + uint128 _totalAssets; + uint256 totalSupply; + uint256 virtualShares; + uint64 maxRate; + uint64 lastUpdate; + address[] adapters; + address liquidityAdapter; + bytes liquidityData; + bool isLiquidityAdapterKnown; + VaultV2Allocation[] liquidityAllocations; + uint96 performanceFee; + uint96 managementFee; + address performanceFeeRecipient; + address managementFeeRecipient; +} + +contract GetVaultV2 { + function query(IVaultV2 vault, IMorphoVaultV1AdapterFactory morphoVaultV1AdapterFactory) + external + view + returns (VaultV2Response memory res) + { + res.token = + Token({asset: vault.asset(), symbol: vault.symbol(), name: vault.name(), decimals: vault.decimals()}); + res.asset = vault.asset(); + res.totalAssets = vault.totalAssets(); + res._totalAssets = vault._totalAssets(); + res.totalSupply = vault.totalSupply(); + res.virtualShares = vault.virtualShares(); + res.maxRate = vault.maxRate(); + res.lastUpdate = vault.lastUpdate(); + res.liquidityAdapter = vault.liquidityAdapter(); + res.liquidityData = vault.liquidityData(); + res.performanceFee = vault.performanceFee(); + res.managementFee = vault.managementFee(); + res.performanceFeeRecipient = vault.performanceFeeRecipient(); + res.managementFeeRecipient = vault.managementFeeRecipient(); + + uint256 adaptersLength = vault.adaptersLength(); + res.adapters = new address[](adaptersLength); + for (uint256 i; i < adaptersLength; ++i) { + res.adapters[i] = vault.adapters(i); + } + + if (morphoVaultV1AdapterFactory.isMorphoVaultV1Adapter(res.liquidityAdapter)) { + res.isLiquidityAdapterKnown = true; + + res.liquidityAllocations = new VaultV2Allocation[](1); + res.liquidityAllocations[0] = VaultV2Allocation({ + id: keccak256(abi.encode("this", res.liquidityAdapter)), + absoluteCap: 0, + relativeCap: 0, + allocation: 0 + }); + } + + uint256 liquidityAllocationsLength = res.liquidityAllocations.length; + for (uint256 i; i < liquidityAllocationsLength; ++i) { + VaultV2Allocation memory allocation = res.liquidityAllocations[i]; + + allocation.absoluteCap = vault.absoluteCap(allocation.id); + allocation.relativeCap = vault.relativeCap(allocation.id); + allocation.allocation = vault.allocation(allocation.id); + } + } +} diff --git a/packages/blue-sdk-viem/contracts/vault-v2/GetVaultV2MorphoMarketV1Adapter.sol b/packages/blue-sdk-viem/contracts/vault-v2/GetVaultV2MorphoMarketV1Adapter.sol new file mode 100644 index 00000000..42869baa --- /dev/null +++ b/packages/blue-sdk-viem/contracts/vault-v2/GetVaultV2MorphoMarketV1Adapter.sol @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.0; + +import {IMorphoMarketV1Adapter} from "./interfaces/IMorphoMarketV1Adapter.sol"; +import {MarketParams} from "../interfaces/IMorpho.sol"; + +struct VaultV2MorphoMarketV1AdapterResponse { + address parentVault; + address skimRecipient; + MarketParams[] marketParamsList; +} + +contract GetVaultV2MorphoMarketV1Adapter { + function query(IMorphoMarketV1Adapter adapter) + external + view + returns (VaultV2MorphoMarketV1AdapterResponse memory res) + { + res.parentVault = adapter.parentVault(); + res.skimRecipient = adapter.skimRecipient(); + + uint256 length = adapter.marketParamsListLength(); + res.marketParamsList = new MarketParams[](length); + for (uint256 i = 0; i < length; i++) { + res.marketParamsList[i] = adapter.marketParamsList(i); + } + } +} diff --git a/packages/blue-sdk-viem/contracts/vault-v2/GetVaultV2MorphoVaultV1Adapter.sol b/packages/blue-sdk-viem/contracts/vault-v2/GetVaultV2MorphoVaultV1Adapter.sol new file mode 100644 index 00000000..d3772dad --- /dev/null +++ b/packages/blue-sdk-viem/contracts/vault-v2/GetVaultV2MorphoVaultV1Adapter.sol @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.0; + +import {IMorphoVaultV1Adapter} from "./interfaces/IMorphoVaultV1Adapter.sol"; + +struct VaultV2MorphoVaultV1AdapterResponse { + address morphoVaultV1; + address parentVault; + address skimRecipient; +} + +contract GetVaultV2MorphoVaultV1Adapter { + function query(IMorphoVaultV1Adapter adapter) + external + view + returns (VaultV2MorphoVaultV1AdapterResponse memory res) + { + res.morphoVaultV1 = adapter.morphoVaultV1(); + res.parentVault = adapter.parentVault(); + res.skimRecipient = adapter.skimRecipient(); + } +} diff --git a/packages/blue-sdk-viem/contracts/vault-v2/interfaces/IAdapter.sol b/packages/blue-sdk-viem/contracts/vault-v2/interfaces/IAdapter.sol new file mode 100644 index 00000000..a33934f3 --- /dev/null +++ b/packages/blue-sdk-viem/contracts/vault-v2/interfaces/IAdapter.sol @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright (c) 2025 Morpho Association +pragma solidity >=0.5.0; + +/// @dev See VaultV2 NatSpec comments for more details on adapter's spec. +interface IAdapter { + /// @dev Returns the market' ids and the change in assets on this market. + function allocate(bytes memory data, uint256 assets, bytes4 selector, address sender) + external + returns (bytes32[] memory ids, int256 change); + + /// @dev Returns the market' ids and the change in assets on this market. + function deallocate(bytes memory data, uint256 assets, bytes4 selector, address sender) + external + returns (bytes32[] memory ids, int256 change); + + /// @dev Returns the current value of the investments of the adapter (in underlying asset). + function realAssets() external view returns (uint256 assets); +} diff --git a/packages/blue-sdk-viem/contracts/vault-v2/interfaces/IMorphoMarketV1Adapter.sol b/packages/blue-sdk-viem/contracts/vault-v2/interfaces/IMorphoMarketV1Adapter.sol new file mode 100644 index 00000000..6195b08c --- /dev/null +++ b/packages/blue-sdk-viem/contracts/vault-v2/interfaces/IMorphoMarketV1Adapter.sol @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright (c) 2025 Morpho Association +pragma solidity >=0.5.0; + +import {IAdapter} from "./IAdapter.sol"; +import {MarketParams} from "../../interfaces/IMorpho.sol"; + +interface IMorphoMarketV1Adapter is IAdapter { + /* EVENTS */ + + event SetSkimRecipient(address indexed newSkimRecipient); + event Skim(address indexed token, uint256 assets); + + /* ERRORS */ + + error LoanAssetMismatch(); + error NotAuthorized(); + + /* FUNCTIONS */ + + function factory() external view returns (address); + function parentVault() external view returns (address); + function asset() external view returns (address); + function morpho() external view returns (address); + function adapterId() external view returns (bytes32); + function skimRecipient() external view returns (address); + function marketParamsList(uint256 index) external view returns (MarketParams calldata); + function marketParamsListLength() external view returns (uint256); + function allocation(MarketParams memory marketParams) external view returns (uint256); + function ids(MarketParams memory marketParams) external view returns (bytes32[] memory); + function setSkimRecipient(address newSkimRecipient) external; + function skim(address token) external; +} diff --git a/packages/blue-sdk-viem/contracts/vault-v2/interfaces/IMorphoVaultV1Adapter.sol b/packages/blue-sdk-viem/contracts/vault-v2/interfaces/IMorphoVaultV1Adapter.sol new file mode 100644 index 00000000..33c81c9c --- /dev/null +++ b/packages/blue-sdk-viem/contracts/vault-v2/interfaces/IMorphoVaultV1Adapter.sol @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright (c) 2025 Morpho Association +pragma solidity >= 0.5.0; + +import {IAdapter} from "./IAdapter.sol"; + +interface IMorphoVaultV1Adapter is IAdapter { + /* EVENTS */ + + event SetSkimRecipient(address indexed newSkimRecipient); + event Skim(address indexed token, uint256 assets); + + /* ERRORS */ + + error AssetMismatch(); + error CannotSkimMorphoVaultV1Shares(); + error InvalidData(); + error NotAuthorized(); + + /* FUNCTIONS */ + + function factory() external view returns (address); + function parentVault() external view returns (address); + function morphoVaultV1() external view returns (address); + function adapterId() external view returns (bytes32); + function skimRecipient() external view returns (address); + function allocation() external view returns (uint256); + function ids() external view returns (bytes32[] memory); + function setSkimRecipient(address newSkimRecipient) external; + function skim(address token) external; +} diff --git a/packages/blue-sdk-viem/contracts/vault-v2/interfaces/IMorphoVaultV1AdapterFactory.sol b/packages/blue-sdk-viem/contracts/vault-v2/interfaces/IMorphoVaultV1AdapterFactory.sol new file mode 100644 index 00000000..38bb1a4f --- /dev/null +++ b/packages/blue-sdk-viem/contracts/vault-v2/interfaces/IMorphoVaultV1AdapterFactory.sol @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright (c) 2025 Morpho Association +pragma solidity >=0.5.0; + +interface IMorphoVaultV1AdapterFactory { + /* EVENTS */ + + event CreateMorphoVaultV1Adapter( + address indexed parentVault, address indexed morphoVaultV1, address indexed morphoVaultV1Adapter + ); + + /* FUNCTIONS */ + + function morphoVaultV1Adapter(address parentVault, address morphoVaultV1) external view returns (address); + function isMorphoVaultV1Adapter(address account) external view returns (bool); + function createMorphoVaultV1Adapter(address parentVault, address morphoVaultV1) + external + returns (address morphoVaultV1Adapter); +} diff --git a/packages/blue-sdk-viem/contracts/vault-v2/interfaces/IVaultV2.sol b/packages/blue-sdk-viem/contracts/vault-v2/interfaces/IVaultV2.sol new file mode 100644 index 00000000..ceb6b921 --- /dev/null +++ b/packages/blue-sdk-viem/contracts/vault-v2/interfaces/IVaultV2.sol @@ -0,0 +1,101 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright (c) 2025 Morpho Association +pragma solidity >=0.5.0; + +import {IERC20} from "../../interfaces/IERC20.sol"; +import {IERC4626} from "../../interfaces/IERC4626.sol"; +import {IERC2612} from "../../interfaces/IERC2612.sol"; + +struct Caps { + uint256 allocation; + uint128 absoluteCap; + uint128 relativeCap; +} + +interface IVaultV2 is IERC4626, IERC2612 { + // State variables + function virtualShares() external view returns (uint256); + function owner() external view returns (address); + function curator() external view returns (address); + function sharesGate() external view returns (address); + function receiveAssetsGate() external view returns (address); + function sendAssetsGate() external view returns (address); + function isSentinel(address account) external view returns (bool); + function isAllocator(address account) external view returns (bool); + function firstTotalAssets() external view returns (uint256); + function _totalAssets() external view returns (uint128); + function lastUpdate() external view returns (uint64); + function maxRate() external view returns (uint64); + function adapters(uint256 index) external view returns (address); + function adaptersLength() external view returns (uint256); + function isAdapter(address account) external view returns (bool); + function allocation(bytes32 id) external view returns (uint256); + function absoluteCap(bytes32 id) external view returns (uint256); + function relativeCap(bytes32 id) external view returns (uint256); + function forceDeallocatePenalty(address adapter) external view returns (uint256); + function liquidityAdapter() external view returns (address); + function liquidityData() external view returns (bytes memory); + function timelock(bytes4 selector) external view returns (uint256); + function executableAt(bytes memory data) external view returns (uint256); + function performanceFee() external view returns (uint96); + function performanceFeeRecipient() external view returns (address); + function managementFee() external view returns (uint96); + function managementFeeRecipient() external view returns (address); + + // Gating + function canSendShares(address account) external view returns (bool); + function canReceiveShares(address account) external view returns (bool); + function canSendAssets(address account) external view returns (bool); + function canReceiveAssets(address account) external view returns (bool); + + // Multicall + function multicall(bytes[] memory data) external; + + // Owner functions + function setOwner(address newOwner) external; + function setCurator(address newCurator) external; + function setIsSentinel(address account, bool isSentinel) external; + function setName(string memory newName) external; + function setSymbol(string memory newSymbol) external; + + // Timelocks for curator functions + function submit(bytes memory data) external; + function revoke(bytes memory data) external; + + // Curator functions + function setIsAllocator(address account, bool newIsAllocator) external; + function setSharesGate(address newSharesGate) external; + function setReceiveAssetsGate(address newReceiveAssetsGate) external; + function setSendAssetsGate(address newSendAssetsGate) external; + function setIsAdapter(address account, bool newIsAdapter) external; + function increaseTimelock(bytes4 selector, uint256 newDuration) external; + function abdicateSubmit(bytes4 selector) external; + function decreaseTimelock(bytes4 selector, uint256 newDuration) external; + function setPerformanceFee(uint256 newPerformanceFee) external; + function setManagementFee(uint256 newManagementFee) external; + function setPerformanceFeeRecipient(address newPerformanceFeeRecipient) external; + function setManagementFeeRecipient(address newManagementFeeRecipient) external; + function increaseAbsoluteCap(bytes memory idData, uint256 newAbsoluteCap) external; + function decreaseAbsoluteCap(bytes memory idData, uint256 newAbsoluteCap) external; + function increaseRelativeCap(bytes memory idData, uint256 newRelativeCap) external; + function decreaseRelativeCap(bytes memory idData, uint256 newRelativeCap) external; + function setMaxRate(uint256 newMaxRate) external; + function setForceDeallocatePenalty(address adapter, uint256 newForceDeallocatePenalty) external; + + // Allocator functions + function allocate(address adapter, bytes memory data, uint256 assets) external; + function deallocate(address adapter, bytes memory data, uint256 assets) external; + function setLiquidityAdapterAndData(address newLiquidityAdapter, bytes memory newLiquidityData) external; + + // Exchange rate + function accrueInterest() external; + function accrueInterestView() + external + view + returns (uint256 newTotalAssets, uint256 performanceFeeShares, uint256 managementFeeShares); + + // Force deallocate + function forceDeallocate(address adapter, bytes memory data, uint256 assets, address onBehalf) + external + returns (uint256 penaltyShares); +} diff --git a/packages/blue-sdk-viem/hardhat.config.cjs b/packages/blue-sdk-viem/hardhat.config.cjs index 42f73e7b..9a02510c 100644 --- a/packages/blue-sdk-viem/hardhat.config.cjs +++ b/packages/blue-sdk-viem/hardhat.config.cjs @@ -15,8 +15,13 @@ subtask(TASK_COMPILE_SOLIDITY_EMIT_ARTIFACTS).setAction( async ([sourceName, contract]) => { if (sourceName.includes("interfaces")) return; - const source = parse(sourceName).name; - const path = join("src", "queries", `${source}.ts`); + const parsed = parse(sourceName); + const source = parsed.name; + const path = join( + "src", + parsed.dir.replaceAll("contracts", "queries"), + `${source}.ts`, + ); const dir = dirname(path); if (!existsSync(dir)) mkdirSync(dir, { recursive: true }); diff --git a/packages/blue-sdk-viem/package.json b/packages/blue-sdk-viem/package.json index 975a91ad..121781fa 100644 --- a/packages/blue-sdk-viem/package.json +++ b/packages/blue-sdk-viem/package.json @@ -30,7 +30,7 @@ "@morpho-org/test": "workspace:^", "hardhat": "^2.22.18", "typescript": "^5.7.2", - "viem": "^2.23.0", + "viem": "^2.33.3", "vitest": "^3.0.5" }, "publishConfig": { diff --git a/packages/blue-sdk-viem/src/abis.ts b/packages/blue-sdk-viem/src/abis.ts index d2af800d..ef9b8e77 100644 --- a/packages/blue-sdk-viem/src/abis.ts +++ b/packages/blue-sdk-viem/src/abis.ts @@ -8275,2993 +8275,3721 @@ export const preLiquidationAbi = [ { type: "error", name: "PreLltvTooHigh", inputs: [] }, ] as const; -export const vaultV2FactoryAbi = [ +export const vaultV2Abi = [ { - anonymous: false, + type: "constructor", inputs: [ { - indexed: true, - internalType: "address", - name: "owner", + name: "_owner", type: "address", + internalType: "address", }, { - indexed: true, - internalType: "address", - name: "asset", + name: "_asset", type: "address", + internalType: "address", }, + ], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "DOMAIN_SEPARATOR", + inputs: [], + outputs: [ { - indexed: false, - internalType: "bytes32", - name: "salt", + name: "", type: "bytes32", + internalType: "bytes32", }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "_totalAssets", + inputs: [], + outputs: [ { - indexed: true, - internalType: "address", - name: "newVaultV2", - type: "address", + name: "", + type: "uint128", + internalType: "uint128", }, ], - name: "CreateVaultV2", - type: "event", + stateMutability: "view", }, { + type: "function", + name: "abdicate", inputs: [ - { internalType: "address", name: "owner", type: "address" }, - { internalType: "address", name: "asset", type: "address" }, - { internalType: "bytes32", name: "salt", type: "bytes32" }, + { + name: "selector", + type: "bytes4", + internalType: "bytes4", + }, ], - name: "createVaultV2", - outputs: [{ internalType: "address", name: "", type: "address" }], + outputs: [], stateMutability: "nonpayable", - type: "function", }, { - inputs: [{ internalType: "address", name: "account", type: "address" }], - name: "isVaultV2", - outputs: [{ internalType: "bool", name: "", type: "bool" }], - stateMutability: "view", type: "function", - }, - { + name: "abdicated", inputs: [ - { internalType: "address", name: "owner", type: "address" }, - { internalType: "address", name: "asset", type: "address" }, - { internalType: "bytes32", name: "salt", type: "bytes32" }, + { + name: "selector", + type: "bytes4", + internalType: "bytes4", + }, + ], + outputs: [ + { + name: "", + type: "bool", + internalType: "bool", + }, ], - name: "vaultV2", - outputs: [{ internalType: "address", name: "", type: "address" }], stateMutability: "view", - type: "function", }, -] as const; - -export const vaultV2Abi = [ { + type: "function", + name: "absoluteCap", inputs: [ { - internalType: "address", - name: "_owner", - type: "address", + name: "id", + type: "bytes32", + internalType: "bytes32", }, + ], + outputs: [ { - internalType: "address", - name: "_asset", - type: "address", + name: "", + type: "uint256", + internalType: "uint256", }, ], - stateMutability: "nonpayable", - type: "constructor", - }, - { - inputs: [], - name: "Abdicated", - type: "error", - }, - { - inputs: [], - name: "AbsoluteCapExceeded", - type: "error", - }, - { - inputs: [], - name: "AbsoluteCapNotDecreasing", - type: "error", - }, - { - inputs: [], - name: "AbsoluteCapNotIncreasing", - type: "error", + stateMutability: "view", }, { + type: "function", + name: "accrueInterest", inputs: [], - name: "AutomaticallyTimelocked", - type: "error", + outputs: [], + stateMutability: "nonpayable", }, { + type: "function", + name: "accrueInterestView", inputs: [], - name: "CannotReceiveAssets", - type: "error", + outputs: [ + { + name: "", + type: "uint256", + internalType: "uint256", + }, + { + name: "", + type: "uint256", + internalType: "uint256", + }, + { + name: "", + type: "uint256", + internalType: "uint256", + }, + ], + stateMutability: "view", }, { + type: "function", + name: "adapterRegistry", inputs: [], - name: "CannotReceiveShares", - type: "error", + outputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + ], + stateMutability: "view", }, { - inputs: [], - name: "CannotSendAssets", - type: "error", + type: "function", + name: "adapters", + inputs: [ + { + name: "", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + ], + stateMutability: "view", }, { + type: "function", + name: "adaptersLength", inputs: [], - name: "CannotSendShares", - type: "error", + outputs: [ + { + name: "", + type: "uint256", + internalType: "uint256", + }, + ], + stateMutability: "view", }, { - inputs: [], - name: "CastOverflow", - type: "error", + type: "function", + name: "addAdapter", + inputs: [ + { + name: "account", + type: "address", + internalType: "address", + }, + ], + outputs: [], + stateMutability: "nonpayable", }, { - inputs: [], - name: "DataAlreadyPending", - type: "error", + type: "function", + name: "allocate", + inputs: [ + { + name: "adapter", + type: "address", + internalType: "address", + }, + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + { + name: "assets", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [], + stateMutability: "nonpayable", }, { - inputs: [], - name: "DataNotTimelocked", - type: "error", + type: "function", + name: "allocation", + inputs: [ + { + name: "id", + type: "bytes32", + internalType: "bytes32", + }, + ], + outputs: [ + { + name: "", + type: "uint256", + internalType: "uint256", + }, + ], + stateMutability: "view", }, { - inputs: [], - name: "FeeInvariantBroken", - type: "error", - }, - { - inputs: [], - name: "FeeTooHigh", - type: "error", - }, - { - inputs: [], - name: "InvalidSigner", - type: "error", - }, - { - inputs: [], - name: "MaxRateTooHigh", - type: "error", - }, - { - inputs: [], - name: "NoCode", - type: "error", - }, - { - inputs: [], - name: "NotAdapter", - type: "error", - }, - { - inputs: [], - name: "NotInAdapterRegistry", - type: "error", - }, - { - inputs: [], - name: "PenaltyTooHigh", - type: "error", - }, - { - inputs: [], - name: "PermitDeadlineExpired", - type: "error", - }, - { - inputs: [], - name: "RelativeCapAboveOne", - type: "error", - }, - { - inputs: [], - name: "RelativeCapExceeded", - type: "error", - }, - { - inputs: [], - name: "RelativeCapNotDecreasing", - type: "error", - }, - { - inputs: [], - name: "RelativeCapNotIncreasing", - type: "error", - }, - { - inputs: [], - name: "TimelockNotDecreasing", - type: "error", - }, - { - inputs: [], - name: "TimelockNotExpired", - type: "error", - }, - { - inputs: [], - name: "TimelockNotIncreasing", - type: "error", - }, - { - inputs: [], - name: "TransferFromReturnedFalse", - type: "error", - }, - { - inputs: [], - name: "TransferFromReverted", - type: "error", - }, - { - inputs: [], - name: "TransferReturnedFalse", - type: "error", - }, - { - inputs: [], - name: "TransferReverted", - type: "error", - }, - { - inputs: [], - name: "Unauthorized", - type: "error", - }, - { - inputs: [], - name: "ZeroAbsoluteCap", - type: "error", - }, - { - inputs: [], - name: "ZeroAddress", - type: "error", - }, - { - inputs: [], - name: "ZeroAllocation", - type: "error", - }, - { - anonymous: false, + type: "function", + name: "allowance", inputs: [ { - indexed: true, - internalType: "bytes4", - name: "selector", - type: "bytes4", + name: "owner", + type: "address", + internalType: "address", }, - ], - name: "Abdicate", - type: "event", - }, - { - anonymous: false, - inputs: [ { - indexed: true, - internalType: "bytes4", - name: "selector", - type: "bytes4", + name: "spender", + type: "address", + internalType: "address", }, + ], + outputs: [ { - indexed: false, - internalType: "bytes", - name: "data", - type: "bytes", + name: "", + type: "uint256", + internalType: "uint256", }, ], - name: "Accept", - type: "event", + stateMutability: "view", }, { - anonymous: false, + type: "function", + name: "approve", inputs: [ { - indexed: false, - internalType: "uint256", - name: "previousTotalAssets", - type: "uint256", + name: "spender", + type: "address", + internalType: "address", }, { - indexed: false, - internalType: "uint256", - name: "newTotalAssets", + name: "shares", type: "uint256", - }, - { - indexed: false, internalType: "uint256", - name: "performanceFeeShares", - type: "uint256", }, + ], + outputs: [ { - indexed: false, - internalType: "uint256", - name: "managementFeeShares", - type: "uint256", + name: "", + type: "bool", + internalType: "bool", }, ], - name: "AccrueInterest", - type: "event", + stateMutability: "nonpayable", }, { - anonymous: false, - inputs: [ + type: "function", + name: "asset", + inputs: [], + outputs: [ { - indexed: true, - internalType: "address", - name: "account", + name: "", type: "address", + internalType: "address", }, ], - name: "AddAdapter", - type: "event", + stateMutability: "view", }, { - anonymous: false, + type: "function", + name: "balanceOf", inputs: [ { - indexed: true, - internalType: "address", - name: "sender", + name: "account", type: "address", - }, - { - indexed: true, internalType: "address", - name: "adapter", - type: "address", }, + ], + outputs: [ { - indexed: false, - internalType: "uint256", - name: "assets", + name: "", type: "uint256", + internalType: "uint256", }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "canReceiveAssets", + inputs: [ { - indexed: false, - internalType: "bytes32[]", - name: "ids", - type: "bytes32[]", + name: "account", + type: "address", + internalType: "address", }, + ], + outputs: [ { - indexed: false, - internalType: "int256", - name: "change", - type: "int256", + name: "", + type: "bool", + internalType: "bool", }, ], - name: "Allocate", - type: "event", + stateMutability: "view", }, { - anonymous: false, + type: "function", + name: "canReceiveShares", inputs: [ { - indexed: true, - internalType: "address", - name: "owner", + name: "account", type: "address", - }, - { - indexed: true, internalType: "address", - name: "spender", - type: "address", }, + ], + outputs: [ { - indexed: false, - internalType: "uint256", - name: "shares", - type: "uint256", + name: "", + type: "bool", + internalType: "bool", }, ], - name: "AllowanceUpdatedByTransferFrom", - type: "event", + stateMutability: "view", }, { - anonymous: false, + type: "function", + name: "canSendAssets", inputs: [ { - indexed: true, - internalType: "address", - name: "owner", + name: "account", type: "address", - }, - { - indexed: true, internalType: "address", - name: "spender", - type: "address", }, + ], + outputs: [ { - indexed: false, - internalType: "uint256", - name: "shares", - type: "uint256", + name: "", + type: "bool", + internalType: "bool", }, ], - name: "Approval", - type: "event", + stateMutability: "view", }, { - anonymous: false, + type: "function", + name: "canSendShares", inputs: [ { - indexed: true, - internalType: "address", - name: "owner", + name: "account", type: "address", + internalType: "address", }, + ], + outputs: [ { - indexed: true, - internalType: "address", - name: "asset", - type: "address", + name: "", + type: "bool", + internalType: "bool", }, ], - name: "Constructor", - type: "event", + stateMutability: "view", }, { - anonymous: false, + type: "function", + name: "convertToAssets", inputs: [ { - indexed: true, - internalType: "address", - name: "sender", - type: "address", + name: "shares", + type: "uint256", + internalType: "uint256", }, + ], + outputs: [ { - indexed: true, - internalType: "address", - name: "adapter", - type: "address", + name: "", + type: "uint256", + internalType: "uint256", }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "convertToShares", + inputs: [ { - indexed: false, - internalType: "uint256", name: "assets", type: "uint256", + internalType: "uint256", }, + ], + outputs: [ { - indexed: false, - internalType: "bytes32[]", - name: "ids", - type: "bytes32[]", + name: "", + type: "uint256", + internalType: "uint256", }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "curator", + inputs: [], + outputs: [ { - indexed: false, - internalType: "int256", - name: "change", - type: "int256", + name: "", + type: "address", + internalType: "address", }, ], - name: "Deallocate", - type: "event", + stateMutability: "view", }, { - anonymous: false, + type: "function", + name: "deallocate", inputs: [ { - indexed: true, - internalType: "address", - name: "sender", + name: "adapter", type: "address", + internalType: "address", }, { - indexed: true, - internalType: "bytes32", - name: "id", - type: "bytes32", - }, - { - indexed: false, - internalType: "bytes", - name: "idData", + name: "data", type: "bytes", + internalType: "bytes", }, { - indexed: false, - internalType: "uint256", - name: "newAbsoluteCap", + name: "assets", type: "uint256", + internalType: "uint256", }, ], - name: "DecreaseAbsoluteCap", - type: "event", + outputs: [], + stateMutability: "nonpayable", }, { - anonymous: false, + type: "function", + name: "decimals", + inputs: [], + outputs: [ + { + name: "", + type: "uint8", + internalType: "uint8", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "decreaseAbsoluteCap", inputs: [ { - indexed: true, - internalType: "address", - name: "sender", - type: "address", + name: "idData", + type: "bytes", + internalType: "bytes", }, { - indexed: true, - internalType: "bytes32", - name: "id", - type: "bytes32", + name: "newAbsoluteCap", + type: "uint256", + internalType: "uint256", }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "decreaseRelativeCap", + inputs: [ { - indexed: false, - internalType: "bytes", name: "idData", type: "bytes", + internalType: "bytes", }, { - indexed: false, - internalType: "uint256", name: "newRelativeCap", type: "uint256", + internalType: "uint256", }, ], - name: "DecreaseRelativeCap", - type: "event", + outputs: [], + stateMutability: "nonpayable", }, { - anonymous: false, + type: "function", + name: "decreaseTimelock", inputs: [ { - indexed: true, - internalType: "bytes4", name: "selector", type: "bytes4", + internalType: "bytes4", }, { - indexed: false, - internalType: "uint256", name: "newDuration", type: "uint256", + internalType: "uint256", }, ], - name: "DecreaseTimelock", - type: "event", + outputs: [], + stateMutability: "nonpayable", }, { - anonymous: false, + type: "function", + name: "deposit", inputs: [ { - indexed: true, - internalType: "address", - name: "sender", - type: "address", + name: "assets", + type: "uint256", + internalType: "uint256", }, { - indexed: true, - internalType: "address", name: "onBehalf", type: "address", + internalType: "address", }, + ], + outputs: [ { - indexed: false, - internalType: "uint256", - name: "assets", + name: "", type: "uint256", - }, - { - indexed: false, internalType: "uint256", - name: "shares", - type: "uint256", }, ], - name: "Deposit", - type: "event", + stateMutability: "nonpayable", }, { - anonymous: false, + type: "function", + name: "executableAt", inputs: [ { - indexed: true, - internalType: "address", - name: "sender", - type: "address", - }, - { - indexed: false, - internalType: "address", - name: "adapter", - type: "address", + name: "data", + type: "bytes", + internalType: "bytes", }, + ], + outputs: [ { - indexed: false, - internalType: "uint256", - name: "assets", - type: "uint256", - }, - { - indexed: true, - internalType: "address", - name: "onBehalf", - type: "address", - }, - { - indexed: false, - internalType: "bytes32[]", - name: "ids", - type: "bytes32[]", - }, - { - indexed: false, - internalType: "uint256", - name: "penaltyAssets", + name: "", type: "uint256", + internalType: "uint256", }, ], - name: "ForceDeallocate", - type: "event", + stateMutability: "view", }, { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "bytes32", - name: "id", - type: "bytes32", - }, - { - indexed: false, - internalType: "bytes", - name: "idData", - type: "bytes", - }, + type: "function", + name: "firstTotalAssets", + inputs: [], + outputs: [ { - indexed: false, - internalType: "uint256", - name: "newAbsoluteCap", + name: "", type: "uint256", + internalType: "uint256", }, ], - name: "IncreaseAbsoluteCap", - type: "event", + stateMutability: "view", }, { - anonymous: false, + type: "function", + name: "forceDeallocate", inputs: [ { - indexed: true, - internalType: "bytes32", - name: "id", - type: "bytes32", + name: "adapter", + type: "address", + internalType: "address", }, { - indexed: false, - internalType: "bytes", - name: "idData", + name: "data", type: "bytes", + internalType: "bytes", }, { - indexed: false, - internalType: "uint256", - name: "newRelativeCap", + name: "assets", type: "uint256", + internalType: "uint256", }, - ], - name: "IncreaseRelativeCap", - type: "event", - }, - { - anonymous: false, - inputs: [ { - indexed: true, - internalType: "bytes4", - name: "selector", - type: "bytes4", + name: "onBehalf", + type: "address", + internalType: "address", }, + ], + outputs: [ { - indexed: false, - internalType: "uint256", - name: "newDuration", + name: "", type: "uint256", + internalType: "uint256", }, ], - name: "IncreaseTimelock", - type: "event", + stateMutability: "nonpayable", }, { - anonymous: false, + type: "function", + name: "forceDeallocatePenalty", inputs: [ { - indexed: true, - internalType: "address", - name: "owner", + name: "adapter", type: "address", - }, - { - indexed: true, internalType: "address", - name: "spender", - type: "address", }, + ], + outputs: [ { - indexed: false, - internalType: "uint256", - name: "shares", + name: "", type: "uint256", + internalType: "uint256", }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "increaseAbsoluteCap", + inputs: [ { - indexed: false, - internalType: "uint256", - name: "nonce", - type: "uint256", + name: "idData", + type: "bytes", + internalType: "bytes", }, { - indexed: false, - internalType: "uint256", - name: "deadline", + name: "newAbsoluteCap", type: "uint256", + internalType: "uint256", }, ], - name: "Permit", - type: "event", + outputs: [], + stateMutability: "nonpayable", }, { - anonymous: false, + type: "function", + name: "increaseRelativeCap", inputs: [ { - indexed: true, - internalType: "address", - name: "account", - type: "address", + name: "idData", + type: "bytes", + internalType: "bytes", + }, + { + name: "newRelativeCap", + type: "uint256", + internalType: "uint256", }, ], - name: "RemoveAdapter", - type: "event", + outputs: [], + stateMutability: "nonpayable", }, { - anonymous: false, + type: "function", + name: "increaseTimelock", inputs: [ { - indexed: true, - internalType: "address", - name: "sender", - type: "address", - }, - { - indexed: true, - internalType: "bytes4", name: "selector", type: "bytes4", + internalType: "bytes4", }, { - indexed: false, - internalType: "bytes", - name: "data", - type: "bytes", + name: "newDuration", + type: "uint256", + internalType: "uint256", }, ], - name: "Revoke", - type: "event", + outputs: [], + stateMutability: "nonpayable", }, { - anonymous: false, + type: "function", + name: "isAdapter", inputs: [ { - indexed: true, - internalType: "address", - name: "newAdapterRegistry", + name: "account", type: "address", + internalType: "address", }, ], - name: "SetAdapterRegistry", - type: "event", - }, - { - anonymous: false, - inputs: [ + outputs: [ { - indexed: true, - internalType: "address", - name: "newCurator", - type: "address", + name: "", + type: "bool", + internalType: "bool", }, ], - name: "SetCurator", - type: "event", + stateMutability: "view", }, { - anonymous: false, + type: "function", + name: "isAllocator", inputs: [ { - indexed: true, - internalType: "address", - name: "adapter", + name: "account", type: "address", + internalType: "address", }, + ], + outputs: [ { - indexed: false, - internalType: "uint256", - name: "forceDeallocatePenalty", - type: "uint256", + name: "", + type: "bool", + internalType: "bool", }, ], - name: "SetForceDeallocatePenalty", - type: "event", + stateMutability: "view", }, { - anonymous: false, + type: "function", + name: "isSentinel", inputs: [ { - indexed: true, - internalType: "address", name: "account", type: "address", + internalType: "address", }, + ], + outputs: [ { - indexed: false, - internalType: "bool", - name: "newIsAllocator", + name: "", type: "bool", + internalType: "bool", }, ], - name: "SetIsAllocator", - type: "event", + stateMutability: "view", }, { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "account", - type: "address", - }, + type: "function", + name: "lastUpdate", + inputs: [], + outputs: [ { - indexed: false, - internalType: "bool", - name: "newIsSentinel", - type: "bool", + name: "", + type: "uint64", + internalType: "uint64", }, ], - name: "SetIsSentinel", - type: "event", + stateMutability: "view", }, { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "sender", - type: "address", - }, + type: "function", + name: "liquidityAdapter", + inputs: [], + outputs: [ { - indexed: true, - internalType: "address", - name: "newLiquidityAdapter", + name: "", type: "address", + internalType: "address", }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "liquidityData", + inputs: [], + outputs: [ { - indexed: true, - internalType: "bytes", - name: "newLiquidityData", + name: "", type: "bytes", + internalType: "bytes", }, ], - name: "SetLiquidityAdapterAndData", - type: "event", + stateMutability: "view", }, { - anonymous: false, - inputs: [ + type: "function", + name: "managementFee", + inputs: [], + outputs: [ { - indexed: false, - internalType: "uint256", - name: "newManagementFee", - type: "uint256", + name: "", + type: "uint96", + internalType: "uint96", }, ], - name: "SetManagementFee", - type: "event", + stateMutability: "view", }, { - anonymous: false, - inputs: [ + type: "function", + name: "managementFeeRecipient", + inputs: [], + outputs: [ { - indexed: true, - internalType: "address", - name: "newManagementFeeRecipient", + name: "", type: "address", + internalType: "address", }, ], - name: "SetManagementFeeRecipient", - type: "event", + stateMutability: "view", }, { - anonymous: false, + type: "function", + name: "maxDeposit", inputs: [ { - indexed: false, - internalType: "uint256", - name: "newMaxRate", - type: "uint256", + name: "", + type: "address", + internalType: "address", }, ], - name: "SetMaxRate", - type: "event", - }, - { - anonymous: false, - inputs: [ + outputs: [ { - indexed: false, - internalType: "string", - name: "newName", - type: "string", + name: "", + type: "uint256", + internalType: "uint256", }, ], - name: "SetName", - type: "event", + stateMutability: "pure", }, { - anonymous: false, + type: "function", + name: "maxMint", inputs: [ { - indexed: true, - internalType: "address", - name: "newOwner", + name: "", type: "address", + internalType: "address", }, ], - name: "SetOwner", - type: "event", - }, - { - anonymous: false, - inputs: [ + outputs: [ { - indexed: false, - internalType: "uint256", - name: "newPerformanceFee", + name: "", type: "uint256", + internalType: "uint256", }, ], - name: "SetPerformanceFee", - type: "event", + stateMutability: "pure", }, { - anonymous: false, - inputs: [ + type: "function", + name: "maxRate", + inputs: [], + outputs: [ { - indexed: true, - internalType: "address", - name: "newPerformanceFeeRecipient", - type: "address", + name: "", + type: "uint64", + internalType: "uint64", }, ], - name: "SetPerformanceFeeRecipient", - type: "event", + stateMutability: "view", }, { - anonymous: false, + type: "function", + name: "maxRedeem", inputs: [ { - indexed: true, - internalType: "address", - name: "newReceiveAssetsGate", + name: "", type: "address", + internalType: "address", }, ], - name: "SetReceiveAssetsGate", - type: "event", - }, - { - anonymous: false, - inputs: [ + outputs: [ { - indexed: true, - internalType: "address", - name: "newReceiveSharesGate", - type: "address", + name: "", + type: "uint256", + internalType: "uint256", }, ], - name: "SetReceiveSharesGate", - type: "event", + stateMutability: "pure", }, { - anonymous: false, + type: "function", + name: "maxWithdraw", inputs: [ { - indexed: true, - internalType: "address", - name: "newSendAssetsGate", + name: "", type: "address", + internalType: "address", }, ], - name: "SetSendAssetsGate", - type: "event", + outputs: [ + { + name: "", + type: "uint256", + internalType: "uint256", + }, + ], + stateMutability: "pure", }, { - anonymous: false, + type: "function", + name: "mint", inputs: [ { - indexed: true, - internalType: "address", - name: "newSendSharesGate", + name: "shares", + type: "uint256", + internalType: "uint256", + }, + { + name: "onBehalf", type: "address", + internalType: "address", }, ], - name: "SetSendSharesGate", - type: "event", - }, - { - anonymous: false, - inputs: [ + outputs: [ { - indexed: false, - internalType: "string", - name: "newSymbol", - type: "string", + name: "", + type: "uint256", + internalType: "uint256", }, ], - name: "SetSymbol", - type: "event", + stateMutability: "nonpayable", }, { - anonymous: false, + type: "function", + name: "multicall", inputs: [ { - indexed: true, - internalType: "bytes4", - name: "selector", - type: "bytes4", - }, - { - indexed: false, - internalType: "bytes", name: "data", - type: "bytes", + type: "bytes[]", + internalType: "bytes[]", }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "name", + inputs: [], + outputs: [ { - indexed: false, - internalType: "uint256", - name: "executableAt", - type: "uint256", + name: "", + type: "string", + internalType: "string", }, ], - name: "Submit", - type: "event", + stateMutability: "view", }, { - anonymous: false, + type: "function", + name: "nonces", inputs: [ { - indexed: true, - internalType: "address", - name: "from", + name: "account", type: "address", - }, - { - indexed: true, internalType: "address", - name: "to", - type: "address", }, + ], + outputs: [ { - indexed: false, - internalType: "uint256", - name: "shares", + name: "", type: "uint256", + internalType: "uint256", }, ], - name: "Transfer", - type: "event", + stateMutability: "view", }, { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "sender", - type: "address", - }, + type: "function", + name: "owner", + inputs: [], + outputs: [ { - indexed: true, - internalType: "address", - name: "receiver", + name: "", type: "address", - }, - { - indexed: true, internalType: "address", - name: "onBehalf", - type: "address", - }, - { - indexed: false, - internalType: "uint256", - name: "assets", - type: "uint256", - }, - { - indexed: false, - internalType: "uint256", - name: "shares", - type: "uint256", }, ], - name: "Withdraw", - type: "event", + stateMutability: "view", }, { + type: "function", + name: "performanceFee", inputs: [], - name: "DOMAIN_SEPARATOR", outputs: [ { - internalType: "bytes32", name: "", - type: "bytes32", + type: "uint96", + internalType: "uint96", }, ], stateMutability: "view", - type: "function", }, { + type: "function", + name: "performanceFeeRecipient", inputs: [], - name: "_totalAssets", outputs: [ { - internalType: "uint128", name: "", - type: "uint128", + type: "address", + internalType: "address", }, ], stateMutability: "view", - type: "function", }, { + type: "function", + name: "permit", inputs: [ { - internalType: "bytes4", - name: "selector", - type: "bytes4", + name: "_owner", + type: "address", + internalType: "address", + }, + { + name: "spender", + type: "address", + internalType: "address", + }, + { + name: "shares", + type: "uint256", + internalType: "uint256", + }, + { + name: "deadline", + type: "uint256", + internalType: "uint256", + }, + { + name: "v", + type: "uint8", + internalType: "uint8", + }, + { + name: "r", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "s", + type: "bytes32", + internalType: "bytes32", }, ], - name: "abdicate", outputs: [], stateMutability: "nonpayable", - type: "function", }, { + type: "function", + name: "previewDeposit", inputs: [ { - internalType: "bytes4", - name: "selector", - type: "bytes4", + name: "assets", + type: "uint256", + internalType: "uint256", }, ], - name: "abdicated", outputs: [ { - internalType: "bool", name: "", - type: "bool", + type: "uint256", + internalType: "uint256", }, ], stateMutability: "view", - type: "function", }, { + type: "function", + name: "previewMint", inputs: [ { - internalType: "bytes32", - name: "id", - type: "bytes32", + name: "shares", + type: "uint256", + internalType: "uint256", }, ], - name: "absoluteCap", outputs: [ { - internalType: "uint256", name: "", type: "uint256", + internalType: "uint256", }, ], stateMutability: "view", - type: "function", }, { - inputs: [], - name: "accrueInterest", - outputs: [], - stateMutability: "nonpayable", type: "function", - }, - { - inputs: [], - name: "accrueInterestView", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, + name: "previewRedeem", + inputs: [ { - internalType: "uint256", - name: "", + name: "shares", type: "uint256", - }, - { internalType: "uint256", - name: "", - type: "uint256", }, ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "adapterRegistry", outputs: [ { - internalType: "address", name: "", - type: "address", + type: "uint256", + internalType: "uint256", }, ], stateMutability: "view", - type: "function", }, { + type: "function", + name: "previewWithdraw", inputs: [ { - internalType: "uint256", - name: "", + name: "assets", type: "uint256", + internalType: "uint256", }, ], - name: "adapters", outputs: [ { - internalType: "address", name: "", - type: "address", + type: "uint256", + internalType: "uint256", }, ], stateMutability: "view", - type: "function", }, { + type: "function", + name: "receiveAssetsGate", inputs: [], - name: "adaptersLength", outputs: [ { - internalType: "uint256", name: "", - type: "uint256", + type: "address", + internalType: "address", }, ], stateMutability: "view", - type: "function", }, { - inputs: [ + type: "function", + name: "receiveSharesGate", + inputs: [], + outputs: [ { - internalType: "address", - name: "account", + name: "", type: "address", + internalType: "address", }, ], - name: "addAdapter", - outputs: [], - stateMutability: "nonpayable", - type: "function", + stateMutability: "view", }, { + type: "function", + name: "redeem", inputs: [ { - internalType: "address", - name: "adapter", + name: "shares", + type: "uint256", + internalType: "uint256", + }, + { + name: "receiver", type: "address", + internalType: "address", }, { - internalType: "bytes", - name: "data", - type: "bytes", + name: "onBehalf", + type: "address", + internalType: "address", }, + ], + outputs: [ { - internalType: "uint256", - name: "assets", + name: "", type: "uint256", + internalType: "uint256", }, ], - name: "allocate", - outputs: [], stateMutability: "nonpayable", - type: "function", }, { + type: "function", + name: "relativeCap", inputs: [ { - internalType: "bytes32", name: "id", type: "bytes32", + internalType: "bytes32", }, ], - name: "allocation", outputs: [ { - internalType: "uint256", name: "", type: "uint256", + internalType: "uint256", }, ], stateMutability: "view", - type: "function", }, { + type: "function", + name: "removeAdapter", inputs: [ { - internalType: "address", - name: "owner", + name: "account", type: "address", + internalType: "address", }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "revoke", + inputs: [ { - internalType: "address", - name: "spender", - type: "address", + name: "data", + type: "bytes", + internalType: "bytes", }, ], - name: "allowance", + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "sendAssetsGate", + inputs: [], outputs: [ { - internalType: "uint256", name: "", - type: "uint256", + type: "address", + internalType: "address", }, ], stateMutability: "view", - type: "function", }, { - inputs: [ + type: "function", + name: "sendSharesGate", + inputs: [], + outputs: [ { - internalType: "address", - name: "spender", - type: "address", - }, - { - internalType: "uint256", - name: "shares", - type: "uint256", - }, - ], - name: "approve", - outputs: [ - { - internalType: "bool", name: "", - type: "bool", + type: "address", + internalType: "address", }, ], - stateMutability: "nonpayable", - type: "function", + stateMutability: "view", }, { - inputs: [], - name: "asset", - outputs: [ + type: "function", + name: "setAdapterRegistry", + inputs: [ { - internalType: "address", - name: "", + name: "newAdapterRegistry", type: "address", + internalType: "address", }, ], - stateMutability: "view", - type: "function", + outputs: [], + stateMutability: "nonpayable", }, { + type: "function", + name: "setCurator", inputs: [ { - internalType: "address", - name: "account", + name: "newCurator", type: "address", + internalType: "address", }, ], - name: "balanceOf", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", + outputs: [], + stateMutability: "nonpayable", }, { + type: "function", + name: "setForceDeallocatePenalty", inputs: [ { - internalType: "address", - name: "account", + name: "adapter", type: "address", + internalType: "address", }, - ], - name: "canReceiveAssets", - outputs: [ { - internalType: "bool", - name: "", - type: "bool", + name: "newForceDeallocatePenalty", + type: "uint256", + internalType: "uint256", }, ], - stateMutability: "view", - type: "function", + outputs: [], + stateMutability: "nonpayable", }, { + type: "function", + name: "setIsAllocator", inputs: [ { - internalType: "address", name: "account", type: "address", + internalType: "address", }, - ], - name: "canReceiveShares", - outputs: [ { - internalType: "bool", - name: "", + name: "newIsAllocator", type: "bool", + internalType: "bool", }, ], - stateMutability: "view", - type: "function", + outputs: [], + stateMutability: "nonpayable", }, { + type: "function", + name: "setIsSentinel", inputs: [ { - internalType: "address", name: "account", type: "address", + internalType: "address", }, - ], - name: "canSendAssets", - outputs: [ { - internalType: "bool", - name: "", + name: "newIsSentinel", type: "bool", + internalType: "bool", }, ], - stateMutability: "view", - type: "function", + outputs: [], + stateMutability: "nonpayable", }, { + type: "function", + name: "setLiquidityAdapterAndData", inputs: [ { - internalType: "address", - name: "account", + name: "newLiquidityAdapter", type: "address", + internalType: "address", }, - ], - name: "canSendShares", - outputs: [ { - internalType: "bool", - name: "", - type: "bool", + name: "newLiquidityData", + type: "bytes", + internalType: "bytes", }, ], - stateMutability: "view", - type: "function", + outputs: [], + stateMutability: "nonpayable", }, { + type: "function", + name: "setManagementFee", inputs: [ { - internalType: "uint256", - name: "shares", + name: "newManagementFee", type: "uint256", - }, - ], - name: "convertToAssets", - outputs: [ - { internalType: "uint256", - name: "", - type: "uint256", }, ], - stateMutability: "view", - type: "function", + outputs: [], + stateMutability: "nonpayable", }, { + type: "function", + name: "setManagementFeeRecipient", inputs: [ { - internalType: "uint256", - name: "assets", - type: "uint256", + name: "newManagementFeeRecipient", + type: "address", + internalType: "address", }, ], - name: "convertToShares", - outputs: [ + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "setMaxRate", + inputs: [ { - internalType: "uint256", - name: "", + name: "newMaxRate", type: "uint256", + internalType: "uint256", }, ], - stateMutability: "view", - type: "function", + outputs: [], + stateMutability: "nonpayable", }, { - inputs: [], - name: "curator", - outputs: [ + type: "function", + name: "setName", + inputs: [ { - internalType: "address", - name: "", - type: "address", + name: "newName", + type: "string", + internalType: "string", }, ], - stateMutability: "view", - type: "function", + outputs: [], + stateMutability: "nonpayable", }, { + type: "function", + name: "setOwner", inputs: [ { - internalType: "address", - name: "adapter", + name: "newOwner", type: "address", - }, - { - internalType: "bytes", - name: "data", - type: "bytes", - }, - { - internalType: "uint256", - name: "assets", - type: "uint256", + internalType: "address", }, ], - name: "deallocate", outputs: [], stateMutability: "nonpayable", - type: "function", }, { - inputs: [], - name: "decimals", - outputs: [ + type: "function", + name: "setPerformanceFee", + inputs: [ { - internalType: "uint8", - name: "", - type: "uint8", + name: "newPerformanceFee", + type: "uint256", + internalType: "uint256", }, ], - stateMutability: "view", - type: "function", + outputs: [], + stateMutability: "nonpayable", }, { + type: "function", + name: "setPerformanceFeeRecipient", inputs: [ { - internalType: "bytes", - name: "idData", - type: "bytes", - }, - { - internalType: "uint256", - name: "newAbsoluteCap", - type: "uint256", + name: "newPerformanceFeeRecipient", + type: "address", + internalType: "address", }, ], - name: "decreaseAbsoluteCap", outputs: [], stateMutability: "nonpayable", - type: "function", }, { + type: "function", + name: "setReceiveAssetsGate", inputs: [ { - internalType: "bytes", - name: "idData", - type: "bytes", - }, - { - internalType: "uint256", - name: "newRelativeCap", - type: "uint256", + name: "newReceiveAssetsGate", + type: "address", + internalType: "address", }, ], - name: "decreaseRelativeCap", outputs: [], stateMutability: "nonpayable", - type: "function", }, { + type: "function", + name: "setReceiveSharesGate", inputs: [ { - internalType: "bytes4", - name: "selector", - type: "bytes4", - }, - { - internalType: "uint256", - name: "newDuration", - type: "uint256", + name: "newReceiveSharesGate", + type: "address", + internalType: "address", }, ], - name: "decreaseTimelock", outputs: [], stateMutability: "nonpayable", - type: "function", }, { + type: "function", + name: "setSendAssetsGate", inputs: [ { - internalType: "uint256", - name: "assets", - type: "uint256", + name: "newSendAssetsGate", + type: "address", + internalType: "address", }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "setSendSharesGate", + inputs: [ { - internalType: "address", - name: "onBehalf", + name: "newSendSharesGate", type: "address", + internalType: "address", }, ], - name: "deposit", - outputs: [ + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "setSymbol", + inputs: [ { - internalType: "uint256", - name: "", - type: "uint256", + name: "newSymbol", + type: "string", + internalType: "string", }, ], + outputs: [], stateMutability: "nonpayable", - type: "function", }, { + type: "function", + name: "submit", inputs: [ { - internalType: "bytes", name: "data", type: "bytes", + internalType: "bytes", }, ], - name: "executableAt", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", + outputs: [], + stateMutability: "nonpayable", }, { + type: "function", + name: "symbol", inputs: [], - name: "firstTotalAssets", outputs: [ { - internalType: "uint256", name: "", - type: "uint256", + type: "string", + internalType: "string", }, ], stateMutability: "view", - type: "function", }, { + type: "function", + name: "timelock", inputs: [ { - internalType: "address", - name: "adapter", - type: "address", - }, - { - internalType: "bytes", - name: "data", - type: "bytes", - }, - { - internalType: "uint256", - name: "assets", - type: "uint256", - }, - { - internalType: "address", - name: "onBehalf", - type: "address", + name: "selector", + type: "bytes4", + internalType: "bytes4", }, ], - name: "forceDeallocate", outputs: [ { - internalType: "uint256", name: "", type: "uint256", + internalType: "uint256", }, ], - stateMutability: "nonpayable", - type: "function", + stateMutability: "view", }, { - inputs: [ - { - internalType: "address", - name: "adapter", - type: "address", - }, - ], - name: "forceDeallocatePenalty", + type: "function", + name: "totalAssets", + inputs: [], outputs: [ { - internalType: "uint256", name: "", type: "uint256", + internalType: "uint256", }, ], stateMutability: "view", - type: "function", }, { - inputs: [ - { - internalType: "bytes", - name: "idData", - type: "bytes", - }, + type: "function", + name: "totalSupply", + inputs: [], + outputs: [ { - internalType: "uint256", - name: "newAbsoluteCap", + name: "", type: "uint256", + internalType: "uint256", }, ], - name: "increaseAbsoluteCap", - outputs: [], - stateMutability: "nonpayable", - type: "function", + stateMutability: "view", }, { + type: "function", + name: "transfer", inputs: [ { - internalType: "bytes", - name: "idData", - type: "bytes", + name: "to", + type: "address", + internalType: "address", }, { - internalType: "uint256", - name: "newRelativeCap", + name: "shares", type: "uint256", + internalType: "uint256", }, ], - name: "increaseRelativeCap", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "bytes4", - name: "selector", - type: "bytes4", - }, + outputs: [ { - internalType: "uint256", - name: "newDuration", - type: "uint256", + name: "", + type: "bool", + internalType: "bool", }, ], - name: "increaseTimelock", - outputs: [], stateMutability: "nonpayable", - type: "function", }, { + type: "function", + name: "transferFrom", inputs: [ { + name: "from", + type: "address", internalType: "address", - name: "account", + }, + { + name: "to", type: "address", + internalType: "address", + }, + { + name: "shares", + type: "uint256", + internalType: "uint256", }, ], - name: "isAdapter", outputs: [ { - internalType: "bool", name: "", type: "bool", + internalType: "bool", }, ], - stateMutability: "view", - type: "function", + stateMutability: "nonpayable", }, { - inputs: [ - { - internalType: "address", - name: "account", - type: "address", - }, - ], - name: "isAllocator", + type: "function", + name: "virtualShares", + inputs: [], outputs: [ { - internalType: "bool", name: "", - type: "bool", + type: "uint256", + internalType: "uint256", }, ], stateMutability: "view", - type: "function", }, { + type: "function", + name: "withdraw", inputs: [ { + name: "assets", + type: "uint256", + internalType: "uint256", + }, + { + name: "receiver", + type: "address", internalType: "address", - name: "account", + }, + { + name: "onBehalf", type: "address", + internalType: "address", }, ], - name: "isSentinel", outputs: [ { - internalType: "bool", name: "", - type: "bool", + type: "uint256", + internalType: "uint256", }, ], - stateMutability: "view", - type: "function", + stateMutability: "nonpayable", }, { - inputs: [], - name: "lastUpdate", - outputs: [ + type: "event", + name: "Abdicate", + inputs: [ { - internalType: "uint64", - name: "", - type: "uint64", + name: "selector", + type: "bytes4", + indexed: true, + internalType: "bytes4", }, ], - stateMutability: "view", - type: "function", + anonymous: false, }, { - inputs: [], - name: "liquidityAdapter", - outputs: [ + type: "event", + name: "Accept", + inputs: [ { - internalType: "address", - name: "", - type: "address", + name: "selector", + type: "bytes4", + indexed: true, + internalType: "bytes4", + }, + { + name: "data", + type: "bytes", + indexed: false, + internalType: "bytes", }, ], - stateMutability: "view", - type: "function", + anonymous: false, }, { - inputs: [], - name: "liquidityData", - outputs: [ + type: "event", + name: "AccrueInterest", + inputs: [ { - internalType: "bytes", - name: "", - type: "bytes", + name: "previousTotalAssets", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + { + name: "newTotalAssets", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + { + name: "performanceFeeShares", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + { + name: "managementFeeShares", + type: "uint256", + indexed: false, + internalType: "uint256", }, ], - stateMutability: "view", - type: "function", + anonymous: false, }, { - inputs: [], - name: "managementFee", - outputs: [ + type: "event", + name: "AddAdapter", + inputs: [ { - internalType: "uint96", - name: "", - type: "uint96", + name: "account", + type: "address", + indexed: true, + internalType: "address", }, ], - stateMutability: "view", - type: "function", + anonymous: false, }, { - inputs: [], - name: "managementFeeRecipient", - outputs: [ + type: "event", + name: "Allocate", + inputs: [ { + name: "sender", + type: "address", + indexed: true, internalType: "address", - name: "", + }, + { + name: "adapter", type: "address", + indexed: true, + internalType: "address", + }, + { + name: "assets", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + { + name: "ids", + type: "bytes32[]", + indexed: false, + internalType: "bytes32[]", + }, + { + name: "change", + type: "int256", + indexed: false, + internalType: "int256", }, ], - stateMutability: "view", - type: "function", + anonymous: false, }, { + type: "event", + name: "AllowanceUpdatedByTransferFrom", inputs: [ { + name: "owner", + type: "address", + indexed: true, internalType: "address", - name: "", + }, + { + name: "spender", type: "address", + indexed: true, + internalType: "address", }, - ], - name: "maxDeposit", - outputs: [ { - internalType: "uint256", - name: "", + name: "shares", type: "uint256", + indexed: false, + internalType: "uint256", }, ], - stateMutability: "pure", - type: "function", + anonymous: false, }, { + type: "event", + name: "Approval", inputs: [ { + name: "owner", + type: "address", + indexed: true, internalType: "address", - name: "", + }, + { + name: "spender", type: "address", + indexed: true, + internalType: "address", }, - ], - name: "maxMint", - outputs: [ { - internalType: "uint256", - name: "", + name: "shares", type: "uint256", + indexed: false, + internalType: "uint256", }, ], - stateMutability: "pure", - type: "function", + anonymous: false, }, { - inputs: [], - name: "maxRate", - outputs: [ + type: "event", + name: "Constructor", + inputs: [ { - internalType: "uint64", - name: "", - type: "uint64", + name: "owner", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "asset", + type: "address", + indexed: true, + internalType: "address", }, ], - stateMutability: "view", - type: "function", + anonymous: false, }, { + type: "event", + name: "Deallocate", inputs: [ { + name: "sender", + type: "address", + indexed: true, internalType: "address", - name: "", + }, + { + name: "adapter", type: "address", + indexed: true, + internalType: "address", }, - ], - name: "maxRedeem", - outputs: [ { - internalType: "uint256", - name: "", + name: "assets", type: "uint256", + indexed: false, + internalType: "uint256", + }, + { + name: "ids", + type: "bytes32[]", + indexed: false, + internalType: "bytes32[]", + }, + { + name: "change", + type: "int256", + indexed: false, + internalType: "int256", }, ], - stateMutability: "pure", - type: "function", + anonymous: false, }, { + type: "event", + name: "DecreaseAbsoluteCap", inputs: [ { - internalType: "address", - name: "", + name: "sender", type: "address", + indexed: true, + internalType: "address", }, - ], - name: "maxWithdraw", - outputs: [ { - internalType: "uint256", - name: "", + name: "id", + type: "bytes32", + indexed: true, + internalType: "bytes32", + }, + { + name: "idData", + type: "bytes", + indexed: false, + internalType: "bytes", + }, + { + name: "newAbsoluteCap", type: "uint256", + indexed: false, + internalType: "uint256", }, ], - stateMutability: "pure", - type: "function", + anonymous: false, }, { + type: "event", + name: "DecreaseRelativeCap", inputs: [ { - internalType: "uint256", - name: "shares", - type: "uint256", + name: "sender", + type: "address", + indexed: true, + internalType: "address", }, { - internalType: "address", - name: "onBehalf", - type: "address", + name: "id", + type: "bytes32", + indexed: true, + internalType: "bytes32", }, - ], - name: "mint", - outputs: [ { - internalType: "uint256", - name: "", + name: "idData", + type: "bytes", + indexed: false, + internalType: "bytes", + }, + { + name: "newRelativeCap", type: "uint256", + indexed: false, + internalType: "uint256", }, ], - stateMutability: "nonpayable", - type: "function", + anonymous: false, }, { + type: "event", + name: "DecreaseTimelock", inputs: [ { - internalType: "bytes[]", - name: "data", - type: "bytes[]", + name: "selector", + type: "bytes4", + indexed: true, + internalType: "bytes4", + }, + { + name: "newDuration", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "Deposit", + inputs: [ + { + name: "sender", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "onBehalf", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "assets", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + { + name: "shares", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "ForceDeallocate", + inputs: [ + { + name: "sender", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "adapter", + type: "address", + indexed: false, + internalType: "address", + }, + { + name: "assets", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + { + name: "onBehalf", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "ids", + type: "bytes32[]", + indexed: false, + internalType: "bytes32[]", + }, + { + name: "penaltyAssets", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "IncreaseAbsoluteCap", + inputs: [ + { + name: "id", + type: "bytes32", + indexed: true, + internalType: "bytes32", + }, + { + name: "idData", + type: "bytes", + indexed: false, + internalType: "bytes", + }, + { + name: "newAbsoluteCap", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "IncreaseRelativeCap", + inputs: [ + { + name: "id", + type: "bytes32", + indexed: true, + internalType: "bytes32", + }, + { + name: "idData", + type: "bytes", + indexed: false, + internalType: "bytes", + }, + { + name: "newRelativeCap", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "IncreaseTimelock", + inputs: [ + { + name: "selector", + type: "bytes4", + indexed: true, + internalType: "bytes4", + }, + { + name: "newDuration", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "Permit", + inputs: [ + { + name: "owner", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "spender", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "shares", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + { + name: "nonce", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + { + name: "deadline", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "RemoveAdapter", + inputs: [ + { + name: "account", + type: "address", + indexed: true, + internalType: "address", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "Revoke", + inputs: [ + { + name: "sender", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "selector", + type: "bytes4", + indexed: true, + internalType: "bytes4", + }, + { + name: "data", + type: "bytes", + indexed: false, + internalType: "bytes", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "SetAdapterRegistry", + inputs: [ + { + name: "newAdapterRegistry", + type: "address", + indexed: true, + internalType: "address", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "SetCurator", + inputs: [ + { + name: "newCurator", + type: "address", + indexed: true, + internalType: "address", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "SetForceDeallocatePenalty", + inputs: [ + { + name: "adapter", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "forceDeallocatePenalty", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "SetIsAllocator", + inputs: [ + { + name: "account", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "newIsAllocator", + type: "bool", + indexed: false, + internalType: "bool", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "SetIsSentinel", + inputs: [ + { + name: "account", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "newIsSentinel", + type: "bool", + indexed: false, + internalType: "bool", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "SetLiquidityAdapterAndData", + inputs: [ + { + name: "sender", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "newLiquidityAdapter", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "newLiquidityData", + type: "bytes", + indexed: true, + internalType: "bytes", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "SetManagementFee", + inputs: [ + { + name: "newManagementFee", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "SetManagementFeeRecipient", + inputs: [ + { + name: "newManagementFeeRecipient", + type: "address", + indexed: true, + internalType: "address", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "SetMaxRate", + inputs: [ + { + name: "newMaxRate", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "SetName", + inputs: [ + { + name: "newName", + type: "string", + indexed: false, + internalType: "string", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "SetOwner", + inputs: [ + { + name: "newOwner", + type: "address", + indexed: true, + internalType: "address", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "SetPerformanceFee", + inputs: [ + { + name: "newPerformanceFee", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "SetPerformanceFeeRecipient", + inputs: [ + { + name: "newPerformanceFeeRecipient", + type: "address", + indexed: true, + internalType: "address", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "SetReceiveAssetsGate", + inputs: [ + { + name: "newReceiveAssetsGate", + type: "address", + indexed: true, + internalType: "address", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "SetReceiveSharesGate", + inputs: [ + { + name: "newReceiveSharesGate", + type: "address", + indexed: true, + internalType: "address", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "SetSendAssetsGate", + inputs: [ + { + name: "newSendAssetsGate", + type: "address", + indexed: true, + internalType: "address", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "SetSendSharesGate", + inputs: [ + { + name: "newSendSharesGate", + type: "address", + indexed: true, + internalType: "address", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "SetSymbol", + inputs: [ + { + name: "newSymbol", + type: "string", + indexed: false, + internalType: "string", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "Submit", + inputs: [ + { + name: "selector", + type: "bytes4", + indexed: true, + internalType: "bytes4", + }, + { + name: "data", + type: "bytes", + indexed: false, + internalType: "bytes", + }, + { + name: "executableAt", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "Transfer", + inputs: [ + { + name: "from", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "to", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "shares", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "Withdraw", + inputs: [ + { + name: "sender", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "receiver", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "onBehalf", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "assets", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + { + name: "shares", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "error", + name: "Abdicated", + inputs: [], + }, + { + type: "error", + name: "AbsoluteCapExceeded", + inputs: [], + }, + { + type: "error", + name: "AbsoluteCapNotDecreasing", + inputs: [], + }, + { + type: "error", + name: "AbsoluteCapNotIncreasing", + inputs: [], + }, + { + type: "error", + name: "AutomaticallyTimelocked", + inputs: [], + }, + { + type: "error", + name: "CannotReceiveAssets", + inputs: [], + }, + { + type: "error", + name: "CannotReceiveShares", + inputs: [], + }, + { + type: "error", + name: "CannotSendAssets", + inputs: [], + }, + { + type: "error", + name: "CannotSendShares", + inputs: [], + }, + { + type: "error", + name: "CastOverflow", + inputs: [], + }, + { + type: "error", + name: "DataAlreadyPending", + inputs: [], + }, + { + type: "error", + name: "DataNotTimelocked", + inputs: [], + }, + { + type: "error", + name: "FeeInvariantBroken", + inputs: [], + }, + { + type: "error", + name: "FeeTooHigh", + inputs: [], + }, + { + type: "error", + name: "InvalidSigner", + inputs: [], + }, + { + type: "error", + name: "MaxRateTooHigh", + inputs: [], + }, + { + type: "error", + name: "NoCode", + inputs: [], + }, + { + type: "error", + name: "NotAdapter", + inputs: [], + }, + { + type: "error", + name: "NotInAdapterRegistry", + inputs: [], + }, + { + type: "error", + name: "PenaltyTooHigh", + inputs: [], + }, + { + type: "error", + name: "PermitDeadlineExpired", + inputs: [], + }, + { + type: "error", + name: "RelativeCapAboveOne", + inputs: [], + }, + { + type: "error", + name: "RelativeCapExceeded", + inputs: [], + }, + { + type: "error", + name: "RelativeCapNotDecreasing", + inputs: [], + }, + { + type: "error", + name: "RelativeCapNotIncreasing", + inputs: [], + }, + { + type: "error", + name: "TimelockNotDecreasing", + inputs: [], + }, + { + type: "error", + name: "TimelockNotExpired", + inputs: [], + }, + { + type: "error", + name: "TimelockNotIncreasing", + inputs: [], + }, + { + type: "error", + name: "TransferFromReturnedFalse", + inputs: [], + }, + { + type: "error", + name: "TransferFromReverted", + inputs: [], + }, + { + type: "error", + name: "TransferReturnedFalse", + inputs: [], + }, + { + type: "error", + name: "TransferReverted", + inputs: [], + }, + { + type: "error", + name: "Unauthorized", + inputs: [], + }, + { + type: "error", + name: "ZeroAbsoluteCap", + inputs: [], + }, + { + type: "error", + name: "ZeroAddress", + inputs: [], + }, + { + type: "error", + name: "ZeroAllocation", + inputs: [], + }, +] as const; + +export const vaultV2FactoryAbi = [ + { + type: "function", + name: "createVaultV2", + inputs: [ + { + name: "owner", + type: "address", + internalType: "address", + }, + { + name: "asset", + type: "address", + internalType: "address", + }, + { + name: "salt", + type: "bytes32", + internalType: "bytes32", }, ], - name: "multicall", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [], - name: "name", outputs: [ { - internalType: "string", name: "", - type: "string", + type: "address", + internalType: "address", }, ], - stateMutability: "view", - type: "function", + stateMutability: "nonpayable", }, { + type: "function", + name: "isVaultV2", inputs: [ { - internalType: "address", name: "account", type: "address", + internalType: "address", }, ], - name: "nonces", outputs: [ { - internalType: "uint256", name: "", - type: "uint256", + type: "bool", + internalType: "bool", }, ], stateMutability: "view", - type: "function", }, { - inputs: [], - name: "owner", - outputs: [ + type: "function", + name: "vaultV2", + inputs: [ { + name: "owner", + type: "address", internalType: "address", - name: "", + }, + { + name: "asset", type: "address", + internalType: "address", }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "performanceFee", - outputs: [ { - internalType: "uint96", - name: "", - type: "uint96", + name: "salt", + type: "bytes32", + internalType: "bytes32", }, ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "performanceFeeRecipient", outputs: [ { - internalType: "address", name: "", type: "address", + internalType: "address", }, ], stateMutability: "view", - type: "function", }, { + type: "event", + name: "CreateVaultV2", inputs: [ { - internalType: "address", - name: "_owner", + name: "owner", type: "address", + indexed: true, + internalType: "address", }, { - internalType: "address", - name: "spender", + name: "asset", type: "address", + indexed: true, + internalType: "address", }, { - internalType: "uint256", - name: "shares", - type: "uint256", + name: "salt", + type: "bytes32", + indexed: false, + internalType: "bytes32", }, { - internalType: "uint256", - name: "deadline", - type: "uint256", + name: "newVaultV2", + type: "address", + indexed: true, + internalType: "address", }, + ], + anonymous: false, + }, +] as const; + +export const morphoVaultV1AdapterFactoryAbi = [ + { + type: "function", + name: "createMorphoVaultV1Adapter", + inputs: [ { - internalType: "uint8", - name: "v", - type: "uint8", + name: "parentVault", + type: "address", + internalType: "address", }, { - internalType: "bytes32", - name: "r", - type: "bytes32", + name: "morphoVaultV1", + type: "address", + internalType: "address", }, + ], + outputs: [ { - internalType: "bytes32", - name: "s", - type: "bytes32", + name: "", + type: "address", + internalType: "address", }, ], - name: "permit", - outputs: [], stateMutability: "nonpayable", - type: "function", }, { + type: "function", + name: "isMorphoVaultV1Adapter", inputs: [ { - internalType: "uint256", - name: "assets", - type: "uint256", + name: "account", + type: "address", + internalType: "address", }, ], - name: "previewDeposit", outputs: [ { - internalType: "uint256", name: "", - type: "uint256", + type: "bool", + internalType: "bool", }, ], stateMutability: "view", - type: "function", }, { + type: "function", + name: "morphoVaultV1Adapter", inputs: [ { - internalType: "uint256", - name: "shares", - type: "uint256", + name: "parentVault", + type: "address", + internalType: "address", + }, + { + name: "morphoVaultV1", + type: "address", + internalType: "address", }, ], - name: "previewMint", outputs: [ { - internalType: "uint256", name: "", - type: "uint256", + type: "address", + internalType: "address", }, ], stateMutability: "view", - type: "function", }, { + type: "event", + name: "CreateMorphoVaultV1Adapter", inputs: [ { - internalType: "uint256", - name: "shares", - type: "uint256", + name: "parentVault", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "morphoVaultV1", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "morphoVaultV1Adapter", + type: "address", + indexed: true, + internalType: "address", }, ], - name: "previewRedeem", + anonymous: false, + }, +] as const; + +export const morphoVaultV1AdapterAbi = [ + { + type: "constructor", + inputs: [ + { + name: "_parentVault", + type: "address", + internalType: "address", + }, + { + name: "_morphoVaultV1", + type: "address", + internalType: "address", + }, + ], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "adapterId", + inputs: [], outputs: [ { - internalType: "uint256", name: "", - type: "uint256", + type: "bytes32", + internalType: "bytes32", }, ], stateMutability: "view", - type: "function", }, { + type: "function", + name: "allocate", inputs: [ { - internalType: "uint256", + name: "data", + type: "bytes", + internalType: "bytes", + }, + { name: "assets", type: "uint256", + internalType: "uint256", }, - ], - name: "previewWithdraw", - outputs: [ { - internalType: "uint256", name: "", - type: "uint256", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "", + type: "address", + internalType: "address", }, ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "receiveAssetsGate", outputs: [ { - internalType: "address", name: "", - type: "address", + type: "bytes32[]", + internalType: "bytes32[]", + }, + { + name: "", + type: "int256", + internalType: "int256", }, ], - stateMutability: "view", - type: "function", + stateMutability: "nonpayable", }, { + type: "function", + name: "allocation", inputs: [], - name: "receiveSharesGate", outputs: [ { - internalType: "address", name: "", - type: "address", + type: "uint256", + internalType: "uint256", }, ], stateMutability: "view", - type: "function", }, { + type: "function", + name: "deallocate", inputs: [ { - internalType: "uint256", - name: "shares", + name: "data", + type: "bytes", + internalType: "bytes", + }, + { + name: "assets", type: "uint256", + internalType: "uint256", }, { - internalType: "address", - name: "receiver", - type: "address", + name: "", + type: "bytes4", + internalType: "bytes4", }, { - internalType: "address", - name: "onBehalf", + name: "", type: "address", + internalType: "address", }, ], - name: "redeem", outputs: [ { - internalType: "uint256", name: "", - type: "uint256", + type: "bytes32[]", + internalType: "bytes32[]", + }, + { + name: "", + type: "int256", + internalType: "int256", }, ], stateMutability: "nonpayable", - type: "function", }, { - inputs: [ - { - internalType: "bytes32", - name: "id", - type: "bytes32", - }, - ], - name: "relativeCap", + type: "function", + name: "factory", + inputs: [], outputs: [ { - internalType: "uint256", name: "", - type: "uint256", + type: "address", + internalType: "address", }, ], stateMutability: "view", - type: "function", }, { - inputs: [ - { - internalType: "address", - name: "account", - type: "address", - }, - ], - name: "removeAdapter", - outputs: [], - stateMutability: "nonpayable", type: "function", - }, - { - inputs: [ + name: "ids", + inputs: [], + outputs: [ { - internalType: "bytes", - name: "data", - type: "bytes", + name: "", + type: "bytes32[]", + internalType: "bytes32[]", }, ], - name: "revoke", - outputs: [], - stateMutability: "nonpayable", - type: "function", + stateMutability: "view", }, { + type: "function", + name: "morphoVaultV1", inputs: [], - name: "sendAssetsGate", outputs: [ { - internalType: "address", name: "", type: "address", + internalType: "address", }, ], stateMutability: "view", - type: "function", }, { + type: "function", + name: "parentVault", inputs: [], - name: "sendSharesGate", outputs: [ { - internalType: "address", name: "", type: "address", + internalType: "address", }, ], stateMutability: "view", - type: "function", }, { - inputs: [ + type: "function", + name: "realAssets", + inputs: [], + outputs: [ { - internalType: "address", - name: "newAdapterRegistry", - type: "address", + name: "", + type: "uint256", + internalType: "uint256", }, ], - name: "setAdapterRegistry", - outputs: [], - stateMutability: "nonpayable", - type: "function", + stateMutability: "view", }, { + type: "function", + name: "setSkimRecipient", inputs: [ { - internalType: "address", - name: "newCurator", + name: "newSkimRecipient", type: "address", + internalType: "address", }, ], - name: "setCurator", outputs: [], stateMutability: "nonpayable", - type: "function", }, { + type: "function", + name: "skim", inputs: [ { - internalType: "address", - name: "adapter", + name: "token", type: "address", - }, - { - internalType: "uint256", - name: "newForceDeallocatePenalty", - type: "uint256", + internalType: "address", }, ], - name: "setForceDeallocatePenalty", outputs: [], stateMutability: "nonpayable", - type: "function", }, { - inputs: [ + type: "function", + name: "skimRecipient", + inputs: [], + outputs: [ { - internalType: "address", - name: "account", + name: "", type: "address", - }, - { - internalType: "bool", - name: "newIsAllocator", - type: "bool", + internalType: "address", }, ], - name: "setIsAllocator", - outputs: [], - stateMutability: "nonpayable", - type: "function", + stateMutability: "view", }, { + type: "event", + name: "SetSkimRecipient", inputs: [ { - internalType: "address", - name: "account", + name: "newSkimRecipient", type: "address", - }, - { - internalType: "bool", - name: "newIsSentinel", - type: "bool", + indexed: true, + internalType: "address", }, ], - name: "setIsSentinel", - outputs: [], - stateMutability: "nonpayable", - type: "function", + anonymous: false, }, { + type: "event", + name: "Skim", inputs: [ { - internalType: "address", - name: "newLiquidityAdapter", + name: "token", type: "address", + indexed: true, + internalType: "address", }, { - internalType: "bytes", - name: "newLiquidityData", - type: "bytes", + name: "assets", + type: "uint256", + indexed: false, + internalType: "uint256", }, ], - name: "setLiquidityAdapterAndData", - outputs: [], - stateMutability: "nonpayable", - type: "function", + anonymous: false, }, { - inputs: [ - { - internalType: "uint256", - name: "newManagementFee", - type: "uint256", - }, - ], - name: "setManagementFee", - outputs: [], - stateMutability: "nonpayable", - type: "function", + type: "error", + name: "ApproveReturnedFalse", + inputs: [], }, { - inputs: [ - { - internalType: "address", - name: "newManagementFeeRecipient", - type: "address", - }, - ], - name: "setManagementFeeRecipient", - outputs: [], - stateMutability: "nonpayable", - type: "function", + type: "error", + name: "ApproveReverted", + inputs: [], }, { - inputs: [ - { - internalType: "uint256", - name: "newMaxRate", - type: "uint256", - }, - ], - name: "setMaxRate", - outputs: [], - stateMutability: "nonpayable", - type: "function", + type: "error", + name: "AssetMismatch", + inputs: [], }, { - inputs: [ - { - internalType: "string", - name: "newName", - type: "string", - }, - ], - name: "setName", - outputs: [], - stateMutability: "nonpayable", - type: "function", + type: "error", + name: "CannotSkimMorphoVaultV1Shares", + inputs: [], + }, + { + type: "error", + name: "InvalidData", + inputs: [], + }, + { + type: "error", + name: "NoCode", + inputs: [], + }, + { + type: "error", + name: "NotAuthorized", + inputs: [], + }, + { + type: "error", + name: "TransferReturnedFalse", + inputs: [], + }, + { + type: "error", + name: "TransferReverted", + inputs: [], }, +] as const; + +export const morphoMarketV1AdapterAbi = [ { + type: "constructor", inputs: [ { + name: "_parentVault", + type: "address", internalType: "address", - name: "newOwner", + }, + { + name: "_morpho", type: "address", + internalType: "address", }, ], - name: "setOwner", - outputs: [], stateMutability: "nonpayable", - type: "function", }, { - inputs: [ + type: "function", + name: "adapterId", + inputs: [], + outputs: [ { - internalType: "uint256", - name: "newPerformanceFee", - type: "uint256", + name: "", + type: "bytes32", + internalType: "bytes32", }, ], - name: "setPerformanceFee", - outputs: [], - stateMutability: "nonpayable", - type: "function", + stateMutability: "view", }, { + type: "function", + name: "allocate", inputs: [ { - internalType: "address", - name: "newPerformanceFeeRecipient", - type: "address", + name: "data", + type: "bytes", + internalType: "bytes", }, - ], - name: "setPerformanceFeeRecipient", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ { - internalType: "address", - name: "newReceiveAssetsGate", - type: "address", + name: "assets", + type: "uint256", + internalType: "uint256", }, - ], - name: "setReceiveAssetsGate", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ { - internalType: "address", - name: "newReceiveSharesGate", - type: "address", + name: "", + type: "bytes4", + internalType: "bytes4", }, - ], - name: "setReceiveSharesGate", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ { - internalType: "address", - name: "newSendAssetsGate", + name: "", type: "address", + internalType: "address", }, ], - name: "setSendAssetsGate", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ + outputs: [ { - internalType: "address", - name: "newSendSharesGate", - type: "address", + name: "", + type: "bytes32[]", + internalType: "bytes32[]", + }, + { + name: "", + type: "int256", + internalType: "int256", }, ], - name: "setSendSharesGate", - outputs: [], stateMutability: "nonpayable", - type: "function", }, { + type: "function", + name: "allocation", inputs: [ { - internalType: "string", - name: "newSymbol", - type: "string", + name: "marketParams", + type: "tuple", + internalType: "struct MarketParams", + components: [ + { + name: "loanToken", + type: "address", + internalType: "address", + }, + { + name: "collateralToken", + type: "address", + internalType: "address", + }, + { + name: "oracle", + type: "address", + internalType: "address", + }, + { + name: "irm", + type: "address", + internalType: "address", + }, + { + name: "lltv", + type: "uint256", + internalType: "uint256", + }, + ], }, ], - name: "setSymbol", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ + outputs: [ { - internalType: "bytes", - name: "data", - type: "bytes", + name: "", + type: "uint256", + internalType: "uint256", }, ], - name: "submit", - outputs: [], - stateMutability: "nonpayable", - type: "function", + stateMutability: "view", }, { + type: "function", + name: "asset", inputs: [], - name: "symbol", outputs: [ { - internalType: "string", name: "", - type: "string", + type: "address", + internalType: "address", }, ], stateMutability: "view", - type: "function", }, { + type: "function", + name: "deallocate", inputs: [ { - internalType: "bytes4", - name: "selector", - type: "bytes4", + name: "data", + type: "bytes", + internalType: "bytes", }, - ], - name: "timelock", - outputs: [ { + name: "assets", + type: "uint256", internalType: "uint256", + }, + { name: "", - type: "uint256", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "", + type: "address", + internalType: "address", }, ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "totalAssets", outputs: [ { - internalType: "uint256", name: "", - type: "uint256", + type: "bytes32[]", + internalType: "bytes32[]", + }, + { + name: "", + type: "int256", + internalType: "int256", }, ], - stateMutability: "view", - type: "function", + stateMutability: "nonpayable", }, { + type: "function", + name: "factory", inputs: [], - name: "totalSupply", outputs: [ { - internalType: "uint256", name: "", - type: "uint256", + type: "address", + internalType: "address", }, ], stateMutability: "view", - type: "function", }, { + type: "function", + name: "ids", inputs: [ { - internalType: "address", - name: "to", - type: "address", - }, - { - internalType: "uint256", - name: "shares", - type: "uint256", + name: "marketParams", + type: "tuple", + internalType: "struct MarketParams", + components: [ + { + name: "loanToken", + type: "address", + internalType: "address", + }, + { + name: "collateralToken", + type: "address", + internalType: "address", + }, + { + name: "oracle", + type: "address", + internalType: "address", + }, + { + name: "irm", + type: "address", + internalType: "address", + }, + { + name: "lltv", + type: "uint256", + internalType: "uint256", + }, + ], }, ], - name: "transfer", outputs: [ { - internalType: "bool", name: "", - type: "bool", + type: "bytes32[]", + internalType: "bytes32[]", }, ], - stateMutability: "nonpayable", - type: "function", + stateMutability: "view", }, { + type: "function", + name: "marketParamsList", inputs: [ { + name: "", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [ + { + name: "loanToken", + type: "address", internalType: "address", - name: "from", + }, + { + name: "collateralToken", type: "address", + internalType: "address", }, { + name: "oracle", + type: "address", internalType: "address", - name: "to", + }, + { + name: "irm", type: "address", + internalType: "address", }, { - internalType: "uint256", - name: "shares", + name: "lltv", type: "uint256", + internalType: "uint256", }, ], - name: "transferFrom", + stateMutability: "view", + }, + { + type: "function", + name: "marketParamsListLength", + inputs: [], outputs: [ { - internalType: "bool", name: "", - type: "bool", + type: "uint256", + internalType: "uint256", }, ], - stateMutability: "nonpayable", - type: "function", + stateMutability: "view", }, { + type: "function", + name: "morpho", inputs: [], - name: "virtualShares", outputs: [ { - internalType: "uint256", name: "", - type: "uint256", + type: "address", + internalType: "address", }, ], stateMutability: "view", - type: "function", }, { - inputs: [ - { - internalType: "uint256", - name: "assets", - type: "uint256", - }, + type: "function", + name: "parentVault", + inputs: [], + outputs: [ { - internalType: "address", - name: "receiver", + name: "", type: "address", - }, - { internalType: "address", - name: "onBehalf", - type: "address", }, ], - name: "withdraw", + stateMutability: "view", + }, + { + type: "function", + name: "realAssets", + inputs: [], outputs: [ { - internalType: "uint256", name: "", type: "uint256", + internalType: "uint256", }, ], - stateMutability: "nonpayable", - type: "function", + stateMutability: "view", }, -] as const; - -export const vaultV1AdapterFactoryAbi = [ { - anonymous: false, + type: "function", + name: "setSkimRecipient", inputs: [ { - indexed: true, - internalType: "address", - name: "parentVault", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "morphoVaultV1", + name: "newSkimRecipient", type: "address", - }, - { - indexed: true, internalType: "address", - name: "morphoVaultV1Adapter", - type: "address", }, ], - name: "CreateMorphoVaultV1Adapter", - type: "event", + outputs: [], + stateMutability: "nonpayable", }, { + type: "function", + name: "skim", inputs: [ - { internalType: "address", name: "parentVault", type: "address" }, - { internalType: "address", name: "morphoVaultV1", type: "address" }, + { + name: "token", + type: "address", + internalType: "address", + }, ], - name: "createMorphoVaultV1Adapter", - outputs: [{ internalType: "address", name: "", type: "address" }], + outputs: [], stateMutability: "nonpayable", - type: "function", }, { - inputs: [{ internalType: "address", name: "account", type: "address" }], - name: "isMorphoVaultV1Adapter", - outputs: [{ internalType: "bool", name: "", type: "bool" }], - stateMutability: "view", type: "function", - }, - { - inputs: [ - { internalType: "address", name: "parentVault", type: "address" }, - { internalType: "address", name: "morphoVaultV1", type: "address" }, + name: "skimRecipient", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "address", + }, ], - name: "morphoVaultV1Adapter", - outputs: [{ internalType: "address", name: "", type: "address" }], stateMutability: "view", - type: "function", - }, -] as const; - -export const vaultV1AdapterAbi = [ - { - inputs: [ - { internalType: "address", name: "_parentVault", type: "address" }, - { internalType: "address", name: "_morphoVaultV1", type: "address" }, - ], - stateMutability: "nonpayable", - type: "constructor", }, - { inputs: [], name: "ApproveReturnedFalse", type: "error" }, - { inputs: [], name: "ApproveReverted", type: "error" }, - { inputs: [], name: "AssetMismatch", type: "error" }, - { inputs: [], name: "CannotSkimMorphoVaultV1Shares", type: "error" }, - { inputs: [], name: "InvalidData", type: "error" }, - { inputs: [], name: "NoCode", type: "error" }, - { inputs: [], name: "NotAuthorized", type: "error" }, - { inputs: [], name: "TransferReturnedFalse", type: "error" }, - { inputs: [], name: "TransferReverted", type: "error" }, { - anonymous: false, + type: "event", + name: "SetSkimRecipient", inputs: [ { - indexed: true, - internalType: "address", name: "newSkimRecipient", type: "address", + indexed: true, + internalType: "address", }, ], - name: "SetSkimRecipient", - type: "event", + anonymous: false, }, { - anonymous: false, + type: "event", + name: "Skim", inputs: [ { - indexed: true, - internalType: "address", name: "token", type: "address", + indexed: true, + internalType: "address", }, { - indexed: false, - internalType: "uint256", name: "assets", type: "uint256", + indexed: false, + internalType: "uint256", }, ], - name: "Skim", - type: "event", + anonymous: false, }, { + type: "error", + name: "ApproveReturnedFalse", inputs: [], - name: "adapterId", - outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { internalType: "bytes", name: "data", type: "bytes" }, - { internalType: "uint256", name: "assets", type: "uint256" }, - { internalType: "bytes4", name: "", type: "bytes4" }, - { internalType: "address", name: "", type: "address" }, - ], - name: "allocate", - outputs: [ - { internalType: "bytes32[]", name: "", type: "bytes32[]" }, - { internalType: "int256", name: "", type: "int256" }, - ], - stateMutability: "nonpayable", - type: "function", }, { + type: "error", + name: "ApproveReverted", inputs: [], - name: "allocation", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - stateMutability: "view", - type: "function", }, { - inputs: [ - { internalType: "bytes", name: "data", type: "bytes" }, - { internalType: "uint256", name: "assets", type: "uint256" }, - { internalType: "bytes4", name: "", type: "bytes4" }, - { internalType: "address", name: "", type: "address" }, - ], - name: "deallocate", - outputs: [ - { internalType: "bytes32[]", name: "", type: "bytes32[]" }, - { internalType: "int256", name: "", type: "int256" }, - ], - stateMutability: "nonpayable", - type: "function", + type: "error", + name: "LoanAssetMismatch", + inputs: [], }, { + type: "error", + name: "NoCode", inputs: [], - name: "factory", - outputs: [{ internalType: "address", name: "", type: "address" }], - stateMutability: "view", - type: "function", }, { + type: "error", + name: "NotAuthorized", inputs: [], - name: "ids", - outputs: [{ internalType: "bytes32[]", name: "", type: "bytes32[]" }], - stateMutability: "view", - type: "function", }, { + type: "error", + name: "TransferReturnedFalse", inputs: [], - name: "morphoVaultV1", - outputs: [{ internalType: "address", name: "", type: "address" }], - stateMutability: "view", - type: "function", }, { + type: "error", + name: "TransferReverted", inputs: [], - name: "parentVault", - outputs: [{ internalType: "address", name: "", type: "address" }], - stateMutability: "view", - type: "function", }, +] as const; + +export const morphoMarketV1AdapterFactoryAbi = [ { - inputs: [], - name: "realAssets", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - stateMutability: "view", - type: "function", + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "parentVault", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "morpho", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "morphoMarketV1Adapter", + type: "address", + }, + ], + name: "CreateMorphoMarketV1Adapter", + type: "event", }, { inputs: [ - { internalType: "address", name: "newSkimRecipient", type: "address" }, + { internalType: "address", name: "parentVault", type: "address" }, + { internalType: "address", name: "morpho", type: "address" }, ], - name: "setSkimRecipient", - outputs: [], + name: "createMorphoMarketV1Adapter", + outputs: [{ internalType: "address", name: "", type: "address" }], stateMutability: "nonpayable", type: "function", }, { - inputs: [{ internalType: "address", name: "token", type: "address" }], - name: "skim", - outputs: [], - stateMutability: "nonpayable", + inputs: [{ internalType: "address", name: "account", type: "address" }], + name: "isMorphoMarketV1Adapter", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", type: "function", }, { - inputs: [], - name: "skimRecipient", + inputs: [ + { internalType: "address", name: "parentVault", type: "address" }, + { internalType: "address", name: "morpho", type: "address" }, + ], + name: "morphoMarketV1Adapter", outputs: [{ internalType: "address", name: "", type: "address" }], stateMutability: "view", type: "function", }, -] as const; +]; + +/** + * @deprecated Use `morphoVaultV1AdapterFactoryAbi` instead. + */ +export const vaultV1AdapterFactoryAbi = morphoVaultV1AdapterFactoryAbi; + +/** + * @deprecated Use `morphoVaultV1AdapterAbi` instead. + */ +export const vaultV1AdapterAbi = morphoVaultV1AdapterAbi; diff --git a/packages/blue-sdk-viem/src/fetch/Vault.ts b/packages/blue-sdk-viem/src/fetch/Vault.ts index 0dd76ec1..b39b70dd 100644 --- a/packages/blue-sdk-viem/src/fetch/Vault.ts +++ b/packages/blue-sdk-viem/src/fetch/Vault.ts @@ -242,7 +242,8 @@ export async function fetchVault( const [supplyQueue, withdrawQueue, publicAllocatorConfig] = await Promise.all( [ Promise.all( - new Array(Number(supplyQueueSize)).fill(null).map( + Array.from( + { length: Number(supplyQueueSize) }, (_, i) => readContract(client, { ...parameters, @@ -254,7 +255,8 @@ export async function fetchVault( ), ), Promise.all( - new Array(Number(withdrawQueueSize)).fill(null).map( + Array.from( + { length: Number(withdrawQueueSize) }, (_, i) => readContract(client, { ...parameters, @@ -299,7 +301,7 @@ export async function fetchAccrualVault( const vault = await fetchVault(address, client, parameters); const allocations = await Promise.all( - Array.from(vault.withdrawQueue, (marketId) => + vault.withdrawQueue.map((marketId) => fetchVaultMarketAllocation(vault.address, marketId, client, parameters), ), ); diff --git a/packages/blue-sdk-viem/src/fetch/index.ts b/packages/blue-sdk-viem/src/fetch/index.ts index af6c529c..2cd54967 100644 --- a/packages/blue-sdk-viem/src/fetch/index.ts +++ b/packages/blue-sdk-viem/src/fetch/index.ts @@ -10,3 +10,4 @@ export * from "./VaultUser"; export * from "./VaultMarketConfig"; export * from "./VaultMarketAllocation"; export * from "./VaultMarketPublicAllocatorConfig"; +export * from "./vault-v2"; diff --git a/packages/blue-sdk-viem/src/fetch/vault-v2/VaultV2.ts b/packages/blue-sdk-viem/src/fetch/vault-v2/VaultV2.ts new file mode 100644 index 00000000..afc53f67 --- /dev/null +++ b/packages/blue-sdk-viem/src/fetch/vault-v2/VaultV2.ts @@ -0,0 +1,270 @@ +import { + AccrualVaultV2, + type IVaultV2Allocation, + VaultV2, + VaultV2MorphoVaultV1Adapter, + getChainAddresses, +} from "@morpho-org/blue-sdk"; +import { + type Address, + type Client, + type Hash, + erc20Abi, + zeroAddress, +} from "viem"; +import { getChainId, readContract } from "viem/actions"; +import { morphoVaultV1AdapterFactoryAbi, vaultV2Abi } from "../../abis"; +import { abi, code } from "../../queries/vault-v2/GetVaultV2"; +import type { DeploylessFetchParameters } from "../../types"; +import { fetchToken } from "../Token"; +import { fetchAccrualVaultV2Adapter } from "./VaultV2Adapter"; + +export async function fetchVaultV2( + address: Address, + client: Client, + { deployless = true, ...parameters }: DeploylessFetchParameters = {}, +) { + parameters.chainId ??= await getChainId(client); + + const { morphoVaultV1AdapterFactory } = getChainAddresses(parameters.chainId); + + if (deployless) { + try { + const { token, isLiquidityAdapterKnown, liquidityAllocations, ...vault } = + await readContract(client, { + ...parameters, + abi, + code, + functionName: "query", + args: [address, morphoVaultV1AdapterFactory ?? zeroAddress], + }); + + return new VaultV2({ + ...token, + ...vault, + address, + adapters: [...vault.adapters], + liquidityAllocations: isLiquidityAdapterKnown + ? [...liquidityAllocations] + : undefined, + }); + } catch { + // Fallback to multicall if deployless call fails. + } + } + + const [ + token, + asset, + totalSupply, + totalAssets, + _totalAssets, + performanceFee, + managementFee, + virtualShares, + lastUpdate, + maxRate, + liquidityAdapter, + liquidityData, + adaptersLength, + performanceFeeRecipient, + managementFeeRecipient, + ] = await Promise.all([ + fetchToken(address, client, parameters), + readContract(client, { + ...parameters, + address, + abi: vaultV2Abi, + functionName: "asset", + }), + readContract(client, { + ...parameters, + address, + abi: vaultV2Abi, + functionName: "totalSupply", + }), + readContract(client, { + ...parameters, + address, + abi: vaultV2Abi, + functionName: "totalAssets", + }), + readContract(client, { + ...parameters, + address, + abi: vaultV2Abi, + functionName: "_totalAssets", + }), + readContract(client, { + ...parameters, + address, + abi: vaultV2Abi, + functionName: "performanceFee", + }), + readContract(client, { + ...parameters, + address, + abi: vaultV2Abi, + functionName: "managementFee", + }), + readContract(client, { + ...parameters, + address, + abi: vaultV2Abi, + functionName: "virtualShares", + }), + readContract(client, { + ...parameters, + address, + abi: vaultV2Abi, + functionName: "lastUpdate", + }), + readContract(client, { + ...parameters, + address, + abi: vaultV2Abi, + functionName: "maxRate", + }), + readContract(client, { + ...parameters, + address, + abi: vaultV2Abi, + functionName: "liquidityAdapter", + }), + readContract(client, { + ...parameters, + address, + abi: vaultV2Abi, + functionName: "liquidityData", + }), + readContract(client, { + ...parameters, + address, + abi: vaultV2Abi, + functionName: "adaptersLength", + }), + readContract(client, { + ...parameters, + address, + abi: vaultV2Abi, + functionName: "performanceFeeRecipient", + }), + readContract(client, { + ...parameters, + address, + abi: vaultV2Abi, + functionName: "managementFeeRecipient", + }), + ]); + + const [hasMorphoVaultV1LiquidityAdapter, ...adapters] = await Promise.all([ + morphoVaultV1AdapterFactory != null && liquidityAdapter !== zeroAddress + ? readContract(client, { + address: morphoVaultV1AdapterFactory, + abi: morphoVaultV1AdapterFactoryAbi, + functionName: "isMorphoVaultV1Adapter", + args: [liquidityAdapter], + ...parameters, + }) + : undefined, + ...Array.from({ length: Number(adaptersLength) }, (_, i) => + readContract(client, { + ...parameters, + address, + abi: vaultV2Abi, + functionName: "adapters", + args: [BigInt(i)], + }), + ), + ]); + + let liquidityAdapterIds: Hash[] | undefined; + if (hasMorphoVaultV1LiquidityAdapter) + liquidityAdapterIds = [ + VaultV2MorphoVaultV1Adapter.adapterId(liquidityAdapter), + ]; + + let liquidityAllocations: IVaultV2Allocation[] | undefined; + if (liquidityAdapterIds != null) + liquidityAllocations = await Promise.all( + liquidityAdapterIds.map(async (id) => { + const [absoluteCap, relativeCap, allocation] = await Promise.all([ + readContract(client, { + ...parameters, + address, + abi: vaultV2Abi, + functionName: "absoluteCap", + args: [id], + }), + readContract(client, { + ...parameters, + address, + abi: vaultV2Abi, + functionName: "relativeCap", + args: [id], + }), + readContract(client, { + ...parameters, + address, + abi: vaultV2Abi, + functionName: "allocation", + args: [id], + }), + ]); + + return { + id, + absoluteCap, + relativeCap, + allocation, + }; + }), + ); + + return new VaultV2({ + ...token, + asset, + totalAssets, + _totalAssets, + totalSupply, + virtualShares, + maxRate, + lastUpdate, + adapters, + liquidityAdapter, + liquidityData, + liquidityAllocations, + performanceFee, + managementFee, + performanceFeeRecipient, + managementFeeRecipient, + }); +} + +export async function fetchAccrualVaultV2( + address: Address, + client: Client, + parameters: DeploylessFetchParameters = {}, +) { + parameters.chainId ??= await getChainId(client); + + const vaultV2 = await fetchVaultV2(address, client, parameters); + + const [assetBalance, liquidityAdapter, ...adapters] = await Promise.all([ + readContract(client, { + ...parameters, + address: vaultV2.asset, + abi: erc20Abi, + functionName: "balanceOf", + args: [vaultV2.address], + }), + vaultV2.liquidityAdapter !== zeroAddress + ? fetchAccrualVaultV2Adapter(vaultV2.liquidityAdapter, client, parameters) + : undefined, + ...vaultV2.adapters.map(async (adapter) => + fetchAccrualVaultV2Adapter(adapter, client, parameters), + ), + ]); + + return new AccrualVaultV2(vaultV2, liquidityAdapter, adapters, assetBalance); +} diff --git a/packages/blue-sdk-viem/src/fetch/vault-v2/VaultV2Adapter.ts b/packages/blue-sdk-viem/src/fetch/vault-v2/VaultV2Adapter.ts new file mode 100644 index 00000000..538558f9 --- /dev/null +++ b/packages/blue-sdk-viem/src/fetch/vault-v2/VaultV2Adapter.ts @@ -0,0 +1,101 @@ +import { + UnsupportedVaultV2AdapterError, + getChainAddresses, +} from "@morpho-org/blue-sdk"; +import type { Address, Client } from "viem"; +import { getChainId, readContract } from "viem/actions"; +import { morphoVaultV1AdapterFactoryAbi } from "../../abis"; +import { morphoMarketV1AdapterFactoryAbi } from "../../abis"; +import type { DeploylessFetchParameters } from "../../types"; +import { fetchVaultV2MorphoMarketV1Adapter } from "./VaultV2MorphoMarketV1Adapter"; +import { fetchAccrualVaultV2MorphoMarketV1Adapter } from "./VaultV2MorphoMarketV1Adapter"; +import { + fetchAccrualVaultV2MorphoVaultV1Adapter, + fetchVaultV2MorphoVaultV1Adapter, +} from "./VaultV2MorphoVaultV1Adapter"; + +export async function fetchVaultV2Adapter( + address: Address, + client: Client, + parameters: DeploylessFetchParameters = {}, +) { + parameters.chainId ??= await getChainId(client); + parameters.deployless ??= true; + + const { morphoVaultV1AdapterFactory, morphoMarketV1AdapterFactory } = + getChainAddresses(parameters.chainId); + + const [isMorphoVaultV1Adapter, isMorphoMarketV1Adapter] = await Promise.all([ + morphoVaultV1AdapterFactory + ? readContract(client, { + ...parameters, + address: morphoVaultV1AdapterFactory, + abi: morphoVaultV1AdapterFactoryAbi, + functionName: "isMorphoVaultV1Adapter", + args: [address], + }) + : false, + morphoMarketV1AdapterFactory + ? readContract(client, { + ...parameters, + address: morphoMarketV1AdapterFactory, + abi: morphoMarketV1AdapterFactoryAbi, + functionName: "isMorphoMarketV1Adapter", + args: [address], + }) + : false, + ]); + + if (isMorphoVaultV1Adapter) + return fetchVaultV2MorphoVaultV1Adapter(address, client, parameters); + + if (isMorphoMarketV1Adapter) + return fetchVaultV2MorphoMarketV1Adapter(address, client, parameters); + + throw new UnsupportedVaultV2AdapterError(address); +} + +export async function fetchAccrualVaultV2Adapter( + address: Address, + client: Client, + parameters: DeploylessFetchParameters = {}, +) { + parameters.chainId ??= await getChainId(client); + parameters.deployless ??= true; + + const { morphoVaultV1AdapterFactory, morphoMarketV1AdapterFactory } = + getChainAddresses(parameters.chainId); + + const [isMorphoVaultV1Adapter, isMorphoMarketV1Adapter] = await Promise.all([ + morphoVaultV1AdapterFactory + ? readContract(client, { + ...parameters, + address: morphoVaultV1AdapterFactory, + abi: morphoVaultV1AdapterFactoryAbi, + functionName: "isMorphoVaultV1Adapter", + args: [address], + }) + : false, + morphoMarketV1AdapterFactory + ? readContract(client, { + ...parameters, + address: morphoMarketV1AdapterFactory, + abi: morphoMarketV1AdapterFactoryAbi, + functionName: "isMorphoMarketV1Adapter", + args: [address], + }) + : false, + ]); + + if (isMorphoVaultV1Adapter) + return fetchAccrualVaultV2MorphoVaultV1Adapter(address, client, parameters); + + if (isMorphoMarketV1Adapter) + return fetchAccrualVaultV2MorphoMarketV1Adapter( + address, + client, + parameters, + ); + + throw new UnsupportedVaultV2AdapterError(address); +} diff --git a/packages/blue-sdk-viem/src/fetch/vault-v2/VaultV2MorphoMarketV1Adapter.ts b/packages/blue-sdk-viem/src/fetch/vault-v2/VaultV2MorphoMarketV1Adapter.ts new file mode 100644 index 00000000..63e32511 --- /dev/null +++ b/packages/blue-sdk-viem/src/fetch/vault-v2/VaultV2MorphoMarketV1Adapter.ts @@ -0,0 +1,102 @@ +import { + AccrualVaultV2MorphoMarketV1Adapter, + VaultV2MorphoMarketV1Adapter, +} from "@morpho-org/blue-sdk"; +import type { Address, Client } from "viem"; +import { getChainId, readContract } from "viem/actions"; +import { morphoMarketV1AdapterAbi } from "../../abis"; +import { + abi, + code, +} from "../../queries/vault-v2/GetVaultV2MorphoMarketV1Adapter"; +import type { DeploylessFetchParameters } from "../../types"; +import { readContractRestructured } from "../../utils"; +import { fetchAccrualPosition } from "../Position"; + +export async function fetchVaultV2MorphoMarketV1Adapter( + address: Address, + client: Client, + { deployless = true, ...parameters }: DeploylessFetchParameters = {}, +) { + parameters.chainId ??= await getChainId(client); + + if (deployless) { + try { + const adapter = await readContract(client, { + ...parameters, + abi, + code, + functionName: "query", + args: [address], + }); + + return new VaultV2MorphoMarketV1Adapter({ + ...adapter, + marketParamsList: [...adapter.marketParamsList], + address, + }); + } catch { + // Fallback to multicall if deployless call fails. + } + } + + const [parentVault, skimRecipient, marketParamsListLength] = + await Promise.all([ + readContract(client, { + ...parameters, + address, + abi: morphoMarketV1AdapterAbi, + functionName: "parentVault", + }), + readContract(client, { + ...parameters, + address, + abi: morphoMarketV1AdapterAbi, + functionName: "skimRecipient", + }), + readContract(client, { + ...parameters, + address, + abi: morphoMarketV1AdapterAbi, + functionName: "marketParamsListLength", + }), + ]); + + const marketParamsList = await Promise.all( + Array.from({ length: Number(marketParamsListLength) }, (_, i) => + readContractRestructured(client, { + ...parameters, + address, + abi: morphoMarketV1AdapterAbi, + functionName: "marketParamsList", + args: [BigInt(i)], + }), + ), + ); + + return new VaultV2MorphoMarketV1Adapter({ + parentVault, + skimRecipient, + address, + marketParamsList, + }); +} + +export async function fetchAccrualVaultV2MorphoMarketV1Adapter( + address: Address, + client: Client, + parameters: DeploylessFetchParameters = {}, +) { + const adapter = await fetchVaultV2MorphoMarketV1Adapter( + address, + client, + parameters, + ); + const positions = await Promise.all( + adapter.marketParamsList.map((params) => + fetchAccrualPosition(address, params.id, client, parameters), + ), + ); + + return new AccrualVaultV2MorphoMarketV1Adapter(adapter, positions); +} diff --git a/packages/blue-sdk-viem/src/fetch/vault-v2/VaultV2MorphoVaultV1Adapter.ts b/packages/blue-sdk-viem/src/fetch/vault-v2/VaultV2MorphoVaultV1Adapter.ts new file mode 100644 index 00000000..da3ccfbc --- /dev/null +++ b/packages/blue-sdk-viem/src/fetch/vault-v2/VaultV2MorphoVaultV1Adapter.ts @@ -0,0 +1,89 @@ +import { + AccrualVaultV2MorphoVaultV1Adapter, + VaultV2MorphoVaultV1Adapter, +} from "@morpho-org/blue-sdk"; +import { type Address, type Client, erc20Abi } from "viem"; +import { getChainId, readContract } from "viem/actions"; +import { morphoVaultV1AdapterAbi } from "../../abis"; +import { + abi, + code, +} from "../../queries/vault-v2/GetVaultV2MorphoVaultV1Adapter"; +import type { DeploylessFetchParameters } from "../../types"; +import { fetchAccrualVault } from "../Vault"; + +export async function fetchVaultV2MorphoVaultV1Adapter( + address: Address, + client: Client, + { deployless = true, ...parameters }: DeploylessFetchParameters = {}, +) { + parameters.chainId ??= await getChainId(client); + + if (deployless) { + try { + const adapter = await readContract(client, { + ...parameters, + abi, + code, + functionName: "query", + args: [address], + }); + + return new VaultV2MorphoVaultV1Adapter({ ...adapter, address }); + } catch { + // Fallback to multicall if deployless call fails. + } + } + + const [parentVault, skimRecipient, morphoVaultV1] = await Promise.all([ + readContract(client, { + ...parameters, + address, + abi: morphoVaultV1AdapterAbi, + functionName: "parentVault", + }), + readContract(client, { + ...parameters, + address, + abi: morphoVaultV1AdapterAbi, + functionName: "skimRecipient", + }), + readContract(client, { + ...parameters, + address, + abi: morphoVaultV1AdapterAbi, + functionName: "morphoVaultV1", + }), + ]); + + return new VaultV2MorphoVaultV1Adapter({ + morphoVaultV1, + parentVault, + skimRecipient, + address, + }); +} + +export async function fetchAccrualVaultV2MorphoVaultV1Adapter( + address: Address, + client: Client, + parameters: DeploylessFetchParameters = {}, +) { + const adapter = await fetchVaultV2MorphoVaultV1Adapter( + address, + client, + parameters, + ); + const [vaultV1, shares] = await Promise.all([ + fetchAccrualVault(adapter.morphoVaultV1, client, parameters), + readContract(client, { + ...parameters, + address: adapter.morphoVaultV1, + abi: erc20Abi, + functionName: "balanceOf", + args: [adapter.address], + }), + ]); + + return new AccrualVaultV2MorphoVaultV1Adapter(adapter, vaultV1, shares); +} diff --git a/packages/blue-sdk-viem/src/fetch/vault-v2/index.ts b/packages/blue-sdk-viem/src/fetch/vault-v2/index.ts new file mode 100644 index 00000000..cc1d7904 --- /dev/null +++ b/packages/blue-sdk-viem/src/fetch/vault-v2/index.ts @@ -0,0 +1,3 @@ +export * from "./VaultV2"; +export * from "./VaultV2MorphoVaultV1Adapter"; +export * from "./VaultV2Adapter"; diff --git a/packages/blue-sdk-viem/src/queries/index.ts b/packages/blue-sdk-viem/src/queries/index.ts index 1bc4a7ef..56640fcc 100644 --- a/packages/blue-sdk-viem/src/queries/index.ts +++ b/packages/blue-sdk-viem/src/queries/index.ts @@ -2,3 +2,4 @@ export * as GetHolding from "./GetHolding"; export * as GetMarket from "./GetMarket"; export * as GetToken from "./GetToken"; export * as GetVault from "./GetVault"; +export * from "./vault-v2"; diff --git a/packages/blue-sdk-viem/src/queries/vault-v2/GetVaultV2.ts b/packages/blue-sdk-viem/src/queries/vault-v2/GetVaultV2.ts new file mode 100644 index 00000000..b93fb3c6 --- /dev/null +++ b/packages/blue-sdk-viem/src/queries/vault-v2/GetVaultV2.ts @@ -0,0 +1,144 @@ +export const abi = [ + { + inputs: [ + { + internalType: "contract IVaultV2", + name: "vault", + type: "address", + }, + { + internalType: "contract IMorphoVaultV1AdapterFactory", + name: "morphoVaultV1AdapterFactory", + type: "address", + }, + ], + name: "query", + outputs: [ + { + components: [ + { + components: [ + { + internalType: "address", + name: "asset", + type: "address", + }, + { + internalType: "string", + name: "symbol", + type: "string", + }, + { internalType: "string", name: "name", type: "string" }, + { + internalType: "uint256", + name: "decimals", + type: "uint256", + }, + ], + internalType: "struct Token", + name: "token", + type: "tuple", + }, + { internalType: "address", name: "asset", type: "address" }, + { + internalType: "uint256", + name: "totalAssets", + type: "uint256", + }, + { + internalType: "uint128", + name: "_totalAssets", + type: "uint128", + }, + { + internalType: "uint256", + name: "totalSupply", + type: "uint256", + }, + { + internalType: "uint256", + name: "virtualShares", + type: "uint256", + }, + { internalType: "uint64", name: "maxRate", type: "uint64" }, + { + internalType: "uint64", + name: "lastUpdate", + type: "uint64", + }, + { + internalType: "address[]", + name: "adapters", + type: "address[]", + }, + { + internalType: "address", + name: "liquidityAdapter", + type: "address", + }, + { + internalType: "bytes", + name: "liquidityData", + type: "bytes", + }, + { + internalType: "bool", + name: "isLiquidityAdapterKnown", + type: "bool", + }, + { + components: [ + { internalType: "bytes32", name: "id", type: "bytes32" }, + { + internalType: "uint256", + name: "absoluteCap", + type: "uint256", + }, + { + internalType: "uint256", + name: "relativeCap", + type: "uint256", + }, + { + internalType: "uint256", + name: "allocation", + type: "uint256", + }, + ], + internalType: "struct VaultV2Allocation[]", + name: "liquidityAllocations", + type: "tuple[]", + }, + { + internalType: "uint96", + name: "performanceFee", + type: "uint96", + }, + { + internalType: "uint96", + name: "managementFee", + type: "uint96", + }, + { + internalType: "address", + name: "performanceFeeRecipient", + type: "address", + }, + { + internalType: "address", + name: "managementFeeRecipient", + type: "address", + }, + ], + internalType: "struct VaultV2Response", + name: "res", + type: "tuple", + }, + ], + stateMutability: "view", + type: "function", + }, +] as const; + +export const code = + "0x60808060405234601557610f72908161001a8239f35b5f80fdfe60806040526004361015610011575f80fd5b5f3560e01c63f6f030ce14610024575f80fd5b34610861576040366003190112610861576004356001600160a01b0381168103610861576024356001600160a01b0381168103610861576102a060405260405161006d81610dd3565b5f80825260606020808401829052604080850183905282850184905260809490945260a083905260c083905260e08390526101008390526101208390526101408390526101608390526101808290526101a08390526101c08290526101e0839052610200919091526102208290526102408290526102608290526102809190915290516338d52e0f60e01b815290816004816001600160a01b0387165afa90811561086d575f91610d7c575b506040516395d89b4160e01b81525f816004816001600160a01b0388165afa90811561086d575f91610d62575b506040516306fdde0360e01b8152905f826004816001600160a01b0389165afa91821561086d575f92610d3e575b5060405163313ce56760e01b8152916020836004816001600160a01b038a165afa91821561086d575f92610cfd575b60ff9350604051946101b486610dd3565b60018060a01b03168552602085015260408401521660608201526080526040516338d52e0f60e01b815260208160048160018060a01b0387165afa90811561086d575f91610cde575b506001600160a01b0390811660a0526040516278744560e21b8152906020908290600490829087165afa90811561086d575f91610cac575b5060c05260405163ce04bebb60e01b81526020816004816001600160a01b0387165afa801561086d575f90610c63575b6001600160801b031660e052506040516318160ddd60e01b81526020816004816001600160a01b0387165afa90811561086d575f91610c31575b50610100526040516331c6651b60e21b81526020816004816001600160a01b0387165afa90811561086d575f91610bff575b506101205260405163ece1d6e560e01b81526020816004816001600160a01b0387165afa801561086d5767ffffffffffffffff915f91610be0575b50166101405260405163c046371160e01b81526020816004816001600160a01b0387165afa801561086d5767ffffffffffffffff915f91610bb1575b50166101605260405163ad468d1160e01b81526020816004816001600160a01b0387165afa90811561086d575f91610b92575b506001600160a01b039081166101a0526040516305c0524560e31b8152905f908290600490829087165afa90811561086d575f91610b39575b506101c0526040516343bc43c160e11b81526020816004816001600160a01b0387165afa801561086d576001600160601b03915f91610b1a575b50166102205260405163537bfaeb60e11b81526020816004816001600160a01b0387165afa801561086d576001600160601b03915f91610aeb575b50166102405260405163ed27f7c960e01b81526020816004816001600160a01b0387165afa90811561086d575f91610acc575b506001600160a01b03908116610260526040516306d9a30160e41b8152906020908290600490829087165afa90811561086d575f91610aad575b506001600160a01b0390811661028052604051630b54457960e31b8152906020908290600490829087165afa90811561086d575f91610a7b575b506104da81610eef565b6104e76040519182610def565b818152601f196104f683610eef565b01366020830137610180525f5b8181106109f55750506101a051604051632c77566560e01b81526001600160a01b0391821660048201529160209183916024918391165afa90811561086d575f916109ba575b506108da575b61020051515f5b818110610766576040516020815280608051610220602083015260018060a01b0381511661024083015260606105b86105a0602084015160806102608701526102c0860190610daf565b604084015185820361023f1901610280870152610daf565b9101516102a083015260018060a01b0360206080015116604083015260406080015160608301526001600160801b03606060800151166080830152608080015160a083015260a06080015160c083015267ffffffffffffffff60c0608001511660e083015267ffffffffffffffff60e060800151166101008301526101006080015190601f1983820301610120840152602080835192838152019201905f5b8181106107445750506101a0516001600160a01b0316610140840152506101c051828203601f190161016084015261068f9190610daf565b6101e051151561018083015261020051828203601f19016101a08401528051808352602092830192909101905f5b81811061070a57505061022080516001600160601b039081166101c086015261024051166101e0850152610260516001600160a01b03908116610200860152610280511690840152500390f35b91935091602060806001926060875180518352848101518584015260408101516040840152015160608201520194019101918493926106bd565b82516001600160a01b0316845285945060209384019390920191600101610657565b6107768161018060800151610f28565b518051604051632f0374dd60e21b815260048101919091529091906020816024816001600160a01b0389165afa90811561086d575f916108a9575b50602083015281516040519063a68bafa360e01b8252600482015260208160248160018060a01b0389165afa90811561086d575f91610878575b5060408301528151916040519263c69507dd60e01b8452600484015260208360248160018060a01b0389165afa92831561086d575f93610835575b50916060600193015201610556565b92506020833d8211610865575b8161084f60209383610def565b81010312610861579151916060610826565b5f80fd5b3d9150610842565b6040513d5f823e3d90fd5b90506020813d82116108a1575b8161089260209383610def565b8101031261086157515f6107eb565b3d9150610885565b90506020813d82116108d2575b816108c360209383610def565b8101031261086157515f6107b1565b3d91506108b6565b60016101e0526040805191906108f08184610def565b60018352601f1981015f5b81811061098d5750506109879192610180608001525f60018060a01b0361012060800151168251602081019184835260046060830152637468697360e01b6080830152848201526080815261095160a082610def565b5190209180519261096184610dd3565b8352602083018290528201525f6060820152610200519061098182610f07565b52610f07565b5061054f565b602090835161099b81610dd3565b5f81525f838201525f858201525f6060820152828288010152016108fb565b90506020813d6020116109ed575b816109d560209383610def565b8101031261086157518015158103610861575f610549565b3d91506109c8565b6040516313bd406b60e21b815260048101829052906020826024816001600160a01b0389165afa801561086d576001925f91610a4d575b50610a3d8261010060800151610f28565b90838060a01b0316905201610503565b610a6e915060203d8111610a74575b610a668183610def565b810190610e11565b5f610a2c565b503d610a5c565b90506020813d602011610aa5575b81610a9660209383610def565b8101031261086157515f6104d0565b3d9150610a89565b610ac6915060203d602011610a7457610a668183610def565b5f610496565b610ae5915060203d602011610a7457610a668183610def565b5f61045c565b610b0d915060203d602011610b13575b610b058183610def565b810190610ed0565b5f610429565b503d610afb565b610b33915060203d602011610b1357610b058183610def565b5f6103ee565b3d9150815f823e610b4a8282610def565b60208183810103126108615780519067ffffffffffffffff821161086157828101601f838301011215610861576020610b8c9382019280830151920101610e30565b5f6103b4565b610bab915060203d602011610a7457610a668183610def565b5f61037b565b610bd3915060203d602011610bd9575b610bcb8183610def565b810190610eb0565b5f610348565b503d610bc1565b610bf9915060203d602011610bd957610bcb8183610def565b5f61030c565b90506020813d602011610c29575b81610c1a60209383610def565b8101031261086157515f6102d1565b3d9150610c0d565b90506020813d602011610c5b575b81610c4c60209383610def565b8101031261086157515f61029f565b3d9150610c3f565b506020813d602011610ca4575b81610c7d60209383610def565b8101031261086157516001600160801b0381168103610861576001600160801b0390610265565b3d9150610c70565b90506020813d602011610cd6575b81610cc760209383610def565b8101031261086157515f610235565b3d9150610cba565b610cf7915060203d602011610a7457610a668183610def565b5f6101fd565b9150916020813d602011610d36575b81610d1960209383610def565b8101031261086157519160ff831683036108615760ff92916101a3565b3d9150610d0c565b610d5b9192503d805f833e610d538183610def565b810190610e76565b905f610174565b610d7691503d805f833e610d538183610def565b5f610146565b610d95915060203d602011610a7457610a668183610def565b5f610119565b634e487b7160e01b5f52604160045260245ffd5b805180835260209291819084018484015e5f828201840152601f01601f1916010190565b6080810190811067ffffffffffffffff821117610d9b57604052565b90601f8019910116810190811067ffffffffffffffff821117610d9b57604052565b9081602091031261086157516001600160a01b03811681036108615790565b92919267ffffffffffffffff8211610d9b5760405191610e5a601f8201601f191660200184610def565b829481845281830111610861578281602093845f96015e010152565b6020818303126108615780519067ffffffffffffffff821161086157019080601f83011215610861578151610ead92602001610e30565b90565b90816020910312610861575167ffffffffffffffff811681036108615790565b9081602091031261086157516001600160601b03811681036108615790565b67ffffffffffffffff8111610d9b5760051b60200190565b805115610f145760200190565b634e487b7160e01b5f52603260045260245ffd5b8051821015610f145760209160051b01019056fea2646970667358221220e45367a157f9ab8ece06c6677e5f948657d19add613effac28b5bb2d6ba7df5864736f6c634300081b0033"; diff --git a/packages/blue-sdk-viem/src/queries/vault-v2/GetVaultV2MorphoMarketV1Adapter.ts b/packages/blue-sdk-viem/src/queries/vault-v2/GetVaultV2MorphoMarketV1Adapter.ts new file mode 100644 index 00000000..d74c3576 --- /dev/null +++ b/packages/blue-sdk-viem/src/queries/vault-v2/GetVaultV2MorphoMarketV1Adapter.ts @@ -0,0 +1,64 @@ +export const abi = [ + { + inputs: [ + { + internalType: "contract IMorphoMarketV1Adapter", + name: "adapter", + type: "address", + }, + ], + name: "query", + outputs: [ + { + components: [ + { + internalType: "address", + name: "parentVault", + type: "address", + }, + { + internalType: "address", + name: "skimRecipient", + type: "address", + }, + { + components: [ + { + internalType: "address", + name: "loanToken", + type: "address", + }, + { + internalType: "address", + name: "collateralToken", + type: "address", + }, + { + internalType: "address", + name: "oracle", + type: "address", + }, + { internalType: "address", name: "irm", type: "address" }, + { + internalType: "uint256", + name: "lltv", + type: "uint256", + }, + ], + internalType: "struct MarketParams[]", + name: "marketParamsList", + type: "tuple[]", + }, + ], + internalType: "struct VaultV2MorphoMarketV1AdapterResponse", + name: "res", + type: "tuple", + }, + ], + stateMutability: "view", + type: "function", + }, +] as const; + +export const code = + "0x608080604052346015576104a2908161001a8239f35b5f80fdfe6080806040526004361015610012575f80fd5b5f3560e01c63d4fc9fc614610025575f80fd5b346102ca5760203660031901126102ca576004356001600160a01b03811691908290036102ca576060810181811067ffffffffffffffff8211176103c6576040525f815260208101915f83526040820190606082526040516307f1b29b60e11b8152602081600481855afa9081156102d6575f9161038c575b506001600160a01b0316835260405163388af5b560e01b8152602081600481855afa9081156102d6575f91610352575b506001600160a01b0316845260405163b045ff5b60e01b815290602082600481845afa9182156102d6575f9261031e575b5061010d829594939561042c565b61011a60405191826103f6565b828152601f196101298461042c565b015f5b8181106102e157505085525f5b8281106101ef57505060408051602080825293516001600160a01b03908116858301529451909416908401525091516060808301528051608083018190529192839260a0840192909101905f5b818110610194575050500390f35b825180516001600160a01b039081168652602082810151821681880152604080840151831690880152606080840151909216918701919091526080918201519186019190915286955060a09094019390920191600101610186565b604051631f1a892160e11b815260048101829052949593949060a082602481865afa9182156102d6575f92610245575b5061023a816001938751906102348383610444565b52610444565b500194939294610139565b915060a0823d82116102ce575b8161025f60a093836103f6565b810103126102ca5761023a8160019360806040519161027d836103da565b61028681610418565b835261029460208201610418565b60208401526102a560408201610418565b60408401526102b660608201610418565b60608401520151608082015293505061021f565b5f80fd5b3d9150610252565b6040513d5f823e3d90fd5b602090604098969798516102f4816103da565b5f81525f838201525f60408201525f60608201525f6080820152828286010152019695949661012c565b9091506020813d60201161034a575b8161033a602093836103f6565b810103126102ca5751905f6100ff565b3d915061032d565b90506020813d602011610384575b8161036d602093836103f6565b810103126102ca5761037e90610418565b5f6100ce565b3d9150610360565b90506020813d6020116103be575b816103a7602093836103f6565b810103126102ca576103b890610418565b5f61009e565b3d915061039a565b634e487b7160e01b5f52604160045260245ffd5b60a0810190811067ffffffffffffffff8211176103c657604052565b90601f8019910116810190811067ffffffffffffffff8211176103c657604052565b51906001600160a01b03821682036102ca57565b67ffffffffffffffff81116103c65760051b60200190565b80518210156104585760209160051b010190565b634e487b7160e01b5f52603260045260245ffdfea26469706673582212207bc9b43d52db27e875ce34abdf262ca8c42d6dbd8e2ed76189f5a1d102c7c72b64736f6c634300081b0033"; diff --git a/packages/blue-sdk-viem/src/queries/vault-v2/GetVaultV2MorphoVaultV1Adapter.ts b/packages/blue-sdk-viem/src/queries/vault-v2/GetVaultV2MorphoVaultV1Adapter.ts new file mode 100644 index 00000000..7d0ee983 --- /dev/null +++ b/packages/blue-sdk-viem/src/queries/vault-v2/GetVaultV2MorphoVaultV1Adapter.ts @@ -0,0 +1,41 @@ +export const abi = [ + { + inputs: [ + { + internalType: "contract IMorphoVaultV1Adapter", + name: "adapter", + type: "address", + }, + ], + name: "query", + outputs: [ + { + components: [ + { + internalType: "address", + name: "morphoVaultV1", + type: "address", + }, + { + internalType: "address", + name: "parentVault", + type: "address", + }, + { + internalType: "address", + name: "skimRecipient", + type: "address", + }, + ], + internalType: "struct VaultV2MorphoVaultV1AdapterResponse", + name: "res", + type: "tuple", + }, + ], + stateMutability: "view", + type: "function", + }, +] as const; + +export const code = + "0x60808060405234601557610233908161001a8239f35b5f80fdfe6080806040526004361015610012575f80fd5b5f3560e01c63d4fc9fc614610025575f80fd5b346101b85760203660031901126101b8576004356001600160a01b03811691908290036101b8576060810181811067ffffffffffffffff8211176101a4576040525f8152602081015f815260408201905f825260405163e4baaddf60e01b8152602081600481885afa90811561015d575f91610185575b506001600160a01b031683526040516307f1b29b60e11b8152602081600481885afa94851561015d576004956020925f91610168575b506001600160a01b0316835260405163388af5b560e01b815295869182905afa801561015d576060945f9161012e575b506001600160a01b03908116835260408051945182168552915181166020850152915190911690820152f35b610150915060203d602011610156575b61014881836101bc565b8101906101de565b5f610102565b503d61013e565b6040513d5f823e3d90fd5b61017f9150833d85116101565761014881836101bc565b5f6100d2565b61019e915060203d6020116101565761014881836101bc565b5f61009c565b634e487b7160e01b5f52604160045260245ffd5b5f80fd5b90601f8019910116810190811067ffffffffffffffff8211176101a457604052565b908160209103126101b857516001600160a01b03811681036101b8579056fea2646970667358221220fd9fcbe191f71c6b2674137c890f7c627af7976d50ddcbbf29aceffa240e67ec64736f6c634300081b0033"; diff --git a/packages/blue-sdk-viem/src/queries/vault-v2/index.ts b/packages/blue-sdk-viem/src/queries/vault-v2/index.ts new file mode 100644 index 00000000..9c9ad78f --- /dev/null +++ b/packages/blue-sdk-viem/src/queries/vault-v2/index.ts @@ -0,0 +1,2 @@ +export * as GetVaultV2 from "./GetVaultV2"; +export * as GetVaultV2MorphoVaultV1Adapter from "./GetVaultV2MorphoVaultV1Adapter"; diff --git a/packages/blue-sdk-viem/test/MarketParams.test.ts b/packages/blue-sdk-viem/test/MarketParams.test.ts index 1827c27b..a096c494 100644 --- a/packages/blue-sdk-viem/test/MarketParams.test.ts +++ b/packages/blue-sdk-viem/test/MarketParams.test.ts @@ -1,4 +1,4 @@ -import { zeroAddress } from "viem"; +import { encodeAbiParameters, zeroAddress } from "viem"; import { ChainId, @@ -39,4 +39,46 @@ describe("augment/MarketParams", () => { expect(market).toEqual(marketParams); // Not strict equal because not the same class. }); + + test("should decode config from bytes", async () => { + const data = encodeAbiParameters( + [ + { type: "address", name: "loanToken" }, + { type: "address", name: "collateralToken" }, + { type: "address", name: "oracle" }, + { type: "address", name: "irm" }, + { type: "uint256", name: "lltv" }, + ], + [ + usdc_wstEth.loanToken, + usdc_wstEth.collateralToken, + usdc_wstEth.oracle, + usdc_wstEth.irm, + usdc_wstEth.lltv, + ], + ); + + expect(MarketParams.fromHex(data)).toStrictEqual(usdc_wstEth); + }); + + test("should not decode invalid config from bytes", async () => { + const data = encodeAbiParameters( + [ + { type: "address", name: "loanToken" }, + { type: "address", name: "collateralToken" }, + { type: "address", name: "oracle" }, + { type: "uint256", name: "lltv" }, + ], + [ + usdc_wstEth.loanToken, + usdc_wstEth.collateralToken, + usdc_wstEth.oracle, + usdc_wstEth.lltv, + ], + ); + + expect(() => MarketParams.fromHex(data)).toThrow( + `cannot decode valid MarketParams from "${data}"`, + ); + }); }); diff --git a/packages/blue-sdk-viem/test/PreLiquidationPosition.test.ts b/packages/blue-sdk-viem/test/PreLiquidationPosition.test.ts index bfea6fd1..d5188411 100644 --- a/packages/blue-sdk-viem/test/PreLiquidationPosition.test.ts +++ b/packages/blue-sdk-viem/test/PreLiquidationPosition.test.ts @@ -35,7 +35,7 @@ const preLiquidationParams = new PreLiquidationParams({ preLiquidationOracle: "0x008bF4B1cDA0cc9f0e882E0697f036667652E1ef", }); -const preLiquidationAddress = "0x0341b93dcb3b27fd4e2a6890cf06d67f64d9ac8e"; +const preLiquidationAddress = "0x0341B93DCB3b27FD4E2A6890cF06D67f64d9Ac8E"; describe("augment/Position", () => { preLiquidationTest("should fetch position", async ({ client }) => { diff --git a/packages/blue-sdk-viem/test/VaultV2.test.ts b/packages/blue-sdk-viem/test/VaultV2.test.ts new file mode 100644 index 00000000..cb8a9dc1 --- /dev/null +++ b/packages/blue-sdk-viem/test/VaultV2.test.ts @@ -0,0 +1,178 @@ +import { VaultV2, VaultV2MorphoVaultV1Adapter } from "@morpho-org/blue-sdk"; +import { Time } from "@morpho-org/morpho-ts"; +import { encodeFunctionData, parseUnits, zeroAddress } from "viem"; +import { readContract } from "viem/actions"; +import { describe, expect } from "vitest"; +import { vaultV2Abi } from "../src"; +import { + fetchAccrualVaultV2, + fetchVaultV2, +} from "../src/fetch/vault-v2/VaultV2"; +import { vaultV2Test } from "./setup"; + +const vaultV2Address = "0xfDE48B9B8568189f629Bc5209bf5FA826336557a"; + +describe("AccrualVaultV2", () => { + vaultV2Test("should accrue interest", async ({ client }) => { + const managementFee = parseUnits("2", 16) / Time.s.from.y(1n); + const performanceFee = parseUnits("5", 16); + + const owner = await readContract(client, { + address: vaultV2Address, + abi: vaultV2Abi, + functionName: "owner", + }); + await client.deal({ account: owner, amount: BigInt(1e18) }); + + const timelockedMulticall = [ + { + functionName: "setCurator", + args: [owner], + }, + { + functionName: "setManagementFeeRecipient", + args: [owner], + }, + { + functionName: "setPerformanceFeeRecipient", + args: [owner], + }, + { + functionName: "setManagementFee", + args: [managementFee], + }, + { + functionName: "setPerformanceFee", + args: [performanceFee], + }, + ] as const; + + await client.writeContract({ + address: vaultV2Address, + abi: vaultV2Abi, + functionName: "multicall", + account: owner, + args: [ + timelockedMulticall.flatMap((timelockedCall) => { + const encoded = encodeFunctionData({ + abi: vaultV2Abi, + ...timelockedCall, + }); + + return [ + encodeFunctionData({ + abi: vaultV2Abi, + functionName: "submit", + args: [encoded], + }), + encoded, + ]; + }), + ], + }); + + const vaultV2 = await fetchAccrualVaultV2(vaultV2Address, client); + + expect(vaultV2.managementFee).toEqual(managementFee); + expect(vaultV2.performanceFee).toEqual(performanceFee); + + await client.mine({ blocks: 1_000_000 }); + + const block = await client.getBlock({ blockTag: "latest" }); + + const { vault: accruedVaultV2 } = vaultV2.accrueInterest(block.timestamp); + const [expectedTotalAssets, performanceFeeShares, managementFeeShares] = + await readContract(client, { + address: vaultV2Address, + abi: vaultV2Abi, + functionName: "accrueInterestView", + blockNumber: block.number, + }); + + expect(accruedVaultV2.totalAssets).toEqual(expectedTotalAssets); + expect(accruedVaultV2.totalSupply).toEqual( + vaultV2.totalSupply + performanceFeeShares + managementFeeShares, + ); + expect(accruedVaultV2.lastUpdate).toEqual(block.timestamp); + }); + + describe("should fetch vault V2", () => { + vaultV2Test("with deployless reads", async ({ client }) => { + const expectedData = new VaultV2({ + adapters: ["0x2C32fF5E1d976015AdbeA8cC73c7Da3A6677C25F"], + address: vaultV2Address, + asset: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", + decimals: 18, + lastUpdate: 1758881557n, + liquidityAdapter: "0x2C32fF5E1d976015AdbeA8cC73c7Da3A6677C25F", + liquidityData: "0x", + liquidityAllocations: [ + { + id: VaultV2MorphoVaultV1Adapter.adapterId( + "0x2C32fF5E1d976015AdbeA8cC73c7Da3A6677C25F", + ), + absoluteCap: 1000000000000n, + relativeCap: 1000000000000000000n, + allocation: 16980381n, + }, + ], + managementFee: 0n, + managementFeeRecipient: zeroAddress, + maxRate: 0n, + name: "test Vault USDC", + performanceFee: 0n, + performanceFeeRecipient: zeroAddress, + symbol: "tvUSDC", + totalAssets: 16963835n, + _totalAssets: 16963835n, + totalSupply: 16963835000000000000n, + virtualShares: 1000000000000n, + }); + + const value = await fetchVaultV2(vaultV2Address, client, { + deployless: true, + }); + + expect(value).toStrictEqual(expectedData); + }); + + vaultV2Test("with multicall", async ({ client }) => { + const expectedData = new VaultV2({ + adapters: ["0x2C32fF5E1d976015AdbeA8cC73c7Da3A6677C25F"], + address: vaultV2Address, + asset: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", + decimals: 18, + lastUpdate: 1758881557n, + liquidityAdapter: "0x2C32fF5E1d976015AdbeA8cC73c7Da3A6677C25F", + liquidityData: "0x", + liquidityAllocations: [ + { + id: VaultV2MorphoVaultV1Adapter.adapterId( + "0x2C32fF5E1d976015AdbeA8cC73c7Da3A6677C25F", + ), + absoluteCap: 1000000000000n, + relativeCap: 1000000000000000000n, + allocation: 16980381n, + }, + ], + managementFee: 0n, + managementFeeRecipient: zeroAddress, + maxRate: 0n, + name: "test Vault USDC", + performanceFee: 0n, + performanceFeeRecipient: zeroAddress, + symbol: "tvUSDC", + totalAssets: 16963835n, + _totalAssets: 16963835n, + totalSupply: 16963835000000000000n, + virtualShares: 1000000000000n, + }); + + const value = await fetchVaultV2(vaultV2Address, client, { + deployless: false, + }); + + expect(value).toStrictEqual(expectedData); + }); + }); +}); diff --git a/packages/blue-sdk-viem/test/VaultV2Adapter.test.ts b/packages/blue-sdk-viem/test/VaultV2Adapter.test.ts new file mode 100644 index 00000000..3985343b --- /dev/null +++ b/packages/blue-sdk-viem/test/VaultV2Adapter.test.ts @@ -0,0 +1,435 @@ +import { + AccrualVaultV2, + CapacityLimitReason, + MathLib, + VaultV2MorphoMarketV1Adapter, + VaultV2MorphoVaultV1Adapter, +} from "@morpho-org/blue-sdk"; +import { + encodeAbiParameters, + encodeFunctionData, + parseEther, + parseUnits, + zeroAddress, +} from "viem"; +import { readContract } from "viem/actions"; +import { describe, expect } from "vitest"; +import { fetchAccrualVaultV2, fetchVaultV2Adapter, vaultV2Abi } from "../src"; +import { vaultV2Test } from "./setup"; + +// VaultV2 with liquidity adapter vaultV1 +const vaultV2Address = "0xfDE48B9B8568189f629Bc5209bf5FA826336557a"; +const vaultV2AdapterVaultV1Address = + "0x2C32fF5E1d976015AdbeA8cC73c7Da3A6677C25F"; +const allocator = "0xc0267A5Fa9aaaf1694283c013CBFA925BCdb5dE8"; +const curator = "0xc0267A5Fa9aaaf1694283c013CBFA925BCdb5dE8"; + +const expectedDataVaultV1Adapter = new VaultV2MorphoVaultV1Adapter({ + morphoVaultV1: "0xbeeF010f9cb27031ad51e3333f9aF9C6B1228183", + address: vaultV2AdapterVaultV1Address, + parentVault: vaultV2Address, + skimRecipient: zeroAddress, +}); + +// VaultV2 with liquidity adapter marketV1 +const vaultV2Address2 = "0x678b8851DFcA08E40F3e31C8ABd08dE3E8E14b64"; +const vaultV2AdapterMarketV1Address = + "0x83831b31f225B3DD0e96C69D683606bE399Dc757"; + +const expectedDataMarketV1Adapter = new VaultV2MorphoMarketV1Adapter({ + address: vaultV2AdapterMarketV1Address, + parentVault: vaultV2Address2, + skimRecipient: zeroAddress, + marketParamsList: [], +}); + +describe("VaultV2Adapter", () => { + describe("should fetch vaultV1 adapter", () => { + vaultV2Test("with deployless reads", async ({ client }) => { + const value = await fetchVaultV2Adapter( + vaultV2AdapterVaultV1Address, + client, + { + deployless: true, + }, + ); + + expect(value).toStrictEqual(expectedDataVaultV1Adapter); + }); + + vaultV2Test("with multicall", async ({ client }) => { + const value = await fetchVaultV2Adapter( + vaultV2AdapterVaultV1Address, + client, + { + deployless: false, + }, + ); + + expect(value).toStrictEqual(expectedDataVaultV1Adapter); + }); + }); + + describe("should fetch marketV1 adapter", () => { + vaultV2Test("with deployless reads", async ({ client }) => { + const value = await fetchVaultV2Adapter( + vaultV2AdapterMarketV1Address, + client, + { + deployless: true, + }, + ); + + expect(value).toStrictEqual(expectedDataMarketV1Adapter); + }); + + vaultV2Test("with multicall", async ({ client }) => { + const value = await fetchVaultV2Adapter( + vaultV2AdapterMarketV1Address, + client, + { + deployless: false, + }, + ); + + expect(value).toStrictEqual(expectedDataMarketV1Adapter); + }); + }); +}); + +describe("LiquidityAdapter vaultV1", () => { + describe("maxDeposit function", () => { + vaultV2Test("should be limited by absolute cap", async ({ client }) => { + const accrualVaultV2 = await fetchAccrualVaultV2(vaultV2Address, client); + + const [absoluteCap, allocation] = await Promise.all([ + readContract(client, { + address: vaultV2Address, + abi: vaultV2Abi, + functionName: "absoluteCap", + args: [ + VaultV2MorphoVaultV1Adapter.adapterId(vaultV2AdapterVaultV1Address), + ], + }), + readContract(client, { + address: vaultV2Address, + abi: vaultV2Abi, + functionName: "allocation", + args: [ + VaultV2MorphoVaultV1Adapter.adapterId(vaultV2AdapterVaultV1Address), + ], + }), + ]); + + const depositAmount = parseUnits("2000000", 6); // 1M + const result = accrualVaultV2.maxDeposit(depositAmount); + + expect(result).toStrictEqual({ + value: absoluteCap - allocation, + limiter: CapacityLimitReason.vaultV2_absoluteCap, + }); + }); + + vaultV2Test("should be limited by relative cap", async ({ client }) => { + await client.deal({ + account: curator, + amount: parseEther("1"), + }); + const idData = encodeAbiParameters( + [{ type: "string" }, { type: "address" }], + ["this", vaultV2AdapterVaultV1Address], + ); + const data = encodeFunctionData({ + abi: vaultV2Abi, + functionName: "decreaseRelativeCap", + args: [idData, parseEther("200000")], + }); + await client.writeContract({ + account: curator, + address: vaultV2Address, + abi: vaultV2Abi, + functionName: "submit", + args: [data], + }); + await client.writeContract({ + account: curator, + address: vaultV2Address, + abi: vaultV2Abi, + functionName: "decreaseRelativeCap", + args: [idData, 1n], + }); + + const accrualVaultV2 = await fetchAccrualVaultV2(vaultV2Address, client); + + const depositAmount = parseUnits("100000", 6); // 100K + const result = accrualVaultV2.maxDeposit(depositAmount); + + expect(result).toStrictEqual({ + value: 0n, + limiter: CapacityLimitReason.vaultV2_relativeCap, + }); + }); + + vaultV2Test("should be limited by metamorpho", async ({ client }) => { + await client.deal({ + account: curator, + amount: parseEther("1"), + }); + const idData = encodeAbiParameters( + [{ type: "string" }, { type: "address" }], + ["this", vaultV2AdapterVaultV1Address], + ); + const data = encodeFunctionData({ + abi: vaultV2Abi, + functionName: "increaseAbsoluteCap", + args: [idData, parseEther("200000")], + }); + await client.writeContract({ + account: curator, + address: vaultV2Address, + abi: vaultV2Abi, + functionName: "submit", + args: [data], + }); + + await client.writeContract({ + account: curator, + address: vaultV2Address, + abi: vaultV2Abi, + functionName: "increaseAbsoluteCap", + args: [idData, parseEther("200000")], + }); + + const accrualVaultV2 = await fetchAccrualVaultV2(vaultV2Address, client); + + const result = accrualVaultV2.maxDeposit(MathLib.MAX_UINT_256); + expect(result).toStrictEqual({ + value: 1000301472035887388n, + limiter: CapacityLimitReason.cap, + }); + }); + }); + + describe("maxWithdraw function", () => { + vaultV2Test( + "should be limited by liquidity when assets > liquidity", + async ({ client }) => { + const accrualVaultV2 = await fetchAccrualVaultV2( + vaultV2Address, + client, + ); + + const shares = parseUnits("1000000", 18); // 1M shares + const result = accrualVaultV2.maxWithdraw(shares); + + expect(result).toStrictEqual({ + value: 17023088n, + limiter: CapacityLimitReason.liquidity, + }); + }, + ); + + vaultV2Test( + "should be limited by balance when assets <= liquidity", + async ({ client }) => { + const accrualVaultV2 = await fetchAccrualVaultV2( + vaultV2Address, + client, + ); + + const shares = parseUnits("10", 18); // 10 shares + const result = accrualVaultV2.maxWithdraw(shares); + + expect(result).toStrictEqual({ + value: accrualVaultV2.toAssets(shares), + limiter: CapacityLimitReason.balance, + }); + }, + ); + }); +}); + +describe("LiquidityAdapter marketV1", () => { + describe("maxDeposit function", () => { + vaultV2Test("should be limited by balance", async ({ client }) => { + await client.writeContract({ + account: "0x707D44b65BA91C42f212e8bB61f71cc69fBf8fd7", + address: vaultV2Address2, + abi: vaultV2Abi, + functionName: "setCurator", + args: [curator], + }); + const data = encodeFunctionData({ + abi: vaultV2Abi, + functionName: "setIsAllocator", + args: [allocator, true], + }); + await client.writeContract({ + account: curator, + address: vaultV2Address2, + abi: vaultV2Abi, + functionName: "submit", + args: [data], + }); + await client.writeContract({ + account: "0x707D44b65BA91C42f212e8bB61f71cc69fBf8fd7", + address: vaultV2Address2, + abi: vaultV2Abi, + functionName: "setIsAllocator", + args: [allocator, true], + }); + await client.writeContract({ + account: allocator, + address: vaultV2Address2, + abi: vaultV2Abi, + functionName: "setLiquidityAdapterAndData", + args: [vaultV2AdapterMarketV1Address, "0x"], + }); + const accrualVaultV2 = await fetchAccrualVaultV2(vaultV2Address, client); + + const assets = parseUnits("100000", 6); // 100K assets + const result = accrualVaultV2.maxDeposit(assets); + expect(result).toStrictEqual({ + value: assets, + limiter: CapacityLimitReason.balance, + }); + }); + }); + + describe("maxWithdraw function", () => { + vaultV2Test("should be limited by balance", async ({ client }) => { + await client.writeContract({ + account: "0x707D44b65BA91C42f212e8bB61f71cc69fBf8fd7", + address: vaultV2Address2, + abi: vaultV2Abi, + functionName: "setCurator", + args: [curator], + }); + const data = encodeFunctionData({ + abi: vaultV2Abi, + functionName: "setIsAllocator", + args: [allocator, true], + }); + await client.writeContract({ + account: curator, + address: vaultV2Address2, + abi: vaultV2Abi, + functionName: "submit", + args: [data], + }); + await client.writeContract({ + account: "0x707D44b65BA91C42f212e8bB61f71cc69fBf8fd7", + address: vaultV2Address2, + abi: vaultV2Abi, + functionName: "setIsAllocator", + args: [allocator, true], + }); + await client.writeContract({ + account: allocator, + address: vaultV2Address2, + abi: vaultV2Abi, + functionName: "setLiquidityAdapterAndData", + args: [vaultV2AdapterMarketV1Address, "0x"], + }); + const accrualVaultV2 = await fetchAccrualVaultV2(vaultV2Address, client); + + const shares = parseUnits("100000", 6); // 100K shares + const result = accrualVaultV2.maxWithdraw(shares); + expect(result).toStrictEqual({ + value: 0n, + limiter: CapacityLimitReason.balance, + }); + }); + }); +}); + +describe("LiquidityAdapter zero address", () => { + vaultV2Test( + "should deposit full amount when liquidityAdapter is zero address", + async ({ client }) => { + // Set liquidity adapter to zero address + await client.writeContract({ + account: allocator, + address: vaultV2Address, + abi: vaultV2Abi, + functionName: "setLiquidityAdapterAndData", + args: [zeroAddress, "0x"], + }); + + const accrualVaultV2 = await fetchAccrualVaultV2(vaultV2Address, client); + + const result = accrualVaultV2.maxDeposit(MathLib.MAX_UINT_256); + expect(result).toStrictEqual({ + value: MathLib.MAX_UINT_256, + limiter: CapacityLimitReason.balance, + }); + }, + ); + + vaultV2Test( + "should withdraw full amount when liquidityAdapter is zero address", + async ({ client }) => { + // Set liquidity adapter to zero address + await client.writeContract({ + account: allocator, + address: vaultV2Address, + abi: vaultV2Abi, + functionName: "setLiquidityAdapterAndData", + args: [zeroAddress, "0x"], + }); + + const accrualVaultV2 = await fetchAccrualVaultV2(vaultV2Address, client); + + const shares = parseUnits("100", 18); + const result = accrualVaultV2.maxWithdraw(shares); + + expect(result).toStrictEqual({ + value: accrualVaultV2.toAssets(shares), + limiter: CapacityLimitReason.balance, + }); + }, + ); +}); + +describe("LiquidityAdapter undefined", () => { + vaultV2Test( + "should throw error for undefined liquidity adapter", + async ({ client }) => { + const accrualVaultV2 = await fetchAccrualVaultV2(vaultV2Address, client); + + const modified1AccrualVaultV2 = new AccrualVaultV2( + accrualVaultV2, + undefined, + accrualVaultV2.accrualAdapters, + accrualVaultV2.assetBalance, + ); + + const depositAmount = parseUnits("1000", 6); + expect(() => modified1AccrualVaultV2.maxDeposit(depositAmount)).toThrow( + "unsupported liquidity adapter", + ); + }, + ); + + vaultV2Test( + "should throw error for undefined liquidity allocations", + async ({ client }) => { + const accrualVaultV2 = await fetchAccrualVaultV2(vaultV2Address, client); + + const modified1AccrualVaultV2 = new AccrualVaultV2( + { + ...accrualVaultV2, + liquidityAllocations: undefined, + }, + accrualVaultV2.accrualLiquidityAdapter, + accrualVaultV2.accrualAdapters, + accrualVaultV2.assetBalance, + ); + + const depositAmount = parseUnits("1000", 6); + expect(() => modified1AccrualVaultV2.maxDeposit(depositAmount)).toThrow( + "unsupported liquidity adapter", + ); + }, + ); +}); diff --git a/packages/blue-sdk-viem/test/setup.ts b/packages/blue-sdk-viem/test/setup.ts index e6a36c5a..3e229d85 100644 --- a/packages/blue-sdk-viem/test/setup.ts +++ b/packages/blue-sdk-viem/test/setup.ts @@ -1,5 +1,5 @@ import { createViemTest } from "@morpho-org/test/vitest"; -import { mainnet } from "viem/chains"; +import { base, mainnet } from "viem/chains"; /** * This test will run on `mainnet` forked at block `19,530,000`. @@ -24,3 +24,8 @@ export const preLiquidationTest = createViemTest(mainnet, { forkUrl: process.env.MAINNET_RPC_URL, forkBlockNumber: 21_950_000, }); + +export const vaultV2Test = createViemTest(base, { + forkUrl: process.env.BASE_RPC_URL, + forkBlockNumber: 36_870_000, +}); diff --git a/packages/blue-sdk-wagmi/package.json b/packages/blue-sdk-wagmi/package.json index 6efce099..6e56b107 100644 --- a/packages/blue-sdk-wagmi/package.json +++ b/packages/blue-sdk-wagmi/package.json @@ -43,7 +43,7 @@ "react": "^19.0.0", "react-dom": "^19.0.0", "typescript": "^5.7.2", - "viem": "^2.23.0", + "viem": "^2.33.3", "vitest": "^3.0.5", "wagmi": "^2.14.10" }, diff --git a/packages/blue-sdk-wagmi/src/hooks/index.ts b/packages/blue-sdk-wagmi/src/hooks/index.ts index 1c812620..695be83c 100644 --- a/packages/blue-sdk-wagmi/src/hooks/index.ts +++ b/packages/blue-sdk-wagmi/src/hooks/index.ts @@ -20,3 +20,7 @@ export * from "./usePositions.js"; export * from "./useHoldings.js"; export * from "./useVaultMarketConfigs.js"; export * from "./useReadContracts.js"; +export * from "./useVaultV2.js"; +export * from "./useVaultV2s.js"; +export * from "./useVaultV2Adapter.js"; +export * from "./useVaultV2Adapters.js"; diff --git a/packages/blue-sdk-wagmi/src/hooks/useVaultV2.ts b/packages/blue-sdk-wagmi/src/hooks/useVaultV2.ts new file mode 100644 index 00000000..9806fc8f --- /dev/null +++ b/packages/blue-sdk-wagmi/src/hooks/useVaultV2.ts @@ -0,0 +1,55 @@ +import type { VaultV2 } from "@morpho-org/blue-sdk"; +import type { ReadContractErrorType } from "viem"; +import { type Config, type ResolvedRegister, useConfig } from "wagmi"; +import { type UseQueryReturnType, useQuery } from "wagmi/query"; +import { + type FetchVaultV2Parameters, + type FetchVaultV2QueryKey, + fetchVaultV2QueryOptions, +} from "../queries/fetchVaultV2.js"; +import type { ConfigParameter, QueryParameter } from "../types/index.js"; +import { replaceDeepEqual } from "../utils/index.js"; +import { useChainId } from "./useChainId.js"; + +export type UseVaultV2Parameters< + config extends Config = Config, + selectData = VaultV2, +> = FetchVaultV2Parameters & + ConfigParameter & + QueryParameter< + VaultV2, + ReadContractErrorType, + selectData, + FetchVaultV2QueryKey + >; + +export type UseVaultV2ReturnType = UseQueryReturnType< + selectData, + ReadContractErrorType +>; + +export function useVaultV2< + config extends Config = ResolvedRegister["config"], + selectData = VaultV2, +>({ + query = {}, + ...parameters +}: UseVaultV2Parameters): UseVaultV2ReturnType { + const config = useConfig(parameters); + const chainId = useChainId(parameters); + + const options = fetchVaultV2QueryOptions(config, { + ...parameters, + chainId, + }); + + return useQuery({ + ...query, + ...options, + enabled: parameters.vaultV2 != null && query.enabled, + structuralSharing: query.structuralSharing ?? replaceDeepEqual, + staleTime: + query.staleTime ?? + (parameters.blockNumber != null ? Number.POSITIVE_INFINITY : undefined), + }); +} diff --git a/packages/blue-sdk-wagmi/src/hooks/useVaultV2Adapter.ts b/packages/blue-sdk-wagmi/src/hooks/useVaultV2Adapter.ts new file mode 100644 index 00000000..40b230ca --- /dev/null +++ b/packages/blue-sdk-wagmi/src/hooks/useVaultV2Adapter.ts @@ -0,0 +1,56 @@ +import type { VaultV2Adapter } from "@morpho-org/blue-sdk"; +import type { ReadContractErrorType } from "viem"; +import { type Config, type ResolvedRegister, useConfig } from "wagmi"; +import { type UseQueryReturnType, useQuery } from "wagmi/query"; +import { + type FetchVaultV2AdapterParameters, + type FetchVaultV2AdapterQueryKey, + fetchVaultV2AdapterQueryOptions, +} from "../queries/fetchVaultV2Adapter.js"; +import type { ConfigParameter, QueryParameter } from "../types/index.js"; +import { replaceDeepEqual } from "../utils/index.js"; +import { useChainId } from "./useChainId.js"; + +export type UseVaultV2AdapterParameters< + config extends Config = Config, + selectData = VaultV2Adapter, +> = FetchVaultV2AdapterParameters & + ConfigParameter & + QueryParameter< + VaultV2Adapter, + ReadContractErrorType, + selectData, + FetchVaultV2AdapterQueryKey + >; + +export type UseVaultV2AdapterReturnType = + UseQueryReturnType; + +export function useVaultV2Adapter< + config extends Config = ResolvedRegister["config"], + selectData = VaultV2Adapter, +>({ + query = {}, + ...parameters +}: UseVaultV2AdapterParameters< + config, + selectData +>): UseVaultV2AdapterReturnType { + const config = useConfig(parameters); + const chainId = useChainId(parameters); + + const options = fetchVaultV2AdapterQueryOptions(config, { + ...parameters, + chainId, + }); + + return useQuery({ + ...query, + ...options, + enabled: parameters.vaultV2Adapter != null && query.enabled, + structuralSharing: query.structuralSharing ?? replaceDeepEqual, + staleTime: + query.staleTime ?? + (parameters.blockNumber != null ? Number.POSITIVE_INFINITY : undefined), + }); +} diff --git a/packages/blue-sdk-wagmi/src/hooks/useVaultV2Adapters.ts b/packages/blue-sdk-wagmi/src/hooks/useVaultV2Adapters.ts new file mode 100644 index 00000000..442d18b3 --- /dev/null +++ b/packages/blue-sdk-wagmi/src/hooks/useVaultV2Adapters.ts @@ -0,0 +1,86 @@ +import { isDefined } from "@morpho-org/morpho-ts"; +import { useQueries } from "@tanstack/react-query"; +import { useRef } from "react"; +import type { Address, UnionOmit } from "viem"; +import { type Config, type ResolvedRegister, useConfig } from "wagmi"; +import { + type VaultV2AdapterParameters, + fetchVaultV2AdapterQueryOptions, +} from "../queries/fetchVaultV2Adapter.js"; +import type { UseIndexedQueriesReturnType } from "../types/index.js"; +import { replaceDeepEqual } from "../utils/index.js"; +import { useChainId } from "./useChainId.js"; +import type { + UseVaultV2AdapterParameters, + UseVaultV2AdapterReturnType, +} from "./useVaultV2Adapter.js"; + +export type FetchVaultV2AdaptersParameters = { + vaultV2Adapters: Iterable
; +}; + +export type UseVaultV2AdaptersParameters = + FetchVaultV2AdaptersParameters & + UnionOmit< + UseVaultV2AdapterParameters, + keyof VaultV2AdapterParameters + >; + +export type UseVaultV2AdaptersReturnType = UseIndexedQueriesReturnType< + Address, + UseVaultV2AdapterReturnType +>; + +export function useVaultV2Adapters< + config extends Config = ResolvedRegister["config"], +>({ + vaultV2Adapters, + query = {}, + ...parameters +}: UseVaultV2AdaptersParameters): UseVaultV2AdaptersReturnType { + const config = useConfig(parameters); + const chainId = useChainId(parameters); + + const uniqueVaultV2Adapters = new Set(vaultV2Adapters); + + const orderedResults = useQueries({ + queries: Array.from(uniqueVaultV2Adapters, (vaultV2Adapter) => ({ + ...query, + ...fetchVaultV2AdapterQueryOptions(config, { + ...parameters, + vaultV2Adapter, + chainId, + }), + enabled: vaultV2Adapter != null && query.enabled, + structuralSharing: query.structuralSharing ?? replaceDeepEqual, + staleTime: + query.staleTime ?? + (parameters.blockNumber != null ? Number.POSITIVE_INFINITY : undefined), + })), + }); + + const result: UseVaultV2AdaptersReturnType = { + data: {}, + error: {}, + isFetching: {}, + isFetchingAny: false, + }; + + uniqueVaultV2Adapters + .values() + .filter(isDefined) + .forEach((vaultV2, index) => { + const { data, error, isFetching } = orderedResults[index]!; + + result.data[vaultV2] = data; + result.error[vaultV2] = error; + result.isFetching[vaultV2] = isFetching; + + if (isFetching) result.isFetchingAny = true; + }); + + const resultRef = useRef(result); + resultRef.current = replaceDeepEqual(resultRef.current, result); + + return resultRef.current; +} diff --git a/packages/blue-sdk-wagmi/src/hooks/useVaultV2s.ts b/packages/blue-sdk-wagmi/src/hooks/useVaultV2s.ts new file mode 100644 index 00000000..94038fbb --- /dev/null +++ b/packages/blue-sdk-wagmi/src/hooks/useVaultV2s.ts @@ -0,0 +1,83 @@ +import { isDefined } from "@morpho-org/morpho-ts"; +import { useQueries } from "@tanstack/react-query"; +import { useRef } from "react"; +import type { Address, UnionOmit } from "viem"; +import { type Config, type ResolvedRegister, useConfig } from "wagmi"; +import { + type VaultV2Parameters, + fetchVaultV2QueryOptions, +} from "../queries/fetchVaultV2.js"; +import type { UseIndexedQueriesReturnType } from "../types/index.js"; +import { replaceDeepEqual } from "../utils/index.js"; +import { useChainId } from "./useChainId.js"; +import type { + UseVaultV2Parameters, + UseVaultV2ReturnType, +} from "./useVaultV2.js"; + +export type FetchVaultV2sParameters = { + vaultV2s: Iterable
; +}; + +export type UseVaultV2sParameters = + FetchVaultV2sParameters & + UnionOmit, keyof VaultV2Parameters>; + +export type UseVaultV2sReturnType = UseIndexedQueriesReturnType< + Address, + UseVaultV2ReturnType +>; + +export function useVaultV2s< + config extends Config = ResolvedRegister["config"], +>({ + vaultV2s, + query = {}, + ...parameters +}: UseVaultV2sParameters): UseVaultV2sReturnType { + const config = useConfig(parameters); + const chainId = useChainId(parameters); + + const uniqueVaultV2s = new Set(vaultV2s); + + const orderedResults = useQueries({ + queries: Array.from(uniqueVaultV2s, (vaultV2) => ({ + ...query, + ...fetchVaultV2QueryOptions(config, { + ...parameters, + vaultV2, + chainId, + }), + enabled: vaultV2 != null && query.enabled, + structuralSharing: query.structuralSharing ?? replaceDeepEqual, + staleTime: + query.staleTime ?? + (parameters.blockNumber != null ? Number.POSITIVE_INFINITY : undefined), + })), + }); + + const result: UseVaultV2sReturnType = { + data: {}, + error: {}, + isFetching: {}, + isFetchingAny: false, + }; + + uniqueVaultV2s + .values() + .filter(isDefined) + .forEach((vaultV2, index) => { + const { data, error, isFetching } = orderedResults[index]!; + + result.data[vaultV2] = data; + result.error[vaultV2] = error; + result.isFetching[vaultV2] = isFetching; + + if (isFetching) result.isFetchingAny = true; + }); + + const resultRef = useRef(result); + resultRef.current = replaceDeepEqual(resultRef.current, result); + + return resultRef.current; +} diff --git a/packages/blue-sdk-wagmi/src/queries/fetchHolding.ts b/packages/blue-sdk-wagmi/src/queries/fetchHolding.ts index 60bbc2ad..6095b8ea 100644 --- a/packages/blue-sdk-wagmi/src/queries/fetchHolding.ts +++ b/packages/blue-sdk-wagmi/src/queries/fetchHolding.ts @@ -24,8 +24,8 @@ export function fetchHoldingQueryOptions( // https://tkdodo.eu/blog/why-you-want-react-query#bonus-cancellation async queryFn({ queryKey }) { const { user, token, chainId, ...parameters } = queryKey[1]; - if (!user) throw Error("user is required"); - if (!token) throw Error("token is required"); + if (user == null) throw Error("user is required"); + if (token == null) throw Error("token is required"); return fetchHolding(user, token, config.getClient({ chainId }), { chainId, diff --git a/packages/blue-sdk-wagmi/src/queries/fetchToken.ts b/packages/blue-sdk-wagmi/src/queries/fetchToken.ts index e6fb9ef9..3d58c90c 100644 --- a/packages/blue-sdk-wagmi/src/queries/fetchToken.ts +++ b/packages/blue-sdk-wagmi/src/queries/fetchToken.ts @@ -24,7 +24,7 @@ export function fetchTokenQueryOptions( // https://tkdodo.eu/blog/why-you-want-react-query#bonus-cancellation async queryFn({ queryKey }) { const { token, chainId, ...parameters } = queryKey[1]; - if (!token) throw Error("token is required"); + if (token == null) throw Error("token is required"); return fetchToken(token, config.getClient({ chainId }), { chainId, diff --git a/packages/blue-sdk-wagmi/src/queries/fetchVaultV2.ts b/packages/blue-sdk-wagmi/src/queries/fetchVaultV2.ts new file mode 100644 index 00000000..4d2c5d5f --- /dev/null +++ b/packages/blue-sdk-wagmi/src/queries/fetchVaultV2.ts @@ -0,0 +1,67 @@ +import type { VaultV2 } from "@morpho-org/blue-sdk"; +import { + type DeploylessFetchParameters, + fetchVaultV2, +} from "@morpho-org/blue-sdk-viem"; +import type { QueryOptions } from "@tanstack/query-core"; +import type { Address, ReadContractErrorType } from "viem"; +import type { Config } from "wagmi"; +import { hashFn } from "wagmi/query"; + +export type VaultV2Parameters = { + vaultV2: Address; +}; + +export type FetchVaultV2Parameters = Partial & + DeploylessFetchParameters; + +export function fetchVaultV2QueryOptions( + config: config, + parameters: FetchVaultV2Parameters, +) { + return { + // TODO: Support `signal` once Viem actions allow passthrough + // https://tkdodo.eu/blog/why-you-want-react-query#bonus-cancellation + async queryFn({ queryKey }) { + const { vaultV2, chainId, ...parameters } = queryKey[1]; + if (!vaultV2) throw Error("vaultV2 is required"); + + return fetchVaultV2(vaultV2, config.getClient({ chainId }), { + chainId, + ...parameters, + }); + }, + queryKey: fetchVaultV2QueryKey(parameters), + queryKeyHashFn: hashFn, // for bigint support + } as const satisfies QueryOptions< + VaultV2, + ReadContractErrorType, + VaultV2, + FetchVaultV2QueryKey + >; +} + +export function fetchVaultV2QueryKey({ + vaultV2, + chainId, + blockTag, + blockNumber, + deployless, + account, + stateOverride, +}: FetchVaultV2Parameters) { + return [ + "fetchVaultV2", + { + vaultV2, + chainId, + blockTag, + blockNumber, + deployless, + account, + stateOverride, + } as FetchVaultV2Parameters, + ] as const; +} + +export type FetchVaultV2QueryKey = ReturnType; diff --git a/packages/blue-sdk-wagmi/src/queries/fetchVaultV2Adapter.ts b/packages/blue-sdk-wagmi/src/queries/fetchVaultV2Adapter.ts new file mode 100644 index 00000000..088476de --- /dev/null +++ b/packages/blue-sdk-wagmi/src/queries/fetchVaultV2Adapter.ts @@ -0,0 +1,73 @@ +import type { VaultV2Adapter } from "@morpho-org/blue-sdk"; +import { + type DeploylessFetchParameters, + fetchVaultV2Adapter, +} from "@morpho-org/blue-sdk-viem"; +import type { QueryOptions } from "@tanstack/query-core"; +import type { Address, ReadContractErrorType } from "viem"; +import type { Config } from "wagmi"; +import { hashFn } from "wagmi/query"; + +export type VaultV2AdapterParameters = { + vaultV2Adapter: Address; +}; + +export type FetchVaultV2AdapterParameters = Partial & + DeploylessFetchParameters; + +export function fetchVaultV2AdapterQueryOptions( + config: config, + parameters: FetchVaultV2AdapterParameters, +) { + return { + // TODO: Support `signal` once Viem actions allow passthrough + // https://tkdodo.eu/blog/why-you-want-react-query#bonus-cancellation + async queryFn({ queryKey }) { + const { vaultV2Adapter, chainId, ...parameters } = queryKey[1]; + if (!vaultV2Adapter) throw Error("vaultV2Adapter is required"); + + return fetchVaultV2Adapter( + vaultV2Adapter, + config.getClient({ chainId }), + { + chainId, + ...parameters, + }, + ); + }, + queryKey: fetchVaultV2AdapterQueryKey(parameters), + queryKeyHashFn: hashFn, // for bigint support + } as const satisfies QueryOptions< + VaultV2Adapter, + ReadContractErrorType, + VaultV2Adapter, + FetchVaultV2AdapterQueryKey + >; +} + +export function fetchVaultV2AdapterQueryKey({ + vaultV2Adapter, + chainId, + blockTag, + blockNumber, + deployless, + account, + stateOverride, +}: FetchVaultV2AdapterParameters) { + return [ + "fetchVaultV2Adapter", + { + vaultV2Adapter, + chainId, + blockTag, + blockNumber, + deployless, + account, + stateOverride, + } as FetchVaultV2AdapterParameters, + ] as const; +} + +export type FetchVaultV2AdapterQueryKey = ReturnType< + typeof fetchVaultV2AdapterQueryKey +>; diff --git a/packages/blue-sdk/package.json b/packages/blue-sdk/package.json index ee96fc75..68d54044 100644 --- a/packages/blue-sdk/package.json +++ b/packages/blue-sdk/package.json @@ -32,7 +32,7 @@ "@morpho-org/morpho-ts": "workspace:^", "@morpho-org/test": "workspace:^", "typescript": "^5.7.2", - "viem": "^2.23.0", + "viem": "^2.33.3", "vitest": "^3.0.5" }, "publishConfig": { diff --git a/packages/blue-sdk/src/errors.ts b/packages/blue-sdk/src/errors.ts index dcbd29c3..31091b9f 100644 --- a/packages/blue-sdk/src/errors.ts +++ b/packages/blue-sdk/src/errors.ts @@ -1,6 +1,12 @@ -import { formatUnits } from "viem"; +import { type Hex, formatUnits } from "viem"; import type { Address, MarketId } from "./types.js"; +export class InvalidMarketParamsError extends Error { + constructor(public readonly data: Hex) { + super(`cannot decode valid MarketParams from "${data}"`); + } +} + export class UnknownDataError extends Error {} export class UnknownTokenError extends UnknownDataError { @@ -41,6 +47,12 @@ export class UnsupportedPreLiquidationParamsError extends Error { } } +export class UnsupportedVaultV2AdapterError extends Error { + constructor(public readonly address: Address) { + super(`vault v2 adapter "${address}" is not supported`); + } +} + export namespace BlueErrors { export class AlreadySet extends Error { constructor( @@ -109,6 +121,26 @@ export namespace BlueErrors { } } +export namespace VaultV2Errors { + export class InvalidInterestAccrual extends Error { + constructor( + public readonly vault: Address, + public readonly timestamp: bigint, + public readonly lastUpdate: bigint, + ) { + super( + `invalid interest accrual on vault ${vault}: accrual timestamp ${timestamp} can't be prior to last update ${lastUpdate}`, + ); + } + } + + export class UnsupportedLiquidityAdapter extends Error { + constructor(public readonly address: Address) { + super(`unsupported liquidity adapter "${address}"`); + } + } +} + export interface ErrorClass { // biome-ignore lint/suspicious/noExplicitAny: match any type of arg new (...args: any[]): E; diff --git a/packages/blue-sdk/src/index.ts b/packages/blue-sdk/src/index.ts index dafd2972..78cfe5bf 100644 --- a/packages/blue-sdk/src/index.ts +++ b/packages/blue-sdk/src/index.ts @@ -11,3 +11,4 @@ export * from "./holding/index.js"; export * from "./position/index.js"; export * from "./vault/index.js"; export * from "./preLiquidation.js"; +export * from "./utils.js"; diff --git a/packages/blue-sdk/src/market/Market.ts b/packages/blue-sdk/src/market/Market.ts index 17177aa9..d1c4c398 100644 --- a/packages/blue-sdk/src/market/Market.ts +++ b/packages/blue-sdk/src/market/Market.ts @@ -6,22 +6,10 @@ import { type RoundingDirection, } from "../math/index.js"; import type { BigIntish } from "../types.js"; +import { type CapacityLimit, CapacityLimitReason } from "../utils.js"; import { type IMarketParams, MarketParams } from "./MarketParams.js"; import { MarketUtils } from "./MarketUtils.js"; -export enum CapacityLimitReason { - liquidity = "Liquidity", - balance = "Balance", - position = "Position", - collateral = "Collateral", - cap = "Cap", -} - -export interface CapacityLimit { - value: bigint; - limiter: CapacityLimitReason; -} - export interface MaxBorrowOptions { maxLtv?: bigint; } diff --git a/packages/blue-sdk/src/market/MarketParams.ts b/packages/blue-sdk/src/market/MarketParams.ts index e4305052..7728c598 100644 --- a/packages/blue-sdk/src/market/MarketParams.ts +++ b/packages/blue-sdk/src/market/MarketParams.ts @@ -1,7 +1,11 @@ import { ZERO_ADDRESS } from "@morpho-org/morpho-ts"; -import { UnknownMarketParamsError } from "../errors.js"; +import { + InvalidMarketParamsError, + UnknownMarketParamsError, +} from "../errors.js"; import type { Address, BigIntish, MarketId } from "../types.js"; +import { type Hex, decodeAbiParameters } from "viem"; import { MarketUtils } from "./MarketUtils.js"; export interface IMarketParams { @@ -17,6 +21,17 @@ export type InputMarketParams = Pick< "loanToken" | "collateralToken" | "oracle" | "irm" | "lltv" >; +export const marketParamsAbi = { + type: "tuple", + components: [ + { type: "address", name: "loanToken" }, + { type: "address", name: "collateralToken" }, + { type: "address", name: "oracle" }, + { type: "address", name: "irm" }, + { type: "uint256", name: "lltv" }, + ], +} as const; + /** * Represents a market's configuration (also called market params). */ @@ -48,6 +63,16 @@ export class MarketParams implements IMarketParams { }); } + static fromHex(data: Hex) { + try { + const [marketParams] = decodeAbiParameters([marketParamsAbi], data); + + return new MarketParams(marketParams); + } catch { + throw new InvalidMarketParamsError(data); + } + } + /** * The market's collateral token address. */ diff --git a/packages/blue-sdk/src/position/Position.ts b/packages/blue-sdk/src/position/Position.ts index e3581090..5cd205ff 100644 --- a/packages/blue-sdk/src/position/Position.ts +++ b/packages/blue-sdk/src/position/Position.ts @@ -1,6 +1,5 @@ import { BlueErrors } from "../errors.js"; import { - CapacityLimitReason, type IMarket, Market, type MaxBorrowOptions, @@ -9,6 +8,7 @@ import { } from "../market/index.js"; import { MathLib } from "../math/MathLib.js"; import type { Address, BigIntish, MarketId } from "../types.js"; +import { CapacityLimitReason } from "../utils.js"; export interface IPosition { user: Address; diff --git a/packages/blue-sdk/src/token/VaultToken.ts b/packages/blue-sdk/src/token/VaultToken.ts index 75ce4a17..65561036 100644 --- a/packages/blue-sdk/src/token/VaultToken.ts +++ b/packages/blue-sdk/src/token/VaultToken.ts @@ -1,5 +1,5 @@ import type { RoundingDirection } from "../math/index.js"; -import type { Address } from "../types.js"; +import type { Address, BigIntish } from "../types.js"; import type { IVaultConfig } from "../vault/VaultConfig.js"; import { VaultUtils } from "../vault/VaultUtils.js"; import { WrappedToken } from "./WrappedToken.js"; @@ -33,11 +33,11 @@ export class VaultToken extends WrappedToken implements IVaultToken { this.decimalsOffset = BigInt(config.decimalsOffset); } - protected _wrap(amount: bigint, rounding: RoundingDirection) { + protected _wrap(amount: BigIntish, rounding: RoundingDirection) { return VaultUtils.toShares(amount, this, rounding); } - protected _unwrap(amount: bigint, rounding: RoundingDirection) { + protected _unwrap(amount: BigIntish, rounding: RoundingDirection) { return VaultUtils.toAssets(amount, this, rounding); } } diff --git a/packages/blue-sdk/src/utils.ts b/packages/blue-sdk/src/utils.ts new file mode 100644 index 00000000..c03324c9 --- /dev/null +++ b/packages/blue-sdk/src/utils.ts @@ -0,0 +1,14 @@ +export enum CapacityLimitReason { + liquidity = "Liquidity", + balance = "Balance", + position = "Position", + collateral = "Collateral", + cap = "Cap", + vaultV2_absoluteCap = "VaultV2_AbsoluteCap", + vaultV2_relativeCap = "VaultV2_RelativeCap", +} + +export interface CapacityLimit { + value: bigint; + limiter: CapacityLimitReason; +} diff --git a/packages/blue-sdk/src/vault/Vault.ts b/packages/blue-sdk/src/vault/Vault.ts index a9f2e65b..95fbee7a 100644 --- a/packages/blue-sdk/src/vault/Vault.ts +++ b/packages/blue-sdk/src/vault/Vault.ts @@ -1,12 +1,9 @@ import { Time } from "@morpho-org/morpho-ts"; -import { - type CapacityLimit, - CapacityLimitReason, - MarketUtils, -} from "../market/index.js"; +import { MarketUtils } from "../market/index.js"; import { MathLib, type RoundingDirection } from "../math/index.js"; import { VaultToken } from "../token/index.js"; import type { Address, BigIntish, MarketId } from "../types.js"; +import { type CapacityLimit, CapacityLimitReason } from "../utils.js"; import type { IVaultConfig } from "./VaultConfig.js"; import { type IVaultMarketAllocation, @@ -181,11 +178,11 @@ export class Vault extends VaultToken implements IVault { return MathLib.zeroFloorSub(this.totalAssets, this.lastTotalAssets); } - public toAssets(shares: bigint, rounding: RoundingDirection = "Down") { + public toAssets(shares: BigIntish, rounding: RoundingDirection = "Down") { return this._unwrap(shares, rounding); } - public toShares(assets: bigint, rounding: RoundingDirection = "Up") { + public toShares(assets: BigIntish, rounding: RoundingDirection = "Up") { return this._wrap(assets, rounding); } } @@ -342,7 +339,31 @@ export class AccrualVault extends Vault implements IAccrualVault { return MathLib.wDivDown(allocation.position.supplyAssets, this.totalAssets); } + /** + * Returns the deposit capacity limit of a given amount of assets on the vault. + * @param assets The maximum amount of assets to deposit. + * @deprecated Use `maxDeposit` instead. + */ public getDepositCapacityLimit(assets: bigint): CapacityLimit { + return this.maxDeposit(assets); + } + + /** + * Returns the withdraw capacity limit corresponding to a given amount of shares of the vault. + * @param shares The maximum amount of shares to redeem. + * @deprecated Use `maxWithdraw` instead. + */ + public getWithdrawCapacityLimit(shares: bigint): CapacityLimit { + return this.maxWithdraw(shares); + } + + /** + * Returns the maximum amount of assets that can be deposited to the vault. + * @param assets The maximum amount of assets to deposit. + */ + public maxDeposit(assets: BigIntish): CapacityLimit { + assets = BigInt(assets); + const suppliable = this.allocations .values() .reduce( @@ -369,7 +390,11 @@ export class AccrualVault extends Vault implements IAccrualVault { }; } - public getWithdrawCapacityLimit(shares: bigint): CapacityLimit { + /** + * Returns the maximum amount of assets that can be withdrawn from the vault. + * @param shares The maximum amount of shares to redeem. + */ + public maxWithdraw(shares: BigIntish): CapacityLimit { const assets = this.toAssets(shares); const { liquidity } = this; @@ -389,7 +414,7 @@ export class AccrualVault extends Vault implements IAccrualVault { * Returns a new vault derived from this vault, whose interest has been accrued up to the given timestamp. * @param timestamp The timestamp at which to accrue interest. Must be greater than or equal to each of the vault's market's `lastUpdate`. */ - public accrueInterest(timestamp: BigIntish) { + public accrueInterest(timestamp?: BigIntish) { const vault = new AccrualVault( this, // Keep withdraw queue order. diff --git a/packages/blue-sdk/src/vault/index.ts b/packages/blue-sdk/src/vault/index.ts index 1775aa74..ae20a2c1 100644 --- a/packages/blue-sdk/src/vault/index.ts +++ b/packages/blue-sdk/src/vault/index.ts @@ -5,3 +5,4 @@ export * from "./VaultMarketConfig.js"; export * from "./VaultMarketPublicAllocatorConfig.js"; export * from "./VaultUser.js"; export * from "./Vault.js"; +export * from "./v2"; diff --git a/packages/blue-sdk/src/vault/v2/VaultV2.ts b/packages/blue-sdk/src/vault/v2/VaultV2.ts new file mode 100644 index 00000000..e1017560 --- /dev/null +++ b/packages/blue-sdk/src/vault/v2/VaultV2.ts @@ -0,0 +1,282 @@ +import { type Address, type Hash, type Hex, zeroAddress } from "viem"; +import { VaultV2Errors } from "../../errors"; +import { MathLib, type RoundingDirection } from "../../math"; +import { type IToken, WrappedToken } from "../../token"; +import type { BigIntish } from "../../types"; +import { type CapacityLimit, CapacityLimitReason } from "../../utils"; +import type { IAccrualVaultV2Adapter } from "./VaultV2Adapter"; + +export interface IVaultV2Allocation { + id: Hash; + absoluteCap: bigint; + relativeCap: bigint; + allocation: bigint; +} + +export interface IVaultV2 extends IToken { + asset: Address; + /** + * The total assets, *including* virtually accrued interest. + */ + totalAssets: bigint; + /** + * The total assets, *excluding* virtually accrued interest. + */ + _totalAssets: bigint; + /** + * The total supply of shares. + */ + totalSupply: bigint; + virtualShares: bigint; + maxRate: bigint; + lastUpdate: bigint; + adapters: Address[]; + liquidityAdapter: Address; + liquidityData: Hex; + liquidityAllocations: IVaultV2Allocation[] | undefined; + performanceFee: bigint; + managementFee: bigint; + performanceFeeRecipient: Address; + managementFeeRecipient: Address; +} + +export class VaultV2 extends WrappedToken implements IVaultV2 { + public readonly asset: Address; + + public totalAssets; + public _totalAssets; + public totalSupply; + public virtualShares; + + public maxRate; + public lastUpdate; + + public adapters; + public liquidityAdapter; + public liquidityData; + public liquidityAllocations; + + public performanceFee; + public managementFee; + public performanceFeeRecipient; + public managementFeeRecipient; + + constructor({ + asset, + totalAssets, + _totalAssets, + totalSupply, + virtualShares, + maxRate, + lastUpdate, + adapters, + liquidityAdapter, + liquidityData, + liquidityAllocations, + performanceFee, + managementFee, + performanceFeeRecipient, + managementFeeRecipient, + ...config + }: IVaultV2) { + super(config, asset); + + this.asset = asset; + this.totalAssets = totalAssets; + this._totalAssets = _totalAssets; + this.totalSupply = totalSupply; + this.virtualShares = virtualShares; + this.maxRate = maxRate; + this.lastUpdate = lastUpdate; + this.adapters = adapters; + this.liquidityAdapter = liquidityAdapter; + this.liquidityData = liquidityData; + this.liquidityAllocations = liquidityAllocations; + this.performanceFee = performanceFee; + this.managementFee = managementFee; + this.performanceFeeRecipient = performanceFeeRecipient; + this.managementFeeRecipient = managementFeeRecipient; + } + + public toAssets(shares: BigIntish) { + return this._unwrap(shares, "Down"); + } + + public toShares(assets: BigIntish) { + return this._wrap(assets, "Down"); + } + + protected _wrap(amount: BigIntish, rounding: RoundingDirection) { + return MathLib.mulDiv( + amount, + this.totalSupply + this.virtualShares, + this.totalAssets + 1n, + rounding, + ); + } + + protected _unwrap(amount: BigIntish, rounding: RoundingDirection) { + return MathLib.mulDiv( + amount, + this.totalAssets + 1n, + this.totalSupply + this.virtualShares, + rounding, + ); + } +} + +export interface IAccrualVaultV2 extends Omit {} + +export class AccrualVaultV2 extends VaultV2 implements IAccrualVaultV2 { + constructor( + vault: IAccrualVaultV2, + public accrualLiquidityAdapter: IAccrualVaultV2Adapter | undefined, + public accrualAdapters: IAccrualVaultV2Adapter[], + public assetBalance: bigint, + ) { + super({ ...vault, adapters: accrualAdapters.map((a) => a.address) }); + } + + /** + * Returns the maximum amount of assets that can be deposited to the vault. + * @param assets The maximum amount of assets to deposit. + */ + public maxDeposit(assets: BigIntish): CapacityLimit { + if (this.liquidityAdapter === zeroAddress) + return { value: BigInt(assets), limiter: CapacityLimitReason.balance }; + + let liquidityAdapterLimit: CapacityLimit | undefined; + if (this.accrualLiquidityAdapter != null) + liquidityAdapterLimit = this.accrualLiquidityAdapter.maxDeposit( + this.liquidityData, + assets, + ); + + if (this.liquidityAllocations == null || liquidityAdapterLimit == null) + throw new VaultV2Errors.UnsupportedLiquidityAdapter( + this.liquidityAdapter, + ); + + // At this stage: `liquidityAdapterLimit.value <= assets` + + for (const { absoluteCap, relativeCap, allocation } of this + .liquidityAllocations) { + // `absoluteCap` can be set lower than `allocation`. + const absoluteMaxDeposit = MathLib.zeroFloorSub(absoluteCap, allocation); + if (liquidityAdapterLimit.value > absoluteMaxDeposit) + return { + value: absoluteMaxDeposit, + limiter: CapacityLimitReason.vaultV2_absoluteCap, + }; + + if (relativeCap !== MathLib.WAD) { + // `relativeCap` can be set lower than `allocation / totalAssets`. + const relativeMaxDeposit = MathLib.zeroFloorSub( + MathLib.wMulDown(this.totalAssets, relativeCap), + allocation, + ); + if (liquidityAdapterLimit.value > relativeMaxDeposit) + return { + value: relativeMaxDeposit, + limiter: CapacityLimitReason.vaultV2_relativeCap, + }; + } + } + + return liquidityAdapterLimit; + } + + /** + * Returns the maximum amount of assets that can be withdrawn from the vault. + * @param shares The maximum amount of shares to redeem. + */ + public maxWithdraw(shares: BigIntish): CapacityLimit { + const assets = this.toAssets(shares); + if (this.liquidityAdapter === zeroAddress) + return { value: BigInt(assets), limiter: CapacityLimitReason.balance }; + + let liquidity = this.assetBalance; + if (this.accrualLiquidityAdapter != null) + liquidity += this.accrualLiquidityAdapter.maxWithdraw( + this.liquidityData, + ).value; + + if (assets > liquidity) + return { + value: liquidity, + limiter: CapacityLimitReason.liquidity, + }; + + return { + value: assets, + limiter: CapacityLimitReason.balance, + }; + } + + /** + * Returns a new vault derived from this vault, whose interest has been accrued up to the given timestamp. + * @param timestamp The timestamp at which to accrue interest. Must be greater than or equal to the vault's `lastUpdate`. + */ + public accrueInterest(timestamp: BigIntish) { + const vault = new AccrualVaultV2( + this, + this.accrualLiquidityAdapter, + this.accrualAdapters, + this.assetBalance, + ); + + timestamp = BigInt(timestamp); + + const elapsed = timestamp - this.lastUpdate; + if (elapsed < 0n) + throw new VaultV2Errors.InvalidInterestAccrual( + this.address, + timestamp, + this.lastUpdate, + ); + + // Corresponds to the `firstTotalAssets == 0` onchain check. + if (elapsed === 0n) + return { vault, performanceFeeShares: 0n, managementFeeShares: 0n }; + + const realAssets = vault.accrualAdapters.reduce( + (curr, adapter) => curr + adapter.realAssets(timestamp), + vault.assetBalance, + ); + const maxTotalAssets = + vault._totalAssets + + MathLib.wMulDown(vault._totalAssets * elapsed, vault.maxRate); + const newTotalAssets = MathLib.min(realAssets, maxTotalAssets); + const interest = MathLib.zeroFloorSub(newTotalAssets, vault._totalAssets); + + const performanceFeeAssets = + interest > 0n && vault.performanceFee > 0n + ? MathLib.wMulDown(interest, vault.performanceFee) + : 0n; + const managementFeeAssets = + elapsed > 0n && vault.managementFee > 0n + ? MathLib.wMulDown(newTotalAssets * elapsed, vault.managementFee) + : 0n; + + const newTotalAssetsWithoutFees = + newTotalAssets - performanceFeeAssets - managementFeeAssets; + const performanceFeeShares = MathLib.mulDivDown( + performanceFeeAssets, + vault.totalSupply + vault.virtualShares, + newTotalAssetsWithoutFees + 1n, + ); + const managementFeeShares = MathLib.mulDivDown( + managementFeeAssets, + vault.totalSupply + vault.virtualShares, + newTotalAssetsWithoutFees + 1n, + ); + + vault.totalAssets = newTotalAssets; + vault._totalAssets = newTotalAssets; + if (performanceFeeShares) vault.totalSupply += performanceFeeShares; + if (managementFeeShares) vault.totalSupply += managementFeeShares; + vault.lastUpdate = BigInt(timestamp); + + return { vault, performanceFeeShares, managementFeeShares }; + } +} diff --git a/packages/blue-sdk/src/vault/v2/VaultV2Adapter.ts b/packages/blue-sdk/src/vault/v2/VaultV2Adapter.ts new file mode 100644 index 00000000..bafa516a --- /dev/null +++ b/packages/blue-sdk/src/vault/v2/VaultV2Adapter.ts @@ -0,0 +1,44 @@ +import type { Address, Hash, Hex } from "viem"; +import type { BigIntish } from "../../types"; +import type { CapacityLimit } from "../../utils"; + +export interface IVaultV2Adapter { + address: Address; + parentVault: Address; + adapterId: Hash; + skimRecipient: Address; +} + +export abstract class VaultV2Adapter implements IVaultV2Adapter { + public readonly address: Address; + public readonly parentVault: Address; + public readonly adapterId: Hash; + public skimRecipient: Address; + + constructor({ + address, + parentVault, + adapterId, + skimRecipient, + }: IVaultV2Adapter) { + this.address = address; + this.parentVault = parentVault; + this.adapterId = adapterId; + this.skimRecipient = skimRecipient; + } +} + +export interface IAccrualVaultV2Adapter extends IVaultV2Adapter { + realAssets(timestamp: BigIntish): bigint; + + /** + * Returns the maximum amount of assets that can be deposited to this adapter. + * @param assets The maximum amount of assets to deposit. + */ + maxDeposit(data: Hex, assets: BigIntish): CapacityLimit; + /** + * Returns the maximum amount of assets that can be withdrawn from this adapter. + * @param shares The maximum amount of shares to redeem. + */ + maxWithdraw(data: Hex): CapacityLimit; +} diff --git a/packages/blue-sdk/src/vault/v2/VaultV2MorphoMarketV1Adapter.ts b/packages/blue-sdk/src/vault/v2/VaultV2MorphoMarketV1Adapter.ts new file mode 100644 index 00000000..faa75600 --- /dev/null +++ b/packages/blue-sdk/src/vault/v2/VaultV2MorphoMarketV1Adapter.ts @@ -0,0 +1,116 @@ +import { type Address, type Hex, encodeAbiParameters, keccak256 } from "viem"; +import { + type IMarketParams, + MarketParams, + marketParamsAbi, +} from "../../market"; +import type { AccrualPosition } from "../../position"; +import type { BigIntish } from "../../types"; +import { CapacityLimitReason } from "../../utils"; +import { VaultV2Adapter } from "./VaultV2Adapter"; +import type { IAccrualVaultV2Adapter, IVaultV2Adapter } from "./VaultV2Adapter"; + +export interface IVaultV2MorphoMarketV1Adapter + extends Omit { + marketParamsList: IMarketParams[]; +} + +export class VaultV2MorphoMarketV1Adapter + extends VaultV2Adapter + implements IVaultV2MorphoMarketV1Adapter +{ + static adapterId(address: Address) { + return keccak256( + encodeAbiParameters( + [{ type: "string" }, { type: "address" }], + ["this", address], + ), + ); + } + + static collateralId(address: Address) { + return keccak256( + encodeAbiParameters( + [{ type: "string" }, { type: "address" }], + ["collateralToken", address], + ), + ); + } + + static marketParamsId(address: Address, params: MarketParams) { + return keccak256( + encodeAbiParameters( + [{ type: "string" }, { type: "address" }, marketParamsAbi], + ["this/marketParams", address, params], + ), + ); + } + + public marketParamsList: MarketParams[]; + + constructor({ + marketParamsList, + ...vaultV2Adapter + }: IVaultV2MorphoMarketV1Adapter) { + super({ + ...vaultV2Adapter, + adapterId: VaultV2MorphoMarketV1Adapter.adapterId(vaultV2Adapter.address), + }); + + this.marketParamsList = marketParamsList.map( + (params) => new MarketParams(params), + ); + } + + public ids(params: MarketParams) { + return [ + this.adapterId, + VaultV2MorphoMarketV1Adapter.collateralId(params.collateralToken), + VaultV2MorphoMarketV1Adapter.marketParamsId(this.address, params), + ]; + } +} + +export interface IAccrualVaultV2MorphoMarketV1Adapter + extends IVaultV2MorphoMarketV1Adapter {} + +export class AccrualVaultV2MorphoMarketV1Adapter + extends VaultV2MorphoMarketV1Adapter + implements IAccrualVaultV2MorphoMarketV1Adapter, IAccrualVaultV2Adapter +{ + constructor( + adapter: IAccrualVaultV2MorphoMarketV1Adapter, + public positions: AccrualPosition[], + ) { + super(adapter); + } + + realAssets(timestamp?: BigIntish) { + return this.positions.reduce( + (total, position) => + total + position.accrueInterest(timestamp).supplyAssets, + 0n, + ); + } + + maxDeposit(_data: Hex, assets: BigIntish) { + return { + value: BigInt(assets), + limiter: CapacityLimitReason.balance, + }; + } + + maxWithdraw(data: Hex) { + const marketId = MarketParams.fromHex(data).id; + const position = this.positions.find( + (position) => position.marketId === marketId, + ); + + return ( + position?.market?.getWithdrawCapacityLimit(position) ?? { + value: 0n, + limiter: CapacityLimitReason.position, + } + ); + } +} diff --git a/packages/blue-sdk/src/vault/v2/VaultV2MorphoVaultV1Adapter.ts b/packages/blue-sdk/src/vault/v2/VaultV2MorphoVaultV1Adapter.ts new file mode 100644 index 00000000..0d774fa4 --- /dev/null +++ b/packages/blue-sdk/src/vault/v2/VaultV2MorphoVaultV1Adapter.ts @@ -0,0 +1,72 @@ +import { type Address, type Hex, encodeAbiParameters, keccak256 } from "viem"; + +import { VaultV2Adapter } from "./VaultV2Adapter"; + +export interface IVaultV2MorphoVaultV1Adapter + extends Omit { + morphoVaultV1: Address; +} + +import type { BigIntish } from "../../types"; +import type { AccrualVault } from "../Vault"; +import type { IAccrualVaultV2Adapter, IVaultV2Adapter } from "./VaultV2Adapter"; + +export class VaultV2MorphoVaultV1Adapter + extends VaultV2Adapter + implements IVaultV2MorphoVaultV1Adapter +{ + static adapterId(address: Address) { + return keccak256( + encodeAbiParameters( + [{ type: "string" }, { type: "address" }], + ["this", address], + ), + ); + } + + public readonly morphoVaultV1: Address; + + constructor({ + morphoVaultV1, + ...vaultV2Adapter + }: IVaultV2MorphoVaultV1Adapter) { + super({ + ...vaultV2Adapter, + adapterId: VaultV2MorphoVaultV1Adapter.adapterId(vaultV2Adapter.address), + }); + + this.morphoVaultV1 = morphoVaultV1; + } + + public ids() { + return [this.adapterId]; + } +} + +export interface IAccrualVaultV2MorphoVaultV1Adapter + extends IVaultV2MorphoVaultV1Adapter {} + +export class AccrualVaultV2MorphoVaultV1Adapter + extends VaultV2MorphoVaultV1Adapter + implements IAccrualVaultV2MorphoVaultV1Adapter, IAccrualVaultV2Adapter +{ + constructor( + adapter: IAccrualVaultV2MorphoVaultV1Adapter, + public accrualVaultV1: AccrualVault, + public shares: bigint, + ) { + super(adapter); + } + + realAssets(timestamp?: BigIntish) { + return this.accrualVaultV1.accrueInterest(timestamp).toAssets(this.shares); + } + + maxDeposit(_data: Hex, assets: BigIntish) { + return this.accrualVaultV1.maxDeposit(assets); + } + + maxWithdraw(_data: Hex) { + return this.accrualVaultV1.maxWithdraw(this.shares); + } +} diff --git a/packages/blue-sdk/src/vault/v2/index.ts b/packages/blue-sdk/src/vault/v2/index.ts new file mode 100644 index 00000000..b3750f3e --- /dev/null +++ b/packages/blue-sdk/src/vault/v2/index.ts @@ -0,0 +1,4 @@ +export * from "./VaultV2.js"; +export * from "./VaultV2Adapter.js"; +export * from "./VaultV2MorphoMarketV1Adapter.js"; +export * from "./VaultV2MorphoVaultV1Adapter.js"; diff --git a/packages/blue-sdk/test/e2e/Market.test.ts b/packages/blue-sdk/test/e2e/Market.test.ts index 8000f132..f566a1e0 100644 --- a/packages/blue-sdk/test/e2e/Market.test.ts +++ b/packages/blue-sdk/test/e2e/Market.test.ts @@ -129,7 +129,7 @@ describe("Market", () => { sender: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 Docs: https://viem.sh/docs/contract/writeContract - Version: viem@2.23.0] + Version: viem@2.33.3] `); const hash = await client.writeContract({ diff --git a/packages/bundler-sdk-viem/.env.example b/packages/bundler-sdk-viem/.env.example deleted file mode 100644 index 1e314b5a..00000000 --- a/packages/bundler-sdk-viem/.env.example +++ /dev/null @@ -1,2 +0,0 @@ -MAINNET_RPC_URL= -BASE_RPC_URL= diff --git a/packages/bundler-sdk-viem/package.json b/packages/bundler-sdk-viem/package.json index 0d05dc02..bed9534f 100644 --- a/packages/bundler-sdk-viem/package.json +++ b/packages/bundler-sdk-viem/package.json @@ -40,7 +40,7 @@ "@types/lodash": "^4.17.12", "lodash": "^4.17.21", "typescript": "^5.7.2", - "viem": "^2.23.0", + "viem": "^2.33.3", "vitest": "^3.0.5" }, "publishConfig": { diff --git a/packages/bundler-sdk-viem/src/operations.ts b/packages/bundler-sdk-viem/src/operations.ts index cb8732ce..60fb27dc 100644 --- a/packages/bundler-sdk-viem/src/operations.ts +++ b/packages/bundler-sdk-viem/src/operations.ts @@ -120,6 +120,7 @@ export const populateInputTransfer = ( const useSimplePermit = erc2612Nonce != null && (data.tryGetVault(address) != null || // MetaMorpho vaults implement EIP-2612. + data.tryGetVaultV2(address) != null || // Vaults V2 implement EIP-2612. hasSimplePermit); const useSimpleTransfer = permit2 == null || @@ -284,9 +285,11 @@ export const populateSubBundle = ( case "Erc20_Wrap": if (isErc20Wrapper) break; case "MetaMorpho_Deposit": - case "MetaMorpho_Withdraw": + case "MetaMorpho_Withdraw": { // Only if sender is owner otherwise the owner would be lost. if (draft.args.owner === sender) draft.args.owner = generalAdapter1; + break; + } } // Redirect operation targets. @@ -751,11 +754,14 @@ export const finalizeBundle = ( // Redirect MetaMorpho deposits. operations.forEach((operation, index) => { - if ( - operation.type !== "MetaMorpho_Deposit" || - operation.args.owner !== generalAdapter1 - ) - return; + switch (operation.type) { + case "MetaMorpho_Deposit": { + if (operation.args.owner !== generalAdapter1) return; + break; + } + default: + return; + } const token = operation.address; @@ -774,10 +780,11 @@ export const finalizeBundle = ( // If the bundler's balance is at least once lower than assets, the bundler does need these assets. return; - operation.args.owner = receiver; + if (operation.type === "MetaMorpho_Deposit") + operation.args.owner = receiver; }); - // Redirect borrows, withdrawals & MetaMorpho withdrawals. + // Redirect borrows, withdrawals, MetaMorpho withdrawals & Vault V2 withdrawals. operations.forEach((operation, index) => { let token: Address; switch (operation.type) { @@ -818,11 +825,14 @@ export const finalizeBundle = ( // Simplify Erc20_Transfer(sender = bundler, to = bundler) + MetaMorpho_Withdraw(owner = bundler) = MetaMorpho_Withdraw(owner = from). operations.forEach((operation, index) => { - if ( - operation.type !== "MetaMorpho_Withdraw" || - operation.args.owner !== generalAdapter1 - ) - return; + switch (operation.type) { + case "MetaMorpho_Withdraw": { + if (operation.args.owner !== generalAdapter1) return; + break; + } + default: + return; + } // shares are not defined when using assets, so we rely on simulation steps. const shares = @@ -845,7 +855,8 @@ export const finalizeBundle = ( inputTransfer.args.amount -= shares; - operation.args.owner = inputTransfer.args.from; + if (operation.type === "MetaMorpho_Withdraw") + operation.args.owner = inputTransfer.args.from; }); // Filter out useless input transfers. diff --git a/packages/bundler-sdk-viem/test/paraswap.test.ts b/packages/bundler-sdk-viem/test/paraswap.test.ts index f20463e0..7e4e3a9c 100644 --- a/packages/bundler-sdk-viem/test/paraswap.test.ts +++ b/packages/bundler-sdk-viem/test/paraswap.test.ts @@ -93,7 +93,7 @@ describe("paraswap", () => { amount: balance * 2n, // https://api.paraswap.io/swap?network=1&slippage=100&side=BUY&srcToken=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48&destToken=0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599&amount=200000000&userAddress=0x03b5259Bd204BfD4A616E5B79b0B786d90c6C38f&version=6.2 swap: { - to: "0x6a000f20005980200259b80c5102003040001068", + to: "0x6A000F20005980200259B80c5102003040001068", data: "0x7f457675000000000000000000000000a0f408a000017007015e0f00320e470d00090a5b000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c5990000000000000000000000000000000000000000000000000000002c2de5311f000000000000000000000000000000000000000000000000000000000bebc2000000000000000000000000000000000000000000000000000000002bbdea86d035ccdf5bf4e8489ea680fbabfec9070d0000000000000000000000000156143b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000005200000016000000000000000000000012000000000000001370000000000001068e592427a0aece92de3edee1f18e0157c058615640140008400a400000000000300000000000000000000000000000000000000000000000000000000f28c0498000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000006a000f20005980200259b80c51020030400010680000000000000000000000000000000000000000000000000000000068221688000000000000000000000000000000000000000000000000000000000501bd00000000000000000000000000000000000000000000000000000000125e767dd2000000000000000000000000000000000000000000000000000000000000002b2260fac5e5542a773aa44fbcfedf7c193bc2c5990001f4a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000000000000000000000000000000000000000000000180000000000000000000000120000000000000014e0000000000000960e592427a0aece92de3edee1f18e0157c058615640160008400a400000000000300000000000000000000000000000000000000000000000000000000f28c0498000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000006a000f20005980200259b80c510200304000106800000000000000000000000000000000000000000000000000000000682216880000000000000000000000000000000000000000000000000000000002dc6c000000000000000000000000000000000000000000000000000000000a7f4e161200000000000000000000000000000000000000000000000000000000000000422260fac5e5542a773aa44fbcfedf7c193bc2c5990001f4dac17f958d2ee523a2206206994597c13d831ec7000064a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000000000000000000000000000000000000000000000000000000000000000180000000000000000000000120000000000000014e0000000000000d48e592427a0aece92de3edee1f18e0157c058615640160008400a400000000000300000000000000000000000000000000000000000000000000000000f28c0498000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000006a000f20005980200259b80c5102003040001068000000000000000000000000000000000000000000000000000000006822168800000000000000000000000000000000000000000000000000000000040d99000000000000000000000000000000000000000000000000000000000ee025f2ec00000000000000000000000000000000000000000000000000000000000000422260fac5e5542a773aa44fbcfedf7c193bc2c5990001f4c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20001f4a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000000000000000000000000000000000000000", offsets: paraswapContractMethodOffsets.swapExactAmountOut, }, @@ -259,7 +259,7 @@ describe("paraswap", () => { srcToken: usdc_wbtc.collateralToken, // https://api.paraswap.io/swap?network=1&slippage=100&side=BUY&srcToken=0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599&destToken=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48&amount=190000000000&userAddress=0x03b5259Bd204BfD4A616E5B79b0B786d90c6C38f&version=6.2 swap: { - to: "0x6a000f20005980200259b80c5102003040001068", + to: "0x6A000F20005980200259B80c5102003040001068", data: "0x7f457675000000000000000000000000a0f408a000017007015e0f00320e470d00090a5b0000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c599000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000000000000000000000000000000000000c21dd730000000000000000000000000000000000000000000000000000002c3ce1ec00000000000000000000000000000000000000000000000000000000000c031d283c96d3db49e249a1a8f60208611603c100000000000000000000000001562fc5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000005200000016000000000000000000000012000000000000001370000000000000960e592427a0aece92de3edee1f18e0157c058615640140008400a400000000000300000000000000000000000000000000000000000000000000000000f28c0498000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000006a000f20005980200259b80c510200304000106800000000000000000000000000000000000000000000000000000000682364560000000000000000000000000000000000000000000000000000000a9df8c8000000000000000000000000000000000000000000000000000000000002e204f0000000000000000000000000000000000000000000000000000000000000002ba0b86991c6218b36c1d19d4a2e9eb0ce3606eb480001f42260fac5e5542a773aa44fbcfedf7c193bc2c59900000000000000000000000000000000000000000000000180000000000000000000000120000000000000014e0000000000001130e592427a0aece92de3edee1f18e0157c058615640160008400a400000000000300000000000000000000000000000000000000000000000000000000f28c0498000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000006a000f20005980200259b80c510200304000106800000000000000000000000000000000000000000000000000000000682364560000000000000000000000000000000000000000000000000000001376f2c4000000000000000000000000000000000000000000000000000000000005490d240000000000000000000000000000000000000000000000000000000000000042a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000064dac17f958d2ee523a2206206994597c13d831ec70001f42260fac5e5542a773aa44fbcfedf7c193bc2c59900000000000000000000000000000000000000000000000000000000000000000180000000000000000000000120000000000000014e0000000000000c80e592427a0aece92de3edee1f18e0157c058615640160008400a400000000000300000000000000000000000000000000000000000000000000000000f28c0498000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000006a000f20005980200259b80c510200304000106800000000000000000000000000000000000000000000000000000000682364560000000000000000000000000000000000000000000000000000000e27f660000000000000000000000000000000000000000000000000000000000003d80b140000000000000000000000000000000000000000000000000000000000000042a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480001f4c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20001f42260fac5e5542a773aa44fbcfedf7c193bc2c599000000000000000000000000000000000000000000000000000000000000", offsets: paraswapContractMethodOffsets.swapExactAmountOut, }, @@ -415,7 +415,7 @@ describe("paraswap", () => { dstToken: usdc, // https://api.paraswap.io/swap?network=1&slippage=100&side=SELL&srcToken=0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599&destToken=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48&amount=150000000&userAddress=0x03b5259Bd204BfD4A616E5B79b0B786d90c6C38f&version=6.2 swap: { - to: "0x6a000f20005980200259b80c5102003040001068", + to: "0x6A000F20005980200259B80c5102003040001068", data: "0xe3ead59e00000000000000000000000000c600b30fb0400701010f4b080409018b9006e00000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c599000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000008f0d180000000000000000000000000000000000000000000000000000000240b2a78af00000000000000000000000000000000000000000000000000000024685e9e1b5d2ea061acb04f0b96538d0fa0498f6f0000000000000000000000000156cd57000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000980000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000009800000000000000000000000000000016000000000000001200000000000001838e592427a0aece92de3edee1f18e0157c0586156400000140008400000000000300000000000000000000000000000000000000000000000000000000c04b8d59000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000006a000f20005980200259b80c510200304000106800000000000000000000000000000000000000000000000000000000682ae4ee00000000000000000000000000000000000000000000000000000000058b11400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002b2260fac5e5542a773aa44fbcfedf7c193bc2c5990001f4a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000000000000000000060000000000000001200000000000000a28e592427a0aece92de3edee1f18e0157c0586156400000140008400ef0000000b00000000000000000000000000000000000000000000000000000000c04b8d59000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000c600b30fb0400701010f4b080409018b9006e000000000000000000000000000000000000000000000000000000000682ae4ee00000000000000000000000000000000000000000000000000000000025317c00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002b2260fac5e5542a773aa44fbcfedf7c193bc2c5990001f4dac17f958d2ee523a2206206994597c13d831ec700000000000000000000000000000000000000000066a9893cc07d91d95644aedd05d03f95e1dba8af0000048002e40000ff0000030000000000000000000000000000000000000000000000000000000024856bc30000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000380000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003060b0e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000026000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000020000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000976ee43e90000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000060000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000006a000f20005980200259b80c5102003040001068000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000180000000000000012000000000000004b0e592427a0aece92de3edee1f18e0157c0586156400000160008400000000000300000000000000000000000000000000000000000000000000000000c04b8d59000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000006a000f20005980200259b80c510200304000106800000000000000000000000000000000000000000000000000000000682ae4ee000000000000000000000000000000000000000000000000000000000112a880000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000422260fac5e5542a773aa44fbcfedf7c193bc2c5990001f4c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20001f4a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000000000000000000000000000000000000000", offsets: paraswapContractMethodOffsets.swapExactAmountIn, }, @@ -487,7 +487,7 @@ describe("paraswap", () => { ).toBe(0n); expect(position.collateral).toBe(collateral - withdrawn); expect(position.supplyShares).toBe(0n); - expect(position.borrowShares).toBe(30615135298059917n); + expect(position.borrowShares).toBe(30615135258771683n); expect( await client.allowance({ diff --git a/packages/bundler-sdk-viem/test/populateBundle.test.ts b/packages/bundler-sdk-viem/test/populateBundle.test.ts index 4ff77ce1..8fa1594e 100644 --- a/packages/bundler-sdk-viem/test/populateBundle.test.ts +++ b/packages/bundler-sdk-viem/test/populateBundle.test.ts @@ -71,6 +71,8 @@ describe("populateBundle", () => { users: [client.account.address, generalAdapter1], tokens: [wNative], vaults: [], + vaultV2Adapters: [], + vaultV2s: [], block, }), ); @@ -130,6 +132,8 @@ describe("populateBundle", () => { users: [client.account.address, generalAdapter1], tokens: [NATIVE_ADDRESS, dai, dai_sUsde.collateralToken], vaults: [], + vaultV2Adapters: [], + vaultV2s: [], block, }), ); @@ -257,6 +261,8 @@ describe("populateBundle", () => { users: [client.account.address, generalAdapter1], tokens: [NATIVE_ADDRESS, wNative, stEth, wstEth], vaults: [], + vaultV2Adapters: [], + vaultV2s: [], block, }), ); @@ -456,6 +462,8 @@ describe("populateBundle", () => { users: [client.account.address, generalAdapter1], tokens: [usdc, stEth, wstEth], vaults: [], + vaultV2Adapters: [], + vaultV2s: [], block, }), ); @@ -565,6 +573,8 @@ describe("populateBundle", () => { ], tokens: [usdc, steakUsdc.address], vaults: [steakUsdc.address], + vaultV2s: [], + vaultV2Adapters: [], block, }), ); @@ -674,6 +684,8 @@ describe("populateBundle", () => { users: [client.account.address, generalAdapter1, bbUsdt.address], tokens: [usdt, stEth, wstEth, bbUsdt.address], vaults: [bbUsdt.address], + vaultV2s: [], + vaultV2Adapters: [], block, }), ); @@ -815,6 +827,8 @@ describe("populateBundle", () => { users: [client.account.address, generalAdapter1, bbUsdt.address], tokens: [usdt, bbUsdt.address], vaults: [bbUsdt.address], + vaultV2s: [], + vaultV2Adapters: [], block, }), ); @@ -984,6 +998,8 @@ describe("populateBundle", () => { users: [client.account.address, generalAdapter1, bbUsdt.address], tokens: [usdt, bbUsdt.address], vaults: [bbUsdt.address], + vaultV2s: [], + vaultV2Adapters: [], block, }), ); @@ -1140,6 +1156,8 @@ describe("populateBundle", () => { users: [client.account.address, generalAdapter1, bbEth.address], tokens: [NATIVE_ADDRESS, wNative, bbEth.address], vaults: [bbEth.address], + vaultV2s: [], + vaultV2Adapters: [], block, }), ); @@ -1291,6 +1309,8 @@ describe("populateBundle", () => { users: [client.account.address, generalAdapter1, bbEth.address], tokens: [NATIVE_ADDRESS, wNative, bbEth.address], vaults: [bbEth.address], + vaultV2s: [], + vaultV2Adapters: [], block, }), ); @@ -1353,6 +1373,8 @@ describe("populateBundle", () => { ], tokens: [usdc, stEth, wstEth, steakUsdc.address], vaults: [steakUsdc.address], + vaultV2s: [], + vaultV2Adapters: [], block, }), ); @@ -1574,6 +1596,8 @@ describe("populateBundle", () => { users: [client.account.address, generalAdapter1, bbEth.address], tokens: [NATIVE_ADDRESS, wNative, stEth, wstEth, bbEth.address], vaults: [bbEth.address], + vaultV2s: [], + vaultV2Adapters: [], block, }), ); @@ -1851,6 +1875,8 @@ describe("populateBundle", () => { re7Weth.address, ], vaults: [bbEth.address, re7Weth.address], + vaultV2s: [], + vaultV2Adapters: [], block, }), ); @@ -2217,6 +2243,8 @@ describe("populateBundle", () => { bbUsdc.address, ], vaults: [steakUsdc.address, bbEth.address, bbUsdc.address], + vaultV2s: [], + vaultV2Adapters: [], block, }), ); @@ -2421,6 +2449,8 @@ describe("populateBundle", () => { users: [client.account.address, generalAdapter1], tokens: [NATIVE_ADDRESS, wNative, stEth, wstEth], vaults: [], + vaultV2Adapters: [], + vaultV2s: [], block, }), ); @@ -2656,6 +2686,8 @@ describe("populateBundle", () => { users: [client.account.address, generalAdapter1], tokens: [wNative], vaults: [], + vaultV2Adapters: [], + vaultV2s: [], block, }), ); @@ -2720,6 +2752,8 @@ describe("populateBundle", () => { users: [client.account.address, generalAdapter1], tokens: [NATIVE_ADDRESS, dai, dai_sUsde.collateralToken], vaults: [], + vaultV2s: [], + vaultV2Adapters: [], block, }), ); @@ -2858,6 +2892,8 @@ describe("populateBundle", () => { users: [client.account.address, generalAdapter1], tokens: [NATIVE_ADDRESS, wNative, stEth, wstEth], vaults: [], + vaultV2Adapters: [], + vaultV2s: [], block, }), ); @@ -3067,6 +3103,8 @@ describe("populateBundle", () => { users: [client.account.address, generalAdapter1], tokens: [usdc, stEth, wstEth], vaults: [], + vaultV2Adapters: [], + vaultV2s: [], block, }), ); @@ -3190,6 +3228,8 @@ describe("populateBundle", () => { ], tokens: [usdc, stEth, wstEth, steakUsdc.address], vaults: [steakUsdc.address], + vaultV2s: [], + vaultV2Adapters: [], block, }), ); @@ -3310,6 +3350,8 @@ describe("populateBundle", () => { users: [client.account.address, generalAdapter1, bbUsdt.address], tokens: [usdt, stEth, wstEth, bbUsdt.address], vaults: [bbUsdt.address], + vaultV2s: [], + vaultV2Adapters: [], block, }), ); @@ -3456,6 +3498,8 @@ describe("populateBundle", () => { users: [client.account.address, generalAdapter1, bbUsdt.address], tokens: [usdt, stEth, wstEth, bbUsdt.address], vaults: [bbUsdt.address], + vaultV2s: [], + vaultV2Adapters: [], block, }), ); @@ -3633,6 +3677,8 @@ describe("populateBundle", () => { users: [client.account.address, generalAdapter1, bbUsdt.address], tokens: [usdt, stEth, wstEth, bbUsdt.address], vaults: [bbUsdt.address], + vaultV2s: [], + vaultV2Adapters: [], block, }), ); @@ -3794,6 +3840,8 @@ describe("populateBundle", () => { users: [client.account.address, generalAdapter1, bbEth.address], tokens: [NATIVE_ADDRESS, wNative, bbEth.address], vaults: [bbEth.address], + vaultV2s: [], + vaultV2Adapters: [], block, }), ); @@ -3945,6 +3993,8 @@ describe("populateBundle", () => { users: [client.account.address, generalAdapter1, bbEth.address], tokens: [NATIVE_ADDRESS, wNative, bbEth.address], vaults: [bbEth.address], + vaultV2s: [], + vaultV2Adapters: [], block, }), ); @@ -4008,6 +4058,8 @@ describe("populateBundle", () => { ], tokens: [usdc, stEth, wstEth, steakUsdc.address], vaults: [steakUsdc.address], + vaultV2s: [], + vaultV2Adapters: [], block, }), ); @@ -4241,6 +4293,8 @@ describe("populateBundle", () => { users: [client.account.address, generalAdapter1, bbEth.address], tokens: [NATIVE_ADDRESS, wNative, stEth, wstEth, bbEth.address], vaults: [bbEth.address], + vaultV2s: [], + vaultV2Adapters: [], block, }), ); @@ -4535,6 +4589,8 @@ describe("populateBundle", () => { re7Weth.address, ], vaults: [bbEth.address, re7Weth.address], + vaultV2s: [], + vaultV2Adapters: [], block, }), ); @@ -4912,6 +4968,8 @@ describe("populateBundle", () => { bbUsdc.address, ], vaults: [steakUsdc.address, bbEth.address, bbUsdc.address], + vaultV2s: [], + vaultV2Adapters: [], block, }), ); @@ -5126,6 +5184,8 @@ describe("populateBundle", () => { users: [client.account.address, generalAdapter1], tokens: [NATIVE_ADDRESS, wNative, stEth, wstEth], vaults: [], + vaultV2Adapters: [], + vaultV2s: [], block, }), ); @@ -5344,6 +5404,8 @@ describe("populateBundle", () => { users: [client.account.address, generalAdapter1], tokens: [NATIVE_ADDRESS, wNative], vaults: [], + vaultV2Adapters: [], + vaultV2s: [], block, }), ); @@ -5467,6 +5529,8 @@ describe("populateBundle", () => { users: [whitelisted, generalAdapter1], tokens: [usdc, verUsdc, wNative], vaults: [], + vaultV2Adapters: [], + vaultV2s: [], block, }), ); diff --git a/packages/liquidation-sdk-viem/.env.example b/packages/liquidation-sdk-viem/.env.example deleted file mode 100644 index 2a192c11..00000000 --- a/packages/liquidation-sdk-viem/.env.example +++ /dev/null @@ -1,2 +0,0 @@ -MAINNET_RPC_URL= -ONE_INCH_SWAP_API_KEY= diff --git a/packages/liquidation-sdk-viem/examples/whitelistedMarkets.ts b/packages/liquidation-sdk-viem/examples/whitelistedMarkets.ts index 52c6046f..16f9c272 100644 --- a/packages/liquidation-sdk-viem/examples/whitelistedMarkets.ts +++ b/packages/liquidation-sdk-viem/examples/whitelistedMarkets.ts @@ -131,9 +131,10 @@ export const check = async < isPreLiquidation ? position.preLiquidation : morpho, ], }), - ...new Array(10) - .fill(undefined) - .map((_v, i) => seizableCollateral / 2n ** BigInt(i)) + ...Array.from( + { length: 10 }, + (_, i) => seizableCollateral / 2n ** BigInt(i), + ) .filter( (seizedAssets) => collateralToken.toUsd(seizedAssets)! > diff --git a/packages/liquidation-sdk-viem/package.json b/packages/liquidation-sdk-viem/package.json index e79e0c98..8b584c0d 100644 --- a/packages/liquidation-sdk-viem/package.json +++ b/packages/liquidation-sdk-viem/package.json @@ -51,9 +51,9 @@ "fetch-mock": "^11.1.5", "graphql": "^16.10.0", "hardhat": "^2.22.18", - "nock": "beta", + "nock": "^14.0.10", "typescript": "^5.7.2", - "viem": "^2.23.0", + "viem": "^2.33.3", "vitest": "^3.0.5" }, "publishConfig": { diff --git a/packages/liquidation-sdk-viem/test/examples/preLiquidation.test.ts b/packages/liquidation-sdk-viem/test/examples/preLiquidation.test.ts index bc4830cf..2f02ce04 100644 --- a/packages/liquidation-sdk-viem/test/examples/preLiquidation.test.ts +++ b/packages/liquidation-sdk-viem/test/examples/preLiquidation.test.ts @@ -293,7 +293,7 @@ describe("pre liquidation", () => { }); const preLiquidationAddress = - "0x0341b93dcb3b27fd4e2a6890cf06d67f64d9ac8e"; + "0x0341B93DCB3b27FD4E2A6890cF06D67f64d9Ac8E"; const [collateralToken, loanToken] = await Promise.all([ fetchToken(market.params.collateralToken, client), diff --git a/packages/liquidation-sdk-viem/test/examples/spectra.test.ts b/packages/liquidation-sdk-viem/test/examples/spectra.test.ts index 2f113899..1e56ae3b 100644 --- a/packages/liquidation-sdk-viem/test/examples/spectra.test.ts +++ b/packages/liquidation-sdk-viem/test/examples/spectra.test.ts @@ -380,7 +380,7 @@ describe("should liquidate Spectra Tokens", () => { await client.deal({ erc20: marketParams.collateralToken, - account: "0x23228469b3439d81dc64e3523068976201ba08c3", + account: "0x23228469b3439d81DC64e3523068976201bA08C3", amount: 8977038222000000000000n, }); @@ -521,7 +521,7 @@ describe("should liquidate Spectra Tokens", () => { await client.deal({ erc20: marketParams.collateralToken, - account: "0x23228469b3439d81dc64e3523068976201ba08c3", + account: "0x23228469b3439d81DC64e3523068976201bA08C3", amount: 8977038222000000000000n, }); diff --git a/packages/liquidity-sdk-viem/package.json b/packages/liquidity-sdk-viem/package.json index 0d3da95c..854e4b0c 100644 --- a/packages/liquidity-sdk-viem/package.json +++ b/packages/liquidity-sdk-viem/package.json @@ -44,9 +44,9 @@ "@morpho-org/test": "workspace:^", "@types/node": "^22.13.1", "graphql": "^16.10.0", - "nock": "beta", + "nock": "^14.0.10", "typescript": "^5.7.2", - "viem": "^2.23.0", + "viem": "^2.33.3", "vitest": "^3.0.5" }, "publishConfig": { diff --git a/packages/migration-sdk-viem/.env.example b/packages/migration-sdk-viem/.env.example deleted file mode 100644 index 1e314b5a..00000000 --- a/packages/migration-sdk-viem/.env.example +++ /dev/null @@ -1,2 +0,0 @@ -MAINNET_RPC_URL= -BASE_RPC_URL= diff --git a/packages/migration-sdk-viem/package.json b/packages/migration-sdk-viem/package.json index 0d62f6d4..83fd8eba 100644 --- a/packages/migration-sdk-viem/package.json +++ b/packages/migration-sdk-viem/package.json @@ -37,7 +37,7 @@ "@types/lodash": "^4.17.12", "lodash": "^4.17.21", "typescript": "^5.7.2", - "viem": "^2.23.0", + "viem": "^2.33.3", "vitest": "^3.0.5" }, "publishConfig": { diff --git a/packages/morpho-test/package.json b/packages/morpho-test/package.json index a634ae2a..a937eb76 100644 --- a/packages/morpho-test/package.json +++ b/packages/morpho-test/package.json @@ -29,7 +29,7 @@ "@morpho-org/test": "workspace:^", "@types/node": "^22.13.1", "typescript": "^5.7.2", - "viem": "^2.23.0" + "viem": "^2.33.3" }, "publishConfig": { "main": "lib/index.js", diff --git a/packages/simulation-sdk-wagmi/package.json b/packages/simulation-sdk-wagmi/package.json index 581636af..ec370075 100644 --- a/packages/simulation-sdk-wagmi/package.json +++ b/packages/simulation-sdk-wagmi/package.json @@ -52,7 +52,7 @@ "react": "^19.0.0", "react-dom": "^19.0.0", "typescript": "^5.7.2", - "viem": "^2.23.0", + "viem": "^2.33.3", "vitest": "^3.0.5", "wagmi": "^2.14.10" }, diff --git a/packages/simulation-sdk-wagmi/src/hooks/useSimulationState.ts b/packages/simulation-sdk-wagmi/src/hooks/useSimulationState.ts index bd69d918..1bfaaa05 100644 --- a/packages/simulation-sdk-wagmi/src/hooks/useSimulationState.ts +++ b/packages/simulation-sdk-wagmi/src/hooks/useSimulationState.ts @@ -1,4 +1,9 @@ -import { type MarketId, addresses } from "@morpho-org/blue-sdk"; +import { + Eip5267Domain, + type MarketId, + Token, + addresses, +} from "@morpho-org/blue-sdk"; import { type DeploylessFetchParameters, blueAbi, @@ -8,6 +13,8 @@ import { type FetchMarketsParameters, type FetchTokensParameters, type FetchUsersParameters, + type FetchVaultV2AdaptersParameters, + type FetchVaultV2sParameters, type FetchVaultsParameters, useChainId, useHoldings, @@ -17,6 +24,8 @@ import { useUsers, useVaultMarketConfigs, useVaultUsers, + useVaultV2Adapters, + useVaultV2s, useVaults, } from "@morpho-org/blue-sdk-wagmi"; import { values } from "@morpho-org/morpho-ts"; @@ -28,7 +37,9 @@ import { type Config, type ResolvedRegister, useReadContract } from "wagmi"; export type FetchSimulationStateParameters = FetchMarketsParameters & FetchUsersParameters & FetchTokensParameters & - FetchVaultsParameters & { + FetchVaultsParameters & + FetchVaultV2sParameters & + FetchVaultV2AdaptersParameters & { includeVaultQueues?: boolean; }; @@ -60,6 +71,8 @@ export interface SimulationStateLike { holdings?: Record>; vaultMarketConfigs?: Record>; vaultUsers?: Record>; + vaultV2s?: Record; + vaultV2Adapters?: Record; } export type UseSimulationReturnType = @@ -249,9 +262,46 @@ export function useSimulationState< }, }); + const vaultV2s = useVaultV2s({ + ...parameters, + blockNumber: block?.number, + query: { + ...parameters.query, + enabled: block != null && parameters.query?.enabled, + }, + }); + + const vaultV2Adapters = useVaultV2Adapters({ + ...parameters, + blockNumber: block?.number, + query: { + ...parameters.query, + enabled: block != null && parameters.query?.enabled, + }, + }); + const data = useMemo(() => { if (block == null) return; + for (const token of values(tokens.data)) { + if (token == null) continue; + const vaultV2 = vaultV2s.data[token.address]; + if (vaultV2 == null) continue; + + // Vaults V2 are not EIP-5267 compliant so we hardcode their EIP-712 domain specification to support EIP-2612 permits. + const eip5267Domain = new Eip5267Domain({ + fields: "0x0c", + name: "", + version: "", + chainId: BigInt(chainId), + verifyingContract: token.address, + salt: "0x", + extensions: [], + }); + + tokens.data[token.address] = new Token({ ...token, eip5267Domain }); + } + return new SimulationState({ chainId, block, @@ -264,6 +314,8 @@ export function useSimulationState< holdings: holdings.data, vaultMarketConfigs: vaultMarketConfigs.data, vaultUsers: vaultUsers.data, + vaultV2s: vaultV2s.data, + vaultV2Adapters: vaultV2Adapters.data, }); }, [ chainId, @@ -277,6 +329,8 @@ export function useSimulationState< holdings.data, vaultMarketConfigs.data, vaultUsers.data, + vaultV2s.data, + vaultV2Adapters.data, ]); const error = useMemo(() => { @@ -290,6 +344,8 @@ export function useSimulationState< holdings: holdings.error, vaultMarketConfigs: vaultMarketConfigs.error, vaultUsers: vaultUsers.error, + vaultV2s: vaultV2s.error, + vaultV2Adapters: vaultV2Adapters.error, }; }, [ feeRecipient.error, @@ -301,6 +357,8 @@ export function useSimulationState< holdings.error, vaultMarketConfigs.error, vaultUsers.error, + vaultV2s.error, + vaultV2Adapters.error, ]); if (block == null) @@ -324,7 +382,9 @@ export function useSimulationState< positions.isFetchingAny || holdings.isFetchingAny || vaultMarketConfigs.isFetchingAny || - vaultUsers.isFetchingAny, + vaultUsers.isFetchingAny || + vaultV2s.isFetchingAny || + vaultV2Adapters.isFetchingAny, isFetching: { global: { feeRecipient: feeRecipient.isFetching }, markets: markets.isFetching, @@ -335,6 +395,8 @@ export function useSimulationState< holdings: holdings.isFetching, vaultMarketConfigs: vaultMarketConfigs.isFetching, vaultUsers: vaultUsers.isFetching, + vaultV2s: vaultV2s.isFetching, + vaultV2Adapters: vaultV2Adapters.isFetching, }, isPending: false, }; diff --git a/packages/simulation-sdk-wagmi/test/handlers/blue/accrueInterest.test.ts b/packages/simulation-sdk-wagmi/test/handlers/blue/accrueInterest.test.ts index c26fd490..42482c7c 100644 --- a/packages/simulation-sdk-wagmi/test/handlers/blue/accrueInterest.test.ts +++ b/packages/simulation-sdk-wagmi/test/handlers/blue/accrueInterest.test.ts @@ -31,6 +31,8 @@ describe("Blue_AccrueInterest", () => { users: [], tokens: [], vaults: [], + vaultV2Adapters: [], + vaultV2s: [], block, accrueInterest: false, }), diff --git a/packages/simulation-sdk-wagmi/test/handlers/metamorpho/deposit.test.ts b/packages/simulation-sdk-wagmi/test/handlers/metamorpho/deposit.test.ts index 21a425ec..44b3e673 100644 --- a/packages/simulation-sdk-wagmi/test/handlers/metamorpho/deposit.test.ts +++ b/packages/simulation-sdk-wagmi/test/handlers/metamorpho/deposit.test.ts @@ -49,6 +49,8 @@ describe("MetaMorpho_AccrueInterest", () => { users: [client.account.address, steakUsdc.address], tokens: [steakUsdc.asset, steakUsdc.address], vaults: [steakUsdc.address], + vaultV2Adapters: [], + vaultV2s: [], block, accrueInterest: false, }), diff --git a/packages/simulation-sdk-wagmi/test/handlers/metamorpho/publicReallocate.test.ts b/packages/simulation-sdk-wagmi/test/handlers/metamorpho/publicReallocate.test.ts index fce9d370..c4aaf125 100644 --- a/packages/simulation-sdk-wagmi/test/handlers/metamorpho/publicReallocate.test.ts +++ b/packages/simulation-sdk-wagmi/test/handlers/metamorpho/publicReallocate.test.ts @@ -86,6 +86,8 @@ describe("MetaMorpho_PublicReallocate", () => { users: [client.account.address, steakUsdc.address], tokens: [NATIVE_ADDRESS, steakUsdc.asset, steakUsdc.address], vaults: [steakUsdc.address], + vaultV2Adapters: [], + vaultV2s: [], block, accrueInterest: false, }), diff --git a/packages/simulation-sdk-wagmi/test/handlers/metamorpho/reallocate.test.ts b/packages/simulation-sdk-wagmi/test/handlers/metamorpho/reallocate.test.ts index f35e9580..9327b36c 100644 --- a/packages/simulation-sdk-wagmi/test/handlers/metamorpho/reallocate.test.ts +++ b/packages/simulation-sdk-wagmi/test/handlers/metamorpho/reallocate.test.ts @@ -36,6 +36,8 @@ describe("MetaMorpho_Reallocate", () => { users: [client.account.address, steakUsdc.address], tokens: [steakUsdc.asset, steakUsdc.address], vaults: [steakUsdc.address], + vaultV2Adapters: [], + vaultV2s: [], block, accrueInterest: false, }), diff --git a/packages/simulation-sdk-wagmi/test/handlers/metamorpho/withdraw.test.ts b/packages/simulation-sdk-wagmi/test/handlers/metamorpho/withdraw.test.ts index aab2c8b9..b5c2802a 100644 --- a/packages/simulation-sdk-wagmi/test/handlers/metamorpho/withdraw.test.ts +++ b/packages/simulation-sdk-wagmi/test/handlers/metamorpho/withdraw.test.ts @@ -56,6 +56,8 @@ describe("MetaMorpho_AccrueInterest", () => { users: [client.account.address, steakUsdc.address], tokens: [steakUsdc.asset, steakUsdc.address], vaults: [steakUsdc.address], + vaultV2Adapters: [], + vaultV2s: [], block, accrueInterest: false, }), diff --git a/packages/simulation-sdk-wagmi/test/hooks/useSimulationState.test.ts b/packages/simulation-sdk-wagmi/test/hooks/useSimulationState.test.ts index 0eb9dbcb..2ab28b7b 100644 --- a/packages/simulation-sdk-wagmi/test/hooks/useSimulationState.test.ts +++ b/packages/simulation-sdk-wagmi/test/hooks/useSimulationState.test.ts @@ -34,6 +34,8 @@ describe("useSimulationState", () => { users: [], tokens: [], vaults: [], + vaultV2Adapters: [], + vaultV2s: [], }), ); @@ -58,6 +60,8 @@ describe("useSimulationState", () => { users: [], tokens: [], vaults: [], + vaultV2Adapters: [], + vaultV2s: [], block, }), ); @@ -90,6 +94,8 @@ describe("useSimulationState", () => { vaults: {}, vaultUsers: {}, vaultMarketConfigs: {}, + vaultV2Adapters: {}, + vaultV2s: {}, }, isFetching: { global: { @@ -103,6 +109,8 @@ describe("useSimulationState", () => { vaults: {}, vaultUsers: {}, vaultMarketConfigs: {}, + vaultV2Adapters: {}, + vaultV2s: {}, }, isFetchingAny: true, isPending: false, @@ -135,6 +143,8 @@ describe("useSimulationState", () => { vaults: {}, vaultUsers: {}, vaultMarketConfigs: {}, + vaultV2Adapters: {}, + vaultV2s: {}, }, isFetching: { global: { @@ -148,6 +158,8 @@ describe("useSimulationState", () => { vaults: {}, vaultUsers: {}, vaultMarketConfigs: {}, + vaultV2Adapters: {}, + vaultV2s: {}, }, isFetchingAny: false, isPending: false, @@ -166,6 +178,8 @@ describe("useSimulationState", () => { users: [], tokens: [], vaults: [], + vaultV2Adapters: [], + vaultV2s: [], block, }), ); @@ -202,6 +216,8 @@ describe("useSimulationState", () => { vaults: {}, vaultUsers: {}, vaultMarketConfigs: {}, + vaultV2Adapters: {}, + vaultV2s: {}, }, isFetching: { global: { @@ -217,6 +233,8 @@ describe("useSimulationState", () => { vaults: {}, vaultUsers: {}, vaultMarketConfigs: {}, + vaultV2Adapters: {}, + vaultV2s: {}, }, isFetchingAny: true, isPending: false, @@ -263,6 +281,8 @@ describe("useSimulationState", () => { vaults: {}, vaultUsers: {}, vaultMarketConfigs: {}, + vaultV2Adapters: {}, + vaultV2s: {}, }, isFetching: { global: { @@ -278,6 +298,8 @@ describe("useSimulationState", () => { vaults: {}, vaultUsers: {}, vaultMarketConfigs: {}, + vaultV2Adapters: {}, + vaultV2s: {}, }, isFetchingAny: false, isPending: false, @@ -304,6 +326,8 @@ describe("useSimulationState", () => { users: [client.account.address], tokens: [usdc], vaults: [], + vaultV2Adapters: [], + vaultV2s: [], block, }), ); @@ -365,6 +389,8 @@ describe("useSimulationState", () => { users: [client.account.address], tokens: [usdc], vaults: [], + vaultV2Adapters: [], + vaultV2s: [], block, }), ); @@ -424,6 +450,8 @@ describe("useSimulationState", () => { users: [client.account.address], tokens: [usdc], vaults: [], + vaultV2Adapters: [], + vaultV2s: [], block, }), { initialProps: block }, @@ -520,6 +548,8 @@ describe("useSimulationState", () => { users: [client.account.address, steakUsdc.address, generalAdapter1], tokens: [steakUsdc.asset, steakUsdc.address], vaults: [steakUsdc.address], + vaultV2Adapters: [], + vaultV2s: [], block, }), ); diff --git a/packages/simulation-sdk/package.json b/packages/simulation-sdk/package.json index 6b9d5e2d..39fd956b 100644 --- a/packages/simulation-sdk/package.json +++ b/packages/simulation-sdk/package.json @@ -32,7 +32,7 @@ "@types/lodash": "^4.17.12", "lodash": "^4.17.21", "typescript": "^5.7.2", - "viem": "^2.23.0", + "viem": "^2.33.3", "vitest": "^3.0.5" }, "publishConfig": { diff --git a/packages/simulation-sdk/src/SimulationState.ts b/packages/simulation-sdk/src/SimulationState.ts index 5916de62..1117dda3 100644 --- a/packages/simulation-sdk/src/SimulationState.ts +++ b/packages/simulation-sdk/src/SimulationState.ts @@ -1,6 +1,8 @@ import { AccrualPosition, AccrualVault, + AccrualVaultV2, + AccrualVaultV2MorphoVaultV1Adapter, type Address, AssetBalances, ChainId, @@ -16,11 +18,15 @@ import { type Token, UnknownDataError, UnknownTokenError, + UnsupportedVaultV2AdapterError, type User, type Vault, type VaultMarketConfig, VaultToken, type VaultUser, + type VaultV2, + type VaultV2Adapter, + VaultV2MorphoVaultV1Adapter, WrappedToken, _try, getChainAddresses, @@ -42,6 +48,8 @@ import { UnknownVaultError, UnknownVaultMarketConfigError, UnknownVaultUserError, + UnknownVaultV2AdapterError, + UnknownVaultV2Error, UnknownWrappedTokenError, } from "./errors.js"; import { type MaybeDraft, simulateOperation } from "./handlers/index.js"; @@ -110,6 +118,8 @@ export interface InputSimulationState { * VaultUsers indexed by vault then by user. */ vaultUsers?: Record>; + vaultV2s?: Record; + vaultV2Adapters?: Record; } export class SimulationState implements InputSimulationState { @@ -149,6 +159,8 @@ export class SimulationState implements InputSimulationState { Address, Record >; + public readonly vaultV2s: Record; + public readonly vaultV2Adapters: Record; constructor({ chainId, @@ -162,6 +174,8 @@ export class SimulationState implements InputSimulationState { holdings = {}, vaultMarketConfigs = {}, vaultUsers = {}, + vaultV2s = {}, + vaultV2Adapters = {}, }: InputSimulationState) { this.chainId = chainId; this.block = { number, timestamp }; @@ -175,6 +189,8 @@ export class SimulationState implements InputSimulationState { this.holdings = holdings; this.vaultMarketConfigs = vaultMarketConfigs; this.vaultUsers = vaultUsers; + this.vaultV2s = vaultV2s; + this.vaultV2Adapters = vaultV2Adapters; } public getMarket(marketId: MarketId) { @@ -331,6 +347,69 @@ export class SimulationState implements InputSimulationState { return _try(this.getWrappedToken.bind(this, address), UnknownDataError); } + public getVaultV2Adapter(address: Address) { + const vaultV2Adapter = this.vaultV2Adapters[address]; + + if (vaultV2Adapter == null) throw new UnknownVaultV2AdapterError(address); + + return vaultV2Adapter; + } + + public tryGetVaultV2Adapter(address: Address) { + return _try( + this.getVaultV2Adapter.bind(this, address), + UnknownVaultV2AdapterError, + ); + } + + public getAccrualVaultV2Adapter(address: Address) { + const vaultV2Adapter = this.getVaultV2Adapter(address); + + if (vaultV2Adapter instanceof VaultV2MorphoVaultV1Adapter) + return new AccrualVaultV2MorphoVaultV1Adapter( + vaultV2Adapter, + this.getAccrualVault(vaultV2Adapter.morphoVaultV1), + this.getHolding(vaultV2Adapter.address, vaultV2Adapter.morphoVaultV1) + .balance, + ); + + throw new UnsupportedVaultV2AdapterError(address); + } + + public tryGetAccrualVaultV2Adapter(address: Address) { + return _try( + this.getAccrualVaultV2Adapter.bind(this, address), + UnknownDataError, + ); + } + + public getVaultV2(address: Address) { + const vaultV2 = this.vaultV2s[address]; + + if (vaultV2 == null) throw new UnknownVaultV2Error(address); + + return vaultV2; + } + + public tryGetVaultV2(address: Address) { + return _try(this.getVaultV2.bind(this, address), UnknownVaultV2Error); + } + + public getAccrualVaultV2(address: Address) { + const vaultV2 = this.getVaultV2(address); + + return new AccrualVaultV2( + vaultV2, + this.getAccrualVaultV2Adapter(vaultV2.liquidityAdapter), + vaultV2.adapters.map(this.getAccrualVaultV2Adapter.bind(this)), + this.getHolding(vaultV2.address, vaultV2.asset).balance, + ); + } + + public tryGetAccrualVaultV2(address: Address) { + return _try(this.getAccrualVaultV2.bind(this, address), UnknownDataError); + } + public getBundleBalance( user: Address, token: Address, diff --git a/packages/simulation-sdk/src/errors.ts b/packages/simulation-sdk/src/errors.ts index cc8d0b3d..9744e855 100644 --- a/packages/simulation-sdk/src/errors.ts +++ b/packages/simulation-sdk/src/errors.ts @@ -132,6 +132,18 @@ export class UnknownVaultMarketPublicAllocatorConfigError extends UnknownDataErr } } +export class UnknownVaultV2AdapterError extends UnknownDataError { + constructor(public readonly adapter: Address) { + super(`unknown vault v2 adapter "${adapter}"`); + } +} + +export class UnknownVaultV2Error extends UnknownDataError { + constructor(public readonly vault: Address) { + super(`unknown vault v2 "${vault}"`); + } +} + export namespace Erc20Errors { export class InsufficientBalance extends Error { constructor( diff --git a/packages/simulation-sdk/test/fixtures.ts b/packages/simulation-sdk/test/fixtures.ts index 61767ea0..70d06d71 100644 --- a/packages/simulation-sdk/test/fixtures.ts +++ b/packages/simulation-sdk/test/fixtures.ts @@ -1,4 +1,10 @@ -import { maxUint256, parseEther, parseUnits } from "viem"; +import { + type Address, + maxUint256, + parseEther, + parseUnits, + zeroAddress, +} from "viem"; import { ChainId, @@ -12,10 +18,13 @@ import { Token, User, Vault, + VaultV2, + VaultV2MorphoVaultV1Adapter, registerCustomAddresses, } from "@morpho-org/blue-sdk"; import { randomMarket, randomVault } from "@morpho-org/morpho-test"; import { randomAddress } from "@morpho-org/test"; +import _merge from "lodash/merge"; import { SimulationState } from "../src/index.js"; @@ -36,6 +45,24 @@ registerCustomAddresses({ }, }); +const emptyHolding = (user: Address, token: Address) => + new Holding({ + erc20Allowances: { + morpho: 0n, + permit2: 0n, + "bundler3.generalAdapter1": 0n, + }, + user, + token, + balance: 0n, + permit2BundlerAllowance: { + amount: 0n, + expiration: 0n, + nonce: 0n, + }, + erc2612Nonce: 0n, + }); + export const marketA1 = new Market({ params: randomMarket({ loanToken: tokenA }), totalBorrowAssets: parseUnits("10000", 6), @@ -1630,11 +1657,103 @@ export const metaMorphoFixture = { }, } as const; +export const morphoVaultV1AdapterA = new VaultV2MorphoVaultV1Adapter({ + morphoVaultV1: vaultA.address, + address: "0x2A0000000000000000000000000000000000000a", + parentVault: "0x200000000000000000000000000000000000000A", + skimRecipient: zeroAddress, +}); +export const vaultV2A = new VaultV2({ + asset: tokenA, + adapters: [morphoVaultV1AdapterA.address], + address: "0x200000000000000000000000000000000000000A", + totalAssets: 0n, + _totalAssets: 0n, + totalSupply: 0n, + performanceFee: 0n, + managementFee: 0n, + performanceFeeRecipient: zeroAddress, + managementFeeRecipient: zeroAddress, + virtualShares: 10n ** BigInt(18 - blueFixture.tokens[tokenA].decimals), + lastUpdate: timestamp, + maxRate: 0n, + liquidityAdapter: morphoVaultV1AdapterA.address, + liquidityData: "0x", + liquidityAllocations: [ + { + id: VaultV2MorphoVaultV1Adapter.adapterId(morphoVaultV1AdapterA.address), + absoluteCap: 0n, + relativeCap: 0n, + allocation: 0n, + }, + ], + decimals: 18, + symbol: "VAULTV2A", + name: "Vault V2 A", +}); +export const vaultV2B = new VaultV2({ + asset: tokenB, + adapters: [], + address: "0x200000000000000000000000000000000000000b", + totalAssets: 0n, + _totalAssets: 0n, + totalSupply: 0n, + performanceFee: 0n, + managementFee: 0n, + performanceFeeRecipient: zeroAddress, + managementFeeRecipient: zeroAddress, + virtualShares: 10n ** BigInt(18 - blueFixture.tokens[tokenB].decimals), + lastUpdate: timestamp, + maxRate: 0n, + liquidityAdapter: zeroAddress, + liquidityData: "0x", + liquidityAllocations: undefined, + decimals: 18, + symbol: "VAULTV2B", + name: "Vault V2 B", +}); + +export const v2Fixture = { + vaultV2Adapters: { + [morphoVaultV1AdapterA.address]: morphoVaultV1AdapterA, + }, + vaultV2s: { + [vaultV2A.address]: vaultV2A, + [vaultV2B.address]: vaultV2B, + }, + tokens: { + [vaultV2A.address]: new Token(vaultV2A), + [vaultV2B.address]: new Token(vaultV2B), + }, + holdings: { + [vaultV2A.address]: { + [tokenA]: emptyHolding(vaultV2A.address, tokenA), + }, + [vaultV2B.address]: { + [tokenB]: emptyHolding(vaultV2B.address, tokenB), + }, + [morphoVaultV1AdapterA.address]: { + [vaultA.address]: emptyHolding( + morphoVaultV1AdapterA.address, + vaultA.address, + ), + [tokenA]: emptyHolding(morphoVaultV1AdapterA.address, tokenA), + }, + [userA]: { + [vaultV2A.address]: emptyHolding(userA, vaultV2A.address), + [vaultV2B.address]: emptyHolding(userA, vaultV2B.address), + }, + [userB]: { + [vaultV2A.address]: emptyHolding(userB, vaultV2A.address), + [vaultV2B.address]: emptyHolding(userB, vaultV2B.address), + }, + }, +}; + export const dataFixture = new SimulationState({ chainId: ChainId.EthMainnet, block: { number: 1n, timestamp }, - ...blueFixture, - ...metaMorphoFixture, + ..._merge(blueFixture, metaMorphoFixture, v2Fixture), }); export const wrapFixtures = new SimulationState({ diff --git a/packages/test-wagmi/package.json b/packages/test-wagmi/package.json index a74ddfa0..3c328c5f 100644 --- a/packages/test-wagmi/package.json +++ b/packages/test-wagmi/package.json @@ -39,7 +39,7 @@ "react": "^19.0.0", "react-dom": "^19.0.0", "typescript": "^5.7.2", - "viem": "^2.23.0", + "viem": "^2.33.3", "vitest": "^3.0.5", "wagmi": "^2.14.10" }, diff --git a/packages/test-wagmi/src/vitest.ts b/packages/test-wagmi/src/vitest.ts index 6f27f237..90a629d8 100644 --- a/packages/test-wagmi/src/vitest.ts +++ b/packages/test-wagmi/src/vitest.ts @@ -27,9 +27,10 @@ export const createWagmiTest = ( mock({ accounts: [ testAccount().address, - ...new Array(parameters?.accounts ?? 9) - .fill(null) - .map((_, i) => testAccount(i + 1).address), + ...Array.from( + { length: parameters?.accounts ?? 9 }, + (_, i) => testAccount(i + 1).address, + ), ], }), ], diff --git a/packages/test/package.json b/packages/test/package.json index 44e91f66..171f09b2 100644 --- a/packages/test/package.json +++ b/packages/test/package.json @@ -47,7 +47,7 @@ "@types/lodash.kebabcase": "^4.1.9", "@types/node": "^22.13.1", "typescript": "^5.7.2", - "viem": "^2.23.0", + "viem": "^2.33.3", "vitest": "^3.0.5", "wagmi": "^2.14.10" }, diff --git a/packages/test/src/vitest.ts b/packages/test/src/vitest.ts index 4b170b0a..72cf6320 100644 --- a/packages/test/src/vitest.ts +++ b/packages/test/src/vitest.ts @@ -1,4 +1,9 @@ -import { http, type Chain } from "viem"; +import { + http, + type Chain, + type SendTransactionParameters, + zeroAddress, +} from "viem"; import { test } from "vitest"; import { type AnvilArgs, spawnAnvil } from "./anvil"; import { type AnvilTestClient, createAnvilTestClient } from "./client"; @@ -46,6 +51,34 @@ export const createViemTest = ( // Make block timestamp 100% predictable. await client.setBlockTimestampInterval({ interval: 1 }); + // Remove code from contract + // cf. https://eips.ethereum.org/EIPS/eip-7702 + const code = await client.getCode({ address: client.account.address }); + + if (code != null) { + const auth = await client.signAuthorization({ + account: client.account, + contractAddress: zeroAddress, + executor: "self", + }); + + await client + .sendTransaction({ + authorizationList: [auth], + to: client.account.address, + data: "0x", + account: client.account, + } as SendTransactionParameters) + .catch(async (e) => { + if ( + e.cause.details === + "EIP-7702 authorization lists are not supported before the Prague hardfork" + ) + return; + throw e; + }); + } + await use(client); await stop(); diff --git a/packages/test/test/utils.test.ts b/packages/test/test/utils.test.ts index 5aff3aa6..38fcb560 100644 --- a/packages/test/test/utils.test.ts +++ b/packages/test/test/utils.test.ts @@ -5,7 +5,7 @@ import { test } from "./setup"; describe("getFunctionCalls", () => { test("should return call count", async ({ client }) => { - const erc20 = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"; + const erc20 = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"; const amount = parseUnits("100", 6); const to = testAccount(1); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0945ae3d..ad0f3023 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -57,8 +57,8 @@ importers: specifier: ^5.7.2 version: 5.7.2 viem: - specifier: ^2.23.0 - version: 2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) + specifier: ^2.33.3 + version: 2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) vitest: specifier: ^3.0.5 version: 3.0.5(@types/debug@4.1.12)(@types/node@22.13.1)(@vitest/ui@3.0.5)(happy-dom@17.0.0)(terser@5.36.0) @@ -112,8 +112,8 @@ importers: specifier: ^5.7.2 version: 5.7.2 viem: - specifier: ^2.23.0 - version: 2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) + specifier: ^2.33.3 + version: 2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) vitest: specifier: ^3.0.5 version: 3.0.5(@types/debug@4.1.12)(@types/node@22.13.1)(@vitest/ui@3.0.5)(happy-dom@17.0.0)(terser@5.36.0) @@ -139,8 +139,8 @@ importers: specifier: ^5.7.2 version: 5.7.2 viem: - specifier: ^2.23.0 - version: 2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) + specifier: ^2.33.3 + version: 2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) vitest: specifier: ^3.0.5 version: 3.0.5(@types/debug@4.1.12)(@types/node@22.13.1)(@vitest/ui@3.0.5)(happy-dom@17.0.0)(terser@5.36.0) @@ -193,14 +193,14 @@ importers: specifier: ^5.7.2 version: 5.7.2 viem: - specifier: ^2.23.0 - version: 2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) + specifier: ^2.33.3 + version: 2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) vitest: specifier: ^3.0.5 version: 3.0.5(@types/debug@4.1.12)(@types/node@22.13.1)(@vitest/ui@3.0.5)(happy-dom@17.0.0)(terser@5.36.0) wagmi: specifier: ^2.14.10 - version: 2.14.10(@tanstack/query-core@5.62.16)(@tanstack/react-query@5.62.11(react@19.0.0))(@types/react@19.0.7)(bufferutil@4.0.8)(encoding@0.1.13)(react@19.0.0)(typescript@5.7.2)(utf-8-validate@5.0.10)(viem@2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)) + version: 2.14.10(@tanstack/query-core@5.62.16)(@tanstack/react-query@5.62.11(react@19.0.0))(@types/react@19.0.7)(bufferutil@4.0.8)(encoding@0.1.13)(react@19.0.0)(typescript@5.7.2)(utf-8-validate@5.0.10)(viem@2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)) packages/bundler-sdk-viem: devDependencies: @@ -250,8 +250,8 @@ importers: specifier: ^5.7.2 version: 5.7.2 viem: - specifier: ^2.23.0 - version: 2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) + specifier: ^2.33.3 + version: 2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) vitest: specifier: ^3.0.5 version: 3.0.5(@types/debug@4.1.12)(@types/node@22.13.1)(@vitest/ui@3.0.5)(happy-dom@17.0.0)(terser@5.36.0) @@ -260,10 +260,10 @@ importers: dependencies: '@paraswap/sdk': specifier: ^7.2.3 - version: 7.2.3(axios@1.7.7)(ethers@6.13.5(bufferutil@4.0.8)(utf-8-validate@5.0.10))(typescript@5.7.2)(viem@2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)) + version: 7.2.3(axios@1.7.7)(ethers@6.13.5(bufferutil@4.0.8)(utf-8-validate@5.0.10))(typescript@5.7.2)(viem@2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)) executooor-viem: specifier: ^1.3.3 - version: 1.3.3(evm-maths@7.0.1)(viem@2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)) + version: 1.3.3(evm-maths@7.0.1)(viem@2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)) graphql-request: specifier: ^6.1.0 version: 6.1.0(encoding@0.1.13)(graphql@16.10.0) @@ -323,14 +323,14 @@ importers: specifier: ^2.22.18 version: 2.22.18(bufferutil@4.0.8)(ts-node@10.9.2(@types/node@22.13.1)(typescript@5.7.2))(typescript@5.7.2)(utf-8-validate@5.0.10) nock: - specifier: beta - version: 14.0.0-beta.19 + specifier: ^14.0.10 + version: 14.0.10 typescript: specifier: ^5.7.2 version: 5.7.2 viem: - specifier: ^2.23.0 - version: 2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) + specifier: ^2.33.3 + version: 2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) vitest: specifier: ^3.0.5 version: 3.0.5(@types/debug@4.1.12)(@types/node@22.13.1)(@vitest/ui@3.0.5)(happy-dom@17.0.0)(terser@5.36.0) @@ -390,14 +390,14 @@ importers: specifier: ^16.10.0 version: 16.10.0 nock: - specifier: beta - version: 14.0.0-beta.19 + specifier: ^14.0.10 + version: 14.0.10 typescript: specifier: ^5.7.2 version: 5.7.2 viem: - specifier: ^2.23.0 - version: 2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) + specifier: ^2.33.3 + version: 2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) vitest: specifier: ^3.0.5 version: 3.0.5(@types/debug@4.1.12)(@types/node@22.13.1)(@vitest/ui@3.0.5)(happy-dom@17.0.0)(terser@5.36.0) @@ -442,8 +442,8 @@ importers: specifier: ^5.7.2 version: 5.7.2 viem: - specifier: ^2.23.0 - version: 2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) + specifier: ^2.33.3 + version: 2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) vitest: specifier: ^3.0.5 version: 3.0.5(@types/debug@4.1.12)(@types/node@22.13.1)(@vitest/ui@3.0.5)(happy-dom@17.0.0)(terser@5.36.0) @@ -466,8 +466,8 @@ importers: specifier: ^5.7.2 version: 5.7.2 viem: - specifier: ^2.23.0 - version: 2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) + specifier: ^2.33.3 + version: 2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) packages/morpho-ts: devDependencies: @@ -506,8 +506,8 @@ importers: specifier: ^5.7.2 version: 5.7.2 viem: - specifier: ^2.23.0 - version: 2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) + specifier: ^2.33.3 + version: 2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) vitest: specifier: ^3.0.5 version: 3.0.5(@types/debug@4.1.12)(@types/node@22.13.1)(@vitest/ui@3.0.5)(happy-dom@17.0.0)(terser@5.36.0) @@ -575,14 +575,14 @@ importers: specifier: ^5.7.2 version: 5.7.2 viem: - specifier: ^2.23.0 - version: 2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) + specifier: ^2.33.3 + version: 2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) vitest: specifier: ^3.0.5 version: 3.0.5(@types/debug@4.1.12)(@types/node@22.13.1)(@vitest/ui@3.0.5)(happy-dom@17.0.0)(terser@5.36.0) wagmi: specifier: ^2.14.10 - version: 2.14.10(@tanstack/query-core@5.62.16)(@tanstack/react-query@5.62.11(react@19.0.0))(@types/react@19.0.7)(bufferutil@4.0.8)(encoding@0.1.13)(react@19.0.0)(typescript@5.7.2)(utf-8-validate@5.0.10)(viem@2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)) + version: 2.14.10(@tanstack/query-core@5.62.16)(@tanstack/react-query@5.62.11(react@19.0.0))(@types/react@19.0.7)(bufferutil@4.0.8)(encoding@0.1.13)(react@19.0.0)(typescript@5.7.2)(utf-8-validate@5.0.10)(viem@2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)) packages/test: dependencies: @@ -591,10 +591,10 @@ importers: version: 4.1.1 viem-deal: specifier: ^2.0.3 - version: 2.0.4(viem@2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)) + version: 2.0.4(viem@2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)) viem-tracer: specifier: ^1.7.1 - version: 1.7.1(viem@2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)) + version: 1.7.1(viem@2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)) devDependencies: '@playwright/test': specifier: ^1.48.1 @@ -609,14 +609,14 @@ importers: specifier: ^5.7.2 version: 5.7.2 viem: - specifier: ^2.23.0 - version: 2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) + specifier: ^2.33.3 + version: 2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) vitest: specifier: ^3.0.5 version: 3.0.5(@types/debug@4.1.12)(@types/node@22.13.1)(@vitest/ui@3.0.5)(happy-dom@17.0.0)(terser@5.36.0) wagmi: specifier: ^2.14.10 - version: 2.14.10(@tanstack/query-core@5.62.16)(@tanstack/react-query@5.62.11(react@19.0.0))(bufferutil@4.0.8)(encoding@0.1.13)(react@19.0.0)(typescript@5.7.2)(utf-8-validate@5.0.10)(viem@2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)) + version: 2.14.10(@tanstack/query-core@5.62.16)(@tanstack/react-query@5.62.11(react@19.0.0))(bufferutil@4.0.8)(encoding@0.1.13)(react@19.0.0)(typescript@5.7.2)(utf-8-validate@5.0.10)(viem@2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)) packages/test-wagmi: devDependencies: @@ -643,7 +643,7 @@ importers: version: 19.0.2(@types/react@19.0.7) '@wagmi/core': specifier: ^2.16.3 - version: 2.16.3(@tanstack/query-core@5.62.16)(@types/react@19.0.7)(react@19.0.0)(typescript@5.7.2)(use-sync-external-store@1.4.0(react@19.0.0))(viem@2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)) + version: 2.16.3(@tanstack/query-core@5.62.16)(@types/react@19.0.7)(react@19.0.0)(typescript@5.7.2)(use-sync-external-store@1.4.0(react@19.0.0))(viem@2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)) react: specifier: ^19.0.0 version: 19.0.0 @@ -654,14 +654,14 @@ importers: specifier: ^5.7.2 version: 5.7.2 viem: - specifier: ^2.23.0 - version: 2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) + specifier: ^2.33.3 + version: 2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) vitest: specifier: ^3.0.5 version: 3.0.5(@types/debug@4.1.12)(@types/node@22.13.1)(@vitest/ui@3.0.5)(happy-dom@17.0.0)(terser@5.36.0) wagmi: specifier: ^2.14.10 - version: 2.14.10(@tanstack/query-core@5.62.16)(@tanstack/react-query@5.62.11(react@19.0.0))(@types/react@19.0.7)(bufferutil@4.0.8)(encoding@0.1.13)(react@19.0.0)(typescript@5.7.2)(utf-8-validate@5.0.10)(viem@2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)) + version: 2.14.10(@tanstack/query-core@5.62.16)(@tanstack/react-query@5.62.11(react@19.0.0))(@types/react@19.0.7)(bufferutil@4.0.8)(encoding@0.1.13)(react@19.0.0)(typescript@5.7.2)(utf-8-validate@5.0.10)(viem@2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)) packages: @@ -1638,6 +1638,9 @@ packages: resolution: {integrity: sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==} engines: {node: '>=8'} + '@jridgewell/gen-mapping@0.3.13': + resolution: {integrity: sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==} + '@jridgewell/gen-mapping@0.3.5': resolution: {integrity: sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==} engines: {node: '>=6.0.0'} @@ -1654,15 +1657,21 @@ packages: resolution: {integrity: sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==} engines: {node: '>=6.0.0'} - '@jridgewell/source-map@0.3.6': - resolution: {integrity: sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ==} + '@jridgewell/source-map@0.3.11': + resolution: {integrity: sha512-ZMp1V8ZFcPG5dIWnQLr3NSI1MiCU7UETdS/A0G8V/XWHvJv3ZsFqutJn1Y5RPmAPX6F3BiE397OqveU/9NCuIA==} '@jridgewell/sourcemap-codec@1.5.0': resolution: {integrity: sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==} + '@jridgewell/sourcemap-codec@1.5.5': + resolution: {integrity: sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==} + '@jridgewell/trace-mapping@0.3.25': resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==} + '@jridgewell/trace-mapping@0.3.30': + resolution: {integrity: sha512-GQ7Nw5G2lTu/BtHTKfXhKHok2WGetd4XYcVKGx00SjAk8GMwgJM3zr6zORiPGuOE+/vkc90KtTosSSvaCjKb2Q==} + '@jridgewell/trace-mapping@0.3.9': resolution: {integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==} @@ -1773,14 +1782,18 @@ packages: resolution: {integrity: sha512-z10PF9JV6SbjFq+/rYabM+8CVlMokgl8RFGvieSGNTmrkQanfHn+15XBrhG3BgUfvmTeSeyShfOHpG0i9zEdcg==} deprecated: Motion One for Vue is deprecated. Use Oku Motion instead https://oku-ui.com/motion - '@mswjs/interceptors@0.37.3': - resolution: {integrity: sha512-USvgCL/uOGFtVa6SVyRrC8kIAedzRohxIXN5LISlg5C5vLZCn7dgMFVSNhSF9cuBEFrm/O2spDWEZeMnw4ZXYg==} + '@mswjs/interceptors@0.39.5': + resolution: {integrity: sha512-B9nHSJYtsv79uo7QdkZ/b/WoKm20IkVSmTc/WCKarmDtFwM0dRx2ouEniqwNkzCSLn3fydzKmnMzjtfdOWt3VQ==} engines: {node: '>=18'} '@noble/ciphers@1.0.0': resolution: {integrity: sha512-wH5EHOmLi0rEazphPbecAzmjd12I6/Yv/SiHdkA9LSycsQk7RuuTp7am5/o62qYr0RScE7Pc9icXGBbsr6cesA==} engines: {node: ^14.21.3 || >=16} + '@noble/ciphers@1.3.0': + resolution: {integrity: sha512-2I0gnIVPtfnMw9ee9h1dJG7tp81+8Ob3OJb3Mv37rx5L40/b0i7djjCVvGOVqc9AEIQyvyu1i6ypKdFw8R8gQw==} + engines: {node: ^14.21.3 || >=16} + '@noble/curves@1.2.0': resolution: {integrity: sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==} @@ -1791,6 +1804,10 @@ packages: resolution: {integrity: sha512-warwspo+UYUPep0Q+vtdVB4Ugn8GGQj8iyB3gnRWsztmUHTI3S1nhdiWNsPUGL0vud7JlRRk1XEu7Lq1KGTnMQ==} engines: {node: ^14.21.3 || >=16} + '@noble/curves@1.9.2': + resolution: {integrity: sha512-HxngEd2XUcg9xi20JkwlLCtYwfoFw4JGkuZpT+WlsPD4gB/cxkvTD8fSsoAnphGZhFdZYKeQIPCuFlWPm1uE0g==} + engines: {node: ^14.21.3 || >=16} + '@noble/hashes@1.2.0': resolution: {integrity: sha512-FZfhjEDbT5GRswV3C6uvLPHMiVD6lQBmpoX5+eSiPaMTXte/IKqI5dykDxzZB/WBeK/CDuQRBWarPdi3FNY2zQ==} @@ -1806,6 +1823,10 @@ packages: resolution: {integrity: sha512-B8XBPsn4vT/KJAGqDzbwztd+6Yte3P4V7iafm24bxgDe/mlRuK6xmWPuCNrKt2vDafZ8MfJLlchDG/vYafQEjQ==} engines: {node: ^14.21.3 || >=16} + '@noble/hashes@1.8.0': + resolution: {integrity: sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==} + engines: {node: ^14.21.3 || >=16} + '@noble/secp256k1@1.7.1': resolution: {integrity: sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw==} @@ -1926,6 +1947,7 @@ packages: '@paraswap/sdk@7.2.3': resolution: {integrity: sha512-c1YZoCOrWViXNdIfd6+kyhIKXS+qsXrwb2CVygfGKon+qqQaUCdgK1DsrcIn2x/RMfg349f0jd6LG2bwfr3gOA==} engines: {node: '>=18'} + deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. peerDependencies: axios: '>=0.25.0 <2.0.0' ethers: ^5.5.0 || ^6.0.0 @@ -2148,14 +2170,17 @@ packages: '@scure/base@1.2.4': resolution: {integrity: sha512-5Yy9czTO47mqz+/J8GM6GIId4umdCk1wc1q8rKERQulIoc8VP9pzDcghv10Tl2E7R96ZUx/PhND3ESYUQX8NuQ==} + '@scure/base@1.2.6': + resolution: {integrity: sha512-g/nm5FgUa//MCj1gV09zTJTaM6KBAHqLN907YVQqf7zC49+DcO4B1so4ZX07Ef10Twr6nuqYEH9GEggFXA4Fmg==} + '@scure/bip32@1.1.5': resolution: {integrity: sha512-XyNh1rB0SkEqd3tXcXMi+Xe1fvg+kUIcoRIEujP1Jgv7DqW2r9lg3Ah0NkFaCs9sTkQAQA8kw7xiRXzENi9Rtw==} '@scure/bip32@1.4.0': resolution: {integrity: sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg==} - '@scure/bip32@1.6.2': - resolution: {integrity: sha512-t96EPDMbtGgtb7onKKqxRLfE5g05k7uHnHRM2xdE6BP/ZmxaLtPek4J4KfVn/90IQNrU1IOAqMgiDtUdtbe3nw==} + '@scure/bip32@1.7.0': + resolution: {integrity: sha512-E4FFX/N3f4B80AKWp5dP6ow+flD1LQZo/w8UnLGYZO674jS6YnYeepycOOksv+vLPSpgN35wgKgy+ybfTb2SMw==} '@scure/bip39@1.1.1': resolution: {integrity: sha512-t+wDck2rVkh65Hmv280fYdVdY25J9YeEUIgn2LG1WM6gxFkGzcksoDiUkWVpVp3Oex9xGC68JU2dSbUfwZ2jPg==} @@ -2163,8 +2188,8 @@ packages: '@scure/bip39@1.3.0': resolution: {integrity: sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ==} - '@scure/bip39@1.5.4': - resolution: {integrity: sha512-TFM4ni0vKvCfBpohoh+/lY05i9gRbSwXWngAsF4CABQxoaOHijxuaZ2R6cStDQ5CHtHO9aGJTr4ksVJASRRyMA==} + '@scure/bip39@1.6.0': + resolution: {integrity: sha512-+lF0BbLiJNwVlev4eKelw1WWLaiKXw7sSl8T6FvBlWkdX+94aGJ4o8XjUdlyhTCjd8c+B3KT3JfS8P0bLRNU6A==} '@sentry/core@5.30.0': resolution: {integrity: sha512-TmfrII8w1PQZSZgPpUESqjB+jC6MvZJZdLtE/0hZ+SrnKhW3x5WlYLvTXZpcWePYBku7rl2wn1RZu6uT0qCTeg==} @@ -2435,6 +2460,7 @@ packages: '@walletconnect/ethereum-provider@2.17.0': resolution: {integrity: sha512-b+KTAXOb6JjoxkwpgYQQKPUcTwENGmdEdZoIDLeRicUmZTn/IQKfkMoC2frClB4YxkyoVMtj1oMV2JAax+yu9A==} + deprecated: 'Reliability and performance improvements. See: https://github.com/WalletConnect/walletconnect-monorepo/releases' '@walletconnect/events@1.0.1': resolution: {integrity: sha512-NPTqaoi0oPBVNuLv7qPaJazmGHs5JGyO8eEAk5VGKmJzDR7AHzD4k6ilox5kxk1iwiOnFopBOOMLs86Oa76HpQ==} @@ -2540,6 +2566,11 @@ packages: engines: {node: '>=0.4.0'} hasBin: true + acorn@8.15.0: + resolution: {integrity: sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==} + engines: {node: '>=0.4.0'} + hasBin: true + adm-zip@0.4.16: resolution: {integrity: sha512-TFi4HBKSGfIKsK5YCkKaaFG2m4PEDyViZmEwof3MTIgzimHLto6muaHVpbrljdIvIrFZzEq/p4nafOeLcYegrg==} engines: {node: '>=0.3.0'} @@ -2689,6 +2720,9 @@ packages: bn.js@5.2.1: resolution: {integrity: sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==} + bn.js@5.2.2: + resolution: {integrity: sha512-v2YAxEmKaBLahNwE1mjp4WON6huMNeuDvagFZW+ASCuA/ku0bXR9hSMw0XpiqMoA3+rmnyck/tPRSFQkoC9Cuw==} + bowser@2.11.0: resolution: {integrity: sha512-AlcaJBi/pqqJBIQ8U9Mcpc9i8Aqxn88Skv5d+xBX006BY5u8N3mGLHa5Lgppa7L/HfwgwLgZ6NYs+Ag6uUmJRA==} @@ -2757,10 +2791,22 @@ packages: resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} engines: {node: '>=8'} + call-bind-apply-helpers@1.0.2: + resolution: {integrity: sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==} + engines: {node: '>= 0.4'} + call-bind@1.0.7: resolution: {integrity: sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==} engines: {node: '>= 0.4'} + call-bind@1.0.8: + resolution: {integrity: sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==} + engines: {node: '>= 0.4'} + + call-bound@1.0.4: + resolution: {integrity: sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==} + engines: {node: '>= 0.4'} + callsites@3.1.0: resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} engines: {node: '>=6'} @@ -3092,6 +3138,15 @@ packages: supports-color: optional: true + debug@4.4.1: + resolution: {integrity: sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + decamelize@1.2.0: resolution: {integrity: sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==} engines: {node: '>=0.10.0'} @@ -3190,6 +3245,10 @@ packages: resolution: {integrity: sha512-2QF/g9/zTaPDc3BjNcVTGoBbXBgYfMTTceLaYcFJ/W9kggFUkhxD/hMEeuLKbugyef9SqAx8cpgwlIP/jinUTA==} engines: {node: '>=4'} + dunder-proto@1.0.1: + resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==} + engines: {node: '>= 0.4'} + duplexify@4.1.3: resolution: {integrity: sha512-M3BmBhwJRZsSx38lZyhE53Csddgzl5R7xGJNk7CVddZD6CcmwMCH8J+7AprIrQKH7TonKxaCjcv27Qmf+sQ+oA==} @@ -3253,6 +3312,10 @@ packages: resolution: {integrity: sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==} engines: {node: '>= 0.4'} + es-define-property@1.0.1: + resolution: {integrity: sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==} + engines: {node: '>= 0.4'} + es-errors@1.3.0: resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==} engines: {node: '>= 0.4'} @@ -3260,6 +3323,14 @@ packages: es-module-lexer@1.6.0: resolution: {integrity: sha512-qqnD1yMU6tk/jnaMosogGySTZP8YtUgAffA9nMN+E/rjxcfRQ6IEk7IiozUjgxKoFHBGjTLnrHB/YC45r/59EQ==} + es-object-atoms@1.1.1: + resolution: {integrity: sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==} + engines: {node: '>= 0.4'} + + es-set-tostringtag@2.1.0: + resolution: {integrity: sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==} + engines: {node: '>= 0.4'} + esbuild@0.21.5: resolution: {integrity: sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==} engines: {node: '>=12'} @@ -3447,6 +3518,15 @@ packages: flatted@3.3.2: resolution: {integrity: sha512-AiwGJM8YcNOaobumgtng+6NHuOqC3A7MixFeDafM3X9cIUM+xUXoS5Vfgf+OihAYe20fxqNM9yPBXJzRtZ/4eA==} + follow-redirects@1.15.11: + resolution: {integrity: sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ==} + engines: {node: '>=4.0'} + peerDependencies: + debug: '*' + peerDependenciesMeta: + debug: + optional: true + follow-redirects@1.15.9: resolution: {integrity: sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==} engines: {node: '>=4.0'} @@ -3459,12 +3539,16 @@ packages: for-each@0.3.3: resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==} + for-each@0.3.5: + resolution: {integrity: sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==} + engines: {node: '>= 0.4'} + foreground-child@3.3.0: resolution: {integrity: sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==} engines: {node: '>=14'} - form-data@4.0.1: - resolution: {integrity: sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==} + form-data@4.0.4: + resolution: {integrity: sha512-KrGhL9Q4zjj0kiUt5OO4Mr/A/jlI2jDYs5eHBpYHPcBEVSiipAvn2Ko2HnPe20rmcuuvMHNdZFp+4IlGTMF0Ow==} engines: {node: '>= 6'} fp-ts@1.19.3: @@ -3506,9 +3590,17 @@ packages: resolution: {integrity: sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==} engines: {node: '>= 0.4'} + get-intrinsic@1.3.0: + resolution: {integrity: sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==} + engines: {node: '>= 0.4'} + get-port-please@3.1.2: resolution: {integrity: sha512-Gxc29eLs1fbn6LQ4jSU4vXjlwyZhF5HsGuMAa7gqBP4Rw4yxxltyDUuF5MBclFzDTXO+ACchGQoeela4DSfzdQ==} + get-proto@1.0.1: + resolution: {integrity: sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==} + engines: {node: '>= 0.4'} + get-stream@8.0.1: resolution: {integrity: sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==} engines: {node: '>=16'} @@ -3553,6 +3645,10 @@ packages: gopd@1.0.1: resolution: {integrity: sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==} + gopd@1.2.0: + resolution: {integrity: sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==} + engines: {node: '>= 0.4'} + graceful-fs@4.2.11: resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} @@ -3635,6 +3731,10 @@ packages: resolution: {integrity: sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==} engines: {node: '>= 0.4'} + has-symbols@1.1.0: + resolution: {integrity: sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==} + engines: {node: '>= 0.4'} + has-tostringtag@1.0.2: resolution: {integrity: sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==} engines: {node: '>= 0.4'} @@ -3861,6 +3961,10 @@ packages: resolution: {integrity: sha512-uZ25/bUAlUY5fR4OKT4rZQEBrzQWYV9ZJYGGsUmEJ6thodVJ1HX64ePQ6Z0qPWP+m+Uq6e9UugrE38jeYsDSMw==} engines: {node: '>= 0.4'} + is-typed-array@1.1.15: + resolution: {integrity: sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==} + engines: {node: '>= 0.4'} + is-unc-path@1.0.0: resolution: {integrity: sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==} engines: {node: '>=0.10.0'} @@ -3887,6 +3991,9 @@ packages: isarray@1.0.0: resolution: {integrity: sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==} + isarray@2.0.5: + resolution: {integrity: sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==} + isexe@2.0.0: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} @@ -3895,8 +4002,8 @@ packages: peerDependencies: ws: '*' - isows@1.0.6: - resolution: {integrity: sha512-lPHCayd40oW98/I0uvgaHKWCSvkzY27LjWLbtzOm64yQ+G3Q5npjjbdppU65iZXkK1Zt+kH9pfegli0AYfwYYw==} + isows@1.0.7: + resolution: {integrity: sha512-I1fSfDCZL5P0v33sVqeTDSpcstAg/N+wF5HS033mogOVIp4B+oHC7oOCsA3axAbBSGTJ8QubbNmnIRN/h8U7hg==} peerDependencies: ws: '*' @@ -4134,6 +4241,10 @@ packages: resolution: {integrity: sha512-8y/eV9QQZCiyn1SprXSrCmqJN0yNRATe+PO8ztwqrvrbdRLA3eYJF0yaR0YayLWkMbsQSKWS9N2gPcGEc4UsZg==} engines: {node: '>=0.10.0'} + math-intrinsics@1.1.0: + resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==} + engines: {node: '>= 0.4'} + md5.js@1.3.5: resolution: {integrity: sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==} @@ -4275,9 +4386,9 @@ packages: no-case@3.0.4: resolution: {integrity: sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==} - nock@14.0.0-beta.19: - resolution: {integrity: sha512-xqWQQZ/Hv01tj5uL7BE4j752hhB2MHP7aaEcTp/iDT1EHsh3TYZOIx4HHFL81yRc8KFx4pqb2P2OtuxKShKhjw==} - engines: {node: '>= 18'} + nock@14.0.10: + resolution: {integrity: sha512-Q7HjkpyPeLa0ZVZC5qpxBt5EyLczFJ91MEewQiIi9taWuA0KB/MDJlUWtON+7dGouVdADTQsf9RA7TZk6D8VMw==} + engines: {node: '>=18.20.0 <20 || >=20.12.1'} node-addon-api@2.0.2: resolution: {integrity: sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==} @@ -4374,8 +4485,8 @@ packages: outvariant@1.4.3: resolution: {integrity: sha512-+Sl2UErvtsoajRDKCE5/dBz4DIvHXQQnAxtQTF04OJxY0+DyZXSo5P5Bb7XYWOh81syohlYL24hbDwxedPUJCA==} - ox@0.6.7: - resolution: {integrity: sha512-17Gk/eFsFRAZ80p5eKqv89a57uXjd3NgIf1CaXojATPBuujVc/fQSVhBeAU9JCRB+k7J50WQAyWTxK19T9GgbA==} + ox@0.8.6: + resolution: {integrity: sha512-eiKcgiVVEGDtEpEdFi1EGoVVI48j6icXHce9nFwCNM7CKG3uoCXKdr4TPhS00Iy1TR2aWSF1ltPD0x/YgqIL9w==} peerDependencies: typescript: '>=5.4.0' peerDependenciesMeta: @@ -4557,6 +4668,9 @@ packages: preact@10.25.4: resolution: {integrity: sha512-jLdZDb+Q+odkHJ+MpW/9U5cODzqnB+fy2EiHSZES7ldV5LK7yjlVzTp7R8Xy6W6y75kfK8iWYtFVH7lvjwrCMA==} + preact@10.27.0: + resolution: {integrity: sha512-/DTYoB6mwwgPytiqQTh/7SFRL98ZdiD8Sk8zIUVOxtwq4oWcwrcd1uno9fE/zZmUaUrFNYzbH14CPebOz9tZQw==} + pretty-format@27.5.1: resolution: {integrity: sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} @@ -4756,6 +4870,11 @@ packages: engines: {node: '>=10'} hasBin: true + semver@7.7.2: + resolution: {integrity: sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==} + engines: {node: '>=10'} + hasBin: true + sentence-case@3.0.4: resolution: {integrity: sha512-8LS0JInaQMCRoQ7YUytAo/xUu5W2XnQxV2HI/6uM6U7CITS1RqPElr30V6uIqyMKM9lJGRVFy5/4CuzcixNYSg==} @@ -4779,6 +4898,11 @@ packages: resolution: {integrity: sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==} hasBin: true + sha.js@2.4.12: + resolution: {integrity: sha512-8LzC5+bvI45BjpfXU8V5fdU2mfeKiQe1D1gIMn7XUlF3OTUrpdJpPPH4EMAnF0DsHHdSZqCdSss5qCmJKuiO3w==} + engines: {node: '>= 0.10'} + hasBin: true + shebang-command@2.0.0: resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} engines: {node: '>=8'} @@ -5012,6 +5136,10 @@ packages: resolution: {integrity: sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==} engines: {node: '>=0.6.0'} + to-buffer@1.2.1: + resolution: {integrity: sha512-tB82LpAIWjhLYbqjx3X4zEeHN6M8CiuOEy2JY8SEQVdYRe3CCHOFaqrBW1doLDrfpWhplcW7BL+bO3/6S3pcDQ==} + engines: {node: '>= 0.4'} + to-fast-properties@2.0.0: resolution: {integrity: sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==} engines: {node: '>=4'} @@ -5099,6 +5227,10 @@ packages: resolution: {integrity: sha512-Ne2YiiGN8bmrmJJEuTWTLJR32nh/JdL1+PSicowtNb0WFpn59GK8/lfD61bVtzguz7b3PBt74nxpv/Pw5po5Rg==} engines: {node: '>=8'} + typed-array-buffer@1.0.3: + resolution: {integrity: sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw==} + engines: {node: '>= 0.4'} + typescript@5.7.2: resolution: {integrity: sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==} engines: {node: '>=14.17'} @@ -5278,8 +5410,8 @@ packages: peerDependencies: viem: ^2.21.0 - viem@2.23.0: - resolution: {integrity: sha512-OrWFRFJ4qlChse0MHqYpdN+WBzQtU/iWQmsVwbIM4IjWT112M2O1Lidbseti6RH/nn1X2MvKMGzgILpmSyV2aw==} + viem@2.33.3: + resolution: {integrity: sha512-aWDr6i6r3OfNCs0h9IieHFhn7xQJJ8YsuA49+9T5JRyGGAkWhLgcbLq2YMecgwM7HdUZpx1vPugZjsShqNi7Gw==} peerDependencies: typescript: '>=5.0.4' peerDependenciesMeta: @@ -5388,6 +5520,10 @@ packages: resolution: {integrity: sha512-oV0jmFtUky6CXfkqehVvBP/LSWJ2sy4vWMioiENyJLePrBO/yKyV9OyJySfAKosh+RYkIl5zJCNZ8/4JncrpdA==} engines: {node: '>= 0.4'} + which-typed-array@1.1.19: + resolution: {integrity: sha512-rEvr90Bck4WZt9HHFC4DJMsjvu7x+r6bImz0/BrbWb7A2djJ8hnZMrWnHo9F8ssv0OMErasDhftrfROTyqSDrw==} + engines: {node: '>= 0.4'} + which@2.0.2: resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} engines: {node: '>= 8'} @@ -5463,6 +5599,18 @@ packages: utf-8-validate: optional: true + ws@8.18.2: + resolution: {integrity: sha512-DMricUmwGZUVr++AEAe2uiVM7UoO9MAVZMDu05UQOaUII0lp+zOzLLU4Xqh/JvTqklB1T4uELaaPBKyjE1r4fQ==} + engines: {node: '>=10.0.0'} + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: '>=5.0.2' + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + xmlhttprequest-ssl@2.1.1: resolution: {integrity: sha512-ptjR8YSJIXoA3Mbv5po7RtSYHO6mZr8s7i5VGmEk7QY2pQWyT1o0N+W1gKbOyJPUCGXGnuw0wqe8f0L6Y0ny7g==} engines: {node: '>=0.4.0'} @@ -5998,15 +6146,15 @@ snapshots: '@coinbase/wallet-sdk@3.9.3': dependencies: - bn.js: 5.2.1 + bn.js: 5.2.2 buffer: 6.0.3 clsx: 1.2.1 eth-block-tracker: 7.1.0 eth-json-rpc-filters: 6.0.1 eventemitter3: 5.0.1 keccak: 3.0.4 - preact: 10.25.4 - sha.js: 2.4.11 + preact: 10.27.0 + sha.js: 2.4.12 transitivePeerDependencies: - supports-color @@ -6325,7 +6473,7 @@ snapshots: '@ethersproject/bytes': 5.8.0 '@ethersproject/logger': 5.8.0 '@ethersproject/properties': 5.8.0 - bn.js: 5.2.1 + bn.js: 5.2.2 elliptic: 6.6.1 hash.js: 1.1.7 @@ -6917,6 +7065,12 @@ snapshots: '@istanbuljs/schema@0.1.3': {} + '@jridgewell/gen-mapping@0.3.13': + dependencies: + '@jridgewell/sourcemap-codec': 1.5.5 + '@jridgewell/trace-mapping': 0.3.30 + optional: true + '@jridgewell/gen-mapping@0.3.5': dependencies: '@jridgewell/set-array': 1.2.1 @@ -6933,23 +7087,32 @@ snapshots: '@jridgewell/set-array@1.2.1': {} - '@jridgewell/source-map@0.3.6': + '@jridgewell/source-map@0.3.11': dependencies: - '@jridgewell/gen-mapping': 0.3.8 - '@jridgewell/trace-mapping': 0.3.25 + '@jridgewell/gen-mapping': 0.3.13 + '@jridgewell/trace-mapping': 0.3.30 optional: true '@jridgewell/sourcemap-codec@1.5.0': {} + '@jridgewell/sourcemap-codec@1.5.5': + optional: true + '@jridgewell/trace-mapping@0.3.25': dependencies: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.5.0 + '@jridgewell/trace-mapping@0.3.30': + dependencies: + '@jridgewell/resolve-uri': 3.1.2 + '@jridgewell/sourcemap-codec': 1.5.5 + optional: true + '@jridgewell/trace-mapping@0.3.9': dependencies: '@jridgewell/resolve-uri': 3.1.2 - '@jridgewell/sourcemap-codec': 1.5.0 + '@jridgewell/sourcemap-codec': 1.5.5 optional: true '@kamilkisiela/fast-url-parser@1.1.4': {} @@ -7090,8 +7253,8 @@ snapshots: dependencies: '@ethereumjs/tx': 4.2.0 '@types/debug': 4.1.12 - debug: 4.4.0(supports-color@8.1.1) - semver: 7.7.1 + debug: 4.4.1 + semver: 7.7.2 superstruct: 1.0.4 transitivePeerDependencies: - supports-color @@ -7169,7 +7332,7 @@ snapshots: '@motionone/dom': 10.18.0 tslib: 2.8.1 - '@mswjs/interceptors@0.37.3': + '@mswjs/interceptors@0.39.5': dependencies: '@open-draft/deferred-promise': 2.2.0 '@open-draft/logger': 0.3.0 @@ -7180,6 +7343,8 @@ snapshots: '@noble/ciphers@1.0.0': {} + '@noble/ciphers@1.3.0': {} + '@noble/curves@1.2.0': dependencies: '@noble/hashes': 1.3.2 @@ -7193,6 +7358,10 @@ snapshots: dependencies: '@noble/hashes': 1.7.1 + '@noble/curves@1.9.2': + dependencies: + '@noble/hashes': 1.8.0 + '@noble/hashes@1.2.0': {} '@noble/hashes@1.3.2': @@ -7202,6 +7371,8 @@ snapshots: '@noble/hashes@1.7.1': {} + '@noble/hashes@1.8.0': {} + '@noble/secp256k1@1.7.1': {} '@nodelib/fs.scandir@2.1.5': @@ -7302,14 +7473,14 @@ snapshots: '@paraswap/core@2.4.0': {} - '@paraswap/sdk@7.2.3(axios@1.7.7)(ethers@6.13.5(bufferutil@4.0.8)(utf-8-validate@5.0.10))(typescript@5.7.2)(viem@2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10))': + '@paraswap/sdk@7.2.3(axios@1.7.7)(ethers@6.13.5(bufferutil@4.0.8)(utf-8-validate@5.0.10))(typescript@5.7.2)(viem@2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10))': dependencies: '@paraswap/core': 2.4.0 ts-essentials: 10.0.3(typescript@5.7.2) optionalDependencies: axios: 1.7.7 ethers: 6.13.5(bufferutil@4.0.8)(utf-8-validate@5.0.10) - viem: 2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) + viem: 2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) transitivePeerDependencies: - typescript @@ -7454,7 +7625,7 @@ snapshots: '@safe-global/safe-apps-sdk@9.1.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)': dependencies: '@safe-global/safe-gateway-typescript-sdk': 3.22.2 - viem: 2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) + viem: 2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) transitivePeerDependencies: - bufferutil - typescript @@ -7467,6 +7638,8 @@ snapshots: '@scure/base@1.2.4': {} + '@scure/base@1.2.6': {} + '@scure/bip32@1.1.5': dependencies: '@noble/hashes': 1.2.0 @@ -7479,11 +7652,11 @@ snapshots: '@noble/hashes': 1.4.0 '@scure/base': 1.1.9 - '@scure/bip32@1.6.2': + '@scure/bip32@1.7.0': dependencies: - '@noble/curves': 1.8.1 - '@noble/hashes': 1.7.1 - '@scure/base': 1.2.4 + '@noble/curves': 1.9.2 + '@noble/hashes': 1.8.0 + '@scure/base': 1.2.6 '@scure/bip39@1.1.1': dependencies: @@ -7495,10 +7668,10 @@ snapshots: '@noble/hashes': 1.4.0 '@scure/base': 1.1.9 - '@scure/bip39@1.5.4': + '@scure/bip39@1.6.0': dependencies: - '@noble/hashes': 1.7.1 - '@scure/base': 1.2.4 + '@noble/hashes': 1.8.0 + '@scure/base': 1.2.6 '@sentry/core@5.30.0': dependencies: @@ -7815,16 +7988,16 @@ snapshots: loupe: 3.1.2 tinyrainbow: 2.0.0 - '@wagmi/connectors@5.7.6(@types/react@19.0.7)(@wagmi/core@2.16.3(@tanstack/query-core@5.62.16)(@types/react@19.0.7)(react@19.0.0)(typescript@5.7.2)(viem@2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)))(bufferutil@4.0.8)(encoding@0.1.13)(react@19.0.0)(typescript@5.7.2)(utf-8-validate@5.0.10)(viem@2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10))': + '@wagmi/connectors@5.7.6(@types/react@19.0.7)(@wagmi/core@2.16.3(@tanstack/query-core@5.62.16)(@types/react@19.0.7)(react@19.0.0)(typescript@5.7.2)(viem@2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)))(bufferutil@4.0.8)(encoding@0.1.13)(react@19.0.0)(typescript@5.7.2)(utf-8-validate@5.0.10)(viem@2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10))': dependencies: '@coinbase/wallet-sdk': 4.2.3 '@metamask/sdk': 0.32.0(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) '@safe-global/safe-apps-provider': 0.18.5(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) '@safe-global/safe-apps-sdk': 9.1.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) - '@wagmi/core': 2.16.3(@tanstack/query-core@5.62.16)(@types/react@19.0.7)(react@19.0.0)(typescript@5.7.2)(use-sync-external-store@1.4.0(react@19.0.0))(viem@2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)) + '@wagmi/core': 2.16.3(@tanstack/query-core@5.62.16)(@types/react@19.0.7)(react@19.0.0)(typescript@5.7.2)(use-sync-external-store@1.4.0(react@19.0.0))(viem@2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)) '@walletconnect/ethereum-provider': 2.17.0(@types/react@19.0.7)(bufferutil@4.0.8)(encoding@0.1.13)(react@19.0.0)(utf-8-validate@5.0.10) cbw-sdk: '@coinbase/wallet-sdk@3.9.3' - viem: 2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) + viem: 2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) optionalDependencies: typescript: 5.7.2 transitivePeerDependencies: @@ -7849,16 +8022,16 @@ snapshots: - utf-8-validate - zod - '@wagmi/connectors@5.7.6(@wagmi/core@2.16.3(@tanstack/query-core@5.62.16)(react@19.0.0)(typescript@5.7.2)(use-sync-external-store@1.4.0(react@19.0.0))(viem@2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)))(bufferutil@4.0.8)(encoding@0.1.13)(react@19.0.0)(typescript@5.7.2)(utf-8-validate@5.0.10)(viem@2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10))': + '@wagmi/connectors@5.7.6(@wagmi/core@2.16.3(@tanstack/query-core@5.62.16)(react@19.0.0)(typescript@5.7.2)(use-sync-external-store@1.4.0(react@19.0.0))(viem@2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)))(bufferutil@4.0.8)(encoding@0.1.13)(react@19.0.0)(typescript@5.7.2)(utf-8-validate@5.0.10)(viem@2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10))': dependencies: '@coinbase/wallet-sdk': 4.2.3 '@metamask/sdk': 0.32.0(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) '@safe-global/safe-apps-provider': 0.18.5(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) '@safe-global/safe-apps-sdk': 9.1.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) - '@wagmi/core': 2.16.3(@tanstack/query-core@5.62.16)(react@19.0.0)(typescript@5.7.2)(use-sync-external-store@1.4.0(react@19.0.0))(viem@2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)) + '@wagmi/core': 2.16.3(@tanstack/query-core@5.62.16)(react@19.0.0)(typescript@5.7.2)(use-sync-external-store@1.4.0(react@19.0.0))(viem@2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)) '@walletconnect/ethereum-provider': 2.17.0(@types/react@19.0.7)(bufferutil@4.0.8)(encoding@0.1.13)(react@19.0.0)(utf-8-validate@5.0.10) cbw-sdk: '@coinbase/wallet-sdk@3.9.3' - viem: 2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) + viem: 2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) optionalDependencies: typescript: 5.7.2 transitivePeerDependencies: @@ -7883,11 +8056,11 @@ snapshots: - utf-8-validate - zod - '@wagmi/core@2.16.3(@tanstack/query-core@5.62.16)(@types/react@19.0.7)(react@19.0.0)(typescript@5.7.2)(use-sync-external-store@1.4.0(react@19.0.0))(viem@2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10))': + '@wagmi/core@2.16.3(@tanstack/query-core@5.62.16)(@types/react@19.0.7)(react@19.0.0)(typescript@5.7.2)(use-sync-external-store@1.4.0(react@19.0.0))(viem@2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10))': dependencies: eventemitter3: 5.0.1 mipd: 0.0.7(typescript@5.7.2) - viem: 2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) + viem: 2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) zustand: 5.0.0(@types/react@19.0.7)(react@19.0.0)(use-sync-external-store@1.4.0(react@19.0.0)) optionalDependencies: '@tanstack/query-core': 5.62.16 @@ -7898,11 +8071,11 @@ snapshots: - react - use-sync-external-store - '@wagmi/core@2.16.3(@tanstack/query-core@5.62.16)(react@19.0.0)(typescript@5.7.2)(use-sync-external-store@1.4.0(react@19.0.0))(viem@2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10))': + '@wagmi/core@2.16.3(@tanstack/query-core@5.62.16)(react@19.0.0)(typescript@5.7.2)(use-sync-external-store@1.4.0(react@19.0.0))(viem@2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10))': dependencies: eventemitter3: 5.0.1 mipd: 0.0.7(typescript@5.7.2) - viem: 2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) + viem: 2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) zustand: 5.0.0(@types/react@19.0.7)(react@19.0.0)(use-sync-external-store@1.4.0(react@19.0.0)) optionalDependencies: '@tanstack/query-core': 5.62.16 @@ -8246,11 +8419,14 @@ snapshots: acorn-walk@8.3.4: dependencies: - acorn: 8.14.0 + acorn: 8.15.0 optional: true acorn@8.14.0: {} + acorn@8.15.0: + optional: true + adm-zip@0.4.16: {} aes-js@4.0.0-beta.5: @@ -8351,8 +8527,8 @@ snapshots: axios@1.7.7: dependencies: - follow-redirects: 1.15.9(debug@4.4.0) - form-data: 4.0.1 + follow-redirects: 1.15.11 + form-data: 4.0.4 proxy-from-env: 1.1.0 transitivePeerDependencies: - debug @@ -8417,6 +8593,8 @@ snapshots: bn.js@5.2.1: {} + bn.js@5.2.2: {} + bowser@2.11.0: {} boxen@5.1.2: @@ -8503,6 +8681,11 @@ snapshots: cac@6.7.14: {} + call-bind-apply-helpers@1.0.2: + dependencies: + es-errors: 1.3.0 + function-bind: 1.1.2 + call-bind@1.0.7: dependencies: es-define-property: 1.0.0 @@ -8511,6 +8694,18 @@ snapshots: get-intrinsic: 1.2.4 set-function-length: 1.2.2 + call-bind@1.0.8: + dependencies: + call-bind-apply-helpers: 1.0.2 + es-define-property: 1.0.1 + get-intrinsic: 1.3.0 + set-function-length: 1.2.2 + + call-bound@1.0.4: + dependencies: + call-bind-apply-helpers: 1.0.2 + get-intrinsic: 1.3.0 + callsites@3.1.0: {} camel-case@4.1.2: @@ -8873,6 +9068,10 @@ snapshots: optionalDependencies: supports-color: 8.1.1 + debug@4.4.1: + dependencies: + ms: 2.1.3 + decamelize@1.2.0: {} decamelize@4.0.0: {} @@ -8889,7 +9088,7 @@ snapshots: dependencies: es-define-property: 1.0.0 es-errors: 1.3.0 - gopd: 1.0.1 + gopd: 1.2.0 defu@6.1.4: {} @@ -8945,6 +9144,12 @@ snapshots: dset@3.1.4: {} + dunder-proto@1.0.1: + dependencies: + call-bind-apply-helpers: 1.0.2 + es-errors: 1.3.0 + gopd: 1.2.0 + duplexify@4.1.3: dependencies: end-of-stream: 1.4.4 @@ -9031,10 +9236,24 @@ snapshots: dependencies: get-intrinsic: 1.2.4 + es-define-property@1.0.1: {} + es-errors@1.3.0: {} es-module-lexer@1.6.0: {} + es-object-atoms@1.1.1: + dependencies: + es-errors: 1.3.0 + + es-set-tostringtag@2.1.0: + dependencies: + es-errors: 1.3.0 + get-intrinsic: 1.3.0 + has-tostringtag: 1.0.2 + hasown: 2.0.2 + optional: true + esbuild@0.21.5: optionalDependencies: '@esbuild/aix-ppc64': 0.21.5 @@ -9189,10 +9408,10 @@ snapshots: signal-exit: 4.1.0 strip-final-newline: 3.0.0 - executooor-viem@1.3.3(evm-maths@7.0.1)(viem@2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)): + executooor-viem@1.3.3(evm-maths@7.0.1)(viem@2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)): dependencies: evm-maths: 7.0.1 - viem: 2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) + viem: 2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) expect-type@1.1.0: {} @@ -9297,6 +9516,9 @@ snapshots: flatted@3.3.2: {} + follow-redirects@1.15.11: + optional: true + follow-redirects@1.15.9(debug@4.4.0): optionalDependencies: debug: 4.4.0(supports-color@8.1.1) @@ -9305,15 +9527,21 @@ snapshots: dependencies: is-callable: 1.2.7 + for-each@0.3.5: + dependencies: + is-callable: 1.2.7 + foreground-child@3.3.0: dependencies: cross-spawn: 7.0.6 signal-exit: 4.1.0 - form-data@4.0.1: + form-data@4.0.4: dependencies: asynckit: 0.4.0 combined-stream: 1.0.8 + es-set-tostringtag: 2.1.0 + hasown: 2.0.2 mime-types: 2.1.35 optional: true @@ -9349,8 +9577,26 @@ snapshots: has-symbols: 1.0.3 hasown: 2.0.2 + get-intrinsic@1.3.0: + dependencies: + call-bind-apply-helpers: 1.0.2 + es-define-property: 1.0.1 + es-errors: 1.3.0 + es-object-atoms: 1.1.1 + function-bind: 1.1.2 + get-proto: 1.0.1 + gopd: 1.2.0 + has-symbols: 1.1.0 + hasown: 2.0.2 + math-intrinsics: 1.1.0 + get-port-please@3.1.2: {} + get-proto@1.0.1: + dependencies: + dunder-proto: 1.0.1 + es-object-atoms: 1.1.1 + get-stream@8.0.1: {} git-raw-commits@4.0.0: @@ -9410,6 +9656,8 @@ snapshots: dependencies: get-intrinsic: 1.2.4 + gopd@1.2.0: {} + graceful-fs@4.2.11: {} graphql-config@5.1.3(@types/node@22.13.1)(bufferutil@4.0.8)(encoding@0.1.13)(graphql@16.10.0)(typescript@5.7.2)(utf-8-validate@5.0.10): @@ -9550,6 +9798,8 @@ snapshots: has-symbols@1.0.3: {} + has-symbols@1.1.0: {} + has-tostringtag@1.0.2: dependencies: has-symbols: 1.0.3 @@ -9764,6 +10014,10 @@ snapshots: dependencies: which-typed-array: 1.1.15 + is-typed-array@1.1.15: + dependencies: + which-typed-array: 1.1.19 + is-unc-path@1.0.0: dependencies: unc-path-regex: 0.1.2 @@ -9786,15 +10040,17 @@ snapshots: isarray@1.0.0: {} + isarray@2.0.5: {} + isexe@2.0.0: {} isomorphic-ws@5.0.0(ws@8.18.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)): dependencies: ws: 8.18.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) - isows@1.0.6(ws@8.18.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)): + isows@1.0.7(ws@8.18.2(bufferutil@4.0.8)(utf-8-validate@5.0.10)): dependencies: - ws: 8.18.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) + ws: 8.18.2(bufferutil@4.0.8)(utf-8-validate@5.0.10) istanbul-lib-coverage@3.2.2: {} @@ -10054,6 +10310,8 @@ snapshots: map-cache@0.2.2: {} + math-intrinsics@1.1.0: {} + md5.js@1.3.5: dependencies: hash-base: 3.1.0 @@ -10185,9 +10443,9 @@ snapshots: lower-case: 2.0.2 tslib: 2.8.1 - nock@14.0.0-beta.19: + nock@14.0.10: dependencies: - '@mswjs/interceptors': 0.37.3 + '@mswjs/interceptors': 0.39.5 json-stringify-safe: 5.0.1 propagate: 2.0.1 @@ -10277,13 +10535,14 @@ snapshots: outvariant@1.4.3: {} - ox@0.6.7(typescript@5.7.2): + ox@0.8.6(typescript@5.7.2): dependencies: '@adraffy/ens-normalize': 1.11.0 - '@noble/curves': 1.8.1 - '@noble/hashes': 1.7.1 - '@scure/bip32': 1.6.2 - '@scure/bip39': 1.5.4 + '@noble/ciphers': 1.3.0 + '@noble/curves': 1.9.2 + '@noble/hashes': 1.8.0 + '@scure/bip32': 1.7.0 + '@scure/bip39': 1.6.0 abitype: 1.0.8(typescript@5.7.2) eventemitter3: 5.0.1 optionalDependencies: @@ -10455,6 +10714,8 @@ snapshots: preact@10.25.4: {} + preact@10.27.0: {} + pretty-format@27.5.1: dependencies: ansi-regex: 5.0.1 @@ -10660,6 +10921,8 @@ snapshots: semver@7.7.1: {} + semver@7.7.2: {} + sentence-case@3.0.4: dependencies: no-case: 3.0.4 @@ -10690,6 +10953,12 @@ snapshots: inherits: 2.0.4 safe-buffer: 5.2.1 + sha.js@2.4.12: + dependencies: + inherits: 2.0.4 + safe-buffer: 5.2.1 + to-buffer: 1.2.1 + shebang-command@2.0.0: dependencies: shebang-regex: 3.0.0 @@ -10878,8 +11147,8 @@ snapshots: terser@5.36.0: dependencies: - '@jridgewell/source-map': 0.3.6 - acorn: 8.14.0 + '@jridgewell/source-map': 0.3.11 + acorn: 8.15.0 commander: 2.20.3 source-map-support: 0.5.21 optional: true @@ -10921,6 +11190,12 @@ snapshots: dependencies: os-tmpdir: 1.0.2 + to-buffer@1.2.1: + dependencies: + isarray: 2.0.5 + safe-buffer: 5.2.1 + typed-array-buffer: 1.0.3 + to-fast-properties@2.0.0: {} to-regex-range@5.0.1: @@ -10947,7 +11222,7 @@ snapshots: '@tsconfig/node14': 1.0.3 '@tsconfig/node16': 1.0.4 '@types/node': 22.13.1 - acorn: 8.14.0 + acorn: 8.15.0 acorn-walk: 8.3.4 arg: 4.1.3 create-require: 1.1.1 @@ -10985,6 +11260,12 @@ snapshots: type-fest@0.7.1: {} + typed-array-buffer@1.0.3: + dependencies: + call-bound: 1.0.4 + es-errors: 1.3.0 + is-typed-array: 1.1.15 + typescript@5.7.2: {} ua-parser-js@1.0.39: {} @@ -11107,25 +11388,25 @@ snapshots: value-or-promise@1.0.12: {} - viem-deal@2.0.4(viem@2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)): + viem-deal@2.0.4(viem@2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)): dependencies: - viem: 2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) + viem: 2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) - viem-tracer@1.7.1(viem@2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)): + viem-tracer@1.7.1(viem@2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)): dependencies: colors: 1.4.0 - viem: 2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) + viem: 2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) - viem@2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10): + viem@2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10): dependencies: - '@noble/curves': 1.8.1 - '@noble/hashes': 1.7.1 - '@scure/bip32': 1.6.2 - '@scure/bip39': 1.5.4 + '@noble/curves': 1.9.2 + '@noble/hashes': 1.8.0 + '@scure/bip32': 1.7.0 + '@scure/bip39': 1.6.0 abitype: 1.0.8(typescript@5.7.2) - isows: 1.0.6(ws@8.18.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)) - ox: 0.6.7(typescript@5.7.2) - ws: 8.18.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) + isows: 1.0.7(ws@8.18.2(bufferutil@4.0.8)(utf-8-validate@5.0.10)) + ox: 0.8.6(typescript@5.7.2) + ws: 8.18.2(bufferutil@4.0.8)(utf-8-validate@5.0.10) optionalDependencies: typescript: 5.7.2 transitivePeerDependencies: @@ -11199,14 +11480,14 @@ snapshots: - supports-color - terser - wagmi@2.14.10(@tanstack/query-core@5.62.16)(@tanstack/react-query@5.62.11(react@19.0.0))(@types/react@19.0.7)(bufferutil@4.0.8)(encoding@0.1.13)(react@19.0.0)(typescript@5.7.2)(utf-8-validate@5.0.10)(viem@2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)): + wagmi@2.14.10(@tanstack/query-core@5.62.16)(@tanstack/react-query@5.62.11(react@19.0.0))(@types/react@19.0.7)(bufferutil@4.0.8)(encoding@0.1.13)(react@19.0.0)(typescript@5.7.2)(utf-8-validate@5.0.10)(viem@2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)): dependencies: '@tanstack/react-query': 5.62.11(react@19.0.0) - '@wagmi/connectors': 5.7.6(@types/react@19.0.7)(@wagmi/core@2.16.3(@tanstack/query-core@5.62.16)(@types/react@19.0.7)(react@19.0.0)(typescript@5.7.2)(viem@2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)))(bufferutil@4.0.8)(encoding@0.1.13)(react@19.0.0)(typescript@5.7.2)(utf-8-validate@5.0.10)(viem@2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)) - '@wagmi/core': 2.16.3(@tanstack/query-core@5.62.16)(@types/react@19.0.7)(react@19.0.0)(typescript@5.7.2)(use-sync-external-store@1.4.0(react@19.0.0))(viem@2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)) + '@wagmi/connectors': 5.7.6(@types/react@19.0.7)(@wagmi/core@2.16.3(@tanstack/query-core@5.62.16)(@types/react@19.0.7)(react@19.0.0)(typescript@5.7.2)(viem@2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)))(bufferutil@4.0.8)(encoding@0.1.13)(react@19.0.0)(typescript@5.7.2)(utf-8-validate@5.0.10)(viem@2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)) + '@wagmi/core': 2.16.3(@tanstack/query-core@5.62.16)(@types/react@19.0.7)(react@19.0.0)(typescript@5.7.2)(use-sync-external-store@1.4.0(react@19.0.0))(viem@2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)) react: 19.0.0 use-sync-external-store: 1.4.0(react@19.0.0) - viem: 2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) + viem: 2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) optionalDependencies: typescript: 5.7.2 transitivePeerDependencies: @@ -11232,14 +11513,14 @@ snapshots: - utf-8-validate - zod - wagmi@2.14.10(@tanstack/query-core@5.62.16)(@tanstack/react-query@5.62.11(react@19.0.0))(bufferutil@4.0.8)(encoding@0.1.13)(react@19.0.0)(typescript@5.7.2)(utf-8-validate@5.0.10)(viem@2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)): + wagmi@2.14.10(@tanstack/query-core@5.62.16)(@tanstack/react-query@5.62.11(react@19.0.0))(bufferutil@4.0.8)(encoding@0.1.13)(react@19.0.0)(typescript@5.7.2)(utf-8-validate@5.0.10)(viem@2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)): dependencies: '@tanstack/react-query': 5.62.11(react@19.0.0) - '@wagmi/connectors': 5.7.6(@wagmi/core@2.16.3(@tanstack/query-core@5.62.16)(react@19.0.0)(typescript@5.7.2)(use-sync-external-store@1.4.0(react@19.0.0))(viem@2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)))(bufferutil@4.0.8)(encoding@0.1.13)(react@19.0.0)(typescript@5.7.2)(utf-8-validate@5.0.10)(viem@2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)) - '@wagmi/core': 2.16.3(@tanstack/query-core@5.62.16)(react@19.0.0)(typescript@5.7.2)(use-sync-external-store@1.4.0(react@19.0.0))(viem@2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)) + '@wagmi/connectors': 5.7.6(@wagmi/core@2.16.3(@tanstack/query-core@5.62.16)(react@19.0.0)(typescript@5.7.2)(use-sync-external-store@1.4.0(react@19.0.0))(viem@2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)))(bufferutil@4.0.8)(encoding@0.1.13)(react@19.0.0)(typescript@5.7.2)(utf-8-validate@5.0.10)(viem@2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)) + '@wagmi/core': 2.16.3(@tanstack/query-core@5.62.16)(react@19.0.0)(typescript@5.7.2)(use-sync-external-store@1.4.0(react@19.0.0))(viem@2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)) react: 19.0.0 use-sync-external-store: 1.4.0(react@19.0.0) - viem: 2.23.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) + viem: 2.33.3(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) optionalDependencies: typescript: 5.7.2 transitivePeerDependencies: @@ -11292,6 +11573,16 @@ snapshots: gopd: 1.0.1 has-tostringtag: 1.0.2 + which-typed-array@1.1.19: + dependencies: + available-typed-arrays: 1.0.7 + call-bind: 1.0.8 + call-bound: 1.0.4 + for-each: 0.3.5 + get-proto: 1.0.1 + gopd: 1.2.0 + has-tostringtag: 1.0.2 + which@2.0.2: dependencies: isexe: 2.0.0 @@ -11350,6 +11641,11 @@ snapshots: bufferutil: 4.0.8 utf-8-validate: 5.0.10 + ws@8.18.2(bufferutil@4.0.8)(utf-8-validate@5.0.10): + optionalDependencies: + bufferutil: 4.0.8 + utf-8-validate: 5.0.10 + xmlhttprequest-ssl@2.1.1: {} xtend@4.0.2: {} diff --git a/vitest.config.ts b/vitest.config.ts index 8f1dd2df..112cd473 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -39,6 +39,7 @@ export default defineConfig({ test: { name: "blue-sdk-viem", include: ["packages/blue-sdk-viem/test/**/*.test.ts"], + testTimeout: 60_000, }, }, {