Skip to content

Commit e25f7de

Browse files
committed
ensure token is an address
1 parent 695b8f0 commit e25f7de

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/templates/origin-arm/origin-arm.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,16 @@ import * as originLidoArmCapManagerAbi from '@abi/origin-lido-arm-cap-manager';
1414
import { Arm, ArmDailyStat, ArmState, ArmSwap, ArmWithdrawalRequest, TraderateChanged } from '@model';
1515
import { Block, Context, EvmBatchProcessor, Processor, blockFrequencyTracker, calculateAPY, logFilter } from '@originprotocol/squid-utils';
1616
import { ensureExchangeRate } from '@shared/post-processors/exchange-rates';
17-
import { Currency } from '@shared/post-processors/exchange-rates/mainnetCurrencies';
17+
import { Currency, mainnetCurrencies, MainnetCurrencySymbol } from '@shared/post-processors/exchange-rates/mainnetCurrencies';
1818
import { createERC20Entry } from '@templates/erc20/erc20-entry';
1919
import { createERC20EventTracker } from '@templates/erc20/erc20-event';
2020
import { createEventProcessor } from '@templates/events/createEventProcessor'
2121
import { traceFilter } from '@utils/traceFilter'
2222

23+
const currencyToAddress = (currency: Currency): string => {
24+
if (currency.startsWith('0x')) return currency.toLowerCase()
25+
return mainnetCurrencies[currency as MainnetCurrencySymbol].toLowerCase()
26+
}
2327

2428
export const createOriginARMProcessors = ({
2529
name,
@@ -469,11 +473,11 @@ export const createOriginARMProcessors = ({
469473
}),
470474
createERC20Entry({
471475
from,
472-
address: token0,
476+
address: currencyToAddress(token0),
473477
}),
474478
createERC20Entry({
475479
from,
476-
address: token1,
480+
address: currencyToAddress(token1),
477481
}),
478482
]
479483
}

0 commit comments

Comments
 (0)