mirror of
https://github.com/oceanprotocol/ocean-subgraph.git
synced 2024-12-02 05:57:29 +01:00
Added baseTokenSymbol to FixedRateExchange (#201)
* added baseTokenSymbol to fre * increase wait for test * fix format
This commit is contained in:
parent
76234da55d
commit
6646d21292
@ -227,6 +227,7 @@ type FixedRateExchange @entity {
|
|||||||
exchangeOwner: User!
|
exchangeOwner: User!
|
||||||
datatoken: Datatoken!
|
datatoken: Datatoken!
|
||||||
baseToken: String!
|
baseToken: String!
|
||||||
|
baseTokenSymbol: String!
|
||||||
rate: BigDecimal!
|
rate: BigDecimal!
|
||||||
active: Boolean!
|
active: Boolean!
|
||||||
updates: [FixedRateExchangeUpdate!] @derivedFrom(field: "exchangeId")
|
updates: [FixedRateExchangeUpdate!] @derivedFrom(field: "exchangeId")
|
||||||
|
@ -13,7 +13,7 @@ import {
|
|||||||
FixedRateExchangeSwap
|
FixedRateExchangeSwap
|
||||||
} from '../@types/schema'
|
} from '../@types/schema'
|
||||||
|
|
||||||
import { tokenToDecimal } from '../helpers'
|
import { getTokenSymbol, tokenToDecimal } from '../helpers'
|
||||||
|
|
||||||
export function handleExchangeCreated(event: ExchangeCreated): void {
|
export function handleExchangeCreated(event: ExchangeCreated): void {
|
||||||
const fixedrateexchange = new FixedRateExchange(
|
const fixedrateexchange = new FixedRateExchange(
|
||||||
@ -22,7 +22,12 @@ export function handleExchangeCreated(event: ExchangeCreated): void {
|
|||||||
fixedrateexchange.exchangeOwner = event.params.exchangeOwner.toHexString()
|
fixedrateexchange.exchangeOwner = event.params.exchangeOwner.toHexString()
|
||||||
fixedrateexchange.datatoken = event.params.dataToken.toHexString()
|
fixedrateexchange.datatoken = event.params.dataToken.toHexString()
|
||||||
fixedrateexchange.baseToken = event.params.baseToken.toHexString()
|
fixedrateexchange.baseToken = event.params.baseToken.toHexString()
|
||||||
|
fixedrateexchange.baseTokenSymbol = getTokenSymbol(event.params.baseToken)
|
||||||
fixedrateexchange.active = false
|
fixedrateexchange.active = false
|
||||||
|
log.info('new exchange with datatoken {} and base token {} ', [
|
||||||
|
fixedrateexchange.datatoken,
|
||||||
|
fixedrateexchange.baseToken
|
||||||
|
])
|
||||||
log.info('for new exchange {} for rate {}', [
|
log.info('for new exchange {} for rate {}', [
|
||||||
event.params.exchangeId.toHexString(),
|
event.params.exchangeId.toHexString(),
|
||||||
event.params.fixedRate.toString()
|
event.params.fixedRate.toString()
|
||||||
|
@ -144,6 +144,12 @@ templates:
|
|||||||
file: ./abis/BPool.json
|
file: ./abis/BPool.json
|
||||||
- name: BToken
|
- name: BToken
|
||||||
file: ./abis/BToken.json
|
file: ./abis/BToken.json
|
||||||
|
- name: ERC20
|
||||||
|
file: ./abis/ERC20.json
|
||||||
|
- name: ERC20SymbolBytes
|
||||||
|
file: ./abis/ERC20SymbolBytes.json
|
||||||
|
- name: ERC20NameBytes
|
||||||
|
file: ./abis/ERC20NameBytes.json
|
||||||
eventHandlers:
|
eventHandlers:
|
||||||
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
|
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
|
||||||
topic0: '0x34e1990700000000000000000000000000000000000000000000000000000000'
|
topic0: '0x34e1990700000000000000000000000000000000000000000000000000000000'
|
||||||
|
@ -83,6 +83,12 @@ dataSources:
|
|||||||
abis:
|
abis:
|
||||||
- name: FixedRateExchange
|
- name: FixedRateExchange
|
||||||
file: ./abis/FixedRateExchange.json
|
file: ./abis/FixedRateExchange.json
|
||||||
|
- name: ERC20
|
||||||
|
file: ./abis/ERC20.json
|
||||||
|
- name: ERC20SymbolBytes
|
||||||
|
file: ./abis/ERC20SymbolBytes.json
|
||||||
|
- name: ERC20NameBytes
|
||||||
|
file: ./abis/ERC20NameBytes.json
|
||||||
eventHandlers:
|
eventHandlers:
|
||||||
- event: ExchangeCreated(indexed bytes32,indexed address,indexed address,address,uint256)
|
- event: ExchangeCreated(indexed bytes32,indexed address,indexed address,address,uint256)
|
||||||
handler: handleExchangeCreated
|
handler: handleExchangeCreated
|
||||||
|
@ -83,6 +83,12 @@ dataSources:
|
|||||||
abis:
|
abis:
|
||||||
- name: FixedRateExchange
|
- name: FixedRateExchange
|
||||||
file: ./abis/FixedRateExchange.json
|
file: ./abis/FixedRateExchange.json
|
||||||
|
- name: ERC20
|
||||||
|
file: ./abis/ERC20.json
|
||||||
|
- name: ERC20SymbolBytes
|
||||||
|
file: ./abis/ERC20SymbolBytes.json
|
||||||
|
- name: ERC20NameBytes
|
||||||
|
file: ./abis/ERC20NameBytes.json
|
||||||
eventHandlers:
|
eventHandlers:
|
||||||
- event: ExchangeCreated(indexed bytes32,indexed address,indexed address,address,uint256)
|
- event: ExchangeCreated(indexed bytes32,indexed address,indexed address,address,uint256)
|
||||||
handler: handleExchangeCreated
|
handler: handleExchangeCreated
|
||||||
|
@ -83,6 +83,12 @@ dataSources:
|
|||||||
abis:
|
abis:
|
||||||
- name: FixedRateExchange
|
- name: FixedRateExchange
|
||||||
file: ./abis/FixedRateExchange.json
|
file: ./abis/FixedRateExchange.json
|
||||||
|
- name: ERC20
|
||||||
|
file: ./abis/ERC20.json
|
||||||
|
- name: ERC20SymbolBytes
|
||||||
|
file: ./abis/ERC20SymbolBytes.json
|
||||||
|
- name: ERC20NameBytes
|
||||||
|
file: ./abis/ERC20NameBytes.json
|
||||||
eventHandlers:
|
eventHandlers:
|
||||||
- event: ExchangeCreated(indexed bytes32,indexed address,indexed address,address,uint256)
|
- event: ExchangeCreated(indexed bytes32,indexed address,indexed address,address,uint256)
|
||||||
handler: handleExchangeCreated
|
handler: handleExchangeCreated
|
||||||
|
@ -83,6 +83,12 @@ dataSources:
|
|||||||
abis:
|
abis:
|
||||||
- name: FixedRateExchange
|
- name: FixedRateExchange
|
||||||
file: ./abis/FixedRateExchange.json
|
file: ./abis/FixedRateExchange.json
|
||||||
|
- name: ERC20
|
||||||
|
file: ./abis/ERC20.json
|
||||||
|
- name: ERC20SymbolBytes
|
||||||
|
file: ./abis/ERC20SymbolBytes.json
|
||||||
|
- name: ERC20NameBytes
|
||||||
|
file: ./abis/ERC20NameBytes.json
|
||||||
eventHandlers:
|
eventHandlers:
|
||||||
- event: ExchangeCreated(indexed bytes32,indexed address,indexed address,address,uint256)
|
- event: ExchangeCreated(indexed bytes32,indexed address,indexed address,address,uint256)
|
||||||
handler: handleExchangeCreated
|
handler: handleExchangeCreated
|
||||||
|
@ -83,6 +83,12 @@ dataSources:
|
|||||||
abis:
|
abis:
|
||||||
- name: FixedRateExchange
|
- name: FixedRateExchange
|
||||||
file: ./abis/FixedRateExchange.json
|
file: ./abis/FixedRateExchange.json
|
||||||
|
- name: ERC20
|
||||||
|
file: ./abis/ERC20.json
|
||||||
|
- name: ERC20SymbolBytes
|
||||||
|
file: ./abis/ERC20SymbolBytes.json
|
||||||
|
- name: ERC20NameBytes
|
||||||
|
file: ./abis/ERC20NameBytes.json
|
||||||
eventHandlers:
|
eventHandlers:
|
||||||
- event: ExchangeCreated(indexed bytes32,indexed address,indexed address,address,uint256)
|
- event: ExchangeCreated(indexed bytes32,indexed address,indexed address,address,uint256)
|
||||||
handler: handleExchangeCreated
|
handler: handleExchangeCreated
|
||||||
|
@ -83,6 +83,12 @@ dataSources:
|
|||||||
abis:
|
abis:
|
||||||
- name: FixedRateExchange
|
- name: FixedRateExchange
|
||||||
file: ./abis/FixedRateExchange.json
|
file: ./abis/FixedRateExchange.json
|
||||||
|
- name: ERC20
|
||||||
|
file: ./abis/ERC20.json
|
||||||
|
- name: ERC20SymbolBytes
|
||||||
|
file: ./abis/ERC20SymbolBytes.json
|
||||||
|
- name: ERC20NameBytes
|
||||||
|
file: ./abis/ERC20NameBytes.json
|
||||||
eventHandlers:
|
eventHandlers:
|
||||||
- event: ExchangeCreated(indexed bytes32,indexed address,indexed address,address,uint256)
|
- event: ExchangeCreated(indexed bytes32,indexed address,indexed address,address,uint256)
|
||||||
handler: handleExchangeCreated
|
handler: handleExchangeCreated
|
||||||
|
@ -83,6 +83,12 @@ dataSources:
|
|||||||
abis:
|
abis:
|
||||||
- name: FixedRateExchange
|
- name: FixedRateExchange
|
||||||
file: ./abis/FixedRateExchange.json
|
file: ./abis/FixedRateExchange.json
|
||||||
|
- name: ERC20
|
||||||
|
file: ./abis/ERC20.json
|
||||||
|
- name: ERC20SymbolBytes
|
||||||
|
file: ./abis/ERC20SymbolBytes.json
|
||||||
|
- name: ERC20NameBytes
|
||||||
|
file: ./abis/ERC20NameBytes.json
|
||||||
eventHandlers:
|
eventHandlers:
|
||||||
- event: ExchangeCreated(indexed bytes32,indexed address,indexed address,address,uint256)
|
- event: ExchangeCreated(indexed bytes32,indexed address,indexed address,address,uint256)
|
||||||
handler: handleExchangeCreated
|
handler: handleExchangeCreated
|
||||||
|
@ -29,7 +29,7 @@ describe('Datatokens test flow', () => {
|
|||||||
it('Alice publishes a datatoken and querys the graph', async () => {
|
it('Alice publishes a datatoken and querys the graph', async () => {
|
||||||
const datatoken = await ocean.datatokens.create('', alice.getId())
|
const datatoken = await ocean.datatokens.create('', alice.getId())
|
||||||
const graphToken = datatoken.toLowerCase()
|
const graphToken = datatoken.toLowerCase()
|
||||||
await sleep(1000) // let graph ingest our transaction
|
await sleep(3000) // let graph ingest our transaction
|
||||||
const query = {
|
const query = {
|
||||||
query: `query {
|
query: `query {
|
||||||
datatoken(id:"${graphToken}"){symbol,id}}`
|
datatoken(id:"${graphToken}"){symbol,id}}`
|
||||||
|
Loading…
Reference in New Issue
Block a user