From 57c220a4d463bf585e539d9f66c4bc7b89b4260c Mon Sep 17 00:00:00 2001 From: andreiashu Date: Mon, 18 Mar 2024 14:52:37 +0700 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=8D=84=20Added=20support=20for=20mult?= =?UTF-8?q?iple=20FXPoolDeployers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- abis/FXPoolDeployerTracker.json | 134 ++++++++++++++++++++++++++++++++ manifest.template.yaml | 71 +++++++++++++++++ networks.yaml | 6 ++ src/mappings/poolFactory.ts | 6 ++ 4 files changed, 217 insertions(+) create mode 100644 abis/FXPoolDeployerTracker.json diff --git a/abis/FXPoolDeployerTracker.json b/abis/FXPoolDeployerTracker.json new file mode 100644 index 00000000..10d69200 --- /dev/null +++ b/abis/FXPoolDeployerTracker.json @@ -0,0 +1,134 @@ +[ + { + "type": "function", + "name": "broadcastNewDeployer", + "inputs": [ + { + "name": "_quoteToken", + "type": "address", + "internalType": "address" + }, + { + "name": "_deployer", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "fxPoolDeployers", + "inputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "owner", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "renounceOwnership", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setDeployer", + "inputs": [ + { + "name": "_quoteToken", + "type": "address", + "internalType": "address" + }, + { + "name": "_deployer", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "transferOwnership", + "inputs": [ + { + "name": "newOwner", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "event", + "name": "NewFXPoolDeployer", + "inputs": [ + { + "name": "quoteToken", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "deployer", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "caller", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "OwnershipTransferred", + "inputs": [ + { + "name": "previousOwner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "newOwner", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + } +] diff --git a/manifest.template.yaml b/manifest.template.yaml index 33341f8e..1d087815 100644 --- a/manifest.template.yaml +++ b/manifest.template.yaml @@ -1662,6 +1662,43 @@ dataSources: - event: NewFXPool(indexed address,indexed bytes32,indexed address) handler: handleNewFXPoolV1 {{/if}} + {{#if FXPoolDeployerTracker}} + - kind: ethereum/contract + name: FXPoolDeployerTracker + network: {{network}} + source: + address: '{{FXPoolDeployerTracker.address}}' + abi: FXPoolDeployerTracker + startBlock: {{FXPoolDeployerTracker.startBlock}} + mapping: + kind: ethereum/events + apiVersion: 0.0.5 + language: wasm/assemblyscript + file: ./src/mappings/poolFactory.ts + entities: + - Balancer + - Pool + abis: + - name: Vault + file: ./abis/Vault.json + - name: ERC20 + file: ./abis/ERC20.json + - name: WeightedPool + file: ./abis/WeightedPool.json + - name: FXPool + file: ./abis/FXPool.json + - name: FXPoolDeployer + file: ./abis/FXPoolDeployer.json + - name: FXPoolDeployerTracker + file: ./abis/FXPoolDeployerTracker.json + - name: Assimilator + file: ./abis/Assimilator.json + - name: ChainlinkPriceFeed + file: ./abis/ChainlinkPriceFeed.json + eventHandlers: + - event: NewFXPoolDeployer(indexed address,indexed address,indexed address) + handler: handleNewFXPoolDeployer + {{/if}} {{#if FXPoolDeployer}} - kind: ethereum/contract name: FXPoolDeployer @@ -2324,6 +2361,40 @@ templates: handler: handlePauseGyroPool - event: UnpausedLocally() handler: handleUnpauseGyroPool + - kind: ethereum/contract + name: FXPoolDeployer + network: {{network}} + source: + abi: FXPoolDeployer + mapping: + kind: ethereum/events + apiVersion: 0.0.5 + language: wasm/assemblyscript + file: ./src/mappings/poolController.ts + entities: + - Pool + - PoolShare + - Swap + - PoolToken + - GradualWeightUpdate + abis: + - name: Vault + file: ./abis/Vault.json + - name: ERC20 + file: ./abis/ERC20.json + - name: WeightedPool + file: ./abis/WeightedPool.json + - name: FXPool + file: ./abis/FXPool.json + - name: FXPoolDeployer + file: ./abis/FXPoolDeployer.json + - name: Assimilator + file: ./abis/Assimilator.json + - name: ChainlinkPriceFeed + file: ./abis/ChainlinkPriceFeed.json + eventHandlers: + - event: NewFXPool(indexed address,indexed bytes32,indexed address) + handler: handleNewFXPoolV2 - kind: ethereum/contract name: FXPool network: {{network}} diff --git a/networks.yaml b/networks.yaml index 8e824b14..6e99ac1a 100644 --- a/networks.yaml +++ b/networks.yaml @@ -124,6 +124,9 @@ mainnet: FXPoolFactory: address: "0x81fE9e5B28dA92aE949b705DfDB225f7a7cc5134" startBlock: 15981805 + FXPoolDeployerTracker: + address: "0x9E0d068Ede387888f8A24c92F7486920c200EfD5" + startBlock: 19417173 FXPoolDeployer: address: "0xfb23Bc0D2629268442CD6521CF4170698967105f" startBlock: 18469425 @@ -352,6 +355,9 @@ polygon: FXPoolFactory: address: "0x627D759314D5c4007b461A74eBaFA7EBC5dFeD71" startBlock: 32054793 + FXPoolDeployerTracker: + address: "0xa2fC51a7f5246a718848F5bdAdBc4a78191A8E2a" + startBlock: 54559455 FXPoolDeployer: address: "0xF169c1Ae8De24Da43a3dC5c5F05De412b4848bD3" startBlock: 49368321 diff --git a/src/mappings/poolFactory.ts b/src/mappings/poolFactory.ts index 51996a02..ec67f50c 100644 --- a/src/mappings/poolFactory.ts +++ b/src/mappings/poolFactory.ts @@ -28,6 +28,7 @@ import { AaveLinearPoolCreated } from '../types/AaveLinearPoolV3Factory/AaveLine import { ProtocolIdRegistered } from '../types/ProtocolIdRegistry/ProtocolIdRegistry'; import { Balancer, Pool, PoolContract, ProtocolIdData } from '../types/schema'; import { KassandraPoolCreated } from '../types/ManagedKassandraPoolControllerFactory/ManagedKassandraPoolControllerFactory'; +import { NewFXPoolDeployer } from '../types/FXPoolDeployerTracker/FXPoolDeployerTracker'; // datasource import { OffchainAggregator, WeightedPool as WeightedPoolTemplate } from '../types/templates'; @@ -46,6 +47,7 @@ import { Gyro2Pool as Gyro2PoolTemplate } from '../types/templates'; import { Gyro3Pool as Gyro3PoolTemplate } from '../types/templates'; import { GyroEPool as GyroEPoolTemplate } from '../types/templates'; import { FXPool as FXPoolTemplate } from '../types/templates'; +import { FXPoolDeployer as FXPoolDeployerTemplate } from '../types/templates'; import { WeightedPool } from '../types/templates/WeightedPool/WeightedPool'; import { WeightedPoolV2 } from '../types/templates/WeightedPoolV2/WeightedPoolV2'; @@ -634,6 +636,10 @@ export function handleNewGyroEV2Pool(event: PoolCreated): void { createGyroEPool(event, 2); } +export function handleNewFXPoolDeployer(event: NewFXPoolDeployer): void { + FXPoolDeployerTemplate.create(event.params.deployer); +} + export function handleNewFXPoolV1(event: ethereum.Event): void { return handleNewFXPool(event, false); } From cd4ab4f3753cdccbba25ca75f721f32981c5e98c Mon Sep 17 00:00:00 2001 From: andreiashu Date: Mon, 18 Mar 2024 15:10:00 +0700 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=8C=9A=20added=20arbitrum=20/=20avala?= =?UTF-8?q?nche=20details=20for=20FXPoolDeployerTracker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- networks.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/networks.yaml b/networks.yaml index 6e99ac1a..0b654ac4 100644 --- a/networks.yaml +++ b/networks.yaml @@ -465,6 +465,9 @@ arbitrum: GyroEV2PoolFactory: address: "0xdCA5f1F0d7994A32BC511e7dbA0259946653Eaf6" startBlock: 124858976 + FXPoolDeployerTracker: + address: "0xEa0a6fcc52Fcea683f962b6Bfd7f4F93E3804EA8" + startBlock: 191573392 FXPoolDeployer: address: "0x0bd5EC16658346eeCd5dE8c704a38Efe02B5DA69" startBlock: 183603904 @@ -692,6 +695,9 @@ avalanche: FXPoolDeployer: address: "0x4042dC4110Ea9500338737605A60065c3de152C6" startBlock: 37150792 + FXPoolDeployerTracker: + address: "0x7ff7B43CEAc9a1163cCB525ac9Dc1dE9A8837b4B" + startBlock: 43049862 basegoerli: network: base-testnet Vault: From 9e7c00776e201d29928b9fd6ac02e2a59519f13c Mon Sep 17 00:00:00 2001 From: andreiashu Date: Wed, 20 Mar 2024 09:03:06 +0700 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=90=9D=20fixed=20issue=20with=20wrong?= =?UTF-8?q?=20file=20for=20handleNewFXPoolV2=20handler=20function?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- manifest.template.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.template.yaml b/manifest.template.yaml index 1d087815..8e9dd61f 100644 --- a/manifest.template.yaml +++ b/manifest.template.yaml @@ -2370,7 +2370,7 @@ templates: kind: ethereum/events apiVersion: 0.0.5 language: wasm/assemblyscript - file: ./src/mappings/poolController.ts + file: ./src/mappings/poolFactory.ts entities: - Pool - PoolShare