Skip to content

Commit

Permalink
Update ocean address (#40)
Browse files Browse the repository at this point in the history
* update ocean address

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

* fix log

Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro>
  • Loading branch information
mihaisc authored Mar 1, 2021
1 parent 42af9ac commit 2125e16
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
32 changes: 16 additions & 16 deletions src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,11 @@ export const ENABLE_DEBUG = true
const network = dataSource.network()

function getOceanAddress(): string {
if (network == 'ropsten') {
return '0x5e8dcb2afa23844bcc311b00ad1a0c30025aade9'
} else if (network == 'rinkeby') {
return '0x8967bcf84170c91b0d24d4302c2376283b0b3a07'
}
// network == 'mainnet'
// switch is not working for some reason
if (network == 'ropsten') return '0x5e8dcb2afa23844bcc311b00ad1a0c30025aade9'
if (network == 'rinkeby') return '0x8967bcf84170c91b0d24d4302c2376283b0b3a07'
if (network == 'polygon') return '0x282d8efce846a88b159800bd4130ad77443fa1a1'

return '0x967da4048cd07ab37855c090aaf366e4ce1b9f48'
}

Expand Down Expand Up @@ -169,6 +168,7 @@ export function updatePoolTransactionToken(
balance: BigDecimal,
feeValue: BigDecimal
): void {
log.warning('WWWWWWWWWW ---- started update ptx with id {}', [poolTx])
const ptx = PoolTransaction.load(poolTx)
const poolToken = PoolToken.load(poolTokenId)
const pool = PoolEntity.load(poolToken.poolId)
Expand Down Expand Up @@ -217,14 +217,14 @@ export function updatePoolTransactionToken(
ptx.datatokenReserve = ptxTokenValues.tokenReserve
pool.datatokenReserve = ptxTokenValues.tokenReserve
}
debuglog('########## updatePoolTransactionToken: ', null, [
BigInt.fromI32(ptx.block).toString(),
BigInt.fromI32(ptx.timestamp).toString(),
ptxTokenValues.type,
ptxTokenValues.value.toString(),
ptxTokenValues.tokenReserve.toString(),
poolToken.poolId
])
// debuglog('########## updatePoolTransactionToken: ', null, [
// BigInt.fromI32(ptx.block).toString(),
// BigInt.fromI32(ptx.timestamp).toString(),
// ptxTokenValues.type,
// ptxTokenValues.value.toString(),
// ptxTokenValues.tokenReserve.toString(),
// poolToken.poolId
// ])

ptx.save()
pool.save()
Expand Down Expand Up @@ -278,7 +278,6 @@ export function createPoolTransaction(
const dtToken = PoolToken.load(
poolId.concat('-').concat(pool.datatokenAddress)
)

if (ocnToken == null || dtToken == null) {
return
}
Expand Down Expand Up @@ -313,7 +312,7 @@ export function createPoolTransaction(
decimalToBigInt(pool.swapFee)
)
debuglog(
'args to calcInGivenOut (ocnBalance, ocnWeight, dtBalance, dtWeight, dtAmount, swapFee, result)',
'createPoolTransaction args to calcInGivenOut (ocnBalance, ocnWeight, dtBalance, dtWeight, dtAmount, swapFee, result)',
null,
[
decimalToBigInt(ocnToken.balance).toString(),
Expand Down Expand Up @@ -384,6 +383,7 @@ export function createPoolTransaction(
poolTx.gasPrice = event.transaction.gasPrice.toBigDecimal()

debuglog('####################### poolTransaction: ', event, [
ptx,
BigInt.fromI32(poolTx.block).toString(),
BigInt.fromI32(poolTx.timestamp).toString(),
pool.oceanReserve.toString()
Expand Down
2 changes: 1 addition & 1 deletion src/mappings/dtfactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export function handleNewToken(event: TokenRegistered): void {
}

const datatoken = new DatatokenEntity(event.params.tokenAddress.toHexString())
log.error('************************ handleNewToken: datatokenId {}', [
log.warning('************************ handleNewToken: datatokenId {}', [
datatoken.id.toString()
])

Expand Down

0 comments on commit 2125e16

Please sign in to comment.