mirror of
https://github.com/oceanprotocol/ocean-subgraph.git
synced 2024-12-02 05:57:29 +01:00
bump contracts to alpha28 and ocean.js to alpha 33 (#401)
* bump contracts to alpha28 and ocean.js to alpha 33 * update dev deps * fix pool reserves
This commit is contained in:
parent
c1a0df4eb8
commit
7073cd8743
2
.github/workflows/tests.yml
vendored
2
.github/workflows/tests.yml
vendored
@ -52,7 +52,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
bash -x start_ocean.sh --with-thegraph --skip-subgraph-deploy --no-dashboard 2>&1 > start_ocean.log &
|
bash -x start_ocean.sh --with-thegraph --skip-subgraph-deploy --no-dashboard 2>&1 > start_ocean.log &
|
||||||
env:
|
env:
|
||||||
CONTRACTS_VERSION: v4_rc1
|
CONTRACTS_VERSION: v1.0.0-alpha.28
|
||||||
|
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
|
|
||||||
|
12455
package-lock.json
generated
12455
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -48,11 +48,12 @@
|
|||||||
"mock-local-storage": "^1.1.21",
|
"mock-local-storage": "^1.1.21",
|
||||||
"prettier": "^2.6.2",
|
"prettier": "^2.6.2",
|
||||||
"release-it": "^14.14.0",
|
"release-it": "^14.14.0",
|
||||||
|
"source-map-support": "^0.5.21",
|
||||||
"ts-node-register": "^1.0.0",
|
"ts-node-register": "^1.0.0",
|
||||||
"typescript": "^4.6.3"
|
"typescript": "^4.6.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@oceanprotocol/lib": "^1.0.0-next.29",
|
"@oceanprotocol/lib": "^1.0.0-next.33",
|
||||||
"cross-fetch": "^3.1.4"
|
"cross-fetch": "^3.1.4"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -80,6 +80,8 @@ type Nft @entity{
|
|||||||
|
|
||||||
"address of the owner of the nft"
|
"address of the owner of the nft"
|
||||||
owner: String!
|
owner: String!
|
||||||
|
"address of the creator of the nft"
|
||||||
|
creator: String!
|
||||||
|
|
||||||
"same as id, it's just for easy discoverability"
|
"same as id, it's just for easy discoverability"
|
||||||
address: String!
|
address: String!
|
||||||
@ -99,6 +101,8 @@ type Nft @entity{
|
|||||||
"template address"
|
"template address"
|
||||||
template: String!
|
template: String!
|
||||||
|
|
||||||
|
"set if NFT is transferable"
|
||||||
|
transferable: Boolean!
|
||||||
|
|
||||||
"block time nft was created"
|
"block time nft was created"
|
||||||
createdTimestamp: Int!
|
createdTimestamp: Int!
|
||||||
|
@ -11,6 +11,8 @@ export function handleNftCreated(event: NFTCreated): void {
|
|||||||
const nft = getNftToken(event.params.newTokenAddress)
|
const nft = getNftToken(event.params.newTokenAddress)
|
||||||
const user = getUser(event.params.admin.toHexString())
|
const user = getUser(event.params.admin.toHexString())
|
||||||
nft.owner = user.id
|
nft.owner = user.id
|
||||||
|
const creator = getUser(event.params.creator.toHexString())
|
||||||
|
nft.creator = creator.id
|
||||||
nft.address = event.params.newTokenAddress.toHexString()
|
nft.address = event.params.newTokenAddress.toHexString()
|
||||||
nft.name = event.params.tokenName
|
nft.name = event.params.tokenName
|
||||||
nft.symbol = event.params.symbol.toString()
|
nft.symbol = event.params.symbol.toString()
|
||||||
@ -18,6 +20,7 @@ export function handleNftCreated(event: NFTCreated): void {
|
|||||||
nft.createdTimestamp = event.block.timestamp.toI32()
|
nft.createdTimestamp = event.block.timestamp.toI32()
|
||||||
nft.tx = event.transaction.hash.toHex()
|
nft.tx = event.transaction.hash.toHex()
|
||||||
nft.block = event.block.number.toI32()
|
nft.block = event.block.number.toI32()
|
||||||
|
nft.transferable = event.params.transferable
|
||||||
|
|
||||||
nft.save()
|
nft.save()
|
||||||
}
|
}
|
||||||
|
@ -23,8 +23,7 @@ import {
|
|||||||
getPoolShare,
|
getPoolShare,
|
||||||
getPoolSnapshot,
|
getPoolSnapshot,
|
||||||
getPoolLpSwapFee,
|
getPoolLpSwapFee,
|
||||||
getPoolPublisherMarketFee,
|
getPoolPublisherMarketFee
|
||||||
getBalance
|
|
||||||
} from './utils/poolUtils'
|
} from './utils/poolUtils'
|
||||||
import { getToken } from './utils/tokenUtils'
|
import { getToken } from './utils/tokenUtils'
|
||||||
import { getUser } from './utils/userUtils'
|
import { getUser } from './utils/userUtils'
|
||||||
@ -118,17 +117,20 @@ export function handleSwap(event: LOG_SWAP): void {
|
|||||||
const poolSnapshot = getPoolSnapshot(pool.id, event.block.timestamp.toI32())
|
const poolSnapshot = getPoolSnapshot(pool.id, event.block.timestamp.toI32())
|
||||||
// get token out and update pool transaction, value is negative
|
// get token out and update pool transaction, value is negative
|
||||||
const tokenOut = getToken(event.params.tokenOut, false)
|
const tokenOut = getToken(event.params.tokenOut, false)
|
||||||
|
const tokenIn = getToken(event.params.tokenIn, false)
|
||||||
const ammountOut = weiToDecimal(
|
const ammountOut = weiToDecimal(
|
||||||
event.params.tokenAmountOut.toBigDecimal(),
|
event.params.tokenAmountOut.toBigDecimal(),
|
||||||
tokenOut.decimals
|
tokenOut.decimals
|
||||||
)
|
)
|
||||||
|
|
||||||
const tokenOutNewBalance = getBalance(
|
const tokenOutNewBalance = weiToDecimal(
|
||||||
event.address,
|
event.params.outBalance.toBigDecimal(),
|
||||||
event.params.tokenOut,
|
|
||||||
tokenOut.decimals
|
tokenOut.decimals
|
||||||
)
|
)
|
||||||
|
const tokenInNewBalance = weiToDecimal(
|
||||||
|
event.params.inBalance.toBigDecimal(),
|
||||||
|
tokenIn.decimals
|
||||||
|
)
|
||||||
|
|
||||||
if (tokenOut.isDatatoken) {
|
if (tokenOut.isDatatoken) {
|
||||||
poolTx.datatoken = tokenOut.id
|
poolTx.datatoken = tokenOut.id
|
||||||
@ -147,16 +149,10 @@ export function handleSwap(event: LOG_SWAP): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// update pool token in
|
// update pool token in
|
||||||
const tokenIn = getToken(event.params.tokenIn, false)
|
|
||||||
const ammountIn = weiToDecimal(
|
const ammountIn = weiToDecimal(
|
||||||
event.params.tokenAmountIn.toBigDecimal(),
|
event.params.tokenAmountIn.toBigDecimal(),
|
||||||
tokenIn.decimals
|
tokenIn.decimals
|
||||||
)
|
)
|
||||||
const tokenInNewBalance = getBalance(
|
|
||||||
event.address,
|
|
||||||
event.params.tokenIn,
|
|
||||||
tokenIn.decimals
|
|
||||||
)
|
|
||||||
if (tokenIn.isDatatoken) {
|
if (tokenIn.isDatatoken) {
|
||||||
poolTx.datatoken = tokenIn.id
|
poolTx.datatoken = tokenIn.id
|
||||||
poolTx.datatokenValue = ammountIn
|
poolTx.datatokenValue = ammountIn
|
||||||
@ -172,13 +168,7 @@ export function handleSwap(event: LOG_SWAP): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// update spot price
|
// update spot price
|
||||||
const isTokenInDatatoken = tokenIn.isDatatoken
|
const spotPrice = event.params.newSpotPrice.toBigDecimal()
|
||||||
const spotPrice = calcSpotPrice(
|
|
||||||
pool.id,
|
|
||||||
isTokenInDatatoken ? tokenOut.id : tokenIn.id,
|
|
||||||
isTokenInDatatoken ? tokenIn.id : tokenOut.id,
|
|
||||||
isTokenInDatatoken ? tokenIn.decimals : tokenOut.decimals
|
|
||||||
)
|
|
||||||
pool.spotPrice = spotPrice
|
pool.spotPrice = spotPrice
|
||||||
poolSnapshot.spotPrice = spotPrice
|
poolSnapshot.spotPrice = spotPrice
|
||||||
poolSnapshot.baseTokenLiquidity = pool.baseTokenLiquidity
|
poolSnapshot.baseTokenLiquidity = pool.baseTokenLiquidity
|
||||||
|
@ -24,7 +24,7 @@ dataSources:
|
|||||||
- name: ERC20
|
- name: ERC20
|
||||||
file: ./abis/ERC20.json
|
file: ./abis/ERC20.json
|
||||||
eventHandlers:
|
eventHandlers:
|
||||||
- event: NFTCreated(indexed address,indexed address,string,address,string,string)
|
- event: NFTCreated(address,indexed address,string,indexed address,string,string,bool,indexed address)
|
||||||
handler: handleNftCreated
|
handler: handleNftCreated
|
||||||
- event: TokenCreated(indexed address,indexed address,string,string,uint256,address)
|
- event: TokenCreated(indexed address,indexed address,string,string,uint256,address)
|
||||||
handler: handleNewToken
|
handler: handleNewToken
|
||||||
@ -134,7 +134,7 @@ templates:
|
|||||||
- name: ERC20
|
- name: ERC20
|
||||||
file: ./abis/ERC20.json
|
file: ./abis/ERC20.json
|
||||||
eventHandlers:
|
eventHandlers:
|
||||||
- event: LOG_SWAP(indexed address,indexed address,indexed address,uint256,uint256,uint256)
|
- event: LOG_SWAP(indexed address,indexed address,indexed address,uint256,uint256,uint256,uint256,uint256,uint256)
|
||||||
handler: handleSwap
|
handler: handleSwap
|
||||||
- event: LOG_JOIN(indexed address,indexed address,uint256,uint256)
|
- event: LOG_JOIN(indexed address,indexed address,uint256,uint256)
|
||||||
handler: handleJoin
|
handler: handleJoin
|
||||||
|
@ -82,13 +82,15 @@ describe('Simple Publish & consume test', async () => {
|
|||||||
name: 'testNFT',
|
name: 'testNFT',
|
||||||
symbol: 'TST',
|
symbol: 'TST',
|
||||||
templateIndex: 1,
|
templateIndex: 1,
|
||||||
tokenURI: ''
|
tokenURI: '',
|
||||||
|
transferable: true,
|
||||||
|
owner: publisherAccount
|
||||||
}
|
}
|
||||||
const erc20Params: Erc20CreateParams = {
|
const erc20Params: Erc20CreateParams = {
|
||||||
templateIndex: 1,
|
templateIndex: 1,
|
||||||
cap: '100000',
|
cap: '100000',
|
||||||
feeAmount: '0',
|
feeAmount: '0',
|
||||||
feeManager: '0x0000000000000000000000000000000000000000',
|
paymentCollector: '0x0000000000000000000000000000000000000000',
|
||||||
feeToken: '0x0000000000000000000000000000000000000000',
|
feeToken: '0x0000000000000000000000000000000000000000',
|
||||||
minter: publisherAccount,
|
minter: publisherAccount,
|
||||||
mpFeeAddress: '0x0000000000000000000000000000000000000000'
|
mpFeeAddress: '0x0000000000000000000000000000000000000000'
|
||||||
|
Loading…
Reference in New Issue
Block a user