Added baseTokenSymbol to FixedRateExchange (#201)

* added baseTokenSymbol to fre

* increase wait for test

* fix format
This commit is contained in:
mihaisc 2021-08-13 17:04:18 +03:00 committed by GitHub
parent 76234da55d
commit 6646d21292
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 56 additions and 2 deletions

View File

@ -227,6 +227,7 @@ type FixedRateExchange @entity {
exchangeOwner: User!
datatoken: Datatoken!
baseToken: String!
baseTokenSymbol: String!
rate: BigDecimal!
active: Boolean!
updates: [FixedRateExchangeUpdate!] @derivedFrom(field: "exchangeId")

View File

@ -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()

View File

@ -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'

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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}}`