fix all issues related to the use of === instead of == in if statements.

This commit is contained in:
ssallam 2021-01-19 12:16:03 +01:00
parent dc5068f5f3
commit 6e02738d9b
4 changed files with 15 additions and 8 deletions

View File

@ -175,7 +175,7 @@ export function updatePoolTransactionToken(
ptxTokenValues.save()
if (ptxTokenValues.tokenAddress === OCEAN) {
if (ptxTokenValues.tokenAddress == OCEAN) {
ptx.oceanReserve = ptxTokenValues.tokenReserve
pool.oceanReserve = ptxTokenValues.tokenReserve
} else {

View File

@ -29,8 +29,8 @@ export function handleTransfer(event: Transfer): void {
let oldBalanceFrom = BigDecimal.fromString('0.0')
let oldBalanceTo = BigDecimal.fromString('0.0')
const isMint = tokenShareFrom === ZERO_ADDRESS
const isBurn = tokenShareTo === ZERO_ADDRESS
const isMint = tokenShareFrom == ZERO_ADDRESS
const isBurn = tokenShareTo == ZERO_ADDRESS
const datatoken = Datatoken.load(tokenId)

View File

@ -7,7 +7,7 @@ import { ZERO_BD } from '../helpers'
export function handleNewPool(event: BPoolRegistered): void {
let factory = PoolFactory.load('1')
if (factory === null) {
if (factory == null) {
factory = new PoolFactory('1')
factory.totalLiquidity = ZERO_BD
factory.totalSwapVolume = ZERO_BD

View File

@ -59,7 +59,7 @@ export function handleSetController(event: LOG_CALL): void {
export function handleSetPublicSwap(event: LOG_CALL): void {
const poolId = event.address.toHex()
const pool = Pool.load(poolId)
pool.publicSwap = event.params.data.toHexString().slice(-1) === '1'
pool.publicSwap = event.params.data.toHexString().slice(-1) == '1'
pool.save()
}
@ -131,6 +131,10 @@ export function handleRebind(event: LOG_CALL): void {
}
export function handleSetup(event: LOG_CALL): void {
if (PoolTransaction.load(event.transaction.hash.toHexString()) != null) {
return
}
const poolId = event.address.toHex()
debuglog('handleSetup: ', event, [])
const data = event.params.data.toHexString()
@ -204,7 +208,7 @@ export function handleJoinPool(event: LOG_JOIN): void {
const poolId = event.address.toHex()
const pool = Pool.load(poolId)
if (pool.finalized === false) {
if (pool.finalized == false) {
return
}
@ -406,8 +410,8 @@ export function handleTransfer(event: Transfer): void {
const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'
const isMint = event.params.from.toHex() === ZERO_ADDRESS
const isBurn = event.params.to.toHex() === ZERO_ADDRESS
const isMint = event.params.from.toHex() == ZERO_ADDRESS
const isBurn = event.params.to.toHex() == ZERO_ADDRESS
const poolShareFromId = poolId.concat('-').concat(event.params.from.toHex())
let poolShareFrom = PoolShare.load(poolShareFromId)
@ -434,6 +438,8 @@ export function handleTransfer(event: Transfer): void {
poolTx.sharesTransferAmount = value
poolTx.sharesBalance = poolShareTo.balance
}
debuglog('pool shares mint: (id, value, totalShares)', event, [poolId, value.toString(), pool.totalShares.toString()])
} else if (isBurn) {
if (poolShareFrom == null) {
createPoolShareEntity(poolShareFromId, poolId, event.params.from.toHex())
@ -446,6 +452,7 @@ export function handleTransfer(event: Transfer): void {
poolTx.sharesTransferAmount = -value
poolTx.sharesBalance = poolShareFrom.balance
}
debuglog('pool shares burn: (id, value, totalShares)', event, [poolId, value.toString(), pool.totalShares.toString()])
} else {
if (poolShareTo == null) {
createPoolShareEntity(poolShareToId, poolId, event.params.to.toHex())