mirror of
https://github.com/oceanprotocol/ocean-subgraph.git
synced 2024-12-02 05:57:29 +01:00
Removing hard coded decimals in handleExchangeCreated
This commit is contained in:
parent
069b6bdf05
commit
17e9c4fa53
@ -37,7 +37,8 @@ export function handleExchangeCreated(event: ExchangeCreated): void {
|
|||||||
fixedRateExchange.contract = event.address.toHexString()
|
fixedRateExchange.contract = event.address.toHexString()
|
||||||
fixedRateExchange.exchangeId = event.params.exchangeId.toHexString()
|
fixedRateExchange.exchangeId = event.params.exchangeId.toHexString()
|
||||||
fixedRateExchange.datatoken = getToken(event.params.datatoken, true).id
|
fixedRateExchange.datatoken = getToken(event.params.datatoken, true).id
|
||||||
fixedRateExchange.baseToken = getToken(event.params.baseToken, false).id
|
const baseToken = getToken(event.params.baseToken, false)
|
||||||
|
fixedRateExchange.baseToken = baseToken.id
|
||||||
fixedRateExchange.datatokenSupply = BigDecimal.zero()
|
fixedRateExchange.datatokenSupply = BigDecimal.zero()
|
||||||
fixedRateExchange.baseTokenSupply = BigDecimal.zero()
|
fixedRateExchange.baseTokenSupply = BigDecimal.zero()
|
||||||
fixedRateExchange.datatokenBalance = BigDecimal.zero()
|
fixedRateExchange.datatokenBalance = BigDecimal.zero()
|
||||||
@ -46,7 +47,7 @@ export function handleExchangeCreated(event: ExchangeCreated): void {
|
|||||||
fixedRateExchange.active = false
|
fixedRateExchange.active = false
|
||||||
fixedRateExchange.price = weiToDecimal(
|
fixedRateExchange.price = weiToDecimal(
|
||||||
event.params.fixedRate.toBigDecimal(),
|
event.params.fixedRate.toBigDecimal(),
|
||||||
BigInt.fromI32(18).toI32()
|
BigInt.fromI32(baseToken.decimals).toI32()
|
||||||
)
|
)
|
||||||
fixedRateExchange.createdTimestamp = event.block.timestamp.toI32()
|
fixedRateExchange.createdTimestamp = event.block.timestamp.toI32()
|
||||||
fixedRateExchange.tx = event.transaction.hash.toHex()
|
fixedRateExchange.tx = event.transaction.hash.toHex()
|
||||||
@ -72,6 +73,9 @@ export function handleRateChange(event: ExchangeRateChanged): void {
|
|||||||
newExchangeUpdate.block = event.block.number.toI32()
|
newExchangeUpdate.block = event.block.number.toI32()
|
||||||
newExchangeUpdate.exchangeId = fixedRateId
|
newExchangeUpdate.exchangeId = fixedRateId
|
||||||
|
|
||||||
|
const fixedRateExchange = getFixedRateExchange(fixedRateId)
|
||||||
|
const baseToken = getToken(fixedRateExchange.baseToken, false)
|
||||||
|
|
||||||
fixedRateExchange.price = weiToDecimal(
|
fixedRateExchange.price = weiToDecimal(
|
||||||
event.params.newRate.toBigDecimal(),
|
event.params.newRate.toBigDecimal(),
|
||||||
BigInt.fromI32(18).toI32()
|
BigInt.fromI32(18).toI32()
|
||||||
|
Loading…
Reference in New Issue
Block a user