fixed swapper change issue (#510)

* fixed swapper change issue

* fix lint
This commit is contained in:
mihaisc 2022-08-03 08:20:25 -07:00 committed by GitHub
parent 8416d773cc
commit 06bbaa54c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 9 deletions

View File

@ -1,4 +1,4 @@
import { BigInt, Address, BigDecimal, log } from '@graphprotocol/graph-ts'
import { BigInt, Address, BigDecimal } from '@graphprotocol/graph-ts'
import {
ExchangeActivated,
ExchangeAllowedSwapperChanged,
@ -62,7 +62,6 @@ export function handleRateChange(event: ExchangeRateChanged): void {
event.params.exchangeId.toHexString(),
event.address
)
const fixedRateExchange = getFixedRateExchange(fixedRateId)
const newExchangeUpdate = new FixedRateExchangeUpdate(
getUpdateOrSwapId(event.transaction.hash.toHex(), fixedRateId)
@ -72,6 +71,7 @@ export function handleRateChange(event: ExchangeRateChanged): void {
newExchangeUpdate.tx = event.transaction.hash.toHex()
newExchangeUpdate.block = event.block.number.toI32()
newExchangeUpdate.exchangeId = fixedRateId
fixedRateExchange.price = weiToDecimal(
event.params.newRate.toBigDecimal(),
BigInt.fromI32(18).toI32()
@ -147,12 +147,11 @@ export function handleAllowedSwapperChanged(
const newExchangeUpdate = new FixedRateExchangeUpdate(
getUpdateOrSwapId(event.transaction.hash.toHex(), fixedRateId)
)
newExchangeUpdate.createdTimestamp = event.block.timestamp.toI32()
newExchangeUpdate.tx = event.transaction.hash.toHex()
newExchangeUpdate.block = event.block.number.toI32()
newExchangeUpdate.oldAllowedSwapper = fixedRateExchange.allowedSwapper
newExchangeUpdate.exchangeId = fixedRateId
fixedRateExchange.allowedSwapper = event.params.allowedSwapper.toHex()
newExchangeUpdate.newAllowedSwapper = fixedRateExchange.allowedSwapper
newExchangeUpdate.save()
@ -195,7 +194,6 @@ export function handleSwap(event: Swapped): void {
swap.save()
updateFixedRateExchangeSupply(event.params.exchangeId, event.address)
log.error('start addFixedSwap', [])
if (event.params.tokenOutAddress.toHexString() == fixedRateExchange.baseToken)
addFixedSwap(
@ -203,7 +201,6 @@ export function handleSwap(event: Swapped): void {
swap.dataTokenAmount
)
else addFixedSwap(fixedRateExchange.baseToken, swap.baseTokenAmount)
log.error('addFixedSwap saved', [])
// update datatoken lastPriceToken and lastPriceValue
const datatoken = getToken(
Address.fromString(fixedRateExchange.datatoken),

View File

@ -43,9 +43,6 @@ export function getToken(address: Address, isDatatoken: boolean): Token {
}
export function createNftToken(address: Address): Nft {
log.warning('started creating nft token with address: {}', [
address.toHexString()
])
ERC721Template.create(address)
const token = new Nft(address.toHexString())
token.name = ''