diff --git a/.eslintrc b/.eslintrc index 06c96aa..f2a06b1 100644 --- a/.eslintrc +++ b/.eslintrc @@ -5,17 +5,14 @@ }, "extends": [ "oceanprotocol", - "plugin:@typescript-eslint/eslint-recommended", "plugin:@typescript-eslint/recommended", - "plugin:prettier/recommended", - "prettier/react", - "prettier/standard", + "prettier", "prettier/@typescript-eslint" ], - "plugins": ["@typescript-eslint", "prettier"], + "plugins": ["@typescript-eslint"], "rules": { "no-use-before-define": "off", + "eqeqeq": "off", "@typescript-eslint/no-use-before-define": "error" - }, - "env": { "es6": true, "node": true } + } } diff --git a/src/helpers.ts b/src/helpers.ts index db20603..5d13c98 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -34,8 +34,6 @@ export const ENABLE_DEBUG = true const network = dataSource.network() -export const OCEAN: string = getOceanAddress() - function getOceanAddress(): string { if (network == 'ropsten') { return '0x5e8dcb2afa23844bcc311b00ad1a0c30025aade9' @@ -46,6 +44,8 @@ function getOceanAddress(): string { return '0x967da4048cd07ab37855c090aaf366e4ce1b9f48' } +export const OCEAN: string = getOceanAddress() + export function _debuglog( message: string, event: ethereum.Event, @@ -310,11 +310,10 @@ export function createPoolTransaction( pool.consumePrice = poolTx.consumePrice pool.spotPrice = poolTx.spotPrice - const { lockedValue } = pool pool.lockedValue = pool.oceanReserve + pool.datatokenReserve * pool.spotPrice const factory = PoolFactory.load('1') factory.totalLockedValue = - factory.totalLockedValue - lockedValue + pool.lockedValue + factory.totalLockedValue - pool.lockedValue + pool.lockedValue pool.transactionCount = pool.transactionCount.plus(BigInt.fromI32(1)) diff --git a/src/mappings/pool.ts b/src/mappings/pool.ts index 7eda015..4440eaa 100644 --- a/src/mappings/pool.ts +++ b/src/mappings/pool.ts @@ -438,8 +438,11 @@ 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()]) - + 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()) @@ -452,7 +455,11 @@ 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()]) + 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())