From e893fab7a626acbacb850cf5af4e962565ad4cac Mon Sep 17 00:00:00 2001 From: mendesfabio Date: Tue, 21 Jan 2025 21:49:31 -0300 Subject: [PATCH 1/7] update subgraphs manifests --- subgraphs/v3-vault/subgraph.gnosis.yaml | 37 ++++++++++++++++++++++++ subgraphs/v3-vault/subgraph.sepolia.yaml | 37 ++++++++++++++++++++++++ subgraphs/v3-vault/subgraph.yaml | 37 ++++++++++++++++++++++++ 3 files changed, 111 insertions(+) diff --git a/subgraphs/v3-vault/subgraph.gnosis.yaml b/subgraphs/v3-vault/subgraph.gnosis.yaml index c8bab12..0d1c5e8 100644 --- a/subgraphs/v3-vault/subgraph.gnosis.yaml +++ b/subgraphs/v3-vault/subgraph.gnosis.yaml @@ -45,6 +45,43 @@ dataSources: - event: Unwrap(indexed address,uint256,uint256,bytes32) handler: handleUnwrap file: ./src/mappings/vault.ts + - kind: ethereum + name: ProtocolFeeController + network: gnosis + source: + abi: ProtocolFeeController + address: "0xa731C23D7c95436Baaae9D52782f966E1ed07cc8" + startBlock: 37360338 + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - Vault + - Pool + abis: + - name: ProtocolFeeController + file: ./abis/ProtocolFeeController.json + eventHandlers: + - event: GlobalProtocolSwapFeePercentageChanged(uint256) + handler: handleGlobalProtocolSwapFeePercentageChanged + - event: GlobalProtocolYieldFeePercentageChanged(uint256) + handler: handleGlobalProtocolYieldFeePercentageChanged + - event: ProtocolSwapFeePercentageChanged(indexed address,uint256) + handler: handleProtocolSwapFeePercentageChanged + - event: ProtocolYieldFeePercentageChanged(indexed address,uint256) + handler: handleProtocolYieldFeePercentageChanged + - event: PoolCreatorSwapFeePercentageChanged(indexed address,uint256) + handler: handlePoolCreatorSwapFeePercentageChanged + - event: PoolCreatorYieldFeePercentageChanged(indexed address,uint256) + handler: handlePoolCreatorYieldFeePercentageChanged + - event: ProtocolSwapFeeCollected(indexed address,indexed address,uint256) + handler: handleProtocolSwapFeeCollected + - event: ProtocolYieldFeeCollected(indexed address,indexed address,uint256) + handler: handleProtocolYieldFeeCollected + - event: ProtocolFeesWithdrawn(indexed address,indexed address,indexed address,uint256) + handler: handleProtocolFeesWithdrawn + file: ./src/mappings/controller.ts templates: - kind: ethereum/contract name: BPT diff --git a/subgraphs/v3-vault/subgraph.sepolia.yaml b/subgraphs/v3-vault/subgraph.sepolia.yaml index 4545380..1efebab 100644 --- a/subgraphs/v3-vault/subgraph.sepolia.yaml +++ b/subgraphs/v3-vault/subgraph.sepolia.yaml @@ -45,6 +45,43 @@ dataSources: - event: Unwrap(indexed address,uint256,uint256,bytes32) handler: handleUnwrap file: ./src/mappings/vault.ts + - kind: ethereum + name: ProtocolFeeController + network: sepolia + source: + abi: ProtocolFeeController + address: "0xa731C23D7c95436Baaae9D52782f966E1ed07cc8" + startBlock: 7212247 + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - Vault + - Pool + abis: + - name: ProtocolFeeController + file: ./abis/ProtocolFeeController.json + eventHandlers: + - event: GlobalProtocolSwapFeePercentageChanged(uint256) + handler: handleGlobalProtocolSwapFeePercentageChanged + - event: GlobalProtocolYieldFeePercentageChanged(uint256) + handler: handleGlobalProtocolYieldFeePercentageChanged + - event: ProtocolSwapFeePercentageChanged(indexed address,uint256) + handler: handleProtocolSwapFeePercentageChanged + - event: ProtocolYieldFeePercentageChanged(indexed address,uint256) + handler: handleProtocolYieldFeePercentageChanged + - event: PoolCreatorSwapFeePercentageChanged(indexed address,uint256) + handler: handlePoolCreatorSwapFeePercentageChanged + - event: PoolCreatorYieldFeePercentageChanged(indexed address,uint256) + handler: handlePoolCreatorYieldFeePercentageChanged + - event: ProtocolSwapFeeCollected(indexed address,indexed address,uint256) + handler: handleProtocolSwapFeeCollected + - event: ProtocolYieldFeeCollected(indexed address,indexed address,uint256) + handler: handleProtocolYieldFeeCollected + - event: ProtocolFeesWithdrawn(indexed address,indexed address,indexed address,uint256) + handler: handleProtocolFeesWithdrawn + file: ./src/mappings/controller.ts templates: - kind: ethereum/contract name: BPT diff --git a/subgraphs/v3-vault/subgraph.yaml b/subgraphs/v3-vault/subgraph.yaml index bfeb75a..c5a345e 100644 --- a/subgraphs/v3-vault/subgraph.yaml +++ b/subgraphs/v3-vault/subgraph.yaml @@ -45,6 +45,43 @@ dataSources: - event: Unwrap(indexed address,uint256,uint256,bytes32) handler: handleUnwrap file: ./src/mappings/vault.ts + - kind: ethereum + name: ProtocolFeeController + network: mainnet + source: + abi: ProtocolFeeController + address: "0xa731C23D7c95436Baaae9D52782f966E1ed07cc8" + startBlock: 21332121 + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - Vault + - Pool + abis: + - name: ProtocolFeeController + file: ./abis/ProtocolFeeController.json + eventHandlers: + - event: GlobalProtocolSwapFeePercentageChanged(uint256) + handler: handleGlobalProtocolSwapFeePercentageChanged + - event: GlobalProtocolYieldFeePercentageChanged(uint256) + handler: handleGlobalProtocolYieldFeePercentageChanged + - event: ProtocolSwapFeePercentageChanged(indexed address,uint256) + handler: handleProtocolSwapFeePercentageChanged + - event: ProtocolYieldFeePercentageChanged(indexed address,uint256) + handler: handleProtocolYieldFeePercentageChanged + - event: PoolCreatorSwapFeePercentageChanged(indexed address,uint256) + handler: handlePoolCreatorSwapFeePercentageChanged + - event: PoolCreatorYieldFeePercentageChanged(indexed address,uint256) + handler: handlePoolCreatorYieldFeePercentageChanged + - event: ProtocolSwapFeeCollected(indexed address,indexed address,uint256) + handler: handleProtocolSwapFeeCollected + - event: ProtocolYieldFeeCollected(indexed address,indexed address,uint256) + handler: handleProtocolYieldFeeCollected + - event: ProtocolFeesWithdrawn(indexed address,indexed address,indexed address,uint256) + handler: handleProtocolFeesWithdrawn + file: ./src/mappings/controller.ts templates: - kind: ethereum/contract name: BPT From 8e29ce14a111cb9d5d2d84edfe646a9153fb8487 Mon Sep 17 00:00:00 2001 From: mendesfabio Date: Tue, 21 Jan 2025 21:54:34 -0300 Subject: [PATCH 2/7] fix generate v3 manifests --- scripts/generate-manifests.js | 2 +- subgraphs/v3-pools/template.yaml | 50 +++++++++++++++ subgraphs/v3-vault/template.yaml | 105 +++++++++++++++++++++++++++++++ 3 files changed, 156 insertions(+), 1 deletion(-) create mode 100644 subgraphs/v3-pools/template.yaml create mode 100644 subgraphs/v3-vault/template.yaml diff --git a/scripts/generate-manifests.js b/scripts/generate-manifests.js index 5ab57bf..b125957 100644 --- a/scripts/generate-manifests.js +++ b/scripts/generate-manifests.js @@ -27,7 +27,7 @@ function replacePlaceholders(template, network, networkData) { Object.entries(networksData).forEach(([network, networkData]) => { const config = replacePlaceholders(template, network, networkData); - const outputPath = path.join('subgraphs', subgraph, `subgraph.${network}.yaml`); + const outputPath = path.join('subgraphs', subgraph, `subgraph${network === 'mainnet' ? '' : `.${network}`}.yaml`); fs.writeFileSync(outputPath, config); console.log(`Generated ${outputPath}`); }); diff --git a/subgraphs/v3-pools/template.yaml b/subgraphs/v3-pools/template.yaml new file mode 100644 index 0000000..d717f6a --- /dev/null +++ b/subgraphs/v3-pools/template.yaml @@ -0,0 +1,50 @@ +specVersion: 1.0.0 +schema: + file: ./schema.graphql +dataSources: + - kind: ethereum + name: WeightedPoolFactory + network: {{ network }} + source: + abi: BasePoolFactory + address: "{{ WeightedPoolFactory.address }}" + startBlock: {{ WeightedPoolFactory.startBlock }} + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - Factory + - Pool + abis: + - name: WeightedPool + file: ./abis/WeightedPool.json + - name: BasePoolFactory + file: ./abis/BasePoolFactory.json + eventHandlers: + - event: PoolCreated(indexed address) + handler: handleWeightedPoolCreated + file: ./src/mappings/weighted.ts + - kind: ethereum + name: StablePoolFactory + network: {{ network }} + source: + abi: BasePoolFactory + address: "{{ StablePoolFactory.address }}" + startBlock: {{ StablePoolFactory.startBlock }} + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - Factory + - Pool + abis: + - name: StablePool + file: ./abis/StablePool.json + - name: BasePoolFactory + file: ./abis/BasePoolFactory.json + eventHandlers: + - event: PoolCreated(indexed address) + handler: handleStablePoolCreated + file: ./src/mappings/stable.ts diff --git a/subgraphs/v3-vault/template.yaml b/subgraphs/v3-vault/template.yaml new file mode 100644 index 0000000..7bc3ae7 --- /dev/null +++ b/subgraphs/v3-vault/template.yaml @@ -0,0 +1,105 @@ +specVersion: 1.0.0 +schema: + file: ./schema.graphql +dataSources: + - kind: ethereum + name: Vault + network: {{ network }} + source: + abi: Vault + address: "{{ Vault.address }}" + startBlock: {{ Vault.startBlock }} + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - Vault + - Pool + abis: + - name: ERC20 + file: ./abis/ERC20.json + - name: ERC4626 + file: ./abis/ERC4626.json + - name: Vault + file: ./abis/Vault.json + - name: VaultExtension + file: ./abis/VaultExtension.json + - name: ProtocolFeeController + file: ./abis/ProtocolFeeController.json + eventHandlers: + - event: PoolRegistered(indexed address,indexed address,(address,uint8,address,bool)[],uint256,uint32,(address,address,address),(bool,bool,bool,bool,bool,bool,bool,bool,bool,bool,address),(bool,bool,bool,bool)) + handler: handlePoolRegistered + - event: LiquidityAdded(indexed address,indexed address,indexed uint8,uint256,uint256[],uint256[]) + handler: handleLiquidityAdded + - event: LiquidityRemoved(indexed address,indexed address,indexed uint8,uint256,uint256[],uint256[]) + handler: handleLiquidityRemoved + - event: Swap(indexed address,indexed address,indexed address,uint256,uint256,uint256,uint256) + handler: handleSwap + - event: LiquidityAddedToBuffer(indexed address,uint256,uint256,bytes32) + handler: handleLiquidityAddedToBuffer + - event: LiquidityRemovedFromBuffer(indexed address,uint256,uint256,bytes32) + handler: handleLiquidityRemovedFromBuffer + - event: Wrap(indexed address,uint256,uint256,bytes32) + handler: handleWrap + - event: Unwrap(indexed address,uint256,uint256,bytes32) + handler: handleUnwrap + file: ./src/mappings/vault.ts + + - kind: ethereum + name: ProtocolFeeController + network: {{ network }} + source: + abi: ProtocolFeeController + address: "{{ ProtocolFeeController.address }}" + startBlock: {{ ProtocolFeeController.startBlock }} + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - Vault + - Pool + abis: + - name: ProtocolFeeController + file: ./abis/ProtocolFeeController.json + eventHandlers: + - event: GlobalProtocolSwapFeePercentageChanged(uint256) + handler: handleGlobalProtocolSwapFeePercentageChanged + - event: GlobalProtocolYieldFeePercentageChanged(uint256) + handler: handleGlobalProtocolYieldFeePercentageChanged + - event: ProtocolSwapFeePercentageChanged(indexed address,uint256) + handler: handleProtocolSwapFeePercentageChanged + - event: ProtocolYieldFeePercentageChanged(indexed address,uint256) + handler: handleProtocolYieldFeePercentageChanged + - event: PoolCreatorSwapFeePercentageChanged(indexed address,uint256) + handler: handlePoolCreatorSwapFeePercentageChanged + - event: PoolCreatorYieldFeePercentageChanged(indexed address,uint256) + handler: handlePoolCreatorYieldFeePercentageChanged + - event: ProtocolSwapFeeCollected(indexed address,indexed address,uint256) + handler: handleProtocolSwapFeeCollected + - event: ProtocolYieldFeeCollected(indexed address,indexed address,uint256) + handler: handleProtocolYieldFeeCollected + - event: ProtocolFeesWithdrawn(indexed address,indexed address,indexed address,uint256) + handler: handleProtocolFeesWithdrawn + file: ./src/mappings/controller.ts + +templates: + - kind: ethereum/contract + name: BPT + network: {{ network }} + source: + abi: BPT + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - PoolShare + abis: + - name: BPT + file: ./abis/ERC20.json + eventHandlers: + - event: Transfer(indexed address,indexed address,uint256) + handler: handleTransfer + file: ./src/mappings/bpt.ts From 7c15660433a04a17c58a64f0a7ba3fca3ec45a59 Mon Sep 17 00:00:00 2001 From: mendesfabio Date: Tue, 21 Jan 2025 21:55:37 -0300 Subject: [PATCH 3/7] add vault admin abi --- subgraphs/v3-vault/abis/VaultAdmin.json | 2305 +++++++++++++++++++++++ 1 file changed, 2305 insertions(+) create mode 100644 subgraphs/v3-vault/abis/VaultAdmin.json diff --git a/subgraphs/v3-vault/abis/VaultAdmin.json b/subgraphs/v3-vault/abis/VaultAdmin.json new file mode 100644 index 0000000..e12921e --- /dev/null +++ b/subgraphs/v3-vault/abis/VaultAdmin.json @@ -0,0 +1,2305 @@ +[ + { + "inputs": [ + { + "internalType": "contract IVault", + "name": "mainVault", + "type": "address" + }, + { + "internalType": "uint32", + "name": "pauseWindowDuration", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "bufferPeriodDuration", + "type": "uint32" + }, + { + "internalType": "uint256", + "name": "minTradeAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minWrapAmount", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "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": "tokenIn", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amountIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxAmountIn", + "type": "uint256" + } + ], + "name": "AmountInAboveMax", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "tokenOut", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amountOut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minAmountOut", + "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": "amountIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxAmountIn", + "type": "uint256" + } + ], + "name": "BptAmountInAboveMax", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountOut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minAmountOut", + "type": "uint256" + } + ], + "name": "BptAmountOutBelowMin", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "contract IERC4626", + "name": "wrappedToken", + "type": "address" + } + ], + "name": "BufferAlreadyInitialized", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "contract IERC4626", + "name": "wrappedToken", + "type": "address" + } + ], + "name": "BufferNotInitialized", + "type": "error" + }, + { + "inputs": [], + "name": "BufferSharesInvalidOwner", + "type": "error" + }, + { + "inputs": [], + "name": "BufferSharesInvalidReceiver", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + } + ], + "name": "BufferTotalSupplyTooLow", + "type": "error" + }, + { + "inputs": [], + "name": "CannotReceiveEth", + "type": "error" + }, + { + "inputs": [], + "name": "CannotSwapSameToken", + "type": "error" + }, + { + "inputs": [], + "name": "CodecOverflow", + "type": "error" + }, + { + "inputs": [], + "name": "DoesNotSupportAddLiquidityCustom", + "type": "error" + }, + { + "inputs": [], + "name": "DoesNotSupportDonation", + "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": "FeePrecisionTooHigh", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "tokenIn", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amountIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxAmountIn", + "type": "uint256" + } + ], + "name": "HookAdjustedAmountInAboveMax", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "tokenOut", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amountOut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minAmountOut", + "type": "uint256" + } + ], + "name": "HookAdjustedAmountOutBelowMin", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "limit", + "type": "uint256" + } + ], + "name": "HookAdjustedSwapLimit", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "poolHooksContract", + "type": "address" + }, + { + "internalType": "address", + "name": "pool", + "type": "address" + }, + { + "internalType": "address", + "name": "poolFactory", + "type": "address" + } + ], + "name": "HookRegistrationFailed", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidAddLiquidityKind", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidRemoveLiquidityKind", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidToken", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidTokenConfiguration", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidTokenDecimals", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidTokenType", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "contract IERC4626", + "name": "wrappedToken", + "type": "address" + } + ], + "name": "InvalidUnderlyingToken", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "issuedShares", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minIssuedShares", + "type": "uint256" + } + ], + "name": "IssuedSharesBelowMin", + "type": "error" + }, + { + "inputs": [], + "name": "MaxTokens", + "type": "error" + }, + { + "inputs": [], + "name": "MinTokens", + "type": "error" + }, + { + "inputs": [], + "name": "NotEnoughBufferShares", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "contract IERC4626", + "name": "wrappedToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "expectedUnderlyingAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "actualUnderlyingAmount", + "type": "uint256" + } + ], + "name": "NotEnoughUnderlying", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "contract IERC4626", + "name": "wrappedToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "expectedWrappedAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "actualWrappedAmount", + "type": "uint256" + } + ], + "name": "NotEnoughWrapped", + "type": "error" + }, + { + "inputs": [], + "name": "NotStaticCall", + "type": "error" + }, + { + "inputs": [], + "name": "NotVaultDelegateCall", + "type": "error" + }, + { + "inputs": [], + "name": "OutOfBounds", + "type": "error" + }, + { + "inputs": [], + "name": "PauseBufferPeriodDurationTooLarge", + "type": "error" + }, + { + "inputs": [], + "name": "PercentageAboveMax", + "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": [ + { + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + } + ], + "name": "PoolTotalSupplyTooLow", + "type": "error" + }, + { + "inputs": [], + "name": "ProtocolFeesExceedTotalCollected", + "type": "error" + }, + { + "inputs": [], + "name": "QueriesDisabled", + "type": "error" + }, + { + "inputs": [], + "name": "QueriesDisabledPermanently", + "type": "error" + }, + { + "inputs": [], + "name": "QuoteResultSpoofed", + "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": "sender", + "type": "address" + } + ], + "name": "SenderIsNotVault", + "type": "error" + }, + { + "inputs": [], + "name": "SenderNotAllowed", + "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": [ + { + "internalType": "contract IERC20", + "name": "token", + "type": "address" + } + ], + "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": "TradeAmountTooSmall", + "type": "error" + }, + { + "inputs": [], + "name": "VaultBuffersArePaused", + "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": [ + { + "internalType": "contract IERC4626", + "name": "wrappedToken", + "type": "address" + } + ], + "name": "WrapAmountTooSmall", + "type": "error" + }, + { + "inputs": [], + "name": "WrongProtocolFeeControllerDeployment", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "contract IERC4626", + "name": "wrappedToken", + "type": "address" + }, + { + "internalType": "address", + "name": "underlyingToken", + "type": "address" + } + ], + "name": "WrongUnderlyingToken", + "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": false, + "internalType": "uint256", + "name": "aggregateSwapFeePercentage", + "type": "uint256" + } + ], + "name": "AggregateSwapFeePercentageChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "pool", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "aggregateYieldFeePercentage", + "type": "uint256" + } + ], + "name": "AggregateYieldFeePercentageChanged", + "type": "event" + }, + { + "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": "contract IERC4626", + "name": "wrappedToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "burnedShares", + "type": "uint256" + } + ], + "name": "BufferSharesBurned", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract IERC4626", + "name": "wrappedToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "issuedShares", + "type": "uint256" + } + ], + "name": "BufferSharesMinted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "pool", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "liquidityProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "enum AddLiquidityKind", + "name": "kind", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "amountsAddedRaw", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "swapFeeAmountsRaw", + "type": "uint256[]" + } + ], + "name": "LiquidityAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract IERC4626", + "name": "wrappedToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountUnderlying", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountWrapped", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "bufferBalances", + "type": "bytes32" + } + ], + "name": "LiquidityAddedToBuffer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "pool", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "liquidityProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "enum RemoveLiquidityKind", + "name": "kind", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "amountsRemovedRaw", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "swapFeeAmountsRaw", + "type": "uint256[]" + } + ], + "name": "LiquidityRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract IERC4626", + "name": "wrappedToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountUnderlying", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountWrapped", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "bufferBalances", + "type": "bytes32" + } + ], + "name": "LiquidityRemovedFromBuffer", + "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": "swapFeePercentage", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "pauseWindowEndTime", + "type": "uint32" + }, + { + "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": "enableHookAdjustedAmounts", + "type": "bool" + }, + { + "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": "address", + "name": "hooksContract", + "type": "address" + } + ], + "indexed": false, + "internalType": "struct HooksConfig", + "name": "hooksConfig", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "disableUnbalancedLiquidity", + "type": "bool" + }, + { + "internalType": "bool", + "name": "enableAddLiquidityCustom", + "type": "bool" + }, + { + "internalType": "bool", + "name": "enableRemoveLiquidityCustom", + "type": "bool" + }, + { + "internalType": "bool", + "name": "enableDonation", + "type": "bool" + } + ], + "indexed": false, + "internalType": "struct LiquidityManagement", + "name": "liquidityManagement", + "type": "tuple" + } + ], + "name": "PoolRegistered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract IProtocolFeeController", + "name": "newProtocolFeeController", + "type": "address" + } + ], + "name": "ProtocolFeeControllerChanged", + "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" + } + ], + "name": "Swap", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "pool", + "type": "address" + }, + { + "indexed": false, + "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": true, + "internalType": "contract IERC4626", + "name": "wrappedToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "burnedShares", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "withdrawnUnderlying", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "bufferBalances", + "type": "bytes32" + } + ], + "name": "Unwrap", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "pool", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "eventKey", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "eventData", + "type": "bytes" + } + ], + "name": "VaultAuxiliary", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bool", + "name": "paused", + "type": "bool" + } + ], + "name": "VaultBuffersPausedStateChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bool", + "name": "paused", + "type": "bool" + } + ], + "name": "VaultPausedStateChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "VaultQueriesDisabled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "VaultQueriesEnabled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract IERC4626", + "name": "wrappedToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "depositedUnderlying", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintedShares", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "bufferBalances", + "type": "bytes32" + } + ], + "name": "Wrap", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [ + { + "internalType": "contract IERC4626", + "name": "wrappedToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "maxAmountUnderlyingInRaw", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxAmountWrappedInRaw", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "exactSharesToIssue", + "type": "uint256" + }, + { + "internalType": "address", + "name": "sharesOwner", + "type": "address" + } + ], + "name": "addLiquidityToBuffer", + "outputs": [ + { + "internalType": "uint256", + "name": "amountUnderlyingRaw", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountWrappedRaw", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "areBuffersPaused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "pool", + "type": "address" + } + ], + "name": "collectAggregateFees", + "outputs": [ + { + "internalType": "uint256[]", + "name": "totalSwapFees", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "totalYieldFees", + "type": "uint256[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "disableQuery", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "disableQueryPermanently", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "pool", + "type": "address" + } + ], + "name": "disableRecoveryMode", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "enableQuery", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "pool", + "type": "address" + } + ], + "name": "enableRecoveryMode", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "selector", + "type": "bytes4" + } + ], + "name": "getActionId", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC4626", + "name": "wrappedToken", + "type": "address" + } + ], + "name": "getBufferAsset", + "outputs": [ + { + "internalType": "address", + "name": "underlyingToken", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC4626", + "name": "token", + "type": "address" + } + ], + "name": "getBufferBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getBufferMinimumTotalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC4626", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "getBufferOwnerShares", + "outputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getBufferPeriodDuration", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getBufferPeriodEndTime", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC4626", + "name": "token", + "type": "address" + } + ], + "name": "getBufferTotalShares", + "outputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMaximumPoolTokens", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "getMinimumPoolTokens", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "getMinimumTradeAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMinimumWrapAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPauseWindowEndTime", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPoolMinimumTotalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "getVaultPausedState", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + }, + { + "internalType": "uint32", + "name": "", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC4626", + "name": "wrappedToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amountUnderlyingRaw", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountWrappedRaw", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minIssuedShares", + "type": "uint256" + }, + { + "internalType": "address", + "name": "sharesOwner", + "type": "address" + } + ], + "name": "initializeBuffer", + "outputs": [ + { + "internalType": "uint256", + "name": "issuedShares", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "isVaultPaused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "pool", + "type": "address" + } + ], + "name": "pausePool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "pauseVault", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "pauseVaultBuffers", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "reentrancyGuardEntered", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC4626", + "name": "wrappedToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "sharesToRemove", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minAmountUnderlyingOutRaw", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minAmountWrappedOutRaw", + "type": "uint256" + } + ], + "name": "removeLiquidityFromBuffer", + "outputs": [ + { + "internalType": "uint256", + "name": "removedUnderlyingBalanceRaw", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "removedWrappedBalanceRaw", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC4626", + "name": "wrappedToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "sharesToRemove", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minAmountUnderlyingOutRaw", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minAmountWrappedOutRaw", + "type": "uint256" + }, + { + "internalType": "address", + "name": "sharesOwner", + "type": "address" + } + ], + "name": "removeLiquidityFromBufferHook", + "outputs": [ + { + "internalType": "uint256", + "name": "removedUnderlyingBalanceRaw", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "removedWrappedBalanceRaw", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IAuthorizer", + "name": "newAuthorizer", + "type": "address" + } + ], + "name": "setAuthorizer", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IProtocolFeeController", + "name": "newProtocolFeeController", + "type": "address" + } + ], + "name": "setProtocolFeeController", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "pool", + "type": "address" + }, + { + "internalType": "uint256", + "name": "swapFeePercentage", + "type": "uint256" + } + ], + "name": "setStaticSwapFeePercentage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "pool", + "type": "address" + } + ], + "name": "unpausePool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "unpauseVault", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "unpauseVaultBuffers", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "pool", + "type": "address" + }, + { + "internalType": "uint256", + "name": "newAggregateSwapFeePercentage", + "type": "uint256" + } + ], + "name": "updateAggregateSwapFeePercentage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "pool", + "type": "address" + }, + { + "internalType": "uint256", + "name": "newAggregateYieldFeePercentage", + "type": "uint256" + } + ], + "name": "updateAggregateYieldFeePercentage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "vault", + "outputs": [ + { + "internalType": "contract IVault", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } +] From f5e70adc1ffbca3431ce20337f3b8f6f6887fb16 Mon Sep 17 00:00:00 2001 From: mendesfabio Date: Tue, 21 Jan 2025 21:56:04 -0300 Subject: [PATCH 4/7] update v3 addresses --- networks.json | 52 +++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 46 insertions(+), 6 deletions(-) diff --git a/networks.json b/networks.json index 34b4bb2..833cc31 100644 --- a/networks.json +++ b/networks.json @@ -1,16 +1,56 @@ { + "mainnet": { + "Vault": { + "address": "0xbA1333333333a1BA1108E8412f11850A5C319bA9", + "startBlock": 21332121 + }, + "ProtocolFeeController": { + "address": "0xa731C23D7c95436Baaae9D52782f966E1ed07cc8", + "startBlock": 21332121 + }, + "WeightedPoolFactory": { + "address": "0x201efd508c8DfE9DE1a13c2452863A78CB2a86Cc", + "startBlock": 21336937 + }, + "StablePoolFactory": { + "address": "0xB9d01CA61b9C181dA1051bFDd28e1097e920AB14", + "startBlock": 21337005 + } + }, + "gnosis": { + "Vault": { + "address": "0xbA1333333333a1BA1108E8412f11850A5C319bA9", + "startBlock": 37360338 + }, + "ProtocolFeeController": { + "address": "0xa731C23D7c95436Baaae9D52782f966E1ed07cc8", + "startBlock": 37360338 + }, + "WeightedPoolFactory": { + "address": "0xEB1eeaBF0126d813589C3D2CfeFFE410D9aE3863", + "startBlock": 37371691 + }, + "StablePoolFactory": { + "address": "0x22625eEDd92c81a219A83e1dc48f88d54786B017", + "startBlock": 37371860 + } + }, "sepolia": { "Vault": { - "address": "0x68aD967ae8393B722EC69dB1018Ec28AF9A34493", - "startBlock": 6924029 + "address": "0xbA1333333333a1BA1108E8412f11850A5C319bA9", + "startBlock": 7212247 + }, + "ProtocolFeeController": { + "address": "0xa731C23D7c95436Baaae9D52782f966E1ed07cc8", + "startBlock": 7212247 }, "WeightedPoolFactory": { - "address": "0x4F12F60148F98aD920b99e844807F0e245f2AE58", - "startBlock": 6924094 + "address": "0x7532d5a3bE916e4a4D900240F49F0BABd4FD855C", + "startBlock": 7216947 }, "StablePoolFactory": { - "address": "0xD895059a81711e4955823ED2C0755F204A86E5DA", - "startBlock": 6924116 + "address": "0xd67F485C07D258B3e93835a3799d862ffcB55923", + "startBlock": 7217020 } } } From a5ce4b818de8471ec78b7a73e72cbace91f4dfda Mon Sep 17 00:00:00 2001 From: mendesfabio Date: Tue, 21 Jan 2025 21:57:21 -0300 Subject: [PATCH 5/7] fix protocol fee amounts --- subgraphs/v3-vault/schema.graphql | 6 ++ subgraphs/v3-vault/src/helpers/constants.ts | 4 ++ subgraphs/v3-vault/src/helpers/entities.ts | 53 ++++++++------- subgraphs/v3-vault/src/helpers/math.ts | 17 +++++ ...protocolFeeController.ts => controller.ts} | 49 ++++++++++++-- subgraphs/v3-vault/src/mappings/vault.ts | 64 +++++++++++++++---- 6 files changed, 148 insertions(+), 45 deletions(-) create mode 100644 subgraphs/v3-vault/src/helpers/math.ts rename subgraphs/v3-vault/src/mappings/{protocolFeeController.ts => controller.ts} (58%) diff --git a/subgraphs/v3-vault/schema.graphql b/subgraphs/v3-vault/schema.graphql index 80430ef..6132ae6 100644 --- a/subgraphs/v3-vault/schema.graphql +++ b/subgraphs/v3-vault/schema.graphql @@ -167,6 +167,12 @@ type PoolToken @entity { totalProtocolYieldFee: BigDecimal! "Indicates whether this token pays yield fees" paysYieldFees: Boolean! + "Protocol fees available for withdrawal from the Controlller" + controllerProtocolFeeBalance: BigDecimal! + "Protocol swap fees pending collection in the Vault" + vaultProtocolSwapFeeBalance: BigDecimal! + "Protocol yield fees pending collection in the Vault" + vaultProtocolYieldFeeBalance: BigDecimal! } type Token @entity { diff --git a/subgraphs/v3-vault/src/helpers/constants.ts b/subgraphs/v3-vault/src/helpers/constants.ts index 849c9cb..52ae9bc 100644 --- a/subgraphs/v3-vault/src/helpers/constants.ts +++ b/subgraphs/v3-vault/src/helpers/constants.ts @@ -7,3 +7,7 @@ export const ONE_BD = BigDecimal.fromString("1"); export const ZERO_ADDRESS = Address.fromString( "0x0000000000000000000000000000000000000000" ); + +export const VAULT_ADDRESS = Address.fromString( + "0xbA1333333333a1BA1108E8412f11850A5C319bA9" +); diff --git a/subgraphs/v3-vault/src/helpers/entities.ts b/subgraphs/v3-vault/src/helpers/entities.ts index 41a5293..f3b3151 100644 --- a/subgraphs/v3-vault/src/helpers/entities.ts +++ b/subgraphs/v3-vault/src/helpers/entities.ts @@ -10,7 +10,7 @@ import { Vault, } from "../types/schema"; import { PoolShare } from "../types/schema"; -import { ONE_BD, ZERO_ADDRESS, ZERO_BD } from "./constants"; +import { ONE_BD, VAULT_ADDRESS, ZERO_ADDRESS, ZERO_BD } from "./constants"; import { PoolRegisteredTokenConfigStruct } from "../types/Vault/Vault"; import { ERC20 } from "../types/Vault/ERC20"; import { VaultExtension } from "../types/Vault/VaultExtension"; @@ -18,14 +18,14 @@ import { scaleDown } from "./misc"; const DAY = 24 * 60 * 60; -export function getVault(vaultAddress: Bytes): Vault { - let vault: Vault | null = Vault.load(vaultAddress); +export function getVault(): Vault { + let vault: Vault | null = Vault.load(VAULT_ADDRESS); if (vault != null) return vault; - let vaultContract = VaultExtension.bind(changetype
(vaultAddress)); + let vaultContract = VaultExtension.bind(changetype
(VAULT_ADDRESS)); let protocolFeeControllerCall = vaultContract.try_getProtocolFeeController(); - vault = new Vault(vaultAddress); + vault = new Vault(VAULT_ADDRESS); vault.isPaused = false; vault.authorizer = ZERO_ADDRESS; vault.protocolSwapFee = ZERO_BD; @@ -131,6 +131,9 @@ export function createPoolToken( poolToken.totalSwapFee = ZERO_BD; poolToken.totalProtocolSwapFee = ZERO_BD; poolToken.totalProtocolYieldFee = ZERO_BD; + poolToken.controllerProtocolFeeBalance = ZERO_BD; + poolToken.vaultProtocolSwapFeeBalance = ZERO_BD; + poolToken.vaultProtocolYieldFeeBalance = ZERO_BD; poolToken.buffer = buffer ? buffer.id : null; poolToken.nestedPool = nestedPool ? nestedPool.id : null; poolToken.paysYieldFees = tokenConfig.paysYieldFees; @@ -217,35 +220,31 @@ export function createPoolShare( return poolShare; } -export function updateProtocolFeeAmounts(pool: Pool): void { - let poolAddress = changetype
(pool.address); - let vaultAddress = changetype
(pool.vault); - let vault = VaultExtension.bind(vaultAddress); +export function updateProtocolYieldFeeAmounts(pool: Pool): void { + let vault = VaultExtension.bind(changetype
(pool.vault)); let poolTokens = pool.tokens.load(); for (let i = 0; i < poolTokens.length; i++) { let poolToken = poolTokens[i]; - let poolTokenAddress = changetype
(poolToken.address); - let swapFeeAmount = vault.try_getAggregateSwapFeeAmount( - poolAddress, - poolTokenAddress + if (!poolToken.paysYieldFees) continue; + + let aggregateYieldFee = vault.try_getAggregateYieldFeeAmount( + changetype
(pool.address), + changetype
(poolToken.address) ); - let yieldFeeAmount = vault.try_getAggregateYieldFeeAmount( - poolAddress, - poolTokenAddress + + if (aggregateYieldFee.reverted) continue; + + let yieldFeeAmount = scaleDown(aggregateYieldFee.value, poolToken.decimals); + let deltaYieldFee = yieldFeeAmount.minus( + poolToken.vaultProtocolYieldFeeBalance ); + poolToken.vaultProtocolYieldFeeBalance = yieldFeeAmount; + + poolToken.totalProtocolYieldFee = + poolToken.totalProtocolYieldFee.plus(deltaYieldFee); - if (!swapFeeAmount.reverted) { - poolToken.totalProtocolSwapFee = poolToken.totalProtocolSwapFee.plus( - scaleDown(swapFeeAmount.value, poolToken.decimals) - ); - } - - if (!yieldFeeAmount.reverted) { - poolToken.totalProtocolYieldFee = poolToken.totalProtocolYieldFee.plus( - scaleDown(yieldFeeAmount.value, poolToken.decimals) - ); - } + poolToken.save(); } } diff --git a/subgraphs/v3-vault/src/helpers/math.ts b/subgraphs/v3-vault/src/helpers/math.ts new file mode 100644 index 0000000..e4d6712 --- /dev/null +++ b/subgraphs/v3-vault/src/helpers/math.ts @@ -0,0 +1,17 @@ +import { BigDecimal, BigInt } from "@graphprotocol/graph-ts"; +import { scaleUp } from "./misc"; + +const ONE = BigInt.fromString("1000000000000000000"); + +export function mulDown(a: BigInt, b: BigInt): BigInt { + const product = a.times(b); + + return product.div(ONE); +} + +export function computeAggregateSwapFee( + swapFeeAmountRaw: BigInt, + swapFeePercentage: BigDecimal +): BigInt { + return mulDown(swapFeeAmountRaw, scaleUp(swapFeePercentage, 18)); +} diff --git a/subgraphs/v3-vault/src/mappings/protocolFeeController.ts b/subgraphs/v3-vault/src/mappings/controller.ts similarity index 58% rename from subgraphs/v3-vault/src/mappings/protocolFeeController.ts rename to subgraphs/v3-vault/src/mappings/controller.ts index 49ef842..82abea2 100644 --- a/subgraphs/v3-vault/src/mappings/protocolFeeController.ts +++ b/subgraphs/v3-vault/src/mappings/controller.ts @@ -1,6 +1,6 @@ import { Address } from "@graphprotocol/graph-ts"; -import { getVault } from "../helpers/entities"; +import { getVault, loadPoolToken } from "../helpers/entities"; import { Pool } from "../types/schema"; import { scaleDown } from "../helpers/misc"; import { @@ -8,18 +8,18 @@ import { GlobalProtocolYieldFeePercentageChanged, PoolCreatorSwapFeePercentageChanged, PoolCreatorYieldFeePercentageChanged, + ProtocolFeesWithdrawn, + ProtocolSwapFeeCollected, ProtocolSwapFeePercentageChanged, + ProtocolYieldFeeCollected, ProtocolYieldFeePercentageChanged, } from "../types/ProtocolFeeController/ProtocolFeeController"; - -const VAULT_ADDRESS = Address.fromString( - "0x68aD967ae8393B722EC69dB1018Ec28AF9A34493" -); +import { ZERO_BD } from "../helpers/constants"; export function handleGlobalProtocolSwapFeePercentageChanged( event: GlobalProtocolSwapFeePercentageChanged ): void { - let vault = getVault(VAULT_ADDRESS); + let vault = getVault(); vault.protocolSwapFee = scaleDown(event.params.swapFeePercentage, 18); vault.save(); } @@ -27,7 +27,7 @@ export function handleGlobalProtocolSwapFeePercentageChanged( export function handleGlobalProtocolYieldFeePercentageChanged( event: GlobalProtocolYieldFeePercentageChanged ): void { - let vault = getVault(VAULT_ADDRESS); + let vault = getVault(); vault.protocolYieldFee = scaleDown(event.params.yieldFeePercentage, 18); vault.save(); } @@ -69,3 +69,38 @@ export function handleProtocolYieldFeePercentageChanged( pool.protocolYieldFee = scaleDown(event.params.yieldFeePercentage, 18); pool.save(); } + +export function handleProtocolSwapFeeCollected( + event: ProtocolSwapFeeCollected +): void { + let poolToken = loadPoolToken(event.params.pool, event.params.token); + poolToken.vaultProtocolSwapFeeBalance = ZERO_BD; + poolToken.controllerProtocolFeeBalance = + poolToken.controllerProtocolFeeBalance.plus( + scaleDown(event.params.amount, poolToken.decimals) + ); + poolToken.save(); +} + +export function handleProtocolYieldFeeCollected( + event: ProtocolYieldFeeCollected +): void { + let poolToken = loadPoolToken(event.params.pool, event.params.token); + poolToken.vaultProtocolYieldFeeBalance = ZERO_BD; + poolToken.controllerProtocolFeeBalance = + poolToken.controllerProtocolFeeBalance.plus( + scaleDown(event.params.amount, poolToken.decimals) + ); + poolToken.save(); +} + +export function handleProtocolFeesWithdrawn( + event: ProtocolFeesWithdrawn +): void { + let poolToken = loadPoolToken(event.params.pool, event.params.token); + poolToken.controllerProtocolFeeBalance = + poolToken.controllerProtocolFeeBalance.minus( + scaleDown(event.params.amount, poolToken.decimals) + ); + poolToken.save(); +} diff --git a/subgraphs/v3-vault/src/mappings/vault.ts b/subgraphs/v3-vault/src/mappings/vault.ts index cfaa113..4fe136b 100644 --- a/subgraphs/v3-vault/src/mappings/vault.ts +++ b/subgraphs/v3-vault/src/mappings/vault.ts @@ -29,21 +29,22 @@ import { getToken, getVault, loadPoolToken, - updateProtocolFeeAmounts, + updateProtocolYieldFeeAmounts, } from "../helpers/entities"; import { ZERO_ADDRESS, ZERO_BD, ZERO_BI } from "../helpers/constants"; -import { hexToBigInt, scaleDown } from "../helpers/misc"; +import { hexToBigInt, scaleDown, scaleUp } from "../helpers/misc"; import { BPT } from "../types/templates"; import { ERC20 } from "../types/Vault/ERC20"; import { VaultExtension } from "../types/Vault/VaultExtension"; import { ERC4626 } from "../types/Vault/ERC4626"; +import { computeAggregateSwapFee } from "../helpers/math"; /************************************ ******* POOLS REGISTRATIONS ******** ************************************/ export function handlePoolRegistered(event: PoolRegistered): void { - let vault = getVault(event.address); + let vault = getVault(); let poolAddress = event.params.pool; let pool = new Pool(poolAddress); @@ -55,8 +56,8 @@ export function handlePoolRegistered(event: PoolRegistered): void { pool.isInitialized = false; pool.swapsCount = ZERO_BI; pool.holdersCount = ZERO_BI; - pool.protocolSwapFee = ZERO_BD; - pool.protocolYieldFee = ZERO_BD; + pool.protocolSwapFee = vault.protocolSwapFee; + pool.protocolYieldFee = vault.protocolYieldFee; pool.poolCreatorSwapFee = ZERO_BD; pool.poolCreatorYieldFee = ZERO_BD; @@ -148,7 +149,7 @@ export function handlePoolRegistered(event: PoolRegistered): void { export function handleLiquidityAdded(event: LiquidityAdded): void { let poolAddress = event.params.pool; - let amounts: BigInt[] = event.params.amountsAddedRaw; + let amountsAddedRaw = event.params.amountsAddedRaw; let transactionHash = event.transaction.hash; let logIndex = event.logIndex; @@ -169,7 +170,7 @@ export function handleLiquidityAdded(event: LiquidityAdded): void { let join = new AddRemove(joinId); let poolTokens = pool.tokens.load(); - let joinAmounts = new Array(amounts.length); + let joinAmounts = new Array(amountsAddedRaw.length); for (let i: i32 = 0; i < poolTokens.length; i++) { let poolToken = poolTokens[i]; @@ -177,8 +178,23 @@ export function handleLiquidityAdded(event: LiquidityAdded): void { event.params.amountsAddedRaw[i], poolToken.decimals ); - joinAmounts[i] = joinAmount; poolToken.balance = poolToken.balance.plus(joinAmount); + joinAmounts[i] = joinAmount; + + let aggregateSwapFeeAmount = scaleDown( + computeAggregateSwapFee( + event.params.swapFeeAmountsRaw[i], + pool.protocolSwapFee + ), + poolToken.decimals + ); + + poolToken.vaultProtocolSwapFeeBalance = + poolToken.vaultProtocolSwapFeeBalance.plus(aggregateSwapFeeAmount); + poolToken.totalProtocolSwapFee = poolToken.totalProtocolSwapFee.plus( + aggregateSwapFeeAmount + ); + poolToken.save(); } @@ -193,6 +209,7 @@ export function handleLiquidityAdded(event: LiquidityAdded): void { join.transactionHash = transactionHash; join.save(); + updateProtocolYieldFeeAmounts(pool); createPoolSnapshot(pool, event.block.timestamp.toI32()); } @@ -224,8 +241,23 @@ export function handleLiquidityRemoved(event: LiquidityRemoved): void { event.params.amountsRemovedRaw[i], poolToken.decimals ); - exitAmounts[i] = exitAmount; poolToken.balance = poolToken.balance.minus(exitAmount); + exitAmounts[i] = exitAmount; + + let aggregateSwapFeeAmount = scaleDown( + computeAggregateSwapFee( + event.params.swapFeeAmountsRaw[i], + pool.protocolSwapFee + ), + poolToken.decimals + ); + + poolToken.vaultProtocolSwapFeeBalance = + poolToken.vaultProtocolSwapFeeBalance.plus(aggregateSwapFeeAmount); + poolToken.totalProtocolSwapFee = poolToken.totalProtocolSwapFee.plus( + aggregateSwapFeeAmount + ); + poolToken.save(); } @@ -240,6 +272,7 @@ export function handleLiquidityRemoved(event: LiquidityRemoved): void { exit.transactionHash = transactionHash; exit.save(); + updateProtocolYieldFeeAmounts(pool); createPoolSnapshot(pool, event.block.timestamp.toI32()); } @@ -279,7 +312,6 @@ export function handleSwap(event: SwapEvent): void { swap.blockNumber = event.block.number; swap.blockTimestamp = event.block.timestamp; swap.transactionHash = event.transaction.hash; - swap.save(); let poolAddress = event.params.pool; @@ -309,10 +341,20 @@ export function handleSwap(event: SwapEvent): void { return; } + let aggregateSwapFeeAmount = scaleDown( + computeAggregateSwapFee(event.params.swapFeeAmount, pool.protocolSwapFee), + poolTokenIn.decimals + ); + let newInAmount = poolTokenIn.balance.plus(tokenAmountIn); poolTokenIn.balance = newInAmount; poolTokenIn.volume = poolTokenIn.volume.plus(tokenAmountIn); poolTokenIn.totalSwapFee = poolTokenIn.totalSwapFee.plus(swapFeeAmount); + poolTokenIn.vaultProtocolSwapFeeBalance = + poolTokenIn.vaultProtocolSwapFeeBalance.plus(aggregateSwapFeeAmount); + poolTokenIn.totalProtocolSwapFee = poolTokenIn.totalProtocolSwapFee.plus( + aggregateSwapFeeAmount + ); poolTokenIn.save(); let newOutAmount = poolTokenOut.balance.minus(tokenAmountOut); @@ -320,7 +362,7 @@ export function handleSwap(event: SwapEvent): void { poolTokenOut.volume = poolTokenOut.volume.plus(tokenAmountOut); poolTokenOut.save(); - updateProtocolFeeAmounts(pool); + updateProtocolYieldFeeAmounts(pool); createPoolSnapshot(pool, event.block.timestamp.toI32()); } From 578fc3bf768b9a7b68ed7f71ed2cc5deb41a0684 Mon Sep 17 00:00:00 2001 From: mendesfabio Date: Tue, 21 Jan 2025 21:59:41 -0300 Subject: [PATCH 6/7] add generated manifests --- subgraphs/v3-vault/subgraph.gnosis.yaml | 2 ++ subgraphs/v3-vault/subgraph.sepolia.yaml | 2 ++ subgraphs/v3-vault/subgraph.yaml | 2 ++ 3 files changed, 6 insertions(+) diff --git a/subgraphs/v3-vault/subgraph.gnosis.yaml b/subgraphs/v3-vault/subgraph.gnosis.yaml index 0d1c5e8..32b6a93 100644 --- a/subgraphs/v3-vault/subgraph.gnosis.yaml +++ b/subgraphs/v3-vault/subgraph.gnosis.yaml @@ -45,6 +45,7 @@ dataSources: - event: Unwrap(indexed address,uint256,uint256,bytes32) handler: handleUnwrap file: ./src/mappings/vault.ts + - kind: ethereum name: ProtocolFeeController network: gnosis @@ -82,6 +83,7 @@ dataSources: - event: ProtocolFeesWithdrawn(indexed address,indexed address,indexed address,uint256) handler: handleProtocolFeesWithdrawn file: ./src/mappings/controller.ts + templates: - kind: ethereum/contract name: BPT diff --git a/subgraphs/v3-vault/subgraph.sepolia.yaml b/subgraphs/v3-vault/subgraph.sepolia.yaml index 1efebab..51252f2 100644 --- a/subgraphs/v3-vault/subgraph.sepolia.yaml +++ b/subgraphs/v3-vault/subgraph.sepolia.yaml @@ -45,6 +45,7 @@ dataSources: - event: Unwrap(indexed address,uint256,uint256,bytes32) handler: handleUnwrap file: ./src/mappings/vault.ts + - kind: ethereum name: ProtocolFeeController network: sepolia @@ -82,6 +83,7 @@ dataSources: - event: ProtocolFeesWithdrawn(indexed address,indexed address,indexed address,uint256) handler: handleProtocolFeesWithdrawn file: ./src/mappings/controller.ts + templates: - kind: ethereum/contract name: BPT diff --git a/subgraphs/v3-vault/subgraph.yaml b/subgraphs/v3-vault/subgraph.yaml index c5a345e..17d5d8c 100644 --- a/subgraphs/v3-vault/subgraph.yaml +++ b/subgraphs/v3-vault/subgraph.yaml @@ -45,6 +45,7 @@ dataSources: - event: Unwrap(indexed address,uint256,uint256,bytes32) handler: handleUnwrap file: ./src/mappings/vault.ts + - kind: ethereum name: ProtocolFeeController network: mainnet @@ -82,6 +83,7 @@ dataSources: - event: ProtocolFeesWithdrawn(indexed address,indexed address,indexed address,uint256) handler: handleProtocolFeesWithdrawn file: ./src/mappings/controller.ts + templates: - kind: ethereum/contract name: BPT From 183b1380e588e3be43ad63bc6212f59983087561 Mon Sep 17 00:00:00 2001 From: mendesfabio Date: Tue, 21 Jan 2025 22:02:59 -0300 Subject: [PATCH 7/7] generate manifests before deployment --- .github/workflows/graph-pools.yml | 4 ++++ .github/workflows/graph-vault.yml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/.github/workflows/graph-pools.yml b/.github/workflows/graph-pools.yml index ce79db6..58e3d2c 100644 --- a/.github/workflows/graph-pools.yml +++ b/.github/workflows/graph-pools.yml @@ -21,6 +21,8 @@ jobs: version: 8 - name: Install dependencies run: pnpm install + - name: Generate manifests + run: pnpm generate-manifests - name: Graph Codegen working-directory: subgraphs/v3-pools run: pnpm codegen subgraph.yaml @@ -51,6 +53,8 @@ jobs: version: 8 - name: Install dependencies run: pnpm install + - name: Generate manifests + run: pnpm generate-manifests - name: Graph Codegen working-directory: subgraphs/v3-pools run: pnpm codegen subgraph.gnosis.yaml diff --git a/.github/workflows/graph-vault.yml b/.github/workflows/graph-vault.yml index 701d1c9..ae1e1c6 100644 --- a/.github/workflows/graph-vault.yml +++ b/.github/workflows/graph-vault.yml @@ -21,6 +21,8 @@ jobs: version: 8 - name: Install dependencies run: pnpm install + - name: Generate manifests + run: pnpm generate-manifests - name: Graph Codegen working-directory: subgraphs/v3-vault run: pnpm codegen subgraph.yaml @@ -51,6 +53,8 @@ jobs: version: 8 - name: Install dependencies run: pnpm install + - name: Generate manifests + run: pnpm generate-manifests - name: Graph Codegen working-directory: subgraphs/v3-vault run: pnpm codegen subgraph.gnosis.yaml