CHanging the decimals so that they are taken from the feeToken

This commit is contained in:
Jamie Hewitt 2023-06-28 17:29:55 +03:00
parent d1cd98ce1b
commit f6b81ecccb
2 changed files with 9 additions and 5 deletions

View File

@ -129,6 +129,7 @@ export function handlerOrderReused(event: OrderReused): void {
}
export function handlePublishMarketFee(event: PublishMarketFee): void {}
export function handlePublishMarketFeeChanged(
event: PublishMarketFeeChanged
): void {

View File

@ -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()
}