From 3dac319c0e81663698e6090e83d81d20a09a13af Mon Sep 17 00:00:00 2001 From: Jamie Hewitt Date: Mon, 4 Jul 2022 11:14:24 +0100 Subject: [PATCH] Removing arrary from providerFee --- schema.graphql | 2 +- src/mappings/erc20Templates.ts | 7 +---- test/integration/SimplePublishConsume.test.ts | 27 +++++++++++++------ 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/schema.graphql b/schema.graphql index feb4ea7..36fe1f2 100644 --- a/schema.graphql +++ b/schema.graphql @@ -265,7 +265,7 @@ type Order @entity { publishingMarket: User publishingMarketToken: Token # publishingMarketAmmount: BigDecimal #call contract to get fee amount - providerFee: [String!] + providerFee: String consumerMarket: User consumerMarketToken: Token # diff --git a/src/mappings/erc20Templates.ts b/src/mappings/erc20Templates.ts index 3d88858..c098229 100644 --- a/src/mappings/erc20Templates.ts +++ b/src/mappings/erc20Templates.ts @@ -214,12 +214,7 @@ export function handleProviderFee(event: ProviderFee): void { } }` - let existingProviderFees: string[] - if (!order.providerFee) existingProviderFees = [] - else existingProviderFees = order.providerFee as string[] - existingProviderFees.push(providerFee) - - order.providerFee = existingProviderFees + order.providerFee = providerFee order.save() } diff --git a/test/integration/SimplePublishConsume.test.ts b/test/integration/SimplePublishConsume.test.ts index 926ddcc..33b3cc2 100644 --- a/test/integration/SimplePublishConsume.test.ts +++ b/test/integration/SimplePublishConsume.test.ts @@ -72,16 +72,27 @@ const ddo = { } describe('Simple Publish & consume test', async () => { - const nft = new Nft(web3) - const Factory = new NftFactory(addresses.ERC721Factory, web3) - const accounts = await web3.eth.getAccounts() - const publisherAccount = accounts[0] - const newOwnerAccount = accounts[1].toLowerCase() - const user1 = accounts[2] - const user2 = accounts[3] - const user3 = accounts[4] let datatokenAddress: string let datatoken: Datatoken + let nft: Nft + let Factory: NftFactory + let accounts: string[] + let publisherAccount: string + let newOwnerAccount: string + let user1: string + let user2: string + let user3: string + + before(async () => { + nft = new Nft(web3) + Factory = new NftFactory(addresses.ERC721Factory, web3) + accounts = await web3.eth.getAccounts() + publisherAccount = accounts[0] + newOwnerAccount = accounts[1].toLowerCase() + user1 = accounts[2] + user2 = accounts[3] + user3 = accounts[4] + }) it('should publish a dataset (create NFT + ERC20)', async () => { // const consumerAccount = accounts[1]