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: |
|
||||
bash -x start_ocean.sh --with-thegraph --skip-subgraph-deploy --no-dashboard 2>&1 > start_ocean.log &
|
||||
env:
|
||||
CONTRACTS_VERSION: v4_rc1
|
||||
CONTRACTS_VERSION: v1.0.0-alpha.28
|
||||
|
||||
- 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",
|
||||
"prettier": "^2.6.2",
|
||||
"release-it": "^14.14.0",
|
||||
"source-map-support": "^0.5.21",
|
||||
"ts-node-register": "^1.0.0",
|
||||
"typescript": "^4.6.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@oceanprotocol/lib": "^1.0.0-next.29",
|
||||
"@oceanprotocol/lib": "^1.0.0-next.33",
|
||||
"cross-fetch": "^3.1.4"
|
||||
},
|
||||
"repository": {
|
||||
|
@ -80,6 +80,8 @@ type Nft @entity{
|
||||
|
||||
"address of the owner of the nft"
|
||||
owner: String!
|
||||
"address of the creator of the nft"
|
||||
creator: String!
|
||||
|
||||
"same as id, it's just for easy discoverability"
|
||||
address: String!
|
||||
@ -99,6 +101,8 @@ type Nft @entity{
|
||||
"template address"
|
||||
template: String!
|
||||
|
||||
"set if NFT is transferable"
|
||||
transferable: Boolean!
|
||||
|
||||
"block time nft was created"
|
||||
createdTimestamp: Int!
|
||||
|
@ -11,6 +11,8 @@ export function handleNftCreated(event: NFTCreated): void {
|
||||
const nft = getNftToken(event.params.newTokenAddress)
|
||||
const user = getUser(event.params.admin.toHexString())
|
||||
nft.owner = user.id
|
||||
const creator = getUser(event.params.creator.toHexString())
|
||||
nft.creator = creator.id
|
||||
nft.address = event.params.newTokenAddress.toHexString()
|
||||
nft.name = event.params.tokenName
|
||||
nft.symbol = event.params.symbol.toString()
|
||||
@ -18,6 +20,7 @@ export function handleNftCreated(event: NFTCreated): void {
|
||||
nft.createdTimestamp = event.block.timestamp.toI32()
|
||||
nft.tx = event.transaction.hash.toHex()
|
||||
nft.block = event.block.number.toI32()
|
||||
nft.transferable = event.params.transferable
|
||||
|
||||
nft.save()
|
||||
}
|
||||
|
@ -23,8 +23,7 @@ import {
|
||||
getPoolShare,
|
||||
getPoolSnapshot,
|
||||
getPoolLpSwapFee,
|
||||
getPoolPublisherMarketFee,
|
||||
getBalance
|
||||
getPoolPublisherMarketFee
|
||||
} from './utils/poolUtils'
|
||||
import { getToken } from './utils/tokenUtils'
|
||||
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())
|
||||
// get token out and update pool transaction, value is negative
|
||||
const tokenOut = getToken(event.params.tokenOut, false)
|
||||
|
||||
const tokenIn = getToken(event.params.tokenIn, false)
|
||||
const ammountOut = weiToDecimal(
|
||||
event.params.tokenAmountOut.toBigDecimal(),
|
||||
tokenOut.decimals
|
||||
)
|
||||
|
||||
const tokenOutNewBalance = getBalance(
|
||||
event.address,
|
||||
event.params.tokenOut,
|
||||
const tokenOutNewBalance = weiToDecimal(
|
||||
event.params.outBalance.toBigDecimal(),
|
||||
tokenOut.decimals
|
||||
)
|
||||
const tokenInNewBalance = weiToDecimal(
|
||||
event.params.inBalance.toBigDecimal(),
|
||||
tokenIn.decimals
|
||||
)
|
||||
|
||||
if (tokenOut.isDatatoken) {
|
||||
poolTx.datatoken = tokenOut.id
|
||||
@ -147,16 +149,10 @@ export function handleSwap(event: LOG_SWAP): void {
|
||||
}
|
||||
|
||||
// update pool token in
|
||||
const tokenIn = getToken(event.params.tokenIn, false)
|
||||
const ammountIn = weiToDecimal(
|
||||
event.params.tokenAmountIn.toBigDecimal(),
|
||||
tokenIn.decimals
|
||||
)
|
||||
const tokenInNewBalance = getBalance(
|
||||
event.address,
|
||||
event.params.tokenIn,
|
||||
tokenIn.decimals
|
||||
)
|
||||
if (tokenIn.isDatatoken) {
|
||||
poolTx.datatoken = tokenIn.id
|
||||
poolTx.datatokenValue = ammountIn
|
||||
@ -172,13 +168,7 @@ export function handleSwap(event: LOG_SWAP): void {
|
||||
}
|
||||
|
||||
// update spot price
|
||||
const isTokenInDatatoken = tokenIn.isDatatoken
|
||||
const spotPrice = calcSpotPrice(
|
||||
pool.id,
|
||||
isTokenInDatatoken ? tokenOut.id : tokenIn.id,
|
||||
isTokenInDatatoken ? tokenIn.id : tokenOut.id,
|
||||
isTokenInDatatoken ? tokenIn.decimals : tokenOut.decimals
|
||||
)
|
||||
const spotPrice = event.params.newSpotPrice.toBigDecimal()
|
||||
pool.spotPrice = spotPrice
|
||||
poolSnapshot.spotPrice = spotPrice
|
||||
poolSnapshot.baseTokenLiquidity = pool.baseTokenLiquidity
|
||||
|
@ -24,7 +24,7 @@ dataSources:
|
||||
- name: ERC20
|
||||
file: ./abis/ERC20.json
|
||||
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
|
||||
- event: TokenCreated(indexed address,indexed address,string,string,uint256,address)
|
||||
handler: handleNewToken
|
||||
@ -134,7 +134,7 @@ templates:
|
||||
- name: ERC20
|
||||
file: ./abis/ERC20.json
|
||||
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
|
||||
- event: LOG_JOIN(indexed address,indexed address,uint256,uint256)
|
||||
handler: handleJoin
|
||||
|
@ -82,13 +82,15 @@ describe('Simple Publish & consume test', async () => {
|
||||
name: 'testNFT',
|
||||
symbol: 'TST',
|
||||
templateIndex: 1,
|
||||
tokenURI: ''
|
||||
tokenURI: '',
|
||||
transferable: true,
|
||||
owner: publisherAccount
|
||||
}
|
||||
const erc20Params: Erc20CreateParams = {
|
||||
templateIndex: 1,
|
||||
cap: '100000',
|
||||
feeAmount: '0',
|
||||
feeManager: '0x0000000000000000000000000000000000000000',
|
||||
paymentCollector: '0x0000000000000000000000000000000000000000',
|
||||
feeToken: '0x0000000000000000000000000000000000000000',
|
||||
minter: publisherAccount,
|
||||
mpFeeAddress: '0x0000000000000000000000000000000000000000'
|
||||
|
Loading…
Reference in New Issue
Block a user