Skip to content

Commit

Permalink
Merge pull request #575 from xave-finance/multipleFXPoolDeployers2
Browse files Browse the repository at this point in the history
Multiple Quote Tokens support for FXPools: FXPoolDeployerTracker
  • Loading branch information
mendesfabio authored Mar 20, 2024
2 parents 8b362c2 + 9e7c007 commit c4a7f0a
Show file tree
Hide file tree
Showing 4 changed files with 223 additions and 0 deletions.
134 changes: 134 additions & 0 deletions abis/FXPoolDeployerTracker.json
Original file line number Diff line number Diff line change
@@ -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
}
]
71 changes: 71 additions & 0 deletions manifest.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1695,6 +1695,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
Expand Down Expand Up @@ -2357,6 +2394,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/poolFactory.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}}
Expand Down
12 changes: 12 additions & 0 deletions networks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ mainnet:
FXPoolFactory:
address: "0x81fE9e5B28dA92aE949b705DfDB225f7a7cc5134"
startBlock: 15981805
FXPoolDeployerTracker:
address: "0x9E0d068Ede387888f8A24c92F7486920c200EfD5"
startBlock: 19417173
FXPoolDeployer:
address: "0xfb23Bc0D2629268442CD6521CF4170698967105f"
startBlock: 18469425
Expand Down Expand Up @@ -361,6 +364,9 @@ polygon:
FXPoolFactory:
address: "0x627D759314D5c4007b461A74eBaFA7EBC5dFeD71"
startBlock: 32054793
FXPoolDeployerTracker:
address: "0xa2fC51a7f5246a718848F5bdAdBc4a78191A8E2a"
startBlock: 54559455
FXPoolDeployer:
address: "0xF169c1Ae8De24Da43a3dC5c5F05De412b4848bD3"
startBlock: 49368321
Expand Down Expand Up @@ -471,6 +477,9 @@ arbitrum:
GyroEV2PoolFactory:
address: "0xdCA5f1F0d7994A32BC511e7dbA0259946653Eaf6"
startBlock: 124858976
FXPoolDeployerTracker:
address: "0xEa0a6fcc52Fcea683f962b6Bfd7f4F93E3804EA8"
startBlock: 191573392
FXPoolDeployer:
address: "0x0bd5EC16658346eeCd5dE8c704a38Efe02B5DA69"
startBlock: 183603903
Expand Down Expand Up @@ -710,6 +719,9 @@ avalanche:
FXPoolDeployer:
address: "0x4042dC4110Ea9500338737605A60065c3de152C6"
startBlock: 37150792
FXPoolDeployerTracker:
address: "0x7ff7B43CEAc9a1163cCB525ac9Dc1dE9A8837b4B"
startBlock: 43049862
basegoerli:
network: base-testnet
Vault:
Expand Down
6 changes: 6 additions & 0 deletions src/mappings/poolFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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';
Expand Down Expand Up @@ -640,6 +642,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);
}
Expand Down

0 comments on commit c4a7f0a

Please sign in to comment.