diff --git a/schema.graphql b/schema.graphql index 1a0caa6..91e7e0b 100644 --- a/schema.graphql +++ b/schema.graphql @@ -227,6 +227,7 @@ type FixedRateExchange @entity { exchangeOwner: User! datatoken: Datatoken! baseToken: String! + baseTokenSymbol: String! rate: BigDecimal! active: Boolean! updates: [FixedRateExchangeUpdate!] @derivedFrom(field: "exchangeId") diff --git a/src/mappings/fixedrateexchange.ts b/src/mappings/fixedrateexchange.ts index 198409d..5f91d51 100644 --- a/src/mappings/fixedrateexchange.ts +++ b/src/mappings/fixedrateexchange.ts @@ -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() diff --git a/subgraph.bsc.yaml b/subgraph.bsc.yaml index 7941ddd..5d497e3 100644 --- a/subgraph.bsc.yaml +++ b/subgraph.bsc.yaml @@ -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' diff --git a/subgraph.gaiaxtestnet.yaml b/subgraph.gaiaxtestnet.yaml index 741f78e..17236ab 100644 --- a/subgraph.gaiaxtestnet.yaml +++ b/subgraph.gaiaxtestnet.yaml @@ -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 diff --git a/subgraph.moonbeamalpha.yaml b/subgraph.moonbeamalpha.yaml index fc7cd0b..305fe72 100644 --- a/subgraph.moonbeamalpha.yaml +++ b/subgraph.moonbeamalpha.yaml @@ -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 diff --git a/subgraph.mumbai.yaml b/subgraph.mumbai.yaml index ba6b662..066ecb5 100644 --- a/subgraph.mumbai.yaml +++ b/subgraph.mumbai.yaml @@ -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 diff --git a/subgraph.polygon.yaml b/subgraph.polygon.yaml index 3e4aac8..1e94cdb 100644 --- a/subgraph.polygon.yaml +++ b/subgraph.polygon.yaml @@ -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 diff --git a/subgraph.rinkeby.yaml b/subgraph.rinkeby.yaml index 94c7114..d7987ef 100644 --- a/subgraph.rinkeby.yaml +++ b/subgraph.rinkeby.yaml @@ -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 diff --git a/subgraph.ropsten.yaml b/subgraph.ropsten.yaml index ea5390d..8bc0ed8 100644 --- a/subgraph.ropsten.yaml +++ b/subgraph.ropsten.yaml @@ -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 diff --git a/subgraph.yaml b/subgraph.yaml index c476ab2..6973abf 100644 --- a/subgraph.yaml +++ b/subgraph.yaml @@ -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 diff --git a/test/integration/Datatokens.test.ts b/test/integration/Datatokens.test.ts index 5d28e6d..0dd2cc5 100644 --- a/test/integration/Datatokens.test.ts +++ b/test/integration/Datatokens.test.ts @@ -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}}`