revert debug changes.

This commit is contained in:
ssallam 2021-01-18 16:24:36 +01:00
parent 50c5ac247c
commit 7a0f2b6113
2 changed files with 5 additions and 20 deletions

View File

@ -151,9 +151,6 @@ export function updatePoolTransactionToken(
feeValue: BigDecimal feeValue: BigDecimal
): void { ): void {
const ptx = PoolTransaction.load(poolTx) const ptx = PoolTransaction.load(poolTx)
if (ptx == null) {
log.error('?????????????????????????? PoolTransaction not found for {}, pooltokenid {} ????????????????', [poolTx, poolTokenId])
}
const poolToken = PoolToken.load(poolTokenId) const poolToken = PoolToken.load(poolTokenId)
const pool = PoolEntity.load(poolToken.poolId) const pool = PoolEntity.load(poolToken.poolId)
const ptxTokenValuesId = poolTx.concat('-').concat(poolToken.tokenAddress) const ptxTokenValuesId = poolTx.concat('-').concat(poolToken.tokenAddress)
@ -238,9 +235,6 @@ export function createPoolTransaction(
event_type: string, event_type: string,
userAddress: string userAddress: string
): void { ): void {
debuglog('createPoolTransaction', event, [])
const poolId = event.address.toHex() const poolId = event.address.toHex()
const pool = PoolEntity.load(poolId) const pool = PoolEntity.load(poolId)
const ptx = event.transaction.hash.toHexString() const ptx = event.transaction.hash.toHexString()
@ -251,7 +245,6 @@ export function createPoolTransaction(
) )
if (ocnToken == null || dtToken == null) { if (ocnToken == null || dtToken == null) {
debuglog('?????????????? no oceanToken or no dtToken: ', event, [poolId, ocnToken.id, poolId.concat('-').concat(pool.datatokenAddress)])
return return
} }
@ -310,17 +303,15 @@ export function createPoolTransaction(
pool.consumePrice = poolTx.consumePrice pool.consumePrice = poolTx.consumePrice
pool.spotPrice = poolTx.spotPrice pool.spotPrice = poolTx.spotPrice
const lockedValue = pool.lockedValue
pool.lockedValue = pool.oceanReserve + (pool.datatokenReserve * pool.spotPrice)
let factory = PoolFactory.load('1')
factory.totalLockedValue = factory.totalLockedValue - lockedValue + pool.lockedValue
pool.transactionCount = pool.transactionCount.plus(BigInt.fromI32(1)) pool.transactionCount = pool.transactionCount.plus(BigInt.fromI32(1))
// const lockedValue = pool.lockedValue
// pool.lockedValue = pool.oceanReserve + (pool.datatokenReserve * pool.spotPrice)
// let factory = PoolFactory.load('1')
// factory.totalLockedValue = factory.totalLockedValue - lockedValue + pool.lockedValue
pool.save() pool.save()
// factory.save() factory.save()
debuglog( debuglog(
'updated pool reserves (source, dtBalance, ocnBalance, dtReserve, ocnReserve): ', 'updated pool reserves (source, dtBalance, ocnBalance, dtReserve, ocnReserve): ',

View File

@ -174,12 +174,6 @@ export function handleSetup(event: LOG_CALL): void {
handleSetSwapFee(event, swapFee) handleSetSwapFee(event, swapFee)
handleFinalize(event) handleFinalize(event)
createPoolTransaction(event, 'setup', event.transaction.from.toHex()) createPoolTransaction(event, 'setup', event.transaction.from.toHex())
const ptx = event.transaction.hash.toHexString()
let poolTx = PoolTransaction.load(ptx)
if (poolTx == null) {
debuglog('????????????????????????????/ no PoolTransaction ', event, [ptx])
return
}
// update base token // update base token
let amount = hexToDecimal(baseTokenAmount, 18) let amount = hexToDecimal(baseTokenAmount, 18)