diff --git a/modules/pool/lib/staking/gauge-staking.service.ts b/modules/pool/lib/staking/gauge-staking.service.ts index 2aa609099..c170bc7f4 100644 --- a/modules/pool/lib/staking/gauge-staking.service.ts +++ b/modules/pool/lib/staking/gauge-staking.service.ts @@ -114,7 +114,7 @@ export class GaugeStakingService implements PoolStakingService { let periodFinish: number; if (gaugeVersion === 1) { - const gaugeV1 = await getContractAt(gauge.id, childChainGaugeV1Abi); + const gaugeV1 = getContractAt(gauge.id, childChainGaugeV1Abi); const rewardData = await gaugeV1.reward_data(tokenAddress); periodFinish = rewardData[2]; @@ -124,10 +124,10 @@ export class GaugeStakingService implements PoolStakingService { } } else { // we can't get BAL rate from the reward data but got it from the inflation_rate call which set the rewardToken.rate - if (tokenAddress === this.balAddress) { + if (tokenAddress.toLowerCase() === this.balAddress.toLowerCase()) { rewardRate = rewardToken.rate ? rewardToken.rate : '0.0'; } else { - const gaugeV2 = await getContractAt(gauge.id, childChainGaugeV2Abi); + const gaugeV2 = getContractAt(gauge.id, childChainGaugeV2Abi); const rewardData = await gaugeV2.reward_data(tokenAddress); periodFinish = parseFloat(formatUnits(rewardData[1], 0)); @@ -164,12 +164,20 @@ export class GaugeStakingService implements PoolStakingService { async getChildChainGaugeInfo(gaugeAddresses: string[]): Promise<{ [gaugeAddress: string]: ChildChainInfo }> { const currentWeek = Math.floor(Date.now() / 1000 / 604800); - const multicall = new Multicaller3(childChainGaugeV2Abi); + const childChainAbi = networkContext.chain === 'MAINNET' + ? 'function inflation_rate() view returns (uint256)' + : 'function inflation_rate(uint256 week) view returns (uint256)'; + const multicall = new Multicaller3([childChainAbi]); let response: { [gaugeAddress: string]: ChildChainInfo } = {}; gaugeAddresses.forEach((address) => { - multicall.call(address, address, 'inflation_rate', [currentWeek], true); + // Only L2 gauges have the inflation_rate with a week parameter + if (networkContext.chain === 'MAINNET') { + multicall.call(address, address, 'inflation_rate', [], true); + } else { + multicall.call(address, address, 'inflation_rate', [currentWeek], true); + } }); const childChainData = (await multicall.execute()) as Record;