From f6b81ecccb274dc4188cff36ea83f3e210bded48 Mon Sep 17 00:00:00 2001 From: Jamie Hewitt Date: Wed, 28 Jun 2023 17:29:55 +0300 Subject: [PATCH] CHanging the decimals so that they are taken from the feeToken --- src/mappings/erc20Templates.ts | 1 + src/mappings/fixedRateExchange.ts | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/mappings/erc20Templates.ts b/src/mappings/erc20Templates.ts index a7b9da5..1822283 100644 --- a/src/mappings/erc20Templates.ts +++ b/src/mappings/erc20Templates.ts @@ -129,6 +129,7 @@ export function handlerOrderReused(event: OrderReused): void { } export function handlePublishMarketFee(event: PublishMarketFee): void {} + export function handlePublishMarketFeeChanged( event: PublishMarketFeeChanged ): void { diff --git a/src/mappings/fixedRateExchange.ts b/src/mappings/fixedRateExchange.ts index 5efcefc..7c62a49 100644 --- a/src/mappings/fixedRateExchange.ts +++ b/src/mappings/fixedRateExchange.ts @@ -246,16 +246,19 @@ export function handlePublishMarketFeeChanged( event.address ) const fixedRateExchange = getFixedRateExchange(fixedRateId) - const baseToken = getToken( - Address.fromString(fixedRateExchange.baseToken), - false - ) + if (fixedRateExchange) { + const feeToken = getToken( + Address.fromString(fixedRateExchange.publishMarketFeeAddress), + false + ) + const feeDecimals = BigInt.fromI32(feeToken.decimals).toI32() + fixedRateExchange.publishMarketFeeAddress = event.params.newMarketCollector.toHexString() fixedRateExchange.publishMarketSwapFee = weiToDecimal( event.params.swapFee.toBigDecimal(), - BigInt.fromI32(baseToken.decimals).toI32() + feeDecimals ) fixedRateExchange.save() }