From 3a281ee8d5af9c4c8087f98767d2daedb439e79f Mon Sep 17 00:00:00 2001 From: esser Date: Mon, 30 Dec 2024 18:57:47 +0800 Subject: [PATCH] fix: gauge compressor adresses hardcoded --- src/sdk/gauges/GaugeStakingService.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/sdk/gauges/GaugeStakingService.ts b/src/sdk/gauges/GaugeStakingService.ts index 3a6f543d..c1451f5e 100644 --- a/src/sdk/gauges/GaugeStakingService.ts +++ b/src/sdk/gauges/GaugeStakingService.ts @@ -2,16 +2,28 @@ import type { Address } from "viem"; import { dataCompressorV3Abi } from "../abi"; import { SDKConstruct } from "../base"; +import { chains as CHAINS } from "../chain"; import type { GearboxSDK } from "../GearboxSDK"; +import { TESTNET_CHAINS } from "../sdk-legacy"; import type { GaugeStakingDataPayload } from "./utils"; +// TODO: should get address from sdk; currently these addresses are datacompressor v3 adresses +export const GAUGE_COMPRESSORS: Record = { + [CHAINS.Mainnet.id]: "0x104c4e209329524adb0febE8b6481346a6eB75C6", + [CHAINS.Arbitrum.id]: "0x88aa4FbF86392cBF6f6517790E288314DE03E181", + [CHAINS.Optimism.id]: "0x2697e6Ddbf572df3403B2451b954762Fd22002F6", + + [TESTNET_CHAINS.Mainnet]: "0x104c4e209329524adb0febE8b6481346a6eB75C6", + [TESTNET_CHAINS.Arbitrum]: "0x88aa4FbF86392cBF6f6517790E288314DE03E181", + [TESTNET_CHAINS.Optimism]: "0x2697e6Ddbf572df3403B2451b954762Fd22002F6", +}; + export class GaugeStakingService extends SDKConstruct { #compressor: Address; constructor(sdk: GearboxSDK) { super(sdk); - // TODO: should get address from sdk.addressProvider.getLatestVersion(AP_DATA_COMPRESSOR) - this.#compressor = "0x104c4e209329524adb0febE8b6481346a6eB75C6"; + this.#compressor = GAUGE_COMPRESSORS[sdk.provider.chainId]; } /**