Update ocean address (#40)

* update ocean address

Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro>

* fix log

Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro>
This commit is contained in:
mihaisc 2021-03-01 14:41:36 +02:00 committed by GitHub
parent 42af9acbe0
commit 2125e16e91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 17 deletions

View File

@ -35,12 +35,11 @@ export const ENABLE_DEBUG = true
const network = dataSource.network() const network = dataSource.network()
function getOceanAddress(): string { function getOceanAddress(): string {
if (network == 'ropsten') { // switch is not working for some reason
return '0x5e8dcb2afa23844bcc311b00ad1a0c30025aade9' if (network == 'ropsten') return '0x5e8dcb2afa23844bcc311b00ad1a0c30025aade9'
} else if (network == 'rinkeby') { if (network == 'rinkeby') return '0x8967bcf84170c91b0d24d4302c2376283b0b3a07'
return '0x8967bcf84170c91b0d24d4302c2376283b0b3a07' if (network == 'polygon') return '0x282d8efce846a88b159800bd4130ad77443fa1a1'
}
// network == 'mainnet'
return '0x967da4048cd07ab37855c090aaf366e4ce1b9f48' return '0x967da4048cd07ab37855c090aaf366e4ce1b9f48'
} }
@ -169,6 +168,7 @@ export function updatePoolTransactionToken(
balance: BigDecimal, balance: BigDecimal,
feeValue: BigDecimal feeValue: BigDecimal
): void { ): void {
log.warning('WWWWWWWWWW ---- started update ptx with id {}', [poolTx])
const ptx = PoolTransaction.load(poolTx) const ptx = PoolTransaction.load(poolTx)
const poolToken = PoolToken.load(poolTokenId) const poolToken = PoolToken.load(poolTokenId)
const pool = PoolEntity.load(poolToken.poolId) const pool = PoolEntity.load(poolToken.poolId)
@ -217,14 +217,14 @@ export function updatePoolTransactionToken(
ptx.datatokenReserve = ptxTokenValues.tokenReserve ptx.datatokenReserve = ptxTokenValues.tokenReserve
pool.datatokenReserve = ptxTokenValues.tokenReserve pool.datatokenReserve = ptxTokenValues.tokenReserve
} }
debuglog('########## updatePoolTransactionToken: ', null, [ // debuglog('########## updatePoolTransactionToken: ', null, [
BigInt.fromI32(ptx.block).toString(), // BigInt.fromI32(ptx.block).toString(),
BigInt.fromI32(ptx.timestamp).toString(), // BigInt.fromI32(ptx.timestamp).toString(),
ptxTokenValues.type, // ptxTokenValues.type,
ptxTokenValues.value.toString(), // ptxTokenValues.value.toString(),
ptxTokenValues.tokenReserve.toString(), // ptxTokenValues.tokenReserve.toString(),
poolToken.poolId // poolToken.poolId
]) // ])
ptx.save() ptx.save()
pool.save() pool.save()
@ -278,7 +278,6 @@ export function createPoolTransaction(
const dtToken = PoolToken.load( const dtToken = PoolToken.load(
poolId.concat('-').concat(pool.datatokenAddress) poolId.concat('-').concat(pool.datatokenAddress)
) )
if (ocnToken == null || dtToken == null) { if (ocnToken == null || dtToken == null) {
return return
} }
@ -313,7 +312,7 @@ export function createPoolTransaction(
decimalToBigInt(pool.swapFee) decimalToBigInt(pool.swapFee)
) )
debuglog( debuglog(
'args to calcInGivenOut (ocnBalance, ocnWeight, dtBalance, dtWeight, dtAmount, swapFee, result)', 'createPoolTransaction args to calcInGivenOut (ocnBalance, ocnWeight, dtBalance, dtWeight, dtAmount, swapFee, result)',
null, null,
[ [
decimalToBigInt(ocnToken.balance).toString(), decimalToBigInt(ocnToken.balance).toString(),
@ -384,6 +383,7 @@ export function createPoolTransaction(
poolTx.gasPrice = event.transaction.gasPrice.toBigDecimal() poolTx.gasPrice = event.transaction.gasPrice.toBigDecimal()
debuglog('####################### poolTransaction: ', event, [ debuglog('####################### poolTransaction: ', event, [
ptx,
BigInt.fromI32(poolTx.block).toString(), BigInt.fromI32(poolTx.block).toString(),
BigInt.fromI32(poolTx.timestamp).toString(), BigInt.fromI32(poolTx.timestamp).toString(),
pool.oceanReserve.toString() pool.oceanReserve.toString()

View File

@ -18,7 +18,7 @@ export function handleNewToken(event: TokenRegistered): void {
} }
const datatoken = new DatatokenEntity(event.params.tokenAddress.toHexString()) const datatoken = new DatatokenEntity(event.params.tokenAddress.toHexString())
log.error('************************ handleNewToken: datatokenId {}', [ log.warning('************************ handleNewToken: datatokenId {}', [
datatoken.id.toString() datatoken.id.toString()
]) ])