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!
|
||||
datatoken: Datatoken!
|
||||
baseToken: String!
|
||||
baseTokenSymbol: String!
|
||||
rate: BigDecimal!
|
||||
active: Boolean!
|
||||
updates: [FixedRateExchangeUpdate!] @derivedFrom(field: "exchangeId")
|
||||
|
@ -13,7 +13,7 @@ import {
|
||||
FixedRateExchangeSwap
|
||||
} from '../@types/schema'
|
||||
|
||||
import { tokenToDecimal } from '../helpers'
|
||||
import { getTokenSymbol, tokenToDecimal } from '../helpers'
|
||||
|
||||
export function handleExchangeCreated(event: ExchangeCreated): void {
|
||||
const fixedrateexchange = new FixedRateExchange(
|
||||
@ -22,7 +22,12 @@ export function handleExchangeCreated(event: ExchangeCreated): void {
|
||||
fixedrateexchange.exchangeOwner = event.params.exchangeOwner.toHexString()
|
||||
fixedrateexchange.datatoken = event.params.dataToken.toHexString()
|
||||
fixedrateexchange.baseToken = event.params.baseToken.toHexString()
|
||||
fixedrateexchange.baseTokenSymbol = getTokenSymbol(event.params.baseToken)
|
||||
fixedrateexchange.active = false
|
||||
log.info('new exchange with datatoken {} and base token {} ', [
|
||||
fixedrateexchange.datatoken,
|
||||
fixedrateexchange.baseToken
|
||||
])
|
||||
log.info('for new exchange {} for rate {}', [
|
||||
event.params.exchangeId.toHexString(),
|
||||
event.params.fixedRate.toString()
|
||||
|
@ -144,6 +144,12 @@ templates:
|
||||
file: ./abis/BPool.json
|
||||
- name: BToken
|
||||
file: ./abis/BToken.json
|
||||
- name: ERC20
|
||||
file: ./abis/ERC20.json
|
||||
- name: ERC20SymbolBytes
|
||||
file: ./abis/ERC20SymbolBytes.json
|
||||
- name: ERC20NameBytes
|
||||
file: ./abis/ERC20NameBytes.json
|
||||
eventHandlers:
|
||||
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
|
||||
topic0: '0x34e1990700000000000000000000000000000000000000000000000000000000'
|
||||
|
@ -83,6 +83,12 @@ dataSources:
|
||||
abis:
|
||||
- name: FixedRateExchange
|
||||
file: ./abis/FixedRateExchange.json
|
||||
- name: ERC20
|
||||
file: ./abis/ERC20.json
|
||||
- name: ERC20SymbolBytes
|
||||
file: ./abis/ERC20SymbolBytes.json
|
||||
- name: ERC20NameBytes
|
||||
file: ./abis/ERC20NameBytes.json
|
||||
eventHandlers:
|
||||
- event: ExchangeCreated(indexed bytes32,indexed address,indexed address,address,uint256)
|
||||
handler: handleExchangeCreated
|
||||
|
@ -83,6 +83,12 @@ dataSources:
|
||||
abis:
|
||||
- name: FixedRateExchange
|
||||
file: ./abis/FixedRateExchange.json
|
||||
- name: ERC20
|
||||
file: ./abis/ERC20.json
|
||||
- name: ERC20SymbolBytes
|
||||
file: ./abis/ERC20SymbolBytes.json
|
||||
- name: ERC20NameBytes
|
||||
file: ./abis/ERC20NameBytes.json
|
||||
eventHandlers:
|
||||
- event: ExchangeCreated(indexed bytes32,indexed address,indexed address,address,uint256)
|
||||
handler: handleExchangeCreated
|
||||
|
@ -83,6 +83,12 @@ dataSources:
|
||||
abis:
|
||||
- name: FixedRateExchange
|
||||
file: ./abis/FixedRateExchange.json
|
||||
- name: ERC20
|
||||
file: ./abis/ERC20.json
|
||||
- name: ERC20SymbolBytes
|
||||
file: ./abis/ERC20SymbolBytes.json
|
||||
- name: ERC20NameBytes
|
||||
file: ./abis/ERC20NameBytes.json
|
||||
eventHandlers:
|
||||
- event: ExchangeCreated(indexed bytes32,indexed address,indexed address,address,uint256)
|
||||
handler: handleExchangeCreated
|
||||
|
@ -83,6 +83,12 @@ dataSources:
|
||||
abis:
|
||||
- name: FixedRateExchange
|
||||
file: ./abis/FixedRateExchange.json
|
||||
- name: ERC20
|
||||
file: ./abis/ERC20.json
|
||||
- name: ERC20SymbolBytes
|
||||
file: ./abis/ERC20SymbolBytes.json
|
||||
- name: ERC20NameBytes
|
||||
file: ./abis/ERC20NameBytes.json
|
||||
eventHandlers:
|
||||
- event: ExchangeCreated(indexed bytes32,indexed address,indexed address,address,uint256)
|
||||
handler: handleExchangeCreated
|
||||
|
@ -83,6 +83,12 @@ dataSources:
|
||||
abis:
|
||||
- name: FixedRateExchange
|
||||
file: ./abis/FixedRateExchange.json
|
||||
- name: ERC20
|
||||
file: ./abis/ERC20.json
|
||||
- name: ERC20SymbolBytes
|
||||
file: ./abis/ERC20SymbolBytes.json
|
||||
- name: ERC20NameBytes
|
||||
file: ./abis/ERC20NameBytes.json
|
||||
eventHandlers:
|
||||
- event: ExchangeCreated(indexed bytes32,indexed address,indexed address,address,uint256)
|
||||
handler: handleExchangeCreated
|
||||
|
@ -83,6 +83,12 @@ dataSources:
|
||||
abis:
|
||||
- name: FixedRateExchange
|
||||
file: ./abis/FixedRateExchange.json
|
||||
- name: ERC20
|
||||
file: ./abis/ERC20.json
|
||||
- name: ERC20SymbolBytes
|
||||
file: ./abis/ERC20SymbolBytes.json
|
||||
- name: ERC20NameBytes
|
||||
file: ./abis/ERC20NameBytes.json
|
||||
eventHandlers:
|
||||
- event: ExchangeCreated(indexed bytes32,indexed address,indexed address,address,uint256)
|
||||
handler: handleExchangeCreated
|
||||
|
@ -83,6 +83,12 @@ dataSources:
|
||||
abis:
|
||||
- name: FixedRateExchange
|
||||
file: ./abis/FixedRateExchange.json
|
||||
- name: ERC20
|
||||
file: ./abis/ERC20.json
|
||||
- name: ERC20SymbolBytes
|
||||
file: ./abis/ERC20SymbolBytes.json
|
||||
- name: ERC20NameBytes
|
||||
file: ./abis/ERC20NameBytes.json
|
||||
eventHandlers:
|
||||
- event: ExchangeCreated(indexed bytes32,indexed address,indexed address,address,uint256)
|
||||
handler: handleExchangeCreated
|
||||
|
@ -29,7 +29,7 @@ describe('Datatokens test flow', () => {
|
||||
it('Alice publishes a datatoken and querys the graph', async () => {
|
||||
const datatoken = await ocean.datatokens.create('', alice.getId())
|
||||
const graphToken = datatoken.toLowerCase()
|
||||
await sleep(1000) // let graph ingest our transaction
|
||||
await sleep(3000) // let graph ingest our transaction
|
||||
const query = {
|
||||
query: `query {
|
||||
datatoken(id:"${graphToken}"){symbol,id}}`
|
||||
|
Loading…
Reference in New Issue
Block a user