Skip to content

Commit

Permalink
namespace for config
Browse files Browse the repository at this point in the history
  • Loading branch information
franzns committed Jan 22, 2024
1 parent 4e4cb03 commit 12a3fce
Show file tree
Hide file tree
Showing 17 changed files with 122 additions and 76 deletions.
16 changes: 10 additions & 6 deletions modules/network/arbitrum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,16 @@ export const arbitrumNetworkData: NetworkData = {
delegationProxy: '0x81cfae226343b24ba12ec6521db2c79e7aeeb310',
},
balancer: {
vaultV2Address: '0xba12222222228d8ba445958a75a0704d566bf2c8',
v2DefaultSwapFeePercentage: '0.5',
v2DefaultYieldFeePercentage: '0.5',
vaultV3Address: '0xba12222222228d8ba445958a75a0704d566bf2c8',
v3DefaultSwapFeePercentage: '0.5',
v3DefaultYieldFeePercentage: '0.5',
v2: {
vaultAddress: '0xba12222222228d8ba445958a75a0704d566bf2c8',
defaultSwapFeePercentage: '0.5',
defaultYieldFeePercentage: '0.5',
},
v3: {
vaultAddress: '0xba12222222228d8ba445958a75a0704d566bf2c8',
defaultSwapFeePercentage: '0.5',
defaultYieldFeePercentage: '0.5',
},
},
multicall: '0x80c7dd17b01855a6d2347444a0fcc36136a314de',
multicall3: '0xca11bde05977b3631167028862be2a173976ca11',
Expand Down
16 changes: 10 additions & 6 deletions modules/network/avalanche.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,16 @@ const avalancheNetworkData: NetworkData = {
delegationProxy: '0x0c6052254551eae3ecac77b01dfcf1025418828f',
},
balancer: {
vaultV2Address: '0xba12222222228d8ba445958a75a0704d566bf2c8',
v2DefaultSwapFeePercentage: '0.5',
v2DefaultYieldFeePercentage: '0.5',
vaultV3Address: '0xba12222222228d8ba445958a75a0704d566bf2c8',
v3DefaultSwapFeePercentage: '0.5',
v3DefaultYieldFeePercentage: '0.5',
v2: {
vaultAddress: '0xba12222222228d8ba445958a75a0704d566bf2c8',
defaultSwapFeePercentage: '0.5',
defaultYieldFeePercentage: '0.5',
},
v3: {
vaultAddress: '0xba12222222228d8ba445958a75a0704d566bf2c8',
defaultSwapFeePercentage: '0.5',
defaultYieldFeePercentage: '0.5',
},
},
multicall: '0xca11bde05977b3631167028862be2a173976ca11',
multicall3: '0xca11bde05977b3631167028862be2a173976ca11',
Expand Down
16 changes: 10 additions & 6 deletions modules/network/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,16 @@ const baseNetworkData: NetworkData = {
delegationProxy: '0xd87f44df0159dc78029ab9ca7d7e57e7249f5acd',
},
balancer: {
vaultV2Address: '0xba12222222228d8ba445958a75a0704d566bf2c8',
v2DefaultSwapFeePercentage: '0.5',
v2DefaultYieldFeePercentage: '0.5',
vaultV3Address: '0xba12222222228d8ba445958a75a0704d566bf2c8',
v3DefaultSwapFeePercentage: '0.5',
v3DefaultYieldFeePercentage: '0.5',
v2: {
vaultAddress: '0xba12222222228d8ba445958a75a0704d566bf2c8',
defaultSwapFeePercentage: '0.5',
defaultYieldFeePercentage: '0.5',
},
v3: {
vaultAddress: '0xba12222222228d8ba445958a75a0704d566bf2c8',
defaultSwapFeePercentage: '0.5',
defaultYieldFeePercentage: '0.5',
},
},
ybAprConfig: {
defaultHandlers: {
Expand Down
16 changes: 10 additions & 6 deletions modules/network/fantom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,16 @@ const fantomNetworkData: NetworkData = {
poolAddress: '0xcde5a11a4acb4ee4c805352cec57e236bdbc3837',
},
balancer: {
vaultV2Address: '0x20dd72ed959b6147912c2e529f0a0c651c33c9ce',
v2DefaultSwapFeePercentage: '0.25',
v2DefaultYieldFeePercentage: '0.25',
vaultV3Address: '0x20dd72ed959b6147912c2e529f0a0c651c33c9ce',
v3DefaultSwapFeePercentage: '0.25',
v3DefaultYieldFeePercentage: '0.25',
v2: {
vaultAddress: '0x20dd72ed959b6147912c2e529f0a0c651c33c9ce',
defaultSwapFeePercentage: '0.5',
defaultYieldFeePercentage: '0.5',
},
v3: {
vaultAddress: '0x20dd72ed959b6147912c2e529f0a0c651c33c9ce',
defaultSwapFeePercentage: '0.5',
defaultYieldFeePercentage: '0.5',
},
},
multicall: '0x66335d7ad8011f6aa3f48aadcb523b62b38ed961',
multicall3: '0xca11bde05977b3631167028862be2a173976ca11',
Expand Down
16 changes: 10 additions & 6 deletions modules/network/gnosis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,16 @@ const gnosisNetworkData: NetworkData = {
delegationProxy: '0x7a2535f5fb47b8e44c02ef5d9990588313fe8f05',
},
balancer: {
vaultV2Address: '0xba12222222228d8ba445958a75a0704d566bf2c8',
v2DefaultSwapFeePercentage: '0.5',
v2DefaultYieldFeePercentage: '0.5',
vaultV3Address: '0xba12222222228d8ba445958a75a0704d566bf2c8',
v3DefaultSwapFeePercentage: '0.5',
v3DefaultYieldFeePercentage: '0.5',
v2: {
vaultAddress: '0xba12222222228d8ba445958a75a0704d566bf2c8',
defaultSwapFeePercentage: '0.5',
defaultYieldFeePercentage: '0.5',
},
v3: {
vaultAddress: '0xba12222222228d8ba445958a75a0704d566bf2c8',
defaultSwapFeePercentage: '0.5',
defaultYieldFeePercentage: '0.5',
},
},
multicall: '0xbb6fab6b627947dae0a75808250d8b2652952cb5',
multicall3: '0xca11bde05977b3631167028862be2a173976ca11',
Expand Down
19 changes: 12 additions & 7 deletions modules/network/mainnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,18 @@ const data: NetworkData = {
config: '0xac89cc9d78bbad7eb3a02601b4d65daa1f908aa6',
},
balancer: {
tokenAdmin: '0xf302f9f50958c5593770fdf4d4812309ff77414f',
vaultV2Address: '0xba12222222228d8ba445958a75a0704d566bf2c8',
v2DefaultSwapFeePercentage: '0.5',
v2DefaultYieldFeePercentage: '0.5',
vaultV3Address: '0xba12222222228d8ba445958a75a0704d566bf2c8',
v3DefaultSwapFeePercentage: '0.5',
v3DefaultYieldFeePercentage: '0.5',
v2: {
vaultAddress: '0xba12222222228d8ba445958a75a0704d566bf2c8',
defaultSwapFeePercentage: '0.5',
defaultYieldFeePercentage: '0.5',
tokenAdmin: '0xf302f9f50958c5593770fdf4d4812309ff77414f',
},
v3: {
vaultAddress: '0xba12222222228d8ba445958a75a0704d566bf2c8',
defaultSwapFeePercentage: '0.5',
defaultYieldFeePercentage: '0.5',
tokenAdmin: '0xf302f9f50958c5593770fdf4d4812309ff77414f',
},
},
multicall: '0x5ba1e12693dc8f9c48aad8770482f4739beed696',
multicall3: '0xca11bde05977b3631167028862be2a173976ca11',
Expand Down
19 changes: 12 additions & 7 deletions modules/network/network-config-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,18 @@ export interface NetworkData {
config: string;
};
balancer: {
vaultV2Address: string;
v2DefaultSwapFeePercentage: string;
v2DefaultYieldFeePercentage: string;
vaultV3Address: string;
v3DefaultSwapFeePercentage: string;
v3DefaultYieldFeePercentage: string;
tokenAdmin?: string;
v2: {
vaultAddress: string;
defaultSwapFeePercentage: string;
defaultYieldFeePercentage: string;
tokenAdmin?: string;
};
v3: {
vaultAddress: string;
defaultSwapFeePercentage: string;
defaultYieldFeePercentage: string;
tokenAdmin?: string;
};
};
multicall: string;
multicall3: string;
Expand Down
16 changes: 10 additions & 6 deletions modules/network/optimism.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,16 @@ const optimismNetworkData: NetworkData = {
config: '0x32acb44fc929339b9f16f0449525cc590d2a23f3',
},
balancer: {
vaultV2Address: '0xba12222222228d8ba445958a75a0704d566bf2c8',
v2DefaultSwapFeePercentage: '0.5',
v2DefaultYieldFeePercentage: '0.5',
vaultV3Address: '0xba12222222228d8ba445958a75a0704d566bf2c8',
v3DefaultSwapFeePercentage: '0.5',
v3DefaultYieldFeePercentage: '0.5',
v2: {
vaultAddress: '0xba12222222228d8ba445958a75a0704d566bf2c8',
defaultSwapFeePercentage: '0.5',
defaultYieldFeePercentage: '0.5',
},
v3: {
vaultAddress: '0xba12222222228d8ba445958a75a0704d566bf2c8',
defaultSwapFeePercentage: '0.5',
defaultYieldFeePercentage: '0.5',
},
},
multicall: '0x2dc0e2aa608532da689e89e237df582b783e552c',
multicall3: '0xca11bde05977b3631167028862be2a173976ca11',
Expand Down
16 changes: 10 additions & 6 deletions modules/network/polygon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,16 @@ const polygonNetworkData: NetworkData = {
config: '0xfdc2e9e03f515804744a40d0f8d25c16e93fbe67',
},
balancer: {
vaultV2Address: '0xba12222222228d8ba445958a75a0704d566bf2c8',
v2DefaultSwapFeePercentage: '0.5',
v2DefaultYieldFeePercentage: '0.5',
vaultV3Address: '0xba12222222228d8ba445958a75a0704d566bf2c8',
v3DefaultSwapFeePercentage: '0.5',
v3DefaultYieldFeePercentage: '0.5',
v2: {
vaultAddress: '0xba12222222228d8ba445958a75a0704d566bf2c8',
defaultSwapFeePercentage: '0.5',
defaultYieldFeePercentage: '0.5',
},
v3: {
vaultAddress: '0xba12222222228d8ba445958a75a0704d566bf2c8',
defaultSwapFeePercentage: '0.5',
defaultYieldFeePercentage: '0.5',
},
},
multicall: '0x275617327c958bd06b5d6b871e7f491d76113dd8',
multicall3: '0xca11bde05977b3631167028862be2a173976ca11',
Expand Down
16 changes: 10 additions & 6 deletions modules/network/sepolia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,16 @@ export const sepoliaNetworkData: NetworkData = {
// delegationProxy: '0x81cfae226343b24ba12ec6521db2c79e7aeeb310',
// },
balancer: {
vaultV2Address: '0xba12222222228d8ba445958a75a0704d566bf2c8',
v2DefaultSwapFeePercentage: '0.5',
v2DefaultYieldFeePercentage: '0.5',
vaultV3Address: '0xba12222222228d8ba445958a75a0704d566bf2c8',
v3DefaultSwapFeePercentage: '0.5',
v3DefaultYieldFeePercentage: '0.5',
v2: {
vaultAddress: '0xba12222222228d8ba445958a75a0704d566bf2c8',
defaultSwapFeePercentage: '0.5',
defaultYieldFeePercentage: '0.5',
},
v3: {
vaultAddress: '0xba12222222228d8ba445958a75a0704d566bf2c8',
defaultSwapFeePercentage: '0.5',
defaultYieldFeePercentage: '0.5',
},
},
multicall: '0x80c7dd17b01855a6d2347444a0fcc36136a314de',
multicall3: '0xca11bde05977b3631167028862be2a173976ca11',
Expand Down
16 changes: 10 additions & 6 deletions modules/network/zkevm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,16 @@ const zkevmNetworkData: NetworkData = {
delegationProxy: '0xc7e5ed1054a24ef31d827e6f86caa58b3bc168d7',
},
balancer: {
vaultV2Address: '0xba12222222228d8ba445958a75a0704d566bf2c8',
v2DefaultSwapFeePercentage: '0.5',
v2DefaultYieldFeePercentage: '0.5',
vaultV3Address: '0xba12222222228d8ba445958a75a0704d566bf2c8',
v3DefaultSwapFeePercentage: '0.5',
v3DefaultYieldFeePercentage: '0.5',
v2: {
vaultAddress: '0xba12222222228d8ba445958a75a0704d566bf2c8',
defaultSwapFeePercentage: '0.5',
defaultYieldFeePercentage: '0.5',
},
v3: {
vaultAddress: '0xba12222222228d8ba445958a75a0704d566bf2c8',
defaultSwapFeePercentage: '0.5',
defaultYieldFeePercentage: '0.5',
},
},
multicall: '0xca11bde05977b3631167028862be2a173976ca11',
multicall3: '0xca11bde05977b3631167028862be2a173976ca11',
Expand Down
6 changes: 3 additions & 3 deletions modules/pool/lib/pool-on-chain-data.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ export class PoolOnChainDataService {
private get options() {
return {
chain: networkContext.chain,
vaultAddress: networkContext.data.balancer.vaultV2Address,
yieldProtocolFeePercentage: networkContext.data.balancer.v2DefaultYieldFeePercentage,
swapProtocolFeePercentage: networkContext.data.balancer.v2DefaultSwapFeePercentage,
vaultAddress: networkContext.data.balancer.v2.vaultAddress,
yieldProtocolFeePercentage: networkContext.data.balancer.v2.defaultSwapFeePercentage,
swapProtocolFeePercentage: networkContext.data.balancer.v2.defaultSwapFeePercentage,
gyroConfig: networkContext.data.gyro?.config,
};
}
Expand Down
2 changes: 1 addition & 1 deletion modules/pool/lib/pool-sync.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class PoolSyncService {
}

get vaultAddress() {
return networkContext.data.balancer.vaultV2Address;
return networkContext.data.balancer.v2.vaultAddress;
}

get rpcUrl() {
Expand Down
2 changes: 1 addition & 1 deletion modules/sor/balancer-sor.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BalancerSorService } from './balancer-sor.service';
import { BalancerSorService } from './sorV1Beets/balancer-sor.service';
import { tokenService } from '../token/token.service';
import { poolService } from '../pool/pool.service';

Expand Down
2 changes: 1 addition & 1 deletion modules/sor/sorV1Beets/balancer-sor.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ export class BalancerSorService {

private queryBatchSwap(swapType: SwapTypes, swaps: SwapV2[], assets: string[]): Promise<string[]> {
const vaultContract = new Contract(
networkContext.data.balancer.vaultV2Address,
networkContext.data.balancer.v2.vaultAddress,
VaultAbi,
networkContext.provider,
);
Expand Down
2 changes: 1 addition & 1 deletion modules/user/lib/user-sync-wallet-balance.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class UserSyncWalletBalanceService {
}

get vaultAddress() {
return AllNetworkConfigs[this.chainId].data.balancer.vaultV2Address;
return AllNetworkConfigs[this.chainId].data.balancer.v2.vaultAddress;
}

get fbeetsAddress() {
Expand Down
2 changes: 1 addition & 1 deletion modules/vebal/balancer-token-admin.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { networkContext } from '../network/network-context.service';

export async function getInflationRate(): Promise<BigNumber> {
if (networkContext.isMainnet) {
const tokenAdmin = new Contract(networkContext.data.balancer.tokenAdmin!, abi, networkContext.provider);
const tokenAdmin = new Contract(networkContext.data.balancer.v2.tokenAdmin!, abi, networkContext.provider);
const inflationRate = await tokenAdmin.getInflationRate();
return inflationRate;
} else {
Expand Down

0 comments on commit 12a3fce

Please sign in to comment.