From 1366de02cc0061b8e68d2317fe454696989474ff Mon Sep 17 00:00:00 2001 From: Bruno Eidam Guerios Date: Fri, 24 May 2024 16:24:24 -0300 Subject: [PATCH 01/15] Update viem to latest version (no breaking changes) --- package.json | 2 +- pnpm-lock.yaml | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 9edb0f1c..600d3bca 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "dependencies": { "decimal.js-light": "^2.5.1", "lodash.clonedeep": "^4.5.0", - "viem": "^2.1.1" + "viem": "^2.12.1" }, "devDependencies": { "@biomejs/biome": "^1.5.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0250761d..33f5b054 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,4 +1,4 @@ -lockfileVersion: '6.1' +lockfileVersion: '6.0' settings: autoInstallPeers: true @@ -12,8 +12,8 @@ dependencies: specifier: ^4.5.0 version: 4.5.0 viem: - specifier: ^2.1.1 - version: 2.1.1(typescript@5.3.3) + specifier: ^2.12.1 + version: 2.12.1(typescript@5.3.3) devDependencies: '@biomejs/biome': @@ -1273,8 +1273,8 @@ packages: pretty-format: 29.7.0 dev: true - /abitype@0.10.0(typescript@5.3.3): - resolution: {integrity: sha512-QvMHEUzgI9nPj9TWtUGnS2scas80/qaL5PBxGdwWhhvzqXfOph+IEiiiWrzuisu3U3JgDQVruW9oLbJoQ3oZ3A==} + /abitype@1.0.0(typescript@5.3.3): + resolution: {integrity: sha512-NMeMah//6bJ56H5XRj8QCV4AwuW6hB6zqz2LnhhLdcWVQOsXki6/Pn3APeqxCma62nXIcmZWdu1DlHWS74umVQ==} peerDependencies: typescript: '>=5.0.4' zod: ^3 >=3.22.0 @@ -2567,8 +2567,8 @@ packages: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} dev: true - /isows@1.0.3(ws@8.13.0): - resolution: {integrity: sha512-2cKei4vlmg2cxEjm3wVSqn8pcoRF/LX/wpifuuNquFO4SQmPwarClT+SUCA2lt+l581tTeZIPIZuIDo2jWN1fg==} + /isows@1.0.4(ws@8.13.0): + resolution: {integrity: sha512-hEzjY+x9u9hPmBom9IIAqdJCwNLax+xrPb51vEPpERoFlIxgmZcHzsT5jKG06nvInKOBGvReAVz80Umed5CczQ==} peerDependencies: ws: '*' dependencies: @@ -3974,8 +3974,8 @@ packages: spdx-expression-parse: 3.0.1 dev: true - /viem@2.1.1(typescript@5.3.3): - resolution: {integrity: sha512-gJiwYceD7Dsjioglr+85GQS3u5Gp9XGG8oJqGsauBaEPFlkmbRx7cxD2Q5RZXFToVvEbarOWtITZtGHBsGv4MQ==} + /viem@2.12.1(typescript@5.3.3): + resolution: {integrity: sha512-71gxcGCXdNXQuBhpqXblVRH1F3hP/wONCptVOCW4r6VrCEXL/9vfNyCdQKtK/0WGyXm04Zs9Jf/AOAxKqf6FmQ==} peerDependencies: typescript: '>=5.0.4' peerDependenciesMeta: @@ -3987,8 +3987,8 @@ packages: '@noble/hashes': 1.3.2 '@scure/bip32': 1.3.2 '@scure/bip39': 1.2.1 - abitype: 0.10.0(typescript@5.3.3) - isows: 1.0.3(ws@8.13.0) + abitype: 1.0.0(typescript@5.3.3) + isows: 1.0.4(ws@8.13.0) typescript: 5.3.3 ws: 8.13.0 transitivePeerDependencies: From 4080122742c4c5e11c38f224269019a4cc2f2ed6 Mon Sep 17 00:00:00 2001 From: Bruno Eidam Guerios Date: Fri, 24 May 2024 16:38:51 -0300 Subject: [PATCH 02/15] Update ABIs and addresses to match testnet deployment 4 --- src/abi/balancerBatchRouter.ts | 32 + src/abi/balancerRouter.ts | 640 +-- src/abi/index.ts | 2 +- src/abi/permit2.ts | 671 +++ src/abi/vaultV3.ts | 5250 +++++++++++++------ src/abi/vaultV3Extension.ts | 1960 ------- src/utils/constants.ts | 14 +- test/anvil/anvil-global-setup.ts | 2 +- test/entities/swapV3.integration.test.ts | 4 +- test/lib/utils/addresses.ts | 18 +- test/v3/addLiquidity.integration.test.ts | 2 +- test/v3/removeLiquidity.integration.test.ts | 2 +- 12 files changed, 4722 insertions(+), 3875 deletions(-) create mode 100644 src/abi/permit2.ts delete mode 100644 src/abi/vaultV3Extension.ts diff --git a/src/abi/balancerBatchRouter.ts b/src/abi/balancerBatchRouter.ts index 31b53440..f1eea65c 100644 --- a/src/abi/balancerBatchRouter.ts +++ b/src/abi/balancerBatchRouter.ts @@ -11,10 +11,26 @@ export const balancerBatchRouterAbi = [ name: 'weth', type: 'address', }, + { + internalType: 'contract IPermit2', + name: 'permit2', + type: 'address', + }, ], stateMutability: 'nonpayable', type: 'constructor', }, + { + inputs: [ + { + internalType: 'address', + name: 'target', + type: 'address', + }, + ], + name: 'AddressEmptyCode', + type: 'error', + }, { inputs: [ { @@ -46,6 +62,17 @@ export const balancerBatchRouterAbi = [ name: 'ReentrancyGuardReentrantCall', type: 'error', }, + { + inputs: [ + { + internalType: 'address', + name: 'token', + type: 'address', + }, + ], + name: 'SafeERC20FailedOperation', + type: 'error', + }, { inputs: [ { @@ -57,6 +84,11 @@ export const balancerBatchRouterAbi = [ name: 'SenderIsNotVault', type: 'error', }, + { + inputs: [], + name: 'SwapDeadline', + type: 'error', + }, { inputs: [ { diff --git a/src/abi/balancerRouter.ts b/src/abi/balancerRouter.ts index b9e8c54d..f3646fcc 100644 --- a/src/abi/balancerRouter.ts +++ b/src/abi/balancerRouter.ts @@ -11,10 +11,26 @@ export const balancerRouterAbi = [ name: 'weth', type: 'address', }, + { + internalType: 'contract IPermit2', + name: 'permit2', + type: 'address', + }, ], stateMutability: 'nonpayable', type: 'constructor', }, + { + inputs: [ + { + internalType: 'address', + name: 'target', + type: 'address', + }, + ], + name: 'AddressEmptyCode', + type: 'error', + }, { inputs: [ { @@ -62,6 +78,17 @@ export const balancerRouterAbi = [ name: 'ReentrancyGuardReentrantCall', type: 'error', }, + { + inputs: [ + { + internalType: 'address', + name: 'token', + type: 'address', + }, + ], + name: 'SafeERC20FailedOperation', + type: 'error', + }, { inputs: [ { @@ -193,6 +220,45 @@ export const balancerRouterAbi = [ stateMutability: 'payable', type: 'function', }, + { + inputs: [ + { + internalType: 'address', + name: 'pool', + type: 'address', + }, + { + internalType: 'uint256[]', + name: 'maxAmountsIn', + type: 'uint256[]', + }, + { + internalType: 'uint256', + name: 'exactBptAmountOut', + type: 'uint256', + }, + { + internalType: 'bool', + name: 'wethIsEth', + type: 'bool', + }, + { + internalType: 'bytes', + name: 'userData', + type: 'bytes', + }, + ], + name: 'addLiquidityProportional', + outputs: [ + { + internalType: 'uint256[]', + name: 'amountsIn', + type: 'uint256[]', + }, + ], + stateMutability: 'payable', + type: 'function', + }, { inputs: [ { @@ -376,6 +442,136 @@ export const balancerRouterAbi = [ stateMutability: 'payable', type: 'function', }, + { + inputs: [ + { + internalType: 'bytes[]', + name: 'data', + type: 'bytes[]', + }, + ], + name: 'multicall', + outputs: [ + { + internalType: 'bytes[]', + name: 'results', + type: 'bytes[]', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + components: [ + { + internalType: 'address', + name: 'token', + type: 'address', + }, + { + internalType: 'address', + name: 'owner', + type: 'address', + }, + { + internalType: 'address', + name: 'spender', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'nonce', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'deadline', + type: 'uint256', + }, + ], + internalType: 'struct IRouter.PermitApproval[]', + name: 'permitBatch', + type: 'tuple[]', + }, + { + internalType: 'bytes[]', + name: 'permitSignatures', + type: 'bytes[]', + }, + { + components: [ + { + components: [ + { + internalType: 'address', + name: 'token', + type: 'address', + }, + { + internalType: 'uint160', + name: 'amount', + type: 'uint160', + }, + { + internalType: 'uint48', + name: 'expiration', + type: 'uint48', + }, + { + internalType: 'uint48', + name: 'nonce', + type: 'uint48', + }, + ], + internalType: + 'struct IAllowanceTransfer.PermitDetails[]', + name: 'details', + type: 'tuple[]', + }, + { + internalType: 'address', + name: 'spender', + type: 'address', + }, + { + internalType: 'uint256', + name: 'sigDeadline', + type: 'uint256', + }, + ], + internalType: 'struct IAllowanceTransfer.PermitBatch', + name: 'permit2Batch', + type: 'tuple', + }, + { + internalType: 'bytes', + name: 'permit2Signature', + type: 'bytes', + }, + { + internalType: 'bytes[]', + name: 'multicallData', + type: 'bytes[]', + }, + ], + name: 'permitBatchAndCall', + outputs: [ + { + internalType: 'bytes[]', + name: 'results', + type: 'bytes[]', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, { inputs: [ { @@ -486,6 +682,40 @@ export const balancerRouterAbi = [ stateMutability: 'payable', type: 'function', }, + { + inputs: [ + { + internalType: 'address', + name: 'pool', + type: 'address', + }, + { + internalType: 'uint256[]', + name: 'maxAmountsIn', + type: 'uint256[]', + }, + { + internalType: 'uint256', + name: 'exactBptAmountOut', + type: 'uint256', + }, + { + internalType: 'bytes', + name: 'userData', + type: 'bytes', + }, + ], + name: 'queryAddLiquidityProportional', + outputs: [ + { + internalType: 'uint256[]', + name: 'amountsIn', + type: 'uint256[]', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, { inputs: [ { @@ -733,9 +963,9 @@ export const balancerRouterAbi = [ name: 'queryRemoveLiquidityRecoveryHook', outputs: [ { - internalType: 'uint256', - name: 'amountOut', - type: 'uint256', + internalType: 'uint256[]', + name: 'amountsOut', + type: 'uint256[]', }, ], stateMutability: 'nonpayable', @@ -1361,410 +1591,6 @@ export const balancerRouterAbi = [ stateMutability: 'payable', type: 'function', }, - { - inputs: [ - { - components: [ - { - internalType: 'contract IERC20', - name: 'tokenIn', - type: 'address', - }, - { - components: [ - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - { - internalType: 'contract IERC20', - name: 'tokenOut', - type: 'address', - }, - ], - internalType: 'struct IRouter.SwapPathStep[]', - name: 'steps', - type: 'tuple[]', - }, - { - internalType: 'uint256', - name: 'exactAmountIn', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'minAmountOut', - type: 'uint256', - }, - ], - internalType: 'struct IRouter.SwapPathExactAmountIn[]', - name: 'paths', - type: 'tuple[]', - }, - { - internalType: 'uint256', - name: 'deadline', - type: 'uint256', - }, - { - internalType: 'bool', - name: 'wethIsEth', - type: 'bool', - }, - { - internalType: 'bytes', - name: 'userData', - type: 'bytes', - }, - ], - name: 'swapExactIn', - outputs: [ - { - internalType: 'uint256[]', - name: 'amountsOut', - type: 'uint256[]', - }, - ], - stateMutability: 'payable', - type: 'function', - }, - { - inputs: [ - { - components: [ - { - internalType: 'address', - name: 'sender', - type: 'address', - }, - { - components: [ - { - internalType: 'contract IERC20', - name: 'tokenIn', - type: 'address', - }, - { - components: [ - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - { - internalType: 'contract IERC20', - name: 'tokenOut', - type: 'address', - }, - ], - internalType: 'struct IRouter.SwapPathStep[]', - name: 'steps', - type: 'tuple[]', - }, - { - internalType: 'uint256', - name: 'exactAmountIn', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'minAmountOut', - type: 'uint256', - }, - ], - internalType: 'struct IRouter.SwapPathExactAmountIn[]', - name: 'paths', - type: 'tuple[]', - }, - { - internalType: 'uint256', - name: 'deadline', - type: 'uint256', - }, - { - internalType: 'bool', - name: 'wethIsEth', - type: 'bool', - }, - { - internalType: 'bytes', - name: 'userData', - type: 'bytes', - }, - ], - internalType: 'struct IRouter.SwapExactInHookParams', - name: 'params', - type: 'tuple', - }, - ], - name: 'swapExactInHook', - outputs: [ - { - internalType: 'uint256[]', - name: 'pathAmountsOut', - type: 'uint256[]', - }, - ], - stateMutability: 'payable', - type: 'function', - }, - { - inputs: [ - { - components: [ - { - internalType: 'contract IERC20', - name: 'tokenIn', - type: 'address', - }, - { - components: [ - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - { - internalType: 'contract IERC20', - name: 'tokenOut', - type: 'address', - }, - ], - internalType: 'struct IRouter.SwapPathStep[]', - name: 'steps', - type: 'tuple[]', - }, - { - internalType: 'uint256', - name: 'maxAmountIn', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'exactAmountOut', - type: 'uint256', - }, - ], - internalType: 'struct IRouter.SwapPathExactAmountOut[]', - name: 'paths', - type: 'tuple[]', - }, - { - internalType: 'uint256', - name: 'deadline', - type: 'uint256', - }, - { - internalType: 'bool', - name: 'wethIsEth', - type: 'bool', - }, - { - internalType: 'bytes', - name: 'userData', - type: 'bytes', - }, - ], - name: 'swapExactOut', - outputs: [ - { - internalType: 'uint256[]', - name: 'amountsIn', - type: 'uint256[]', - }, - ], - stateMutability: 'payable', - type: 'function', - }, - { - inputs: [ - { - components: [ - { - internalType: 'address', - name: 'sender', - type: 'address', - }, - { - components: [ - { - internalType: 'contract IERC20', - name: 'tokenIn', - type: 'address', - }, - { - components: [ - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - { - internalType: 'contract IERC20', - name: 'tokenOut', - type: 'address', - }, - ], - internalType: 'struct IRouter.SwapPathStep[]', - name: 'steps', - type: 'tuple[]', - }, - { - internalType: 'uint256', - name: 'maxAmountIn', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'exactAmountOut', - type: 'uint256', - }, - ], - internalType: 'struct IRouter.SwapPathExactAmountOut[]', - name: 'paths', - type: 'tuple[]', - }, - { - internalType: 'uint256', - name: 'deadline', - type: 'uint256', - }, - { - internalType: 'bool', - name: 'wethIsEth', - type: 'bool', - }, - { - internalType: 'bytes', - name: 'userData', - type: 'bytes', - }, - ], - internalType: 'struct IRouter.SwapExactOutHookParams', - name: 'params', - type: 'tuple', - }, - ], - name: 'swapExactOutHook', - outputs: [ - { - internalType: 'uint256[]', - name: 'pathAmountsIn', - type: 'uint256[]', - }, - ], - stateMutability: 'payable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - { - internalType: 'contract IERC20', - name: 'tokenIn', - type: 'address', - }, - { - internalType: 'contract IERC20', - name: 'tokenOut', - type: 'address', - }, - { - internalType: 'uint256', - name: 'exactAmountIn', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'minAmountOut', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'deadline', - type: 'uint256', - }, - { - internalType: 'bool', - name: 'wethIsEth', - type: 'bool', - }, - { - internalType: 'bytes', - name: 'userData', - type: 'bytes', - }, - ], - name: 'swapSingleTokenExactIn', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'payable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - { - internalType: 'contract IERC20', - name: 'tokenIn', - type: 'address', - }, - { - internalType: 'contract IERC20', - name: 'tokenOut', - type: 'address', - }, - { - internalType: 'uint256', - name: 'exactAmountOut', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'maxAmountIn', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'deadline', - type: 'uint256', - }, - { - internalType: 'bool', - name: 'wethIsEth', - type: 'bool', - }, - { - internalType: 'bytes', - name: 'userData', - type: 'bytes', - }, - ], - name: 'swapSingleTokenExactOut', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'payable', - type: 'function', - }, { inputs: [ { diff --git a/src/abi/index.ts b/src/abi/index.ts index 72da6de6..5ffb6d37 100644 --- a/src/abi/index.ts +++ b/src/abi/index.ts @@ -6,9 +6,9 @@ export * from './batchRelayerLibrary'; export * from './composableStableFactoryV5.V2'; export * from './composableStablePoolV5.V2'; export * from './erc20'; +export * from './permit2'; export * from './vaultV2'; export * from './vaultV3'; -export * from './composableStablePoolV5.V2'; export * from './weightedPoolFactory.V3'; export * from './weightedPoolFactoryV4.V2'; export * from './weightedPoolV4.V2'; diff --git a/src/abi/permit2.ts b/src/abi/permit2.ts new file mode 100644 index 00000000..71490949 --- /dev/null +++ b/src/abi/permit2.ts @@ -0,0 +1,671 @@ +export const permit2Abi = [ + { + inputs: [ + { internalType: 'uint256', name: 'deadline', type: 'uint256' }, + ], + name: 'AllowanceExpired', + type: 'error', + }, + { inputs: [], name: 'ExcessiveInvalidation', type: 'error' }, + { + inputs: [{ internalType: 'uint256', name: 'amount', type: 'uint256' }], + name: 'InsufficientAllowance', + type: 'error', + }, + { + inputs: [ + { internalType: 'uint256', name: 'maxAmount', type: 'uint256' }, + ], + name: 'InvalidAmount', + type: 'error', + }, + { inputs: [], name: 'InvalidContractSignature', type: 'error' }, + { inputs: [], name: 'InvalidNonce', type: 'error' }, + { inputs: [], name: 'InvalidSignature', type: 'error' }, + { inputs: [], name: 'InvalidSignatureLength', type: 'error' }, + { inputs: [], name: 'InvalidSigner', type: 'error' }, + { inputs: [], name: 'LengthMismatch', type: 'error' }, + { + inputs: [ + { + internalType: 'uint256', + name: 'signatureDeadline', + type: 'uint256', + }, + ], + name: 'SignatureExpired', + type: 'error', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'owner', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'token', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'spender', + type: 'address', + }, + { + indexed: false, + internalType: 'uint160', + name: 'amount', + type: 'uint160', + }, + { + indexed: false, + internalType: 'uint48', + name: 'expiration', + type: 'uint48', + }, + ], + name: 'Approval', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'owner', + type: 'address', + }, + { + indexed: false, + internalType: 'address', + name: 'token', + type: 'address', + }, + { + indexed: false, + internalType: 'address', + name: 'spender', + type: 'address', + }, + ], + name: 'Lockdown', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'owner', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'token', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'spender', + type: 'address', + }, + { + indexed: false, + internalType: 'uint48', + name: 'newNonce', + type: 'uint48', + }, + { + indexed: false, + internalType: 'uint48', + name: 'oldNonce', + type: 'uint48', + }, + ], + name: 'NonceInvalidation', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'owner', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'token', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'spender', + type: 'address', + }, + { + indexed: false, + internalType: 'uint160', + name: 'amount', + type: 'uint160', + }, + { + indexed: false, + internalType: 'uint48', + name: 'expiration', + type: 'uint48', + }, + { + indexed: false, + internalType: 'uint48', + name: 'nonce', + type: 'uint48', + }, + ], + name: 'Permit', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'owner', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'word', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'mask', + type: 'uint256', + }, + ], + name: 'UnorderedNonceInvalidation', + type: 'event', + }, + { + inputs: [], + name: 'DOMAIN_SEPARATOR', + outputs: [{ internalType: 'bytes32', name: '', type: 'bytes32' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'address', name: '', type: 'address' }, + { internalType: 'address', name: '', type: 'address' }, + { internalType: 'address', name: '', type: 'address' }, + ], + name: 'allowance', + outputs: [ + { internalType: 'uint160', name: 'amount', type: 'uint160' }, + { internalType: 'uint48', name: 'expiration', type: 'uint48' }, + { internalType: 'uint48', name: 'nonce', type: 'uint48' }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'address', name: 'token', type: 'address' }, + { internalType: 'address', name: 'spender', type: 'address' }, + { internalType: 'uint160', name: 'amount', type: 'uint160' }, + { internalType: 'uint48', name: 'expiration', type: 'uint48' }, + ], + name: 'approve', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'address', name: 'token', type: 'address' }, + { internalType: 'address', name: 'spender', type: 'address' }, + { internalType: 'uint48', name: 'newNonce', type: 'uint48' }, + ], + name: 'invalidateNonces', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'uint256', name: 'wordPos', type: 'uint256' }, + { internalType: 'uint256', name: 'mask', type: 'uint256' }, + ], + name: 'invalidateUnorderedNonces', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + components: [ + { internalType: 'address', name: 'token', type: 'address' }, + { + internalType: 'address', + name: 'spender', + type: 'address', + }, + ], + internalType: 'struct IAllowanceTransfer.TokenSpenderPair[]', + name: 'approvals', + type: 'tuple[]', + }, + ], + name: 'lockdown', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'address', name: '', type: 'address' }, + { internalType: 'uint256', name: '', type: 'uint256' }, + ], + name: 'nonceBitmap', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'address', name: 'owner', type: 'address' }, + { + components: [ + { + components: [ + { + internalType: 'address', + name: 'token', + type: 'address', + }, + { + internalType: 'uint160', + name: 'amount', + type: 'uint160', + }, + { + internalType: 'uint48', + name: 'expiration', + type: 'uint48', + }, + { + internalType: 'uint48', + name: 'nonce', + type: 'uint48', + }, + ], + internalType: + 'struct IAllowanceTransfer.PermitDetails[]', + name: 'details', + type: 'tuple[]', + }, + { + internalType: 'address', + name: 'spender', + type: 'address', + }, + { + internalType: 'uint256', + name: 'sigDeadline', + type: 'uint256', + }, + ], + internalType: 'struct IAllowanceTransfer.PermitBatch', + name: 'permitBatch', + type: 'tuple', + }, + { internalType: 'bytes', name: 'signature', type: 'bytes' }, + ], + name: 'permit', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'address', name: 'owner', type: 'address' }, + { + components: [ + { + components: [ + { + internalType: 'address', + name: 'token', + type: 'address', + }, + { + internalType: 'uint160', + name: 'amount', + type: 'uint160', + }, + { + internalType: 'uint48', + name: 'expiration', + type: 'uint48', + }, + { + internalType: 'uint48', + name: 'nonce', + type: 'uint48', + }, + ], + internalType: 'struct IAllowanceTransfer.PermitDetails', + name: 'details', + type: 'tuple', + }, + { + internalType: 'address', + name: 'spender', + type: 'address', + }, + { + internalType: 'uint256', + name: 'sigDeadline', + type: 'uint256', + }, + ], + internalType: 'struct IAllowanceTransfer.PermitSingle', + name: 'permitSingle', + type: 'tuple', + }, + { internalType: 'bytes', name: 'signature', type: 'bytes' }, + ], + name: 'permit', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + components: [ + { + components: [ + { + internalType: 'address', + name: 'token', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + internalType: + 'struct ISignatureTransfer.TokenPermissions', + name: 'permitted', + type: 'tuple', + }, + { internalType: 'uint256', name: 'nonce', type: 'uint256' }, + { + internalType: 'uint256', + name: 'deadline', + type: 'uint256', + }, + ], + internalType: 'struct ISignatureTransfer.PermitTransferFrom', + name: 'permit', + type: 'tuple', + }, + { + components: [ + { internalType: 'address', name: 'to', type: 'address' }, + { + internalType: 'uint256', + name: 'requestedAmount', + type: 'uint256', + }, + ], + internalType: + 'struct ISignatureTransfer.SignatureTransferDetails', + name: 'transferDetails', + type: 'tuple', + }, + { internalType: 'address', name: 'owner', type: 'address' }, + { internalType: 'bytes', name: 'signature', type: 'bytes' }, + ], + name: 'permitTransferFrom', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + components: [ + { + components: [ + { + internalType: 'address', + name: 'token', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + internalType: + 'struct ISignatureTransfer.TokenPermissions[]', + name: 'permitted', + type: 'tuple[]', + }, + { internalType: 'uint256', name: 'nonce', type: 'uint256' }, + { + internalType: 'uint256', + name: 'deadline', + type: 'uint256', + }, + ], + internalType: + 'struct ISignatureTransfer.PermitBatchTransferFrom', + name: 'permit', + type: 'tuple', + }, + { + components: [ + { internalType: 'address', name: 'to', type: 'address' }, + { + internalType: 'uint256', + name: 'requestedAmount', + type: 'uint256', + }, + ], + internalType: + 'struct ISignatureTransfer.SignatureTransferDetails[]', + name: 'transferDetails', + type: 'tuple[]', + }, + { internalType: 'address', name: 'owner', type: 'address' }, + { internalType: 'bytes', name: 'signature', type: 'bytes' }, + ], + name: 'permitTransferFrom', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + components: [ + { + components: [ + { + internalType: 'address', + name: 'token', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + internalType: + 'struct ISignatureTransfer.TokenPermissions', + name: 'permitted', + type: 'tuple', + }, + { internalType: 'uint256', name: 'nonce', type: 'uint256' }, + { + internalType: 'uint256', + name: 'deadline', + type: 'uint256', + }, + ], + internalType: 'struct ISignatureTransfer.PermitTransferFrom', + name: 'permit', + type: 'tuple', + }, + { + components: [ + { internalType: 'address', name: 'to', type: 'address' }, + { + internalType: 'uint256', + name: 'requestedAmount', + type: 'uint256', + }, + ], + internalType: + 'struct ISignatureTransfer.SignatureTransferDetails', + name: 'transferDetails', + type: 'tuple', + }, + { internalType: 'address', name: 'owner', type: 'address' }, + { internalType: 'bytes32', name: 'witness', type: 'bytes32' }, + { + internalType: 'string', + name: 'witnessTypeString', + type: 'string', + }, + { internalType: 'bytes', name: 'signature', type: 'bytes' }, + ], + name: 'permitWitnessTransferFrom', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + components: [ + { + components: [ + { + internalType: 'address', + name: 'token', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + internalType: + 'struct ISignatureTransfer.TokenPermissions[]', + name: 'permitted', + type: 'tuple[]', + }, + { internalType: 'uint256', name: 'nonce', type: 'uint256' }, + { + internalType: 'uint256', + name: 'deadline', + type: 'uint256', + }, + ], + internalType: + 'struct ISignatureTransfer.PermitBatchTransferFrom', + name: 'permit', + type: 'tuple', + }, + { + components: [ + { internalType: 'address', name: 'to', type: 'address' }, + { + internalType: 'uint256', + name: 'requestedAmount', + type: 'uint256', + }, + ], + internalType: + 'struct ISignatureTransfer.SignatureTransferDetails[]', + name: 'transferDetails', + type: 'tuple[]', + }, + { internalType: 'address', name: 'owner', type: 'address' }, + { internalType: 'bytes32', name: 'witness', type: 'bytes32' }, + { + internalType: 'string', + name: 'witnessTypeString', + type: 'string', + }, + { internalType: 'bytes', name: 'signature', type: 'bytes' }, + ], + name: 'permitWitnessTransferFrom', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + components: [ + { internalType: 'address', name: 'from', type: 'address' }, + { internalType: 'address', name: 'to', type: 'address' }, + { + internalType: 'uint160', + name: 'amount', + type: 'uint160', + }, + { internalType: 'address', name: 'token', type: 'address' }, + ], + internalType: + 'struct IAllowanceTransfer.AllowanceTransferDetails[]', + name: 'transferDetails', + type: 'tuple[]', + }, + ], + name: 'transferFrom', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'address', name: 'from', type: 'address' }, + { internalType: 'address', name: 'to', type: 'address' }, + { internalType: 'uint160', name: 'amount', type: 'uint160' }, + { internalType: 'address', name: 'token', type: 'address' }, + ], + name: 'transferFrom', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, +] as const; diff --git a/src/abi/vaultV3.ts b/src/abi/vaultV3.ts index 29007ad4..ace71641 100644 --- a/src/abi/vaultV3.ts +++ b/src/abi/vaultV3.ts @@ -1,1492 +1,3762 @@ -import { vaultV3ExtensionAbi } from './vaultV3Extension'; - export const vaultV3Abi = [ - ...vaultV3ExtensionAbi, - [ - { - inputs: [ - { - internalType: 'contract IVaultExtension', - name: 'vaultExtension', - type: 'address', - }, - { - internalType: 'contract IAuthorizer', - name: 'authorizer', - type: 'address', - }, - ], - stateMutability: 'nonpayable', - type: 'constructor', - }, - { - inputs: [ - { - internalType: 'address', - name: 'target', - type: 'address', - }, - ], - name: 'AddressEmptyCode', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'account', - type: 'address', - }, - ], - name: 'AddressInsufficientBalance', - type: 'error', - }, - { - inputs: [], - name: 'AfterAddLiquidityHookFailed', - type: 'error', - }, - { - inputs: [], - name: 'AfterInitializeHookFailed', - type: 'error', - }, - { - inputs: [], - name: 'AfterRemoveLiquidityHookFailed', - type: 'error', - }, - { - inputs: [], - name: 'AfterSwapHookFailed', - type: 'error', - }, - { - inputs: [], - name: 'AllZeroInputs', - type: 'error', - }, - { - inputs: [], - name: 'AmountGivenZero', - type: 'error', - }, - { - inputs: [ - { - internalType: 'contract IERC20', - name: 'token', - type: 'address', - }, - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'limit', - type: 'uint256', - }, - ], - name: 'AmountInAboveMax', - type: 'error', - }, - { - inputs: [ - { - internalType: 'contract IERC20', - name: 'token', - type: 'address', - }, - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'limit', - type: 'uint256', - }, - ], - name: 'AmountOutBelowMin', - type: 'error', - }, - { - inputs: [], - name: 'BalanceNotSettled', - type: 'error', - }, - { - inputs: [], - name: 'BalanceOverflow', - type: 'error', - }, - { - inputs: [], - name: 'BeforeAddLiquidityHookFailed', - type: 'error', - }, - { - inputs: [], - name: 'BeforeInitializeHookFailed', - type: 'error', - }, - { - inputs: [], - name: 'BeforeRemoveLiquidityHookFailed', - type: 'error', - }, - { - inputs: [], - name: 'BeforeSwapHookFailed', - type: 'error', - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'limit', - type: 'uint256', - }, - ], - name: 'BptAmountInAboveMax', - type: 'error', - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'limit', - type: 'uint256', - }, - ], - name: 'BptAmountOutBelowMin', - type: 'error', - }, - { - inputs: [], - name: 'CannotReceiveEth', - type: 'error', - }, - { - inputs: [], - name: 'CannotSwapSameToken', - type: 'error', - }, - { - inputs: [], - name: 'DoesNotSupportAddLiquidityCustom', - type: 'error', - }, - { - inputs: [], - name: 'DoesNotSupportRemoveLiquidityCustom', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'spender', - type: 'address', - }, - { - internalType: 'uint256', - name: 'allowance', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'needed', - type: 'uint256', - }, - ], - name: 'ERC20InsufficientAllowance', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'sender', - type: 'address', - }, - { - internalType: 'uint256', - name: 'balance', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'needed', - type: 'uint256', - }, - ], - name: 'ERC20InsufficientBalance', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'approver', - type: 'address', - }, - ], - name: 'ERC20InvalidApprover', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'receiver', - type: 'address', - }, - ], - name: 'ERC20InvalidReceiver', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'sender', - type: 'address', - }, - ], - name: 'ERC20InvalidSender', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'spender', - type: 'address', - }, - ], - name: 'ERC20InvalidSpender', - type: 'error', - }, - { - inputs: [], - name: 'FailedInnerCall', - type: 'error', - }, - { - inputs: [], - name: 'InputLengthMismatch', - type: 'error', - }, - { - inputs: [], - name: 'InvalidAddLiquidityKind', - type: 'error', - }, - { - inputs: [], - name: 'InvalidRemoveLiquidityKind', - type: 'error', - }, - { - inputs: [], - name: 'InvalidToken', - type: 'error', - }, - { - inputs: [], - name: 'InvalidTokenConfiguration', - type: 'error', - }, - { - inputs: [], - name: 'InvalidTokenType', - type: 'error', - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'index', - type: 'uint256', - }, - ], - name: 'LockerOutOfBounds', - type: 'error', - }, - { - inputs: [], - name: 'MaxTokens', - type: 'error', - }, - { - inputs: [], - name: 'MinTokens', - type: 'error', - }, - { - inputs: [], - name: 'MultipleNonZeroInputs', - type: 'error', - }, - { - inputs: [], - name: 'NoLocker', - type: 'error', - }, - { - inputs: [], - name: 'NotStaticCall', - type: 'error', - }, - { - inputs: [], - name: 'NotVaultDelegateCall', - type: 'error', - }, - { - inputs: [], - name: 'OperationNotSupported', - type: 'error', - }, - { - inputs: [], - name: 'PauseBufferPeriodDurationTooLarge', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - ], - name: 'PoolAlreadyInitialized', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - ], - name: 'PoolAlreadyRegistered', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - ], - name: 'PoolInRecoveryMode', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - ], - name: 'PoolNotInRecoveryMode', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - ], - name: 'PoolNotInitialized', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - ], - name: 'PoolNotPaused', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - ], - name: 'PoolNotRegistered', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - ], - name: 'PoolPauseWindowExpired', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - ], - name: 'PoolPaused', - type: 'error', - }, - { - inputs: [], - name: 'ProtocolSwapFeePercentageTooHigh', - type: 'error', - }, - { - inputs: [], - name: 'ProtocolYieldFeePercentageTooHigh', - type: 'error', - }, - { - inputs: [], - name: 'QueriesDisabled', - type: 'error', - }, - { - inputs: [], - name: 'ReentrancyGuardReentrantCall', - type: 'error', - }, - { - inputs: [], - name: 'RouterNotTrusted', - type: 'error', - }, - { - inputs: [ - { - internalType: 'uint8', - name: 'bits', - type: 'uint8', - }, - { - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - ], - name: 'SafeCastOverflowedUintDowncast', - type: 'error', - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - ], - name: 'SafeCastOverflowedUintToInt', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'token', - type: 'address', - }, - ], - name: 'SafeERC20FailedOperation', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - ], - name: 'SenderIsNotPauseManager', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'sender', - type: 'address', - }, - ], - name: 'SenderIsNotVault', - type: 'error', - }, - { - inputs: [], - name: 'SwapFeePercentageTooHigh', - type: 'error', - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'limit', - type: 'uint256', - }, - ], - name: 'SwapLimit', - type: 'error', - }, - { - inputs: [ - { - internalType: 'contract IERC20', - name: 'token', - type: 'address', - }, - ], - name: 'TokenAlreadyRegistered', - type: 'error', - }, - { - inputs: [], - name: 'TokenNotRegistered', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - { - internalType: 'address', - name: 'expectedToken', - type: 'address', - }, - { - internalType: 'address', - name: 'actualToken', - type: 'address', - }, - ], - name: 'TokensMismatch', - type: 'error', - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'limit', - type: 'uint256', - }, - ], - name: 'TotalSupplyTooLow', - type: 'error', - }, - { - inputs: [], - name: 'UserDataNotSupported', - type: 'error', - }, - { - inputs: [], - name: 'VaultNotPaused', - type: 'error', - }, - { - inputs: [], - name: 'VaultPauseWindowDurationTooLarge', - type: 'error', - }, - { - inputs: [], - name: 'VaultPauseWindowExpired', - type: 'error', - }, - { - inputs: [], - name: 'VaultPaused', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'locker', - type: 'address', - }, - { - internalType: 'address', - name: 'caller', - type: 'address', - }, - ], - name: 'WrongLocker', - type: 'error', - }, - { - inputs: [], - name: 'WrongVaultAdminDeployment', - type: 'error', - }, - { - inputs: [], - name: 'WrongVaultExtensionDeployment', - type: 'error', - }, - { - inputs: [], - name: 'ZeroDivision', - type: 'error', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'pool', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'owner', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'spender', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - ], - name: 'Approval', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'contract IAuthorizer', - name: 'newAuthorizer', - type: 'address', - }, - ], - name: 'AuthorizerChanged', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'pool', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'liquidityProvider', - type: 'address', - }, - { - indexed: false, - internalType: 'contract IERC20[]', - name: 'tokens', - type: 'address[]', - }, - { - indexed: false, - internalType: 'int256[]', - name: 'deltas', - type: 'int256[]', - }, - ], - name: 'PoolBalanceChanged', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'pool', - type: 'address', - }, - ], - name: 'PoolInitialized', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'pool', - type: 'address', - }, - { - indexed: false, - internalType: 'bool', - name: 'paused', - type: 'bool', - }, - ], - name: 'PoolPausedStateChanged', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'pool', - type: 'address', - }, - { - indexed: false, - internalType: 'bool', - name: 'recoveryMode', - type: 'bool', - }, - ], - name: 'PoolRecoveryModeStateChanged', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'pool', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'factory', - type: 'address', - }, - { - components: [ - { - internalType: 'contract IERC20', - name: 'token', - type: 'address', - }, - { - internalType: 'enum TokenType', - name: 'tokenType', - type: 'uint8', - }, - { - internalType: 'contract IRateProvider', - name: 'rateProvider', - type: 'address', - }, - { - internalType: 'bool', - name: 'yieldFeeExempt', - type: 'bool', - }, - ], - indexed: false, - internalType: 'struct TokenConfig[]', - name: 'tokenConfig', - type: 'tuple[]', - }, - { - indexed: false, - internalType: 'uint256', - name: 'pauseWindowEndTime', - type: 'uint256', - }, - { - indexed: false, - internalType: 'address', - name: 'pauseManager', - type: 'address', - }, - { - components: [ - { - internalType: 'bool', - name: 'shouldCallBeforeInitialize', - type: 'bool', - }, - { - internalType: 'bool', - name: 'shouldCallAfterInitialize', - type: 'bool', - }, - { - internalType: 'bool', - name: 'shouldCallBeforeSwap', - type: 'bool', - }, - { - internalType: 'bool', - name: 'shouldCallAfterSwap', - type: 'bool', - }, - { - internalType: 'bool', - name: 'shouldCallBeforeAddLiquidity', - type: 'bool', - }, - { - internalType: 'bool', - name: 'shouldCallAfterAddLiquidity', - type: 'bool', - }, - { - internalType: 'bool', - name: 'shouldCallBeforeRemoveLiquidity', - type: 'bool', - }, - { - internalType: 'bool', - name: 'shouldCallAfterRemoveLiquidity', - type: 'bool', - }, - ], - indexed: false, - internalType: 'struct PoolHooks', - name: 'hooks', - type: 'tuple', - }, - { - components: [ - { - internalType: 'bool', - name: 'supportsAddLiquidityCustom', - type: 'bool', - }, - { - internalType: 'bool', - name: 'supportsRemoveLiquidityCustom', - type: 'bool', - }, - ], - indexed: false, - internalType: 'struct LiquidityManagement', - name: 'liquidityManagement', - type: 'tuple', - }, - ], - name: 'PoolRegistered', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'contract IERC20', - name: 'token', - type: 'address', - }, - { - indexed: true, - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'ProtocolFeeCollected', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'pool', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'token', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'ProtocolSwapFeeCharged', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'uint256', - name: 'swapFeePercentage', - type: 'uint256', - }, - ], - name: 'ProtocolSwapFeePercentageChanged', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'pool', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'token', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'ProtocolYieldFeeCharged', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'uint256', - name: 'yieldFeePercentage', - type: 'uint256', - }, - ], - name: 'ProtocolYieldFeePercentageChanged', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'pool', - type: 'address', - }, - { - indexed: true, - internalType: 'contract IERC20', - name: 'tokenIn', - type: 'address', - }, - { - indexed: true, - internalType: 'contract IERC20', - name: 'tokenOut', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'amountIn', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'amountOut', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'swapFeeAmount', - type: 'uint256', - }, - ], - name: 'Swap', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'pool', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'from', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'to', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - ], - name: 'Transfer', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'bool', - name: 'paused', - type: 'bool', - }, - ], - name: 'VaultPausedStateChanged', - type: 'event', - }, - { - stateMutability: 'payable', - type: 'fallback', - }, - { - inputs: [], - name: 'MAX_BUFFER_PERIOD_DURATION', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'MAX_PAUSE_WINDOW_DURATION', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - components: [ - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - { - internalType: 'address', - name: 'to', - type: 'address', - }, - { - internalType: 'uint256[]', - name: 'maxAmountsIn', - type: 'uint256[]', - }, - { - internalType: 'uint256', - name: 'minBptAmountOut', - type: 'uint256', - }, - { - internalType: 'enum AddLiquidityKind', - name: 'kind', - type: 'uint8', - }, - { - internalType: 'bytes', - name: 'userData', - type: 'bytes', - }, - ], - internalType: 'struct AddLiquidityParams', - name: 'params', - type: 'tuple', - }, - ], - name: 'addLiquidity', - outputs: [ - { - internalType: 'uint256[]', - name: 'amountsIn', - type: 'uint256[]', - }, - { - internalType: 'uint256', - name: 'bptAmountOut', - type: 'uint256', - }, - { - internalType: 'bytes', - name: 'returnData', - type: 'bytes', - }, - ], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'getAuthorizer', - outputs: [ - { - internalType: 'contract IAuthorizer', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - { - internalType: 'contract IERC20', - name: 'token', - type: 'address', - }, - ], - name: 'getPoolTokenCountAndIndexOfToken', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'getVaultExtension', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'bytes', - name: 'data', - type: 'bytes', - }, - ], - name: 'lock', - outputs: [ - { - internalType: 'bytes', - name: 'result', - type: 'bytes', - }, - ], - stateMutability: 'payable', - type: 'function', - }, - { - inputs: [], - name: 'reentrancyGuardEntered', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - components: [ - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - { - internalType: 'address', - name: 'from', - type: 'address', - }, - { - internalType: 'uint256', - name: 'maxBptAmountIn', - type: 'uint256', - }, - { - internalType: 'uint256[]', - name: 'minAmountsOut', - type: 'uint256[]', - }, - { - internalType: 'enum RemoveLiquidityKind', - name: 'kind', - type: 'uint8', - }, - { - internalType: 'bytes', - name: 'userData', - type: 'bytes', - }, - ], - internalType: 'struct RemoveLiquidityParams', - name: 'params', - type: 'tuple', - }, - ], - name: 'removeLiquidity', - outputs: [ - { - internalType: 'uint256', - name: 'bptAmountIn', - type: 'uint256', - }, - { - internalType: 'uint256[]', - name: 'amountsOut', - type: 'uint256[]', - }, - { - internalType: 'bytes', - name: 'returnData', - type: 'bytes', - }, - ], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'contract IERC20', - name: 'token', - type: 'address', - }, - { - internalType: 'address', - name: 'to', - type: 'address', - }, - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'sendTo', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'contract IERC20', - name: 'token', - type: 'address', - }, - ], - name: 'settle', - outputs: [ - { - internalType: 'uint256', - name: 'paid', - type: 'uint256', - }, - ], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - components: [ - { - internalType: 'enum SwapKind', - name: 'kind', - type: 'uint8', - }, - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - { - internalType: 'contract IERC20', - name: 'tokenIn', - type: 'address', - }, - { - internalType: 'contract IERC20', - name: 'tokenOut', - type: 'address', - }, - { - internalType: 'uint256', - name: 'amountGivenRaw', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'limitRaw', - type: 'uint256', - }, - { - internalType: 'bytes', - name: 'userData', - type: 'bytes', - }, - ], - internalType: 'struct SwapParams', - name: 'params', - type: 'tuple', - }, - ], - name: 'swap', - outputs: [ - { - internalType: 'uint256', - name: 'amountCalculated', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'amountIn', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'amountOut', - type: 'uint256', - }, - ], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'contract IERC20', - name: 'token', - type: 'address', - }, - { - internalType: 'address', - name: 'from', - type: 'address', - }, - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'takeFrom', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - stateMutability: 'payable', - type: 'receive', - }, - ], + { + inputs: [ + { + internalType: 'contract IVaultExtension', + name: 'vaultExtension', + type: 'address', + }, + { + internalType: 'contract IAuthorizer', + name: 'authorizer', + type: 'address', + }, + ], + stateMutability: 'nonpayable', + type: 'constructor', + }, + { + inputs: [ + { + internalType: 'address', + name: 'target', + type: 'address', + }, + ], + name: 'AddressEmptyCode', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'account', + type: 'address', + }, + ], + name: 'AddressInsufficientBalance', + type: 'error', + }, + { + inputs: [], + name: 'AfterAddLiquidityHookFailed', + type: 'error', + }, + { + inputs: [], + name: 'AfterInitializeHookFailed', + type: 'error', + }, + { + inputs: [], + name: 'AfterRemoveLiquidityHookFailed', + type: 'error', + }, + { + inputs: [], + name: 'AfterSwapHookFailed', + type: 'error', + }, + { + inputs: [], + name: 'AllZeroInputs', + type: 'error', + }, + { + inputs: [], + name: 'AmountGivenZero', + type: 'error', + }, + { + inputs: [ + { + internalType: 'contract IERC20', + name: 'token', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'limit', + type: 'uint256', + }, + ], + name: 'AmountInAboveMax', + type: 'error', + }, + { + inputs: [ + { + internalType: 'contract IERC20', + name: 'token', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'limit', + type: 'uint256', + }, + ], + name: 'AmountOutBelowMin', + type: 'error', + }, + { + inputs: [], + name: 'BalanceNotSettled', + type: 'error', + }, + { + inputs: [], + name: 'BalanceOverflow', + type: 'error', + }, + { + inputs: [], + name: 'BeforeAddLiquidityHookFailed', + type: 'error', + }, + { + inputs: [], + name: 'BeforeInitializeHookFailed', + type: 'error', + }, + { + inputs: [], + name: 'BeforeRemoveLiquidityHookFailed', + type: 'error', + }, + { + inputs: [], + name: 'BeforeSwapHookFailed', + type: 'error', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'limit', + type: 'uint256', + }, + ], + name: 'BptAmountInAboveMax', + type: 'error', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'limit', + type: 'uint256', + }, + ], + name: 'BptAmountOutBelowMin', + type: 'error', + }, + { + inputs: [], + name: 'CannotReceiveEth', + type: 'error', + }, + { + inputs: [], + name: 'CannotSwapSameToken', + type: 'error', + }, + { + inputs: [], + name: 'DoesNotSupportAddLiquidityCustom', + type: 'error', + }, + { + inputs: [], + name: 'DoesNotSupportRemoveLiquidityCustom', + type: 'error', + }, + { + inputs: [], + name: 'DoesNotSupportUnbalancedLiquidity', + type: 'error', + }, + { + inputs: [], + name: 'DynamicSwapFeeHookFailed', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'spender', + type: 'address', + }, + { + internalType: 'uint256', + name: 'allowance', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'needed', + type: 'uint256', + }, + ], + name: 'ERC20InsufficientAllowance', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'sender', + type: 'address', + }, + { + internalType: 'uint256', + name: 'balance', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'needed', + type: 'uint256', + }, + ], + name: 'ERC20InsufficientBalance', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'approver', + type: 'address', + }, + ], + name: 'ERC20InvalidApprover', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'receiver', + type: 'address', + }, + ], + name: 'ERC20InvalidReceiver', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'sender', + type: 'address', + }, + ], + name: 'ERC20InvalidSender', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'spender', + type: 'address', + }, + ], + name: 'ERC20InvalidSpender', + type: 'error', + }, + { + inputs: [], + name: 'FailedInnerCall', + type: 'error', + }, + { + inputs: [], + name: 'InputLengthMismatch', + type: 'error', + }, + { + inputs: [], + name: 'InvalidAddLiquidityKind', + type: 'error', + }, + { + inputs: [], + name: 'InvalidRemoveLiquidityKind', + type: 'error', + }, + { + inputs: [], + name: 'InvalidToken', + type: 'error', + }, + { + inputs: [], + name: 'InvalidTokenConfiguration', + type: 'error', + }, + { + inputs: [], + name: 'InvalidTokenType', + type: 'error', + }, + { + inputs: [], + name: 'MaxTokens', + type: 'error', + }, + { + inputs: [], + name: 'MinTokens', + type: 'error', + }, + { + inputs: [], + name: 'MultipleNonZeroInputs', + type: 'error', + }, + { + inputs: [], + name: 'NotStaticCall', + type: 'error', + }, + { + inputs: [], + name: 'NotVaultDelegateCall', + type: 'error', + }, + { + inputs: [], + name: 'OperationNotSupported', + type: 'error', + }, + { + inputs: [], + name: 'PauseBufferPeriodDurationTooLarge', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'pool', + type: 'address', + }, + ], + name: 'PoolAlreadyInitialized', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'pool', + type: 'address', + }, + ], + name: 'PoolAlreadyRegistered', + type: 'error', + }, + { + inputs: [], + name: 'PoolCreatorFeePercentageTooHigh', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'pool', + type: 'address', + }, + ], + name: 'PoolInRecoveryMode', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'pool', + type: 'address', + }, + ], + name: 'PoolNotInRecoveryMode', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'pool', + type: 'address', + }, + ], + name: 'PoolNotInitialized', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'pool', + type: 'address', + }, + ], + name: 'PoolNotPaused', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'pool', + type: 'address', + }, + ], + name: 'PoolNotRegistered', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'pool', + type: 'address', + }, + ], + name: 'PoolPauseWindowExpired', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'pool', + type: 'address', + }, + ], + name: 'PoolPaused', + type: 'error', + }, + { + inputs: [], + name: 'ProtocolFeesExceedSwapFee', + type: 'error', + }, + { + inputs: [], + name: 'ProtocolSwapFeePercentageTooHigh', + type: 'error', + }, + { + inputs: [], + name: 'ProtocolYieldFeePercentageTooHigh', + type: 'error', + }, + { + inputs: [], + name: 'QueriesDisabled', + type: 'error', + }, + { + inputs: [], + name: 'ReentrancyGuardReentrantCall', + type: 'error', + }, + { + inputs: [], + name: 'RouterNotTrusted', + type: 'error', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'value', + type: 'uint256', + }, + ], + name: 'SafeCastOverflowedUintToInt', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'token', + type: 'address', + }, + ], + name: 'SafeERC20FailedOperation', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'sender', + type: 'address', + }, + ], + name: 'SenderIsNotVault', + type: 'error', + }, + { + inputs: [], + name: 'SwapFeePercentageTooHigh', + type: 'error', + }, + { + inputs: [], + name: 'SwapFeePercentageTooLow', + type: 'error', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'limit', + type: 'uint256', + }, + ], + name: 'SwapLimit', + type: 'error', + }, + { + inputs: [ + { + internalType: 'contract IERC20', + name: 'token', + type: 'address', + }, + ], + name: 'TokenAlreadyRegistered', + type: 'error', + }, + { + inputs: [], + name: 'TokenNotRegistered', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'pool', + type: 'address', + }, + { + internalType: 'address', + name: 'expectedToken', + type: 'address', + }, + { + internalType: 'address', + name: 'actualToken', + type: 'address', + }, + ], + name: 'TokensMismatch', + type: 'error', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'limit', + type: 'uint256', + }, + ], + name: 'TotalSupplyTooLow', + type: 'error', + }, + { + inputs: [], + name: 'UserDataNotSupported', + type: 'error', + }, + { + inputs: [], + name: 'VaultIsNotUnlocked', + type: 'error', + }, + { + inputs: [], + name: 'VaultNotPaused', + type: 'error', + }, + { + inputs: [], + name: 'VaultPauseWindowDurationTooLarge', + type: 'error', + }, + { + inputs: [], + name: 'VaultPauseWindowExpired', + type: 'error', + }, + { + inputs: [], + name: 'VaultPaused', + type: 'error', + }, + { + inputs: [], + name: 'WrongVaultAdminDeployment', + type: 'error', + }, + { + inputs: [], + name: 'WrongVaultExtensionDeployment', + type: 'error', + }, + { + inputs: [], + name: 'ZeroDivision', + type: 'error', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'pool', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'owner', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'spender', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'value', + type: 'uint256', + }, + ], + name: 'Approval', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'contract IAuthorizer', + name: 'newAuthorizer', + type: 'address', + }, + ], + name: 'AuthorizerChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'pool', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'liquidityProvider', + type: 'address', + }, + { + indexed: false, + internalType: 'contract IERC20[]', + name: 'tokens', + type: 'address[]', + }, + { + indexed: false, + internalType: 'int256[]', + name: 'deltas', + type: 'int256[]', + }, + ], + name: 'PoolBalanceChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'address', + name: 'pool', + type: 'address', + }, + { + indexed: true, + internalType: 'contract IERC20', + name: 'token', + type: 'address', + }, + { + indexed: true, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'PoolCreatorFeeCollected', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'pool', + type: 'address', + }, + { + indexed: true, + internalType: 'uint256', + name: 'poolCreatorFeePercentage', + type: 'uint256', + }, + ], + name: 'PoolCreatorFeePercentageChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'pool', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'token', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'PoolCreatorSwapFeeCharged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'pool', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'token', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'PoolCreatorYieldFeeCharged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'pool', + type: 'address', + }, + ], + name: 'PoolInitialized', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'pool', + type: 'address', + }, + { + indexed: false, + internalType: 'bool', + name: 'paused', + type: 'bool', + }, + ], + name: 'PoolPausedStateChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'pool', + type: 'address', + }, + { + indexed: false, + internalType: 'bool', + name: 'recoveryMode', + type: 'bool', + }, + ], + name: 'PoolRecoveryModeStateChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'pool', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'factory', + type: 'address', + }, + { + components: [ + { + internalType: 'contract IERC20', + name: 'token', + type: 'address', + }, + { + internalType: 'enum TokenType', + name: 'tokenType', + type: 'uint8', + }, + { + internalType: 'contract IRateProvider', + name: 'rateProvider', + type: 'address', + }, + { + internalType: 'bool', + name: 'paysYieldFees', + type: 'bool', + }, + ], + indexed: false, + internalType: 'struct TokenConfig[]', + name: 'tokenConfig', + type: 'tuple[]', + }, + { + indexed: false, + internalType: 'uint256', + name: 'pauseWindowEndTime', + type: 'uint256', + }, + { + components: [ + { + internalType: 'address', + name: 'pauseManager', + type: 'address', + }, + { + internalType: 'address', + name: 'swapFeeManager', + type: 'address', + }, + { + internalType: 'address', + name: 'poolCreator', + type: 'address', + }, + ], + indexed: false, + internalType: 'struct PoolRoleAccounts', + name: 'roleAccounts', + type: 'tuple', + }, + { + components: [ + { + internalType: 'bool', + name: 'shouldCallBeforeInitialize', + type: 'bool', + }, + { + internalType: 'bool', + name: 'shouldCallAfterInitialize', + type: 'bool', + }, + { + internalType: 'bool', + name: 'shouldCallComputeDynamicSwapFee', + type: 'bool', + }, + { + internalType: 'bool', + name: 'shouldCallBeforeSwap', + type: 'bool', + }, + { + internalType: 'bool', + name: 'shouldCallAfterSwap', + type: 'bool', + }, + { + internalType: 'bool', + name: 'shouldCallBeforeAddLiquidity', + type: 'bool', + }, + { + internalType: 'bool', + name: 'shouldCallAfterAddLiquidity', + type: 'bool', + }, + { + internalType: 'bool', + name: 'shouldCallBeforeRemoveLiquidity', + type: 'bool', + }, + { + internalType: 'bool', + name: 'shouldCallAfterRemoveLiquidity', + type: 'bool', + }, + ], + indexed: false, + internalType: 'struct PoolHooks', + name: 'poolHooks', + type: 'tuple', + }, + { + components: [ + { + internalType: 'bool', + name: 'disableUnbalancedLiquidity', + type: 'bool', + }, + { + internalType: 'bool', + name: 'enableAddLiquidityCustom', + type: 'bool', + }, + { + internalType: 'bool', + name: 'enableRemoveLiquidityCustom', + type: 'bool', + }, + ], + indexed: false, + internalType: 'struct LiquidityManagement', + name: 'liquidityManagement', + type: 'tuple', + }, + ], + name: 'PoolRegistered', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'contract IERC20', + name: 'token', + type: 'address', + }, + { + indexed: true, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'ProtocolFeeCollected', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'pool', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'token', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'ProtocolSwapFeeCharged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'uint256', + name: 'swapFeePercentage', + type: 'uint256', + }, + ], + name: 'ProtocolSwapFeePercentageChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'pool', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'token', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'ProtocolYieldFeeCharged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'uint256', + name: 'yieldFeePercentage', + type: 'uint256', + }, + ], + name: 'ProtocolYieldFeePercentageChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'pool', + type: 'address', + }, + { + indexed: true, + internalType: 'contract IERC20', + name: 'tokenIn', + type: 'address', + }, + { + indexed: true, + internalType: 'contract IERC20', + name: 'tokenOut', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amountIn', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amountOut', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'swapFeePercentage', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'swapFeeAmount', + type: 'uint256', + }, + { + indexed: false, + internalType: 'contract IERC20', + name: 'swapFeeToken', + type: 'address', + }, + ], + name: 'Swap', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'pool', + type: 'address', + }, + { + indexed: true, + internalType: 'uint256', + name: 'swapFeePercentage', + type: 'uint256', + }, + ], + name: 'SwapFeePercentageChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'pool', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'from', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'to', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'value', + type: 'uint256', + }, + ], + name: 'Transfer', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'bool', + name: 'paused', + type: 'bool', + }, + ], + name: 'VaultPausedStateChanged', + type: 'event', + }, + { + stateMutability: 'payable', + type: 'fallback', + }, + { + inputs: [ + { + components: [ + { + internalType: 'address', + name: 'pool', + type: 'address', + }, + { + internalType: 'address', + name: 'to', + type: 'address', + }, + { + internalType: 'uint256[]', + name: 'maxAmountsIn', + type: 'uint256[]', + }, + { + internalType: 'uint256', + name: 'minBptAmountOut', + type: 'uint256', + }, + { + internalType: 'enum AddLiquidityKind', + name: 'kind', + type: 'uint8', + }, + { + internalType: 'bytes', + name: 'userData', + type: 'bytes', + }, + ], + internalType: 'struct AddLiquidityParams', + name: 'params', + type: 'tuple', + }, + ], + name: 'addLiquidity', + outputs: [ + { + internalType: 'uint256[]', + name: 'amountsIn', + type: 'uint256[]', + }, + { + internalType: 'uint256', + name: 'bptAmountOut', + type: 'uint256', + }, + { + internalType: 'bytes', + name: 'returnData', + type: 'bytes', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'getAuthorizer', + outputs: [ + { + internalType: 'contract IAuthorizer', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'pool', + type: 'address', + }, + { + internalType: 'contract IERC20', + name: 'token', + type: 'address', + }, + ], + name: 'getPoolTokenCountAndIndexOfToken', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'getVaultExtension', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'reentrancyGuardEntered', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + components: [ + { + internalType: 'address', + name: 'pool', + type: 'address', + }, + { + internalType: 'address', + name: 'from', + type: 'address', + }, + { + internalType: 'uint256', + name: 'maxBptAmountIn', + type: 'uint256', + }, + { + internalType: 'uint256[]', + name: 'minAmountsOut', + type: 'uint256[]', + }, + { + internalType: 'enum RemoveLiquidityKind', + name: 'kind', + type: 'uint8', + }, + { + internalType: 'bytes', + name: 'userData', + type: 'bytes', + }, + ], + internalType: 'struct RemoveLiquidityParams', + name: 'params', + type: 'tuple', + }, + ], + name: 'removeLiquidity', + outputs: [ + { + internalType: 'uint256', + name: 'bptAmountIn', + type: 'uint256', + }, + { + internalType: 'uint256[]', + name: 'amountsOut', + type: 'uint256[]', + }, + { + internalType: 'bytes', + name: 'returnData', + type: 'bytes', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'contract IERC20', + name: 'token', + type: 'address', + }, + { + internalType: 'address', + name: 'to', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'sendTo', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'contract IERC20', + name: 'token', + type: 'address', + }, + ], + name: 'settle', + outputs: [ + { + internalType: 'uint256', + name: 'paid', + type: 'uint256', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + components: [ + { + internalType: 'enum SwapKind', + name: 'kind', + type: 'uint8', + }, + { + internalType: 'address', + name: 'pool', + type: 'address', + }, + { + internalType: 'contract IERC20', + name: 'tokenIn', + type: 'address', + }, + { + internalType: 'contract IERC20', + name: 'tokenOut', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amountGivenRaw', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'limitRaw', + type: 'uint256', + }, + { + internalType: 'bytes', + name: 'userData', + type: 'bytes', + }, + ], + internalType: 'struct SwapParams', + name: 'params', + type: 'tuple', + }, + ], + name: 'swap', + outputs: [ + { + internalType: 'uint256', + name: 'amountCalculated', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'amountIn', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'amountOut', + type: 'uint256', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes', + name: 'data', + type: 'bytes', + }, + ], + name: 'unlock', + outputs: [ + { + internalType: 'bytes', + name: 'result', + type: 'bytes', + }, + ], + stateMutability: 'payable', + type: 'function', + }, + { + stateMutability: 'payable', + type: 'receive', + }, // extension starts here + { + inputs: [ + { + internalType: 'contract IVault', + name: 'mainVault', + type: 'address', + }, + { + internalType: 'contract IVaultAdmin', + name: 'vaultAdmin', + type: 'address', + }, + ], + stateMutability: 'nonpayable', + type: 'constructor', + }, + { + inputs: [ + { + internalType: 'address', + name: 'target', + type: 'address', + }, + ], + name: 'AddressEmptyCode', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'account', + type: 'address', + }, + ], + name: 'AddressInsufficientBalance', + type: 'error', + }, + { + inputs: [], + name: 'AfterAddLiquidityHookFailed', + type: 'error', + }, + { + inputs: [], + name: 'AfterInitializeHookFailed', + type: 'error', + }, + { + inputs: [], + name: 'AfterRemoveLiquidityHookFailed', + type: 'error', + }, + { + inputs: [], + name: 'AfterSwapHookFailed', + type: 'error', + }, + { + inputs: [], + name: 'AmountGivenZero', + type: 'error', + }, + { + inputs: [ + { + internalType: 'contract IERC20', + name: 'token', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'limit', + type: 'uint256', + }, + ], + name: 'AmountInAboveMax', + type: 'error', + }, + { + inputs: [ + { + internalType: 'contract IERC20', + name: 'token', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'limit', + type: 'uint256', + }, + ], + name: 'AmountOutBelowMin', + type: 'error', + }, + { + inputs: [], + name: 'BalanceNotSettled', + type: 'error', + }, + { + inputs: [], + name: 'BalanceOverflow', + type: 'error', + }, + { + inputs: [], + name: 'BeforeAddLiquidityHookFailed', + type: 'error', + }, + { + inputs: [], + name: 'BeforeInitializeHookFailed', + type: 'error', + }, + { + inputs: [], + name: 'BeforeRemoveLiquidityHookFailed', + type: 'error', + }, + { + inputs: [], + name: 'BeforeSwapHookFailed', + type: 'error', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'limit', + type: 'uint256', + }, + ], + name: 'BptAmountInAboveMax', + type: 'error', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'limit', + type: 'uint256', + }, + ], + name: 'BptAmountOutBelowMin', + type: 'error', + }, + { + inputs: [], + name: 'CannotReceiveEth', + type: 'error', + }, + { + inputs: [], + name: 'CannotSwapSameToken', + type: 'error', + }, + { + inputs: [], + name: 'CodecOverflow', + type: 'error', + }, + { + inputs: [], + name: 'DoesNotSupportAddLiquidityCustom', + type: 'error', + }, + { + inputs: [], + name: 'DoesNotSupportRemoveLiquidityCustom', + type: 'error', + }, + { + inputs: [], + name: 'DoesNotSupportUnbalancedLiquidity', + type: 'error', + }, + { + inputs: [], + name: 'DynamicSwapFeeHookFailed', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'spender', + type: 'address', + }, + { + internalType: 'uint256', + name: 'allowance', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'needed', + type: 'uint256', + }, + ], + name: 'ERC20InsufficientAllowance', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'sender', + type: 'address', + }, + { + internalType: 'uint256', + name: 'balance', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'needed', + type: 'uint256', + }, + ], + name: 'ERC20InsufficientBalance', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'approver', + type: 'address', + }, + ], + name: 'ERC20InvalidApprover', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'receiver', + type: 'address', + }, + ], + name: 'ERC20InvalidReceiver', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'sender', + type: 'address', + }, + ], + name: 'ERC20InvalidSender', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'spender', + type: 'address', + }, + ], + name: 'ERC20InvalidSpender', + type: 'error', + }, + { + inputs: [], + name: 'FailedInnerCall', + type: 'error', + }, + { + inputs: [], + name: 'InputLengthMismatch', + type: 'error', + }, + { + inputs: [], + name: 'InvalidAddLiquidityKind', + type: 'error', + }, + { + inputs: [], + name: 'InvalidRemoveLiquidityKind', + type: 'error', + }, + { + inputs: [], + name: 'InvalidToken', + type: 'error', + }, + { + inputs: [], + name: 'InvalidTokenConfiguration', + type: 'error', + }, + { + inputs: [], + name: 'InvalidTokenType', + type: 'error', + }, + { + inputs: [], + name: 'MaxTokens', + type: 'error', + }, + { + inputs: [], + name: 'MinTokens', + type: 'error', + }, + { + inputs: [], + name: 'NotStaticCall', + type: 'error', + }, + { + inputs: [], + name: 'NotVaultDelegateCall', + type: 'error', + }, + { + inputs: [], + name: 'OperationNotSupported', + type: 'error', + }, + { + inputs: [], + name: 'OutOfBounds', + type: 'error', + }, + { + inputs: [], + name: 'PauseBufferPeriodDurationTooLarge', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'pool', + type: 'address', + }, + ], + name: 'PoolAlreadyInitialized', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'pool', + type: 'address', + }, + ], + name: 'PoolAlreadyRegistered', + type: 'error', + }, + { + inputs: [], + name: 'PoolCreatorFeePercentageTooHigh', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'pool', + type: 'address', + }, + ], + name: 'PoolInRecoveryMode', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'pool', + type: 'address', + }, + ], + name: 'PoolNotInRecoveryMode', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'pool', + type: 'address', + }, + ], + name: 'PoolNotInitialized', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'pool', + type: 'address', + }, + ], + name: 'PoolNotPaused', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'pool', + type: 'address', + }, + ], + name: 'PoolNotRegistered', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'pool', + type: 'address', + }, + ], + name: 'PoolPauseWindowExpired', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'pool', + type: 'address', + }, + ], + name: 'PoolPaused', + type: 'error', + }, + { + inputs: [], + name: 'ProtocolFeesExceedSwapFee', + type: 'error', + }, + { + inputs: [], + name: 'ProtocolSwapFeePercentageTooHigh', + type: 'error', + }, + { + inputs: [], + name: 'ProtocolYieldFeePercentageTooHigh', + type: 'error', + }, + { + inputs: [], + name: 'QueriesDisabled', + type: 'error', + }, + { + inputs: [], + name: 'ReentrancyGuardReentrantCall', + type: 'error', + }, + { + inputs: [], + name: 'RouterNotTrusted', + type: 'error', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'value', + type: 'uint256', + }, + ], + name: 'SafeCastOverflowedUintToInt', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'sender', + type: 'address', + }, + ], + name: 'SenderIsNotVault', + type: 'error', + }, + { + inputs: [], + name: 'SwapFeePercentageTooHigh', + type: 'error', + }, + { + inputs: [], + name: 'SwapFeePercentageTooLow', + type: 'error', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'limit', + type: 'uint256', + }, + ], + name: 'SwapLimit', + type: 'error', + }, + { + inputs: [ + { + internalType: 'contract IERC20', + name: 'token', + type: 'address', + }, + ], + name: 'TokenAlreadyRegistered', + type: 'error', + }, + { + inputs: [], + name: 'TokenNotRegistered', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'pool', + type: 'address', + }, + { + internalType: 'address', + name: 'expectedToken', + type: 'address', + }, + { + internalType: 'address', + name: 'actualToken', + type: 'address', + }, + ], + name: 'TokensMismatch', + type: 'error', + }, + { + inputs: [], + name: 'TokensNotSorted', + type: 'error', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'limit', + type: 'uint256', + }, + ], + name: 'TotalSupplyTooLow', + type: 'error', + }, + { + inputs: [], + name: 'UserDataNotSupported', + type: 'error', + }, + { + inputs: [], + name: 'VaultIsNotUnlocked', + type: 'error', + }, + { + inputs: [], + name: 'VaultNotPaused', + type: 'error', + }, + { + inputs: [], + name: 'VaultPauseWindowDurationTooLarge', + type: 'error', + }, + { + inputs: [], + name: 'VaultPauseWindowExpired', + type: 'error', + }, + { + inputs: [], + name: 'VaultPaused', + type: 'error', + }, + { + inputs: [], + name: 'WrongVaultAdminDeployment', + type: 'error', + }, + { + inputs: [], + name: 'WrongVaultExtensionDeployment', + type: 'error', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'pool', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'owner', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'spender', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'value', + type: 'uint256', + }, + ], + name: 'Approval', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'contract IAuthorizer', + name: 'newAuthorizer', + type: 'address', + }, + ], + name: 'AuthorizerChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'pool', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'liquidityProvider', + type: 'address', + }, + { + indexed: false, + internalType: 'contract IERC20[]', + name: 'tokens', + type: 'address[]', + }, + { + indexed: false, + internalType: 'int256[]', + name: 'deltas', + type: 'int256[]', + }, + ], + name: 'PoolBalanceChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'address', + name: 'pool', + type: 'address', + }, + { + indexed: true, + internalType: 'contract IERC20', + name: 'token', + type: 'address', + }, + { + indexed: true, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'PoolCreatorFeeCollected', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'pool', + type: 'address', + }, + { + indexed: true, + internalType: 'uint256', + name: 'poolCreatorFeePercentage', + type: 'uint256', + }, + ], + name: 'PoolCreatorFeePercentageChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'pool', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'token', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'PoolCreatorSwapFeeCharged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'pool', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'token', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'PoolCreatorYieldFeeCharged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'pool', + type: 'address', + }, + ], + name: 'PoolInitialized', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'pool', + type: 'address', + }, + { + indexed: false, + internalType: 'bool', + name: 'paused', + type: 'bool', + }, + ], + name: 'PoolPausedStateChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'pool', + type: 'address', + }, + { + indexed: false, + internalType: 'bool', + name: 'recoveryMode', + type: 'bool', + }, + ], + name: 'PoolRecoveryModeStateChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'pool', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'factory', + type: 'address', + }, + { + components: [ + { + internalType: 'contract IERC20', + name: 'token', + type: 'address', + }, + { + internalType: 'enum TokenType', + name: 'tokenType', + type: 'uint8', + }, + { + internalType: 'contract IRateProvider', + name: 'rateProvider', + type: 'address', + }, + { + internalType: 'bool', + name: 'paysYieldFees', + type: 'bool', + }, + ], + indexed: false, + internalType: 'struct TokenConfig[]', + name: 'tokenConfig', + type: 'tuple[]', + }, + { + indexed: false, + internalType: 'uint256', + name: 'pauseWindowEndTime', + type: 'uint256', + }, + { + components: [ + { + internalType: 'address', + name: 'pauseManager', + type: 'address', + }, + { + internalType: 'address', + name: 'swapFeeManager', + type: 'address', + }, + { + internalType: 'address', + name: 'poolCreator', + type: 'address', + }, + ], + indexed: false, + internalType: 'struct PoolRoleAccounts', + name: 'roleAccounts', + type: 'tuple', + }, + { + components: [ + { + internalType: 'bool', + name: 'shouldCallBeforeInitialize', + type: 'bool', + }, + { + internalType: 'bool', + name: 'shouldCallAfterInitialize', + type: 'bool', + }, + { + internalType: 'bool', + name: 'shouldCallComputeDynamicSwapFee', + type: 'bool', + }, + { + internalType: 'bool', + name: 'shouldCallBeforeSwap', + type: 'bool', + }, + { + internalType: 'bool', + name: 'shouldCallAfterSwap', + type: 'bool', + }, + { + internalType: 'bool', + name: 'shouldCallBeforeAddLiquidity', + type: 'bool', + }, + { + internalType: 'bool', + name: 'shouldCallAfterAddLiquidity', + type: 'bool', + }, + { + internalType: 'bool', + name: 'shouldCallBeforeRemoveLiquidity', + type: 'bool', + }, + { + internalType: 'bool', + name: 'shouldCallAfterRemoveLiquidity', + type: 'bool', + }, + ], + indexed: false, + internalType: 'struct PoolHooks', + name: 'poolHooks', + type: 'tuple', + }, + { + components: [ + { + internalType: 'bool', + name: 'disableUnbalancedLiquidity', + type: 'bool', + }, + { + internalType: 'bool', + name: 'enableAddLiquidityCustom', + type: 'bool', + }, + { + internalType: 'bool', + name: 'enableRemoveLiquidityCustom', + type: 'bool', + }, + ], + indexed: false, + internalType: 'struct LiquidityManagement', + name: 'liquidityManagement', + type: 'tuple', + }, + ], + name: 'PoolRegistered', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'contract IERC20', + name: 'token', + type: 'address', + }, + { + indexed: true, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'ProtocolFeeCollected', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'pool', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'token', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'ProtocolSwapFeeCharged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'uint256', + name: 'swapFeePercentage', + type: 'uint256', + }, + ], + name: 'ProtocolSwapFeePercentageChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'pool', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'token', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'ProtocolYieldFeeCharged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'uint256', + name: 'yieldFeePercentage', + type: 'uint256', + }, + ], + name: 'ProtocolYieldFeePercentageChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'pool', + type: 'address', + }, + { + indexed: true, + internalType: 'uint256', + name: 'swapFeePercentage', + type: 'uint256', + }, + ], + name: 'SwapFeePercentageChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'pool', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'from', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'to', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'value', + type: 'uint256', + }, + ], + name: 'Transfer', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'bool', + name: 'paused', + type: 'bool', + }, + ], + name: 'VaultPausedStateChanged', + type: 'event', + }, + { + stateMutability: 'payable', + type: 'fallback', + }, + { + inputs: [ + { + internalType: 'address', + name: 'token', + type: 'address', + }, + { + internalType: 'address', + name: 'owner', + type: 'address', + }, + { + internalType: 'address', + name: 'spender', + type: 'address', + }, + ], + name: 'allowance', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'owner', + type: 'address', + }, + { + internalType: 'address', + name: 'spender', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'approve', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'token', + type: 'address', + }, + { + internalType: 'address', + name: 'account', + type: 'address', + }, + ], + name: 'balanceOf', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'pool', + type: 'address', + }, + { + components: [ + { + internalType: 'enum SwapKind', + name: 'kind', + type: 'uint8', + }, + { + internalType: 'uint256', + name: 'amountGivenScaled18', + type: 'uint256', + }, + { + internalType: 'uint256[]', + name: 'balancesScaled18', + type: 'uint256[]', + }, + { + internalType: 'uint256', + name: 'indexIn', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'indexOut', + type: 'uint256', + }, + { + internalType: 'address', + name: 'sender', + type: 'address', + }, + { + internalType: 'bytes', + name: 'userData', + type: 'bytes', + }, + ], + internalType: 'struct IBasePool.PoolSwapParams', + name: 'swapParams', + type: 'tuple', + }, + ], + name: 'computeDynamicSwapFee', + outputs: [ + { + internalType: 'bool', + name: 'success', + type: 'bool', + }, + { + internalType: 'uint256', + name: 'dynamicSwapFee', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'getNonzeroDeltaCount', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'pool', + type: 'address', + }, + ], + name: 'getPoolConfig', + outputs: [ + { + components: [ + { + components: [ + { + internalType: 'bool', + name: 'shouldCallBeforeInitialize', + type: 'bool', + }, + { + internalType: 'bool', + name: 'shouldCallAfterInitialize', + type: 'bool', + }, + { + internalType: 'bool', + name: 'shouldCallComputeDynamicSwapFee', + type: 'bool', + }, + { + internalType: 'bool', + name: 'shouldCallBeforeSwap', + type: 'bool', + }, + { + internalType: 'bool', + name: 'shouldCallAfterSwap', + type: 'bool', + }, + { + internalType: 'bool', + name: 'shouldCallBeforeAddLiquidity', + type: 'bool', + }, + { + internalType: 'bool', + name: 'shouldCallAfterAddLiquidity', + type: 'bool', + }, + { + internalType: 'bool', + name: 'shouldCallBeforeRemoveLiquidity', + type: 'bool', + }, + { + internalType: 'bool', + name: 'shouldCallAfterRemoveLiquidity', + type: 'bool', + }, + ], + internalType: 'struct PoolHooks', + name: 'hooks', + type: 'tuple', + }, + { + components: [ + { + internalType: 'bool', + name: 'disableUnbalancedLiquidity', + type: 'bool', + }, + { + internalType: 'bool', + name: 'enableAddLiquidityCustom', + type: 'bool', + }, + { + internalType: 'bool', + name: 'enableRemoveLiquidityCustom', + type: 'bool', + }, + ], + internalType: 'struct LiquidityManagement', + name: 'liquidityManagement', + type: 'tuple', + }, + { + internalType: 'uint256', + name: 'staticSwapFeePercentage', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'poolCreatorFeePercentage', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'tokenDecimalDiffs', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'pauseWindowEndTime', + type: 'uint256', + }, + { + internalType: 'bool', + name: 'isPoolRegistered', + type: 'bool', + }, + { + internalType: 'bool', + name: 'isPoolInitialized', + type: 'bool', + }, + { + internalType: 'bool', + name: 'isPoolPaused', + type: 'bool', + }, + { + internalType: 'bool', + name: 'isPoolInRecoveryMode', + type: 'bool', + }, + ], + internalType: 'struct PoolConfig', + name: '', + type: 'tuple', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'pool', + type: 'address', + }, + ], + name: 'getPoolCreator', + outputs: [ + { + internalType: 'address', + name: 'poolCreator', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'pool', + type: 'address', + }, + { + internalType: 'contract IERC20', + name: 'token', + type: 'address', + }, + ], + name: 'getPoolCreatorFees', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'pool', + type: 'address', + }, + ], + name: 'getPoolPausedState', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'pool', + type: 'address', + }, + ], + name: 'getPoolTokenInfo', + outputs: [ + { + components: [ + { + internalType: 'contract IERC20', + name: 'token', + type: 'address', + }, + { + internalType: 'enum TokenType', + name: 'tokenType', + type: 'uint8', + }, + { + internalType: 'contract IRateProvider', + name: 'rateProvider', + type: 'address', + }, + { + internalType: 'bool', + name: 'paysYieldFees', + type: 'bool', + }, + ], + internalType: 'struct TokenConfig[]', + name: 'tokenConfig', + type: 'tuple[]', + }, + { + internalType: 'uint256[]', + name: 'balancesRaw', + type: 'uint256[]', + }, + { + internalType: 'uint256[]', + name: 'decimalScalingFactors', + type: 'uint256[]', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'pool', + type: 'address', + }, + ], + name: 'getPoolTokens', + outputs: [ + { + internalType: 'contract IERC20[]', + name: '', + type: 'address[]', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'token', + type: 'address', + }, + ], + name: 'getProtocolFees', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'getProtocolSwapFeePercentage', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'getProtocolYieldFeePercentage', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'contract IERC20', + name: 'token', + type: 'address', + }, + ], + name: 'getReservesOf', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'pool', + type: 'address', + }, + ], + name: 'getStaticSwapFeeManager', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'pool', + type: 'address', + }, + ], + name: 'getStaticSwapFeePercentage', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'contract IERC20', + name: 'token', + type: 'address', + }, + ], + name: 'getTokenDelta', + outputs: [ + { + internalType: 'int256', + name: '', + type: 'int256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'getVaultAdmin', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'pool', + type: 'address', + }, + { + internalType: 'address', + name: 'to', + type: 'address', + }, + { + internalType: 'contract IERC20[]', + name: 'tokens', + type: 'address[]', + }, + { + internalType: 'uint256[]', + name: 'exactAmountsIn', + type: 'uint256[]', + }, + { + internalType: 'uint256', + name: 'minBptAmountOut', + type: 'uint256', + }, + { + internalType: 'bytes', + name: 'userData', + type: 'bytes', + }, + ], + name: 'initialize', + outputs: [ + { + internalType: 'uint256', + name: 'bptAmountOut', + type: 'uint256', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'pool', + type: 'address', + }, + ], + name: 'isPoolInRecoveryMode', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'pool', + type: 'address', + }, + ], + name: 'isPoolInitialized', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'pool', + type: 'address', + }, + ], + name: 'isPoolPaused', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'pool', + type: 'address', + }, + ], + name: 'isPoolRegistered', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'isQueryDisabled', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'isUnlocked', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes', + name: 'data', + type: 'bytes', + }, + ], + name: 'quote', + outputs: [ + { + internalType: 'bytes', + name: 'result', + type: 'bytes', + }, + ], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [], + name: 'reentrancyGuardEntered', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'pool', + type: 'address', + }, + { + components: [ + { + internalType: 'contract IERC20', + name: 'token', + type: 'address', + }, + { + internalType: 'enum TokenType', + name: 'tokenType', + type: 'uint8', + }, + { + internalType: 'contract IRateProvider', + name: 'rateProvider', + type: 'address', + }, + { + internalType: 'bool', + name: 'paysYieldFees', + type: 'bool', + }, + ], + internalType: 'struct TokenConfig[]', + name: 'tokenConfig', + type: 'tuple[]', + }, + { + internalType: 'uint256', + name: 'swapFeePercentage', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'pauseWindowEndTime', + type: 'uint256', + }, + { + components: [ + { + internalType: 'address', + name: 'pauseManager', + type: 'address', + }, + { + internalType: 'address', + name: 'swapFeeManager', + type: 'address', + }, + { + internalType: 'address', + name: 'poolCreator', + type: 'address', + }, + ], + internalType: 'struct PoolRoleAccounts', + name: 'roleAccounts', + type: 'tuple', + }, + { + components: [ + { + internalType: 'bool', + name: 'shouldCallBeforeInitialize', + type: 'bool', + }, + { + internalType: 'bool', + name: 'shouldCallAfterInitialize', + type: 'bool', + }, + { + internalType: 'bool', + name: 'shouldCallComputeDynamicSwapFee', + type: 'bool', + }, + { + internalType: 'bool', + name: 'shouldCallBeforeSwap', + type: 'bool', + }, + { + internalType: 'bool', + name: 'shouldCallAfterSwap', + type: 'bool', + }, + { + internalType: 'bool', + name: 'shouldCallBeforeAddLiquidity', + type: 'bool', + }, + { + internalType: 'bool', + name: 'shouldCallAfterAddLiquidity', + type: 'bool', + }, + { + internalType: 'bool', + name: 'shouldCallBeforeRemoveLiquidity', + type: 'bool', + }, + { + internalType: 'bool', + name: 'shouldCallAfterRemoveLiquidity', + type: 'bool', + }, + ], + internalType: 'struct PoolHooks', + name: 'poolHooks', + type: 'tuple', + }, + { + components: [ + { + internalType: 'bool', + name: 'disableUnbalancedLiquidity', + type: 'bool', + }, + { + internalType: 'bool', + name: 'enableAddLiquidityCustom', + type: 'bool', + }, + { + internalType: 'bool', + name: 'enableRemoveLiquidityCustom', + type: 'bool', + }, + ], + internalType: 'struct LiquidityManagement', + name: 'liquidityManagement', + type: 'tuple', + }, + ], + name: 'registerPool', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'pool', + type: 'address', + }, + { + internalType: 'address', + name: 'from', + type: 'address', + }, + { + internalType: 'uint256', + name: 'exactBptAmountIn', + type: 'uint256', + }, + ], + name: 'removeLiquidityRecovery', + outputs: [ + { + internalType: 'uint256[]', + name: 'amountsOutRaw', + type: 'uint256[]', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'token', + type: 'address', + }, + ], + name: 'totalSupply', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'owner', + type: 'address', + }, + { + internalType: 'address', + name: 'to', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'transfer', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'spender', + type: 'address', + }, + { + internalType: 'address', + name: 'from', + type: 'address', + }, + { + internalType: 'address', + name: 'to', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'transferFrom', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'vault', + outputs: [ + { + internalType: 'contract IVault', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + stateMutability: 'payable', + type: 'receive', + }, ] as const; diff --git a/src/abi/vaultV3Extension.ts b/src/abi/vaultV3Extension.ts deleted file mode 100644 index fc0c7b02..00000000 --- a/src/abi/vaultV3Extension.ts +++ /dev/null @@ -1,1960 +0,0 @@ -export const vaultV3ExtensionAbi = [ - { - inputs: [ - { - internalType: 'contract IVault', - name: 'mainVault', - type: 'address', - }, - { - internalType: 'contract IVaultAdmin', - name: 'vaultAdmin', - type: 'address', - }, - ], - stateMutability: 'nonpayable', - type: 'constructor', - }, - { - inputs: [ - { - internalType: 'address', - name: 'target', - type: 'address', - }, - ], - name: 'AddressEmptyCode', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'account', - type: 'address', - }, - ], - name: 'AddressInsufficientBalance', - type: 'error', - }, - { - inputs: [], - name: 'AfterAddLiquidityHookFailed', - type: 'error', - }, - { - inputs: [], - name: 'AfterInitializeHookFailed', - type: 'error', - }, - { - inputs: [], - name: 'AfterRemoveLiquidityHookFailed', - type: 'error', - }, - { - inputs: [], - name: 'AfterSwapHookFailed', - type: 'error', - }, - { - inputs: [], - name: 'AmountGivenZero', - type: 'error', - }, - { - inputs: [ - { - internalType: 'contract IERC20', - name: 'token', - type: 'address', - }, - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'limit', - type: 'uint256', - }, - ], - name: 'AmountInAboveMax', - type: 'error', - }, - { - inputs: [ - { - internalType: 'contract IERC20', - name: 'token', - type: 'address', - }, - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'limit', - type: 'uint256', - }, - ], - name: 'AmountOutBelowMin', - type: 'error', - }, - { - inputs: [], - name: 'BalanceNotSettled', - type: 'error', - }, - { - inputs: [], - name: 'BalanceOverflow', - type: 'error', - }, - { - inputs: [], - name: 'BeforeAddLiquidityHookFailed', - type: 'error', - }, - { - inputs: [], - name: 'BeforeInitializeHookFailed', - type: 'error', - }, - { - inputs: [], - name: 'BeforeRemoveLiquidityHookFailed', - type: 'error', - }, - { - inputs: [], - name: 'BeforeSwapHookFailed', - type: 'error', - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'limit', - type: 'uint256', - }, - ], - name: 'BptAmountInAboveMax', - type: 'error', - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'limit', - type: 'uint256', - }, - ], - name: 'BptAmountOutBelowMin', - type: 'error', - }, - { - inputs: [], - name: 'CannotReceiveEth', - type: 'error', - }, - { - inputs: [], - name: 'CannotSwapSameToken', - type: 'error', - }, - { - inputs: [], - name: 'CodecOverflow', - type: 'error', - }, - { - inputs: [], - name: 'DoesNotSupportAddLiquidityCustom', - type: 'error', - }, - { - inputs: [], - name: 'DoesNotSupportRemoveLiquidityCustom', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'spender', - type: 'address', - }, - { - internalType: 'uint256', - name: 'allowance', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'needed', - type: 'uint256', - }, - ], - name: 'ERC20InsufficientAllowance', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'sender', - type: 'address', - }, - { - internalType: 'uint256', - name: 'balance', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'needed', - type: 'uint256', - }, - ], - name: 'ERC20InsufficientBalance', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'approver', - type: 'address', - }, - ], - name: 'ERC20InvalidApprover', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'receiver', - type: 'address', - }, - ], - name: 'ERC20InvalidReceiver', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'sender', - type: 'address', - }, - ], - name: 'ERC20InvalidSender', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'spender', - type: 'address', - }, - ], - name: 'ERC20InvalidSpender', - type: 'error', - }, - { - inputs: [], - name: 'FailedInnerCall', - type: 'error', - }, - { - inputs: [], - name: 'InputLengthMismatch', - type: 'error', - }, - { - inputs: [], - name: 'InvalidAddLiquidityKind', - type: 'error', - }, - { - inputs: [], - name: 'InvalidRemoveLiquidityKind', - type: 'error', - }, - { - inputs: [], - name: 'InvalidToken', - type: 'error', - }, - { - inputs: [], - name: 'InvalidTokenConfiguration', - type: 'error', - }, - { - inputs: [], - name: 'InvalidTokenType', - type: 'error', - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'index', - type: 'uint256', - }, - ], - name: 'LockerOutOfBounds', - type: 'error', - }, - { - inputs: [], - name: 'MaxTokens', - type: 'error', - }, - { - inputs: [], - name: 'MinTokens', - type: 'error', - }, - { - inputs: [], - name: 'NoLocker', - type: 'error', - }, - { - inputs: [], - name: 'NotStaticCall', - type: 'error', - }, - { - inputs: [], - name: 'NotVaultDelegateCall', - type: 'error', - }, - { - inputs: [], - name: 'OperationNotSupported', - type: 'error', - }, - { - inputs: [], - name: 'OutOfBounds', - type: 'error', - }, - { - inputs: [], - name: 'PauseBufferPeriodDurationTooLarge', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - ], - name: 'PoolAlreadyInitialized', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - ], - name: 'PoolAlreadyRegistered', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - ], - name: 'PoolInRecoveryMode', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - ], - name: 'PoolNotInRecoveryMode', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - ], - name: 'PoolNotInitialized', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - ], - name: 'PoolNotPaused', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - ], - name: 'PoolNotRegistered', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - ], - name: 'PoolPauseWindowExpired', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - ], - name: 'PoolPaused', - type: 'error', - }, - { - inputs: [], - name: 'ProtocolSwapFeePercentageTooHigh', - type: 'error', - }, - { - inputs: [], - name: 'ProtocolYieldFeePercentageTooHigh', - type: 'error', - }, - { - inputs: [], - name: 'QueriesDisabled', - type: 'error', - }, - { - inputs: [], - name: 'ReentrancyGuardReentrantCall', - type: 'error', - }, - { - inputs: [], - name: 'RouterNotTrusted', - type: 'error', - }, - { - inputs: [ - { - internalType: 'uint8', - name: 'bits', - type: 'uint8', - }, - { - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - ], - name: 'SafeCastOverflowedUintDowncast', - type: 'error', - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - ], - name: 'SafeCastOverflowedUintToInt', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - ], - name: 'SenderIsNotPauseManager', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'sender', - type: 'address', - }, - ], - name: 'SenderIsNotVault', - type: 'error', - }, - { - inputs: [], - name: 'SwapFeePercentageTooHigh', - type: 'error', - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'limit', - type: 'uint256', - }, - ], - name: 'SwapLimit', - type: 'error', - }, - { - inputs: [ - { - internalType: 'contract IERC20', - name: 'token', - type: 'address', - }, - ], - name: 'TokenAlreadyRegistered', - type: 'error', - }, - { - inputs: [], - name: 'TokenNotRegistered', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - { - internalType: 'address', - name: 'expectedToken', - type: 'address', - }, - { - internalType: 'address', - name: 'actualToken', - type: 'address', - }, - ], - name: 'TokensMismatch', - type: 'error', - }, - { - inputs: [], - name: 'TokensNotSorted', - type: 'error', - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'limit', - type: 'uint256', - }, - ], - name: 'TotalSupplyTooLow', - type: 'error', - }, - { - inputs: [], - name: 'UserDataNotSupported', - type: 'error', - }, - { - inputs: [], - name: 'VaultNotPaused', - type: 'error', - }, - { - inputs: [], - name: 'VaultPauseWindowDurationTooLarge', - type: 'error', - }, - { - inputs: [], - name: 'VaultPauseWindowExpired', - type: 'error', - }, - { - inputs: [], - name: 'VaultPaused', - type: 'error', - }, - { - inputs: [ - { - internalType: 'address', - name: 'locker', - type: 'address', - }, - { - internalType: 'address', - name: 'caller', - type: 'address', - }, - ], - name: 'WrongLocker', - type: 'error', - }, - { - inputs: [], - name: 'WrongVaultAdminDeployment', - type: 'error', - }, - { - inputs: [], - name: 'WrongVaultExtensionDeployment', - type: 'error', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'pool', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'owner', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'spender', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - ], - name: 'Approval', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'contract IAuthorizer', - name: 'newAuthorizer', - type: 'address', - }, - ], - name: 'AuthorizerChanged', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'pool', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'liquidityProvider', - type: 'address', - }, - { - indexed: false, - internalType: 'contract IERC20[]', - name: 'tokens', - type: 'address[]', - }, - { - indexed: false, - internalType: 'int256[]', - name: 'deltas', - type: 'int256[]', - }, - ], - name: 'PoolBalanceChanged', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'pool', - type: 'address', - }, - ], - name: 'PoolInitialized', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'pool', - type: 'address', - }, - { - indexed: false, - internalType: 'bool', - name: 'paused', - type: 'bool', - }, - ], - name: 'PoolPausedStateChanged', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'pool', - type: 'address', - }, - { - indexed: false, - internalType: 'bool', - name: 'recoveryMode', - type: 'bool', - }, - ], - name: 'PoolRecoveryModeStateChanged', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'pool', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'factory', - type: 'address', - }, - { - components: [ - { - internalType: 'contract IERC20', - name: 'token', - type: 'address', - }, - { - internalType: 'enum TokenType', - name: 'tokenType', - type: 'uint8', - }, - { - internalType: 'contract IRateProvider', - name: 'rateProvider', - type: 'address', - }, - { - internalType: 'bool', - name: 'yieldFeeExempt', - type: 'bool', - }, - ], - indexed: false, - internalType: 'struct TokenConfig[]', - name: 'tokenConfig', - type: 'tuple[]', - }, - { - indexed: false, - internalType: 'uint256', - name: 'pauseWindowEndTime', - type: 'uint256', - }, - { - indexed: false, - internalType: 'address', - name: 'pauseManager', - type: 'address', - }, - { - components: [ - { - internalType: 'bool', - name: 'shouldCallBeforeInitialize', - type: 'bool', - }, - { - internalType: 'bool', - name: 'shouldCallAfterInitialize', - type: 'bool', - }, - { - internalType: 'bool', - name: 'shouldCallBeforeSwap', - type: 'bool', - }, - { - internalType: 'bool', - name: 'shouldCallAfterSwap', - type: 'bool', - }, - { - internalType: 'bool', - name: 'shouldCallBeforeAddLiquidity', - type: 'bool', - }, - { - internalType: 'bool', - name: 'shouldCallAfterAddLiquidity', - type: 'bool', - }, - { - internalType: 'bool', - name: 'shouldCallBeforeRemoveLiquidity', - type: 'bool', - }, - { - internalType: 'bool', - name: 'shouldCallAfterRemoveLiquidity', - type: 'bool', - }, - ], - indexed: false, - internalType: 'struct PoolHooks', - name: 'hooks', - type: 'tuple', - }, - { - components: [ - { - internalType: 'bool', - name: 'supportsAddLiquidityCustom', - type: 'bool', - }, - { - internalType: 'bool', - name: 'supportsRemoveLiquidityCustom', - type: 'bool', - }, - ], - indexed: false, - internalType: 'struct LiquidityManagement', - name: 'liquidityManagement', - type: 'tuple', - }, - ], - name: 'PoolRegistered', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'contract IERC20', - name: 'token', - type: 'address', - }, - { - indexed: true, - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'ProtocolFeeCollected', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'pool', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'token', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'ProtocolSwapFeeCharged', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'uint256', - name: 'swapFeePercentage', - type: 'uint256', - }, - ], - name: 'ProtocolSwapFeePercentageChanged', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'pool', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'token', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'ProtocolYieldFeeCharged', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'uint256', - name: 'yieldFeePercentage', - type: 'uint256', - }, - ], - name: 'ProtocolYieldFeePercentageChanged', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'pool', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'from', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'to', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - ], - name: 'Transfer', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'bool', - name: 'paused', - type: 'bool', - }, - ], - name: 'VaultPausedStateChanged', - type: 'event', - }, - { - stateMutability: 'payable', - type: 'fallback', - }, - { - inputs: [], - name: 'MAX_BUFFER_PERIOD_DURATION', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'MAX_PAUSE_WINDOW_DURATION', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'token', - type: 'address', - }, - { - internalType: 'address', - name: 'owner', - type: 'address', - }, - { - internalType: 'address', - name: 'spender', - type: 'address', - }, - ], - name: 'allowance', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'owner', - type: 'address', - }, - { - internalType: 'address', - name: 'spender', - type: 'address', - }, - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'approve', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - ], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'token', - type: 'address', - }, - { - internalType: 'address', - name: 'account', - type: 'address', - }, - ], - name: 'balanceOf', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'index', - type: 'uint256', - }, - ], - name: 'getLocker', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'getLockersCount', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'getNonzeroDeltaCount', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - ], - name: 'getPoolConfig', - outputs: [ - { - components: [ - { - internalType: 'bool', - name: 'isPoolRegistered', - type: 'bool', - }, - { - internalType: 'bool', - name: 'isPoolInitialized', - type: 'bool', - }, - { - internalType: 'bool', - name: 'isPoolPaused', - type: 'bool', - }, - { - internalType: 'bool', - name: 'isPoolInRecoveryMode', - type: 'bool', - }, - { - internalType: 'bool', - name: 'hasDynamicSwapFee', - type: 'bool', - }, - { - internalType: 'uint256', - name: 'staticSwapFeePercentage', - type: 'uint256', - }, - { - internalType: 'uint24', - name: 'tokenDecimalDiffs', - type: 'uint24', - }, - { - internalType: 'uint32', - name: 'pauseWindowEndTime', - type: 'uint32', - }, - { - components: [ - { - internalType: 'bool', - name: 'shouldCallBeforeInitialize', - type: 'bool', - }, - { - internalType: 'bool', - name: 'shouldCallAfterInitialize', - type: 'bool', - }, - { - internalType: 'bool', - name: 'shouldCallBeforeSwap', - type: 'bool', - }, - { - internalType: 'bool', - name: 'shouldCallAfterSwap', - type: 'bool', - }, - { - internalType: 'bool', - name: 'shouldCallBeforeAddLiquidity', - type: 'bool', - }, - { - internalType: 'bool', - name: 'shouldCallAfterAddLiquidity', - type: 'bool', - }, - { - internalType: 'bool', - name: 'shouldCallBeforeRemoveLiquidity', - type: 'bool', - }, - { - internalType: 'bool', - name: 'shouldCallAfterRemoveLiquidity', - type: 'bool', - }, - ], - internalType: 'struct PoolHooks', - name: 'hooks', - type: 'tuple', - }, - { - components: [ - { - internalType: 'bool', - name: 'supportsAddLiquidityCustom', - type: 'bool', - }, - { - internalType: 'bool', - name: 'supportsRemoveLiquidityCustom', - type: 'bool', - }, - ], - internalType: 'struct LiquidityManagement', - name: 'liquidityManagement', - type: 'tuple', - }, - ], - internalType: 'struct PoolConfig', - name: '', - type: 'tuple', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - ], - name: 'getPoolPausedState', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - ], - name: 'getPoolTokenInfo', - outputs: [ - { - internalType: 'contract IERC20[]', - name: 'tokens', - type: 'address[]', - }, - { - internalType: 'enum TokenType[]', - name: 'tokenTypes', - type: 'uint8[]', - }, - { - internalType: 'uint256[]', - name: 'balancesRaw', - type: 'uint256[]', - }, - { - internalType: 'uint256[]', - name: 'decimalScalingFactors', - type: 'uint256[]', - }, - { - internalType: 'contract IRateProvider[]', - name: 'rateProviders', - type: 'address[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - ], - name: 'getPoolTokens', - outputs: [ - { - internalType: 'contract IERC20[]', - name: '', - type: 'address[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'token', - type: 'address', - }, - ], - name: 'getProtocolFees', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'getProtocolSwapFeePercentage', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'getProtocolYieldFeePercentage', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'contract IERC20', - name: 'token', - type: 'address', - }, - ], - name: 'getReservesOf', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - ], - name: 'getStaticSwapFeePercentage', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'user', - type: 'address', - }, - { - internalType: 'contract IERC20', - name: 'token', - type: 'address', - }, - ], - name: 'getTokenDelta', - outputs: [ - { - internalType: 'int256', - name: '', - type: 'int256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'getVaultAdmin', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - { - internalType: 'address', - name: 'to', - type: 'address', - }, - { - internalType: 'contract IERC20[]', - name: 'tokens', - type: 'address[]', - }, - { - internalType: 'uint256[]', - name: 'exactAmountsIn', - type: 'uint256[]', - }, - { - internalType: 'uint256', - name: 'minBptAmountOut', - type: 'uint256', - }, - { - internalType: 'bytes', - name: 'userData', - type: 'bytes', - }, - ], - name: 'initialize', - outputs: [ - { - internalType: 'uint256', - name: 'bptAmountOut', - type: 'uint256', - }, - ], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - ], - name: 'isPoolInRecoveryMode', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - ], - name: 'isPoolInitialized', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - ], - name: 'isPoolPaused', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - ], - name: 'isPoolRegistered', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'isQueryDisabled', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'bytes', - name: 'data', - type: 'bytes', - }, - ], - name: 'quote', - outputs: [ - { - internalType: 'bytes', - name: 'result', - type: 'bytes', - }, - ], - stateMutability: 'payable', - type: 'function', - }, - { - inputs: [], - name: 'reentrancyGuardEntered', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - { - components: [ - { - internalType: 'contract IERC20', - name: 'token', - type: 'address', - }, - { - internalType: 'enum TokenType', - name: 'tokenType', - type: 'uint8', - }, - { - internalType: 'contract IRateProvider', - name: 'rateProvider', - type: 'address', - }, - { - internalType: 'bool', - name: 'yieldFeeExempt', - type: 'bool', - }, - ], - internalType: 'struct TokenConfig[]', - name: 'tokenConfig', - type: 'tuple[]', - }, - { - internalType: 'uint256', - name: 'pauseWindowEndTime', - type: 'uint256', - }, - { - internalType: 'address', - name: 'pauseManager', - type: 'address', - }, - { - components: [ - { - internalType: 'bool', - name: 'shouldCallBeforeInitialize', - type: 'bool', - }, - { - internalType: 'bool', - name: 'shouldCallAfterInitialize', - type: 'bool', - }, - { - internalType: 'bool', - name: 'shouldCallBeforeSwap', - type: 'bool', - }, - { - internalType: 'bool', - name: 'shouldCallAfterSwap', - type: 'bool', - }, - { - internalType: 'bool', - name: 'shouldCallBeforeAddLiquidity', - type: 'bool', - }, - { - internalType: 'bool', - name: 'shouldCallAfterAddLiquidity', - type: 'bool', - }, - { - internalType: 'bool', - name: 'shouldCallBeforeRemoveLiquidity', - type: 'bool', - }, - { - internalType: 'bool', - name: 'shouldCallAfterRemoveLiquidity', - type: 'bool', - }, - ], - internalType: 'struct PoolHooks', - name: 'poolHooks', - type: 'tuple', - }, - { - components: [ - { - internalType: 'bool', - name: 'supportsAddLiquidityCustom', - type: 'bool', - }, - { - internalType: 'bool', - name: 'supportsRemoveLiquidityCustom', - type: 'bool', - }, - ], - internalType: 'struct LiquidityManagement', - name: 'liquidityManagement', - type: 'tuple', - }, - ], - name: 'registerPool', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'pool', - type: 'address', - }, - { - internalType: 'address', - name: 'from', - type: 'address', - }, - { - internalType: 'uint256', - name: 'exactBptAmountIn', - type: 'uint256', - }, - ], - name: 'removeLiquidityRecovery', - outputs: [ - { - internalType: 'uint256[]', - name: 'amountsOutRaw', - type: 'uint256[]', - }, - ], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'token', - type: 'address', - }, - ], - name: 'totalSupply', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'owner', - type: 'address', - }, - { - internalType: 'address', - name: 'to', - type: 'address', - }, - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'transfer', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - ], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'spender', - type: 'address', - }, - { - internalType: 'address', - name: 'from', - type: 'address', - }, - { - internalType: 'address', - name: 'to', - type: 'address', - }, - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'transferFrom', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - ], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'vault', - outputs: [ - { - internalType: 'contract IVault', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - stateMutability: 'payable', - type: 'receive', - }, -] as const; diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 96d5aa1b..c5945b1e 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -160,7 +160,7 @@ export const VAULT: Record = { }; export const VAULT_V3: Record = { - [ChainId.SEPOLIA]: '0x1FC7F1F84CFE61a04224AC8D3F87f56214FeC08c', + [ChainId.SEPOLIA]: '0x89aa28a8D2B327cD9dB4aDc0f259D757F000AE66', }; export const BALANCER_QUERIES: Record = { @@ -200,13 +200,21 @@ export const COMPOSABLE_STABLE_POOL_FACTORY: Record = { }; export const BALANCER_ROUTER: Record = { - [ChainId.SEPOLIA]: '0xA0De078cd5cFa7088821B83e0bD7545ccfb7c883', + [ChainId.SEPOLIA]: '0xa59F164d6cf6ee5d63580C0bcEA5CCB2e50b908c', }; export const BALANCER_BATCH_ROUTER: Record = { - [ChainId.SEPOLIA]: '0x8A8B9f35765899B3a0291700141470D79EA2eA88', + [ChainId.SEPOLIA]: '0x0252Cdbd41114e657945772d02cB1eE8008E9E1D', }; +export const PERMIT2: Record = { + [ChainId.SEPOLIA]: '0x000000000022D473030F116dDEE9F6B43aC78BA3', +}; + +/** + * Native Assets + */ + export const NATIVE_ASSETS = { [ChainId.MAINNET]: new Token( ChainId.MAINNET, diff --git a/test/anvil/anvil-global-setup.ts b/test/anvil/anvil-global-setup.ts index 4b8e8732..e4f62a08 100644 --- a/test/anvil/anvil-global-setup.ts +++ b/test/anvil/anvil-global-setup.ts @@ -52,7 +52,7 @@ export const ANVIL_NETWORKS: Record = { rpcEnv: 'SEPOLIA_RPC_URL', fallBackRpc: 'https://sepolia.gateway.tenderly.co', port: ANVIL_PORTS.SEPOLIA, - forkBlockNumber: 5769940n, + forkBlockNumber: 5970070n, }, OPTIMISM: { rpcEnv: 'OPTIMISM_RPC_URL', diff --git a/test/entities/swapV3.integration.test.ts b/test/entities/swapV3.integration.test.ts index dea3bd6f..8c3162c7 100644 --- a/test/entities/swapV3.integration.test.ts +++ b/test/entities/swapV3.integration.test.ts @@ -94,7 +94,7 @@ describe('SwapV3', () => { decimals: TOKENS[chainId].WETH.decimals, }, ], - pools: [POOLS[chainId].MOCK_WEIGHTED_POOL.id], + pools: [POOLS[chainId].MOCK_WETH_BAL_POOL.id], inputAmountRaw: 100000000000n, outputAmountRaw: 100000000000n, }; @@ -274,7 +274,7 @@ describe('SwapV3', () => { }, ], pools: [ - POOLS[chainId].MOCK_WEIGHTED_POOL.id, + POOLS[chainId].MOCK_WETH_BAL_POOL.id, POOLS[chainId].MOCK_BAL_DAI_POOL.id, POOLS[chainId].MOCK_USDC_DAI_POOL.id, ], diff --git a/test/lib/utils/addresses.ts b/test/lib/utils/addresses.ts index bd77197b..2ba17f7b 100644 --- a/test/lib/utils/addresses.ts +++ b/test/lib/utils/addresses.ts @@ -204,30 +204,30 @@ export const POOLS: Record> = { }, }, [ChainId.SEPOLIA]: { - MOCK_WEIGHTED_POOL: { - address: '0x204d4194e4e42364e3d1841d0a9b1ef857879c31', - id: '0x204d4194e4e42364e3d1841d0a9b1ef857879c31', + MOCK_WETH_BAL_POOL: { + address: '0xB2456A6f51530053bC41b0EE700fe6A2C37282e8', + id: '0xB2456A6f51530053bC41b0EE700fe6A2C37282e8', type: PoolType.Weighted, decimals: 18, slot: 0, }, MOCK_BAL_DAI_POOL: { - address: '0xac79a8276860bf96d761804e5ed5736d3afaaecf', - id: '0xac79a8276860bf96d761804e5ed5736d3afaaecf', + address: '0x877AbBc4c390716a5F22D1a74183bd88b11106de', + id: '0x877AbBc4c390716a5F22D1a74183bd88b11106de', type: PoolType.Weighted, decimals: 18, slot: 0, }, MOCK_USDC_DAI_POOL: { - address: '0xe623a14c663e66f63ceddd73528da84db4e41350', - id: '0xe623a14c663e66f63ceddd73528da84db4e41350', + address: '0x04FCB7Bd2C77597fA89E05C6452E21e01eeE187A', + id: '0x04FCB7Bd2C77597fA89E05C6452E21e01eeE187A', type: PoolType.Weighted, decimals: 18, slot: 0, }, MOCK_NESTED_POOL: { - address: '0x4c885071fc0e694c7e0091c1e5694267066df96f', - id: '0x4c885071fc0e694c7e0091c1e5694267066df96f', + address: '0xE184b377F9Ac3e5BC74c1b6b72f64ce312485081', + id: '0xE184b377F9Ac3e5BC74c1b6b72f64ce312485081', type: PoolType.Weighted, decimals: 18, slot: 0, diff --git a/test/v3/addLiquidity.integration.test.ts b/test/v3/addLiquidity.integration.test.ts index 330a1a29..cd357628 100644 --- a/test/v3/addLiquidity.integration.test.ts +++ b/test/v3/addLiquidity.integration.test.ts @@ -40,7 +40,7 @@ const vaultVersion = 3; const { rpcUrl } = await startFork(ANVIL_NETWORKS.SEPOLIA); const chainId = ChainId.SEPOLIA; -const poolId = POOLS[chainId].MOCK_WEIGHTED_POOL.id; +const poolId = POOLS[chainId].MOCK_WETH_BAL_POOL.id; const BAL = TOKENS[chainId].BAL; const WETH = TOKENS[chainId].WETH; diff --git a/test/v3/removeLiquidity.integration.test.ts b/test/v3/removeLiquidity.integration.test.ts index abe60ea5..0aea1366 100644 --- a/test/v3/removeLiquidity.integration.test.ts +++ b/test/v3/removeLiquidity.integration.test.ts @@ -49,7 +49,7 @@ const vaultVersion = 3; const chainId = ChainId.SEPOLIA; const { rpcUrl } = await startFork(ANVIL_NETWORKS.SEPOLIA); -const poolId = POOLS[chainId].MOCK_WEIGHTED_POOL.address; +const poolId = POOLS[chainId].MOCK_WETH_BAL_POOL.address; const WETH = TOKENS[chainId].WETH; const BAL = TOKENS[chainId].BAL; From cf22118e51828128b8cda99e80e1520435b49803 Mon Sep 17 00:00:00 2001 From: Bruno Eidam Guerios Date: Fri, 24 May 2024 16:43:58 -0300 Subject: [PATCH 03/15] Update token approval flow to use Permit2 --- test/lib/utils/helper.ts | 139 ++++++++++++++++++++++++++++++++------- 1 file changed, 117 insertions(+), 22 deletions(-) diff --git a/test/lib/utils/helper.ts b/test/lib/utils/helper.ts index 45312446..f654c1d7 100644 --- a/test/lib/utils/helper.ts +++ b/test/lib/utils/helper.ts @@ -10,13 +10,22 @@ import { encodeAbiParameters, hexToBigInt, keccak256, + maxUint160, + maxUint48, pad, toBytes, toHex, trim, } from 'viem'; -import { erc20Abi } from '../../../src/abi'; -import { VAULT, MAX_UINT256, ZERO_ADDRESS, VAULT_V3 } from '../../../src/utils'; + +import { erc20Abi, permit2Abi } from '@/abi'; +import { + VAULT, + MAX_UINT256, + ZERO_ADDRESS, + PERMIT2, + BALANCER_ROUTER, +} from '@/utils'; export type TxOutput = { transactionReceipt: TransactionReceipt; @@ -28,14 +37,33 @@ export const hasApprovedToken = async ( client: Client & PublicActions & WalletActions, account: Address, token: Address, + spender: Address, amount = MAX_UINT256, ): Promise => { - const chainId = await client.getChainId(); const allowance = await client.readContract({ address: token, abi: erc20Abi, functionName: 'allowance', - args: [account, VAULT[chainId]], + args: [account, spender], + }); + + const hasApproved = allowance >= amount; + return hasApproved; +}; + +export const hasApprovedTokenOnPermit2 = async ( + client: Client & PublicActions & WalletActions, + account: Address, + token: Address, + spender: Address, + amount = maxUint160, +): Promise => { + const chainId = await client.getChainId(); + const [allowance, ,] = await client.readContract({ + address: PERMIT2[chainId], + abi: permit2Abi, + functionName: 'allowance', + args: [account, token, spender], }); const hasApproved = allowance >= amount; @@ -43,29 +71,101 @@ export const hasApprovedToken = async ( }; export const approveToken = async ( + client: Client & PublicActions & WalletActions, + accountAddress: Address, + tokenAddress: Address, + vaultVersion: 2 | 3, + amount?: bigint, + deadline?: bigint, +): Promise => { + const chainId = await client.getChainId(); + + let approved = false; + if (vaultVersion === 2) { + // Approve Vault V2 to spend account tokens + approved = await approveSpenderOnToken( + client, + accountAddress, + tokenAddress, + VAULT[chainId], + amount, + ); + } else { + // Approve Permit2 to spend account tokens + const approvedOnToken = await approveSpenderOnToken( + client, + accountAddress, + tokenAddress, + PERMIT2[chainId], + amount, + ); + // Approve Router to spend account tokens using Permit2 + const approvedOnPermit2 = await approveSpenderOnPermit2( + client, + accountAddress, + tokenAddress, + BALANCER_ROUTER[chainId], + amount, + deadline, + ); + approved = approvedOnToken && approvedOnPermit2; + } + return approved; +}; + +export const approveSpenderOnToken = async ( client: Client & PublicActions & WalletActions, account: Address, token: Address, + spender: Address, amount = MAX_UINT256, // approve max by default - vaultVersion: 2 | 3 = 2, ): Promise => { - const chainId = await client.getChainId(); - const vaultAddress = - vaultVersion === 2 ? VAULT[chainId] : VAULT_V3[chainId]; // approve token on the vault - const hash = await client.writeContract({ + await client.writeContract({ account, chain: client.chain, address: token, abi: erc20Abi, functionName: 'approve', - args: [vaultAddress, amount], + args: [spender, amount], }); - const txReceipt = await client.waitForTransactionReceipt({ - hash, + const approved = await hasApprovedToken( + client, + account, + token, + spender, + amount, + ); + return approved; +}; + +export const approveSpenderOnPermit2 = async ( + client: Client & PublicActions & WalletActions, + account: Address, + token: Address, + spender: Address, + amount = maxUint160, // approve max by default + deadline = maxUint48, // approve max by default +): Promise => { + const chainId = await client.getChainId(); + await client.writeContract({ + account, + chain: client.chain, + address: PERMIT2[chainId], + abi: permit2Abi, + functionName: 'approve', + args: [token, spender, amount, Number(deadline)], }); - return txReceipt.status === 'success'; + + const approved = await hasApprovedTokenOnPermit2( + client, + account, + token, + spender, + amount, + ); + return approved; }; export const getErc20Balance = ( @@ -122,6 +222,7 @@ export async function sendTransactionGetBalances( client, clientAddress, ); + // Send transaction to local fork const hash = await client.sendTransaction({ account: clientAddress, @@ -312,7 +413,8 @@ export const forkSetup = async ( } for (let i = 0; i < tokens.length; i++) { - // Set initial account balance for each token that will be used to add liquidity to the pool + // Set initial account balance for each token that will be used to add + // liquidity to the pool await setTokenBalance( client, accountAddress, @@ -322,13 +424,6 @@ export const forkSetup = async ( isVyperMapping[i], ); - // Approve appropriate allowances so that vault contract can move tokens - await approveToken( - client, - accountAddress, - tokens[i], - undefined, - vaultVersion, - ); + await approveToken(client, accountAddress, tokens[i], vaultVersion); } }; From cf42633cc776eb1e59209351bfa67dde32b3f02f Mon Sep 17 00:00:00 2001 From: Bruno Eidam Guerios Date: Fri, 24 May 2024 16:59:37 -0300 Subject: [PATCH 04/15] Fix callData omit --- test/lib/utils/addLiquidityHelper.ts | 2 +- test/lib/utils/removeLiquidityHelper.ts | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/test/lib/utils/addLiquidityHelper.ts b/test/lib/utils/addLiquidityHelper.ts index bcead3a9..3a1a21dd 100644 --- a/test/lib/utils/addLiquidityHelper.ts +++ b/test/lib/utils/addLiquidityHelper.ts @@ -463,7 +463,7 @@ function assertAddLiquidityBuildCallOutput( )?.amount ?? 0n; } - const expectedBuildOutput: Omit = { + const expectedBuildOutput: Omit = { maxAmountsIn, minBptOut, to, diff --git a/test/lib/utils/removeLiquidityHelper.ts b/test/lib/utils/removeLiquidityHelper.ts index 9ccad27c..09568edc 100644 --- a/test/lib/utils/removeLiquidityHelper.ts +++ b/test/lib/utils/removeLiquidityHelper.ts @@ -532,7 +532,10 @@ export function assertRemoveLiquidityBuildCallOutput( ? VAULT[removeLiquidityQueryOutput.chainId] : BALANCER_ROUTER[removeLiquidityQueryOutput.chainId]; - const expectedBuildOutput: Omit = { + const expectedBuildOutput: Omit< + RemoveLiquidityBuildCallOutput, + 'callData' + > = { minAmountsOut, maxBptIn, to, From 41e6a72fbe8861452f3eef63a785ff9bc6ff4bd0 Mon Sep 17 00:00:00 2001 From: Bruno Eidam Guerios Date: Fri, 24 May 2024 17:00:12 -0300 Subject: [PATCH 05/15] Fix swap integration test for single swaps --- test/entities/swapV3.integration.test.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/entities/swapV3.integration.test.ts b/test/entities/swapV3.integration.test.ts index 8c3162c7..c4e108b3 100644 --- a/test/entities/swapV3.integration.test.ts +++ b/test/entities/swapV3.integration.test.ts @@ -39,8 +39,8 @@ import { Path } from '@/entities/swap/paths/types'; const vaultVersion = 3; const chainId = ChainId.SEPOLIA; -// blockNo with guaranteed liquidity -const blockNo = 5490330n; +// blockNo shouldn't change as checks depend on token balances +const blockNo = 5963063n; const BAL = TOKENS[chainId].BAL; const WETH = TOKENS[chainId].WETH; @@ -116,7 +116,7 @@ describe('SwapV3', () => { TOKENS[chainId].WETH.decimals, ); expect(expected.expectedAmountOut.token).to.deep.eq(wethToken); - expect(expected.expectedAmountOut.amount).to.eq(138379302n); + expect(expected.expectedAmountOut.amount).to.eq(135294078n); }); test('GivenOut', async () => { const swap = new Swap({ @@ -135,7 +135,7 @@ describe('SwapV3', () => { TOKENS[chainId].BAL.decimals, ); expect(expected.expectedAmountIn.token).to.deep.eq(balToken); - expect(expected.expectedAmountIn.amount).to.eq(72265254280201n); + expect(expected.expectedAmountIn.amount).to.eq(73906032837021n); }); }); describe('swap should be executed correctly', () => { From 6512942945c06bd595b885caef58d6556d41d96f Mon Sep 17 00:00:00 2001 From: Bruno Eidam Guerios Date: Fri, 24 May 2024 17:00:54 -0300 Subject: [PATCH 06/15] Approve BPT on remove liquidity integration test --- test/v3/removeLiquidity.integration.test.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/v3/removeLiquidity.integration.test.ts b/test/v3/removeLiquidity.integration.test.ts index 0aea1366..26c7fbb7 100644 --- a/test/v3/removeLiquidity.integration.test.ts +++ b/test/v3/removeLiquidity.integration.test.ts @@ -30,7 +30,7 @@ import { RemoveLiquidityUnbalancedInput, removeLiquidityUnbalancedNotSupportedOnV3, } from '../../src'; -import { forkSetup } from '../lib/utils/helper'; +import { approveToken, forkSetup } from '../lib/utils/helper'; import { assertRemoveLiquidityProportional, assertRemoveLiquiditySingleTokenExactIn, @@ -122,6 +122,14 @@ describe('remove liquidity test', () => { undefined, vaultVersion, ); + + await approveToken( + txInput.client, + txInput.testAddress, + txInput.poolState.address, + vaultVersion, + ); + await doAddLiquidity(prepTxInput); }); From a8bc7989a0d9bb9163785e7be98beb3bf77921a4 Mon Sep 17 00:00:00 2001 From: Bruno Eidam Guerios Date: Fri, 24 May 2024 17:01:33 -0300 Subject: [PATCH 07/15] Minor add liquidity integration test fix --- test/v3/addLiquidity.integration.test.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/v3/addLiquidity.integration.test.ts b/test/v3/addLiquidity.integration.test.ts index cd357628..4d277cc6 100644 --- a/test/v3/addLiquidity.integration.test.ts +++ b/test/v3/addLiquidity.integration.test.ts @@ -38,7 +38,6 @@ import { POOLS, TOKENS } from 'test/lib/utils/addresses'; const vaultVersion = 3; -const { rpcUrl } = await startFork(ANVIL_NETWORKS.SEPOLIA); const chainId = ChainId.SEPOLIA; const poolId = POOLS[chainId].MOCK_WETH_BAL_POOL.id; @@ -48,6 +47,7 @@ const WETH = TOKENS[chainId].WETH; describe('add liquidity test', () => { let txInput: AddLiquidityTxInput; let poolState: PoolState; + let rpcUrl: string; beforeAll(async () => { // setup mock api @@ -56,6 +56,8 @@ describe('add liquidity test', () => { // get pool state from api poolState = await api.getPool(poolId); + ({ rpcUrl } = await startFork(ANVIL_NETWORKS[ChainId[chainId]])); + const client = createTestClient({ mode: 'anvil', chain: CHAINS[chainId], From 93caa14e66ed5376a087aeaa97d41cc5393f6452 Mon Sep 17 00:00:00 2001 From: Bruno Eidam Guerios Date: Tue, 28 May 2024 15:43:19 -0300 Subject: [PATCH 08/15] Fix token approval for BPT on remove liquidity test --- test/v3/removeLiquidity.integration.test.ts | 47 +++++++++++---------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/test/v3/removeLiquidity.integration.test.ts b/test/v3/removeLiquidity.integration.test.ts index 26c7fbb7..c5e2a2b1 100644 --- a/test/v3/removeLiquidity.integration.test.ts +++ b/test/v3/removeLiquidity.integration.test.ts @@ -10,40 +10,43 @@ import { publicActions, walletActions, } from 'viem'; + import { - RemoveLiquiditySingleTokenExactInInput, - RemoveLiquidityProportionalInput, - RemoveLiquidityKind, - Slippage, - PoolState, - RemoveLiquidity, - Hex, + AddLiquidity, + AddLiquidityKind, + AddLiquidityUnbalancedInput, + BALANCER_ROUTER, CHAINS, ChainId, - RemoveLiquidityInput, + Hex, InputAmount, + PoolState, PoolType, - AddLiquidity, - AddLiquidityKind, - AddLiquidityUnbalancedInput, + Slippage, + RemoveLiquidity, + RemoveLiquidityKind, + RemoveLiquidityInput, + RemoveLiquidityProportionalInput, + RemoveLiquiditySingleTokenExactInInput, RemoveLiquiditySingleTokenExactOutInput, RemoveLiquidityUnbalancedInput, removeLiquidityUnbalancedNotSupportedOnV3, -} from '../../src'; -import { approveToken, forkSetup } from '../lib/utils/helper'; +} from 'src'; + +import { ANVIL_NETWORKS, startFork } from 'test/anvil/anvil-global-setup'; import { + AddLiquidityTxInput, + approveSpenderOnToken, assertRemoveLiquidityProportional, assertRemoveLiquiditySingleTokenExactIn, assertRemoveLiquiditySingleTokenExactOut, + doAddLiquidity, doRemoveLiquidity, -} from '../lib/utils/removeLiquidityHelper'; -import { - AddLiquidityTxInput, + forkSetup, + POOLS, RemoveLiquidityTxInput, -} from '../lib/utils/types'; -import { ANVIL_NETWORKS, startFork } from '../anvil/anvil-global-setup'; -import { POOLS, TOKENS } from 'test/lib/utils/addresses'; -import { doAddLiquidity } from 'test/lib/utils/addLiquidityHelper'; + TOKENS, +} from 'test/lib/utils'; const vaultVersion = 3; @@ -123,11 +126,11 @@ describe('remove liquidity test', () => { vaultVersion, ); - await approveToken( + await approveSpenderOnToken( txInput.client, txInput.testAddress, txInput.poolState.address, - vaultVersion, + BALANCER_ROUTER[chainId], ); await doAddLiquidity(prepTxInput); From 1dc6910e7d34554fe322b563c3a5c4ccf16cefbf Mon Sep 17 00:00:00 2001 From: Bruno Eidam Guerios Date: Wed, 29 May 2024 13:20:33 -0300 Subject: [PATCH 09/15] Adapt swap integration tests to work with Permit2 --- test/anvil/anvil-global-setup.ts | 2 +- test/entities/swapV3.integration.test.ts | 32 ++++++++++++------------ test/lib/utils/addresses.ts | 2 +- test/lib/utils/helper.ts | 17 +++++++++++-- 4 files changed, 33 insertions(+), 20 deletions(-) diff --git a/test/anvil/anvil-global-setup.ts b/test/anvil/anvil-global-setup.ts index e4f62a08..451337b5 100644 --- a/test/anvil/anvil-global-setup.ts +++ b/test/anvil/anvil-global-setup.ts @@ -52,7 +52,7 @@ export const ANVIL_NETWORKS: Record = { rpcEnv: 'SEPOLIA_RPC_URL', fallBackRpc: 'https://sepolia.gateway.tenderly.co', port: ANVIL_PORTS.SEPOLIA, - forkBlockNumber: 5970070n, + forkBlockNumber: 6000510n, }, OPTIMISM: { rpcEnv: 'OPTIMISM_RPC_URL', diff --git a/test/entities/swapV3.integration.test.ts b/test/entities/swapV3.integration.test.ts index c4e108b3..d6689d0d 100644 --- a/test/entities/swapV3.integration.test.ts +++ b/test/entities/swapV3.integration.test.ts @@ -40,7 +40,7 @@ import { Path } from '@/entities/swap/paths/types'; const vaultVersion = 3; const chainId = ChainId.SEPOLIA; // blockNo shouldn't change as checks depend on token balances -const blockNo = 5963063n; +const blockNo = 6001201n; const BAL = TOKENS[chainId].BAL; const WETH = TOKENS[chainId].WETH; @@ -116,7 +116,7 @@ describe('SwapV3', () => { TOKENS[chainId].WETH.decimals, ); expect(expected.expectedAmountOut.token).to.deep.eq(wethToken); - expect(expected.expectedAmountOut.amount).to.eq(135294078n); + expect(expected.expectedAmountOut.amount).to.eq(103365122n); }); test('GivenOut', async () => { const swap = new Swap({ @@ -135,7 +135,7 @@ describe('SwapV3', () => { TOKENS[chainId].BAL.decimals, ); expect(expected.expectedAmountIn.token).to.deep.eq(balToken); - expect(expected.expectedAmountIn.amount).to.eq(73906032837021n); + expect(expected.expectedAmountIn.amount).to.eq(96734829986472n); }); }); describe('swap should be executed correctly', () => { @@ -278,8 +278,8 @@ describe('SwapV3', () => { POOLS[chainId].MOCK_BAL_DAI_POOL.id, POOLS[chainId].MOCK_USDC_DAI_POOL.id, ], - inputAmountRaw: 10000000000000000n, - outputAmountRaw: 20000000n, + inputAmountRaw: 100000000000000n, + outputAmountRaw: 2000000n, }; // weth > bpt > usdc const pathWithExit: Path = { @@ -302,8 +302,8 @@ describe('SwapV3', () => { POOLS[chainId].MOCK_NESTED_POOL.id, POOLS[chainId].MOCK_USDC_DAI_POOL.id, ], - inputAmountRaw: 10000000000000000n, - outputAmountRaw: 60000000n, + inputAmountRaw: 100000000000000n, + outputAmountRaw: 6000000n, }; describe('query method should return correct updated', () => { @@ -324,9 +324,9 @@ describe('SwapV3', () => { TOKENS[chainId].USDC.decimals, ); expect(expected.swapKind).to.eq(SwapKind.GivenIn); - expect(expected.pathAmounts).to.deep.eq([19831031n, 59000343n]); + expect(expected.pathAmounts).to.deep.eq([90214n, 770252n]); expect(expected.expectedAmountOut.token).to.deep.eq(usdcToken); - expect(expected.expectedAmountOut.amount).to.eq(78831374n); + expect(expected.expectedAmountOut.amount).to.eq(860466n); }); test('GivenOut', async () => { const swap = new Swap({ @@ -346,12 +346,12 @@ describe('SwapV3', () => { ); expect(expected.swapKind).to.eq(SwapKind.GivenOut); expect(expected.pathAmounts).to.deep.eq([ - 10109072337868053n, - 10221727279669762n, + 2286265697052729n, + 831382813409707n, ]); expect(expected.expectedAmountIn.token).to.deep.eq(wethToken); expect(expected.expectedAmountIn.amount).to.eq( - 20330799617537815n, + 3117648510462436n, ); }); }); @@ -430,16 +430,16 @@ describe('SwapV3', () => { ...pathMultiSwap, tokens: [...pathMultiSwap.tokens].reverse(), pools: [...pathMultiSwap.pools].reverse(), - inputAmountRaw: 1000000n, - outputAmountRaw: 400000000000000n, + inputAmountRaw: 100000n, + outputAmountRaw: 40000000000000n, }; // usdc > bpt > weth const pathUsdcWethJoin = { ...pathWithExit, tokens: [...pathWithExit.tokens].reverse(), pools: [...pathWithExit.pools].reverse(), - inputAmountRaw: 60000000n, - outputAmountRaw: 6000000000000000n, + inputAmountRaw: 6000000n, + outputAmountRaw: 600000000000000n, }; test('GivenIn', async () => { const swap = new Swap({ diff --git a/test/lib/utils/addresses.ts b/test/lib/utils/addresses.ts index 2ba17f7b..b77eec0c 100644 --- a/test/lib/utils/addresses.ts +++ b/test/lib/utils/addresses.ts @@ -107,7 +107,7 @@ export const TOKENS: Record> = { slot: 0, }, BPT: { - address: '0xe623a14c663e66f63ceddd73528da84db4e41350', + address: '0x04FCB7Bd2C77597fA89E05C6452E21e01eeE187A', decimals: 18, slot: 1, }, diff --git a/test/lib/utils/helper.ts b/test/lib/utils/helper.ts index f654c1d7..19018b24 100644 --- a/test/lib/utils/helper.ts +++ b/test/lib/utils/helper.ts @@ -25,6 +25,7 @@ import { ZERO_ADDRESS, PERMIT2, BALANCER_ROUTER, + BALANCER_BATCH_ROUTER, } from '@/utils'; export type TxOutput = { @@ -100,7 +101,7 @@ export const approveToken = async ( amount, ); // Approve Router to spend account tokens using Permit2 - const approvedOnPermit2 = await approveSpenderOnPermit2( + const routerApprovedOnPermit2 = await approveSpenderOnPermit2( client, accountAddress, tokenAddress, @@ -108,7 +109,19 @@ export const approveToken = async ( amount, deadline, ); - approved = approvedOnToken && approvedOnPermit2; + // Approve BatchRouter to spend account tokens using Permit2 + const batchRouterApprovedOnPermit2 = await approveSpenderOnPermit2( + client, + accountAddress, + tokenAddress, + BALANCER_BATCH_ROUTER[chainId], + amount, + deadline, + ); + approved = + approvedOnToken && + routerApprovedOnPermit2 && + batchRouterApprovedOnPermit2; } return approved; }; From df0da3c0218da3d1596d90d373653a30927f9dc1 Mon Sep 17 00:00:00 2001 From: Bruno Eidam Guerios Date: Wed, 29 May 2024 14:04:20 -0300 Subject: [PATCH 10/15] Update CreatePool to conform with new testnet deployment --- src/abi/weightedPoolFactory.V3.ts | 119 +++++++++++++++++- .../weighted/createPoolWeighted.ts | 41 +++--- src/entities/createPool/types.ts | 22 ++-- src/utils/constants.ts | 2 +- src/utils/index.ts | 1 + .../createPool/weighted.integration.test.ts | 4 + test/v3/initPool.integration.test.ts | 6 +- 7 files changed, 165 insertions(+), 30 deletions(-) diff --git a/src/abi/weightedPoolFactory.V3.ts b/src/abi/weightedPoolFactory.V3.ts index 55465ab4..5ae195c3 100644 --- a/src/abi/weightedPoolFactory.V3.ts +++ b/src/abi/weightedPoolFactory.V3.ts @@ -80,7 +80,7 @@ export const weightedPoolFactoryAbi_V3 = [ }, { internalType: 'bool', - name: 'yieldFeeExempt', + name: 'paysYieldFees', type: 'bool', }, ], @@ -93,6 +93,33 @@ export const weightedPoolFactoryAbi_V3 = [ name: 'normalizedWeights', type: 'uint256[]', }, + { + components: [ + { + internalType: 'address', + name: 'pauseManager', + type: 'address', + }, + { + internalType: 'address', + name: 'swapFeeManager', + type: 'address', + }, + { + internalType: 'address', + name: 'poolCreator', + type: 'address', + }, + ], + internalType: 'struct PoolRoleAccounts', + name: 'roleAccounts', + type: 'tuple', + }, + { + internalType: 'uint256', + name: 'swapFeePercentage', + type: 'uint256', + }, { internalType: 'bytes32', name: 'salt', @@ -149,6 +176,96 @@ export const weightedPoolFactoryAbi_V3 = [ stateMutability: 'view', type: 'function', }, + { + inputs: [], + name: 'getDefaultLiquidityManagement', + outputs: [ + { + components: [ + { + internalType: 'bool', + name: 'disableUnbalancedLiquidity', + type: 'bool', + }, + { + internalType: 'bool', + name: 'enableAddLiquidityCustom', + type: 'bool', + }, + { + internalType: 'bool', + name: 'enableRemoveLiquidityCustom', + type: 'bool', + }, + ], + internalType: 'struct LiquidityManagement', + name: 'liquidityManagement', + type: 'tuple', + }, + ], + stateMutability: 'pure', + type: 'function', + }, + { + inputs: [], + name: 'getDefaultPoolHooks', + outputs: [ + { + components: [ + { + internalType: 'bool', + name: 'shouldCallBeforeInitialize', + type: 'bool', + }, + { + internalType: 'bool', + name: 'shouldCallAfterInitialize', + type: 'bool', + }, + { + internalType: 'bool', + name: 'shouldCallComputeDynamicSwapFee', + type: 'bool', + }, + { + internalType: 'bool', + name: 'shouldCallBeforeSwap', + type: 'bool', + }, + { + internalType: 'bool', + name: 'shouldCallAfterSwap', + type: 'bool', + }, + { + internalType: 'bool', + name: 'shouldCallBeforeAddLiquidity', + type: 'bool', + }, + { + internalType: 'bool', + name: 'shouldCallAfterAddLiquidity', + type: 'bool', + }, + { + internalType: 'bool', + name: 'shouldCallBeforeRemoveLiquidity', + type: 'bool', + }, + { + internalType: 'bool', + name: 'shouldCallAfterRemoveLiquidity', + type: 'bool', + }, + ], + internalType: 'struct PoolHooks', + name: 'poolHooks', + type: 'tuple', + }, + ], + stateMutability: 'pure', + type: 'function', + }, { inputs: [ { diff --git a/src/entities/createPool/createPoolV3/weighted/createPoolWeighted.ts b/src/entities/createPool/createPoolV3/weighted/createPoolWeighted.ts index 36073eac..e2bd8a3f 100644 --- a/src/entities/createPool/createPoolV3/weighted/createPoolWeighted.ts +++ b/src/entities/createPool/createPoolV3/weighted/createPoolWeighted.ts @@ -4,30 +4,23 @@ import { CreatePoolBase, CreatePoolV3WeightedInput, CreatePoolBuildCallOutput, - CreatePoolV3WeightedArgs, TokenConfig, + PoolRoleAccounts, } from '../../types'; import { weightedPoolFactoryAbi_V3 } from '@/abi/weightedPoolFactory.V3'; -import { WEIGHTED_POOL_FACTORY_BALANCER_V3 } from '@/utils'; -import { sortByAddress } from '@/utils/sortByAddress'; +import { WEIGHTED_POOL_FACTORY_BALANCER_V3, sortByAddress } from '@/utils'; +import { Hex } from '@/types'; export class CreatePoolWeightedV3 implements CreatePoolBase { buildCall(input: CreatePoolV3WeightedInput): CreatePoolBuildCallOutput { - const args = this.parseCreateFunctionArgs(input); - const encodedCall = encodeFunctionData({ - abi: weightedPoolFactoryAbi_V3, - functionName: 'create', - args, - }); + const callData = this.encodeCall(input); return { - callData: encodedCall, + callData, to: WEIGHTED_POOL_FACTORY_BALANCER_V3[input.chainId], }; } - private parseCreateFunctionArgs( - input: CreatePoolV3WeightedInput, - ): CreatePoolV3WeightedArgs { + private encodeCall(input: CreatePoolV3WeightedInput): Hex { const sortedTokenParams = sortByAddress(input.tokens); const [tokenConfigs, normalizedWeights] = sortedTokenParams.reduce( @@ -38,14 +31,14 @@ export class CreatePoolWeightedV3 implements CreatePoolBase { rateProvider, weight, tokenType, - yieldFeeExempt, + paysYieldFees, }, ) => { acc[0].push({ token: tokenAddress, tokenType, rateProvider, - yieldFeeExempt: yieldFeeExempt ?? false, + paysYieldFees: paysYieldFees ?? false, }); acc[1].push(weight); return acc; @@ -53,12 +46,26 @@ export class CreatePoolWeightedV3 implements CreatePoolBase { [[], []] as [TokenConfig[], bigint[]], ); - return [ + const roleAccounts: PoolRoleAccounts = { + pauseManager: input.pauseManager, + swapFeeManager: input.swapFeeManager, + poolCreator: input.poolCreator, + }; + + const args = [ input.name || input.symbol, input.symbol, tokenConfigs, normalizedWeights, + roleAccounts, + input.swapFeePercentage, input.salt || getRandomBytes32(), - ]; + ] as const; + + return encodeFunctionData({ + abi: weightedPoolFactoryAbi_V3, + functionName: 'create', + args, + }); } } diff --git a/src/entities/createPool/types.ts b/src/entities/createPool/types.ts index 5fd536e6..8a739e60 100644 --- a/src/entities/createPool/types.ts +++ b/src/entities/createPool/types.ts @@ -41,6 +41,10 @@ export type CreatePoolV2ComposableStableInput = CreatePoolV2BaseInput & { export type CreatePoolV3BaseInput = CreatePoolBaseInput & { vaultVersion: 3; + pauseManager: Address; + swapFeeManager: Address; + poolCreator: Address; + swapFeePercentage: bigint; }; export type CreatePoolV3WeightedInput = CreatePoolV3BaseInput & { @@ -50,7 +54,7 @@ export type CreatePoolV3WeightedInput = CreatePoolV3BaseInput & { rateProvider: Address; weight: bigint; tokenType: TokenType; - yieldFeeExempt?: boolean; + paysYieldFees?: boolean; }[]; }; @@ -88,17 +92,15 @@ export type CreatePoolV2ComposableStableArgs = [ Hex, ]; -export type CreatePoolV3WeightedArgs = [ - string, - string, - TokenConfig[], - bigint[], - Hex, -]; - export type TokenConfig = { token: Address; tokenType: TokenType; rateProvider: Address; - yieldFeeExempt: boolean; + paysYieldFees: boolean; +}; + +export type PoolRoleAccounts = { + pauseManager: Address; + swapFeeManager: Address; + poolCreator: Address; }; diff --git a/src/utils/constants.ts b/src/utils/constants.ts index c5945b1e..48cd60c4 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -186,7 +186,7 @@ export const WEIGHTED_POOL_FACTORY_BALANCER_V2: Record = { [ChainId.BASE]: '0x4c32a8a8fda4e24139b51b456b42290f51d6a1c4', }; export const WEIGHTED_POOL_FACTORY_BALANCER_V3: Record = { - [ChainId.SEPOLIA]: '0xc00fF743B73346c9a4C40509e0550FfC18e5426d', + [ChainId.SEPOLIA]: '0x2FAa140F90f76eeEEBC191f4eF4b2634be1E4e91', }; export const COMPOSABLE_STABLE_POOL_FACTORY: Record = { [ChainId.ARBITRUM_ONE]: '0xa8920455934da4d853faac1f94fe7bef72943ef1', diff --git a/src/utils/index.ts b/src/utils/index.ts index ccdbe085..d498555b 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -4,3 +4,4 @@ export * from './helpers'; export * from './math'; export * from './pool'; export * from './poolTypeMapper'; +export * from './sortByAddress'; diff --git a/test/v3/createPool/weighted.integration.test.ts b/test/v3/createPool/weighted.integration.test.ts index bef13483..bab872c9 100644 --- a/test/v3/createPool/weighted.integration.test.ts +++ b/test/v3/createPool/weighted.integration.test.ts @@ -64,6 +64,10 @@ describe('Create Weighted Pool tests', () => { tokenType: TokenType.STANDARD, }, ], + swapFeePercentage: parseEther('0.01'), + pauseManager: signerAddress, + swapFeeManager: signerAddress, + poolCreator: signerAddress, chainId, vaultVersion: 3, }; diff --git a/test/v3/initPool.integration.test.ts b/test/v3/initPool.integration.test.ts index 1138415e..9110929d 100644 --- a/test/v3/initPool.integration.test.ts +++ b/test/v3/initPool.integration.test.ts @@ -45,7 +45,7 @@ describe('Initialize Pool V3 - Weighted Pool', async () => { const client = createTestClient({ mode: 'anvil', chain: CHAINS[chainId], - transport: http(rpcUrl, { timeout: 120_000 }), // FIXME: shouldn't take that long - investigate/fix in a following PR + transport: http(rpcUrl, { timeout: 120_000 }), // FIXME: createPool step takes a long time, so we increase the timeout as a temporary solution }) .extend(publicActions) .extend(walletActions); @@ -69,6 +69,10 @@ describe('Initialize Pool V3 - Weighted Pool', async () => { tokenType: TokenType.STANDARD, }, ], + swapFeePercentage: parseEther('0.01'), + pauseManager: signerAddress, + swapFeeManager: signerAddress, + poolCreator: signerAddress, chainId, vaultVersion: 3, }; From 975bf48da16d9f68894ea62fecd6ba9abe2ac556 Mon Sep 17 00:00:00 2001 From: Bruno Eidam Guerios Date: Wed, 29 May 2024 14:22:33 -0300 Subject: [PATCH 11/15] Remove duplicate BPT from addresses file --- test/entities/swapV3.integration.test.ts | 56 ++++++++++++------------ test/lib/utils/addresses.ts | 5 --- 2 files changed, 27 insertions(+), 34 deletions(-) diff --git a/test/entities/swapV3.integration.test.ts b/test/entities/swapV3.integration.test.ts index d6689d0d..469afe1b 100644 --- a/test/entities/swapV3.integration.test.ts +++ b/test/entities/swapV3.integration.test.ts @@ -45,6 +45,8 @@ const blockNo = 6001201n; const BAL = TOKENS[chainId].BAL; const WETH = TOKENS[chainId].WETH; const USDC = TOKENS[chainId].USDC; +const DAI = TOKENS[chainId].DAI; +const USDC_DAI_BPT = POOLS[chainId].MOCK_USDC_DAI_POOL; describe('SwapV3', () => { let client: Client & PublicActions & TestActions & WalletActions; @@ -86,12 +88,12 @@ describe('SwapV3', () => { vaultVersion: 3, tokens: [ { - address: TOKENS[chainId].BAL.address, - decimals: TOKENS[chainId].BAL.decimals, + address: BAL.address, + decimals: BAL.decimals, }, { - address: TOKENS[chainId].WETH.address, - decimals: TOKENS[chainId].WETH.decimals, + address: WETH.address, + decimals: WETH.decimals, }, ], pools: [POOLS[chainId].MOCK_WETH_BAL_POOL.id], @@ -112,8 +114,8 @@ describe('SwapV3', () => { const wethToken = new Token( chainId, - TOKENS[chainId].WETH.address, - TOKENS[chainId].WETH.decimals, + WETH.address, + WETH.decimals, ); expect(expected.expectedAmountOut.token).to.deep.eq(wethToken); expect(expected.expectedAmountOut.amount).to.eq(103365122n); @@ -129,11 +131,7 @@ describe('SwapV3', () => { rpcUrl, )) as ExactOutQueryOutput; - const balToken = new Token( - chainId, - TOKENS[chainId].BAL.address, - TOKENS[chainId].BAL.decimals, - ); + const balToken = new Token(chainId, BAL.address, BAL.decimals); expect(expected.expectedAmountIn.token).to.deep.eq(balToken); expect(expected.expectedAmountIn.amount).to.eq(96734829986472n); }); @@ -257,20 +255,20 @@ describe('SwapV3', () => { vaultVersion: 3, tokens: [ { - address: TOKENS[chainId].WETH.address, - decimals: TOKENS[chainId].WETH.decimals, + address: WETH.address, + decimals: WETH.decimals, }, { - address: TOKENS[chainId].BAL.address, - decimals: TOKENS[chainId].BAL.decimals, + address: BAL.address, + decimals: BAL.decimals, }, { - address: TOKENS[chainId].DAI.address, - decimals: TOKENS[chainId].DAI.decimals, + address: DAI.address, + decimals: DAI.decimals, }, { - address: TOKENS[chainId].USDC.address, - decimals: TOKENS[chainId].USDC.decimals, + address: USDC.address, + decimals: USDC.decimals, }, ], pools: [ @@ -286,16 +284,16 @@ describe('SwapV3', () => { vaultVersion: 3, tokens: [ { - address: TOKENS[chainId].WETH.address, - decimals: TOKENS[chainId].WETH.decimals, + address: WETH.address, + decimals: WETH.decimals, }, { - address: TOKENS[chainId].BPT.address, - decimals: TOKENS[chainId].BPT.decimals, + address: USDC_DAI_BPT.address, + decimals: USDC_DAI_BPT.decimals, }, { - address: TOKENS[chainId].USDC.address, - decimals: TOKENS[chainId].USDC.decimals, + address: USDC.address, + decimals: USDC.decimals, }, ], pools: [ @@ -320,8 +318,8 @@ describe('SwapV3', () => { const usdcToken = new Token( chainId, - TOKENS[chainId].USDC.address, - TOKENS[chainId].USDC.decimals, + USDC.address, + USDC.decimals, ); expect(expected.swapKind).to.eq(SwapKind.GivenIn); expect(expected.pathAmounts).to.deep.eq([90214n, 770252n]); @@ -341,8 +339,8 @@ describe('SwapV3', () => { const wethToken = new Token( chainId, - TOKENS[chainId].WETH.address, - TOKENS[chainId].WETH.decimals, + WETH.address, + WETH.decimals, ); expect(expected.swapKind).to.eq(SwapKind.GivenOut); expect(expected.pathAmounts).to.deep.eq([ diff --git a/test/lib/utils/addresses.ts b/test/lib/utils/addresses.ts index b77eec0c..a34b70c4 100644 --- a/test/lib/utils/addresses.ts +++ b/test/lib/utils/addresses.ts @@ -106,11 +106,6 @@ export const TOKENS: Record> = { decimals: 6, slot: 0, }, - BPT: { - address: '0x04FCB7Bd2C77597fA89E05C6452E21e01eeE187A', - decimals: 18, - slot: 1, - }, scUSD: { address: '0x990c8eab51d9ecb365bf9b3de09d121af007db68', decimals: 18, From c46ed22338634d0684bf6eede0cfdaf766dd9c81 Mon Sep 17 00:00:00 2001 From: Bruno Eidam Guerios Date: Wed, 29 May 2024 14:41:08 -0300 Subject: [PATCH 12/15] Fix lint issues --- biome.json | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/biome.json b/biome.json index 6479560c..295004ed 100644 --- a/biome.json +++ b/biome.json @@ -1,17 +1,10 @@ { "$schema": "https://biomejs.dev/schemas/1.5.2/schema.json", "files": { - "ignore": [ - "./node_modules", - "dist", - "pnpm-lock.yaml", - "./local" - ] + "ignore": ["./node_modules", "dist", "pnpm-lock.yaml", "./local"] }, "organizeImports": { - "ignore": [ - "." - ] + "ignore": ["."] }, "formatter": { "enabled": true, @@ -53,4 +46,4 @@ "semicolons": "always" } } -} \ No newline at end of file +} From d0173671a7e968ff8c86c71b719399d9830f8a6e Mon Sep 17 00:00:00 2001 From: Bruno Eidam Guerios Date: Fri, 31 May 2024 16:29:44 -0300 Subject: [PATCH 13/15] Fix build issues and some other minor things --- examples/addLiquidity/addLiquidity.ts | 5 +++-- examples/addLiquidity/addLiquidityCustom.ts | 1 + .../balancer-api/modules/sorSwapPaths/index.ts | 14 ++++++++++---- src/data/providers/onchain/index.ts | 8 ++++---- src/entities/swap/swaps/v2/index.ts | 4 +++- src/entities/swap/swaps/v3/index.ts | 4 +++- 6 files changed, 24 insertions(+), 12 deletions(-) diff --git a/examples/addLiquidity/addLiquidity.ts b/examples/addLiquidity/addLiquidity.ts index ddeb20ce..e6e608d7 100644 --- a/examples/addLiquidity/addLiquidity.ts +++ b/examples/addLiquidity/addLiquidity.ts @@ -14,6 +14,7 @@ import { ChainId, PriceImpact, Slippage, + OnChainProvider, } from '../../src'; import { ANVIL_NETWORKS, startFork } from '../../test/anvil/anvil-global-setup'; import { makeForkTx } from '../lib/makeForkTx'; @@ -26,8 +27,8 @@ async function runAgainstFork() { const userAccount = '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'; // 80BAL-20WETH const pool = { - id: '0x204d4194e4e42364E3D1841d0a9B1eF857879C31', - address: '0x204d4194e4e42364E3D1841d0a9B1eF857879C31' as Address, + id: '0xB2456A6f51530053bC41b0EE700fe6A2C37282e8', + address: '0xB2456A6f51530053bC41b0EE700fe6A2C37282e8' as Address, }; const amountsIn = [ { diff --git a/examples/addLiquidity/addLiquidityCustom.ts b/examples/addLiquidity/addLiquidityCustom.ts index 8dab352e..ab0f7d96 100644 --- a/examples/addLiquidity/addLiquidityCustom.ts +++ b/examples/addLiquidity/addLiquidityCustom.ts @@ -25,6 +25,7 @@ async function runAgainstFork() { const userAccount = '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'; // Pool from a custom factory that is not currently supported in Balancer API const pool = { + // TODO: update with pool from testnet deployment 4 id: '0xd851b2b78c41c40a4fa134f6fc4282b71f0f1491', address: '0xd851b2b78c41c40a4fa134f6fc4282b71f0f1491' as Address, }; diff --git a/src/data/providers/balancer-api/modules/sorSwapPaths/index.ts b/src/data/providers/balancer-api/modules/sorSwapPaths/index.ts index 4cea762e..dd43dde0 100644 --- a/src/data/providers/balancer-api/modules/sorSwapPaths/index.ts +++ b/src/data/providers/balancer-api/modules/sorSwapPaths/index.ts @@ -16,7 +16,7 @@ export type SorInput = { export class SorSwapPaths { readonly sorSwapPathQuery = ` - query MyQuery($chain: GqlChain!, $swapType: GqlSorSwapType!, $swapAmount: BigDecimal!, $tokenIn: String!, $tokenOut: String!) { + query MyQuery($chain: GqlChain!, $swapType: GqlSorSwapType!, $swapAmount: AmountHumanReadable!, $tokenIn: String!, $tokenOut: String!) { sorGetSwapPaths( swapAmount: $swapAmount chain: $chain @@ -27,7 +27,10 @@ export class SorSwapPaths { tokenInAmount tokenOutAmount returnAmount - priceImpact + priceImpact { + error + priceImpact + } swapAmount paths { inputAmountRaw @@ -43,7 +46,7 @@ export class SorSwapPaths { } `; readonly sorSwapPathQueryWithVersion = ` - query MyQuery($chain: GqlChain!, $swapType: GqlSorSwapType!, $swapAmount: BigDecimal!, $tokenIn: String!, $tokenOut: String!, $useVaultVersion: Int!) { + query MyQuery($chain: GqlChain!, $swapType: GqlSorSwapType!, $swapAmount: AmountHumanReadable!, $tokenIn: String!, $tokenOut: String!, $useVaultVersion: Int!) { sorGetSwapPaths( swapAmount: $swapAmount chain: $chain @@ -55,7 +58,10 @@ export class SorSwapPaths { tokenInAmount tokenOutAmount returnAmount - priceImpact + priceImpact { + error + priceImpact + } swapAmount paths { inputAmountRaw diff --git a/src/data/providers/onchain/index.ts b/src/data/providers/onchain/index.ts index f509538f..07bf4f6c 100644 --- a/src/data/providers/onchain/index.ts +++ b/src/data/providers/onchain/index.ts @@ -23,7 +23,7 @@ export class Pools { async fetchPoolState(id: Address, poolType: string): Promise { // First call fetches pool tokens from vault - const poolTokenCall = await this.client.simulateContract({ + const poolTokens = await this.client.readContract({ address: VAULT_V3[this.chainId], abi: vaultV3Abi, functionName: 'getPoolTokens', @@ -31,7 +31,7 @@ export class Pools { }); // Multicall to fetch token decimals - const decimalCalls = (poolTokenCall.result as string[]).map((t) => { + const decimalCalls = poolTokens.map((t) => { return { address: t as Address, abi: parseAbi([ @@ -51,10 +51,10 @@ export class Pools { address: id, type: poolType, vaultVersion: 3, - tokens: (poolTokenCall.result as string[]).map((t, i) => { + tokens: poolTokens.map((t, i) => { return { index: i, - address: t as Address, + address: t, decimals: decimals[i], }; }), diff --git a/src/entities/swap/swaps/v2/index.ts b/src/entities/swap/swaps/v2/index.ts index d7811fe6..6b23f97d 100644 --- a/src/entities/swap/swaps/v2/index.ts +++ b/src/entities/swap/swaps/v2/index.ts @@ -10,6 +10,7 @@ import { NATIVE_ASSETS, ChainId, MAX_UINT256, + CHAINS, } from '../../../../utils'; import { Address, @@ -93,7 +94,8 @@ export class SwapV2 implements SwapBase { block?: bigint, ): Promise { const client = createPublicClient({ - transport: http(rpcUrl), + chain: CHAINS[this.chainId], + transport: rpcUrl ? http(rpcUrl) : http(), }); const queriesContract = getContract({ diff --git a/src/entities/swap/swaps/v3/index.ts b/src/entities/swap/swaps/v3/index.ts index 0aae196c..3138a4b6 100644 --- a/src/entities/swap/swaps/v3/index.ts +++ b/src/entities/swap/swaps/v3/index.ts @@ -13,6 +13,7 @@ import { NATIVE_ASSETS, BALANCER_BATCH_ROUTER, MAX_UINT256, + CHAINS, } from '../../../../utils'; import { balancerRouterAbi } from '../../../../abi'; import { @@ -88,7 +89,8 @@ export class SwapV3 implements SwapBase { block?: bigint, ): Promise { const client = createPublicClient({ - transport: http(rpcUrl), + chain: CHAINS[this.chainId], + transport: rpcUrl ? http(rpcUrl) : http(), }); return this.isBatchSwap From bd7794bda8ce8a7cfb056f1d821d90c07c3f878e Mon Sep 17 00:00:00 2001 From: Bruno Eidam Guerios Date: Fri, 31 May 2024 16:33:08 -0300 Subject: [PATCH 14/15] Fix lint issue --- examples/addLiquidity/addLiquidity.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/addLiquidity/addLiquidity.ts b/examples/addLiquidity/addLiquidity.ts index e6e608d7..9d2b06a8 100644 --- a/examples/addLiquidity/addLiquidity.ts +++ b/examples/addLiquidity/addLiquidity.ts @@ -14,7 +14,6 @@ import { ChainId, PriceImpact, Slippage, - OnChainProvider, } from '../../src'; import { ANVIL_NETWORKS, startFork } from '../../test/anvil/anvil-global-setup'; import { makeForkTx } from '../lib/makeForkTx'; From d81de7377b4484e1a3f140ac0e1d96f0eeb015a8 Mon Sep 17 00:00:00 2001 From: Bruno Eidam Guerios Date: Mon, 3 Jun 2024 13:33:56 -0300 Subject: [PATCH 15/15] Add changeset --- .changeset/popular-carpets-explain.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/popular-carpets-explain.md diff --git a/.changeset/popular-carpets-explain.md b/.changeset/popular-carpets-explain.md new file mode 100644 index 00000000..a5a25f2b --- /dev/null +++ b/.changeset/popular-carpets-explain.md @@ -0,0 +1,5 @@ +--- +"@balancer/sdk": minor +--- + +Update SDK to use Permit2 and conform with new SC deployment