diff --git a/.travis.yml b/.travis.yml index f4d0373..5b26c35 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,9 +19,9 @@ before_script: - ganache-cli --port 18545 > ganache-cli.log & - git clone https://github.com/oceanprotocol/barge - cd barge - - export AQUARIUS_VERSION=v0.2.9 - - export BRIZO_VERSION=v0.3.10 - - export KEEPER_VERSION=v0.9.7 + - export AQUARIUS_VERSION=v0.3.4 + - export BRIZO_VERSION=v0.3.12 + - export KEEPER_VERSION=v0.10.3 - export KEEPER_OWNER_ROLE_ADDRESS="0xe2DD09d719Da89e5a3D0F2549c7E24566e947260" - bash -x start_ocean.sh --no-pleuston --local-spree-node 2>&1 > start_ocean.log & - cd .. diff --git a/integration/config.ts b/integration/config.ts index 1878c10..866d9eb 100644 --- a/integration/config.ts +++ b/integration/config.ts @@ -52,6 +52,5 @@ if (process.env.SEED_WORDS) { ) } -export const config: Config & {forceVerbose: Config} = configJson as any - -(config as any).forceVerbose = {...configJson, verbose: true} +export const config: Config & { forceVerbose: Config } = configJson as any +;(config as any).forceVerbose = { ...configJson, verbose: true } diff --git a/integration/ocean/AssetOwners.test.ts b/integration/ocean/AssetOwners.test.ts index 1a483ef..a32a904 100644 --- a/integration/ocean/AssetOwners.test.ts +++ b/integration/ocean/AssetOwners.test.ts @@ -12,13 +12,17 @@ describe('Asset Owners', () => { let account1: Account let account2: Account - const metadata = getMetadata() + let metadata = getMetadata() before(async () => { ocean = await Ocean.getInstance(config) // Accounts ;[account1, account2] = await ocean.accounts.list() + + if (!ocean.keeper.dispenser) { + metadata = getMetadata(0) + } }) it('should be set correctly the owner of a asset', async () => { @@ -59,9 +63,13 @@ describe('Asset Owners', () => { assert.equal(finalLength1 - initialLength, 0) // Granting access - await account2.requestTokens( - +metadata.base.price * 10 ** -(await ocean.keeper.token.decimals()) - ) + try { + await account2.requestTokens( + +metadata.base.price * + 10 ** -(await ocean.keeper.token.decimals()) + ) + } catch {} + await ocean.assets.order( ddo.id, ddo.findServiceByType('Access').serviceDefinitionId, diff --git a/integration/ocean/ConsumeAsset.test.ts b/integration/ocean/ConsumeAsset.test.ts index 61c0d36..7635e22 100644 --- a/integration/ocean/ConsumeAsset.test.ts +++ b/integration/ocean/ConsumeAsset.test.ts @@ -12,7 +12,7 @@ describe('Consume Asset', () => { let publisher: Account let consumer: Account - const metadata = getMetadata() + let metadata = getMetadata() let ddo: DDO let serviceAgreementSignatureResult: { @@ -25,6 +25,10 @@ describe('Consume Asset', () => { // Accounts ;[publisher, consumer] = await ocean.accounts.list() + + if (!ocean.keeper.dispenser) { + metadata = getMetadata(0) + } }) it('should regiester a asset', async () => { @@ -47,7 +51,10 @@ describe('Consume Asset', () => { const initialBalance = (await consumer.getBalance()).ocn const claimedTokens = +metadata.base.price * 10 ** -(await ocean.keeper.token.decimals()) - await consumer.requestTokens(claimedTokens) + + try { + await consumer.requestTokens(claimedTokens) + } catch {} assert.equal( (await consumer.getBalance()).ocn, diff --git a/integration/ocean/ConsumeAssetBrizo.test.ts b/integration/ocean/ConsumeAssetBrizo.test.ts index 1d1f5a0..fe82d10 100644 --- a/integration/ocean/ConsumeAssetBrizo.test.ts +++ b/integration/ocean/ConsumeAssetBrizo.test.ts @@ -15,13 +15,17 @@ describe('Consume Asset (Brizo)', () => { let ddo: DDO let agreementId: string - const metadata = getMetadata() + let metadata = getMetadata() before(async () => { ocean = await Ocean.getInstance(config) // Accounts ;[publisher, consumer] = await ocean.accounts.list() + + if (!ocean.keeper.dispenser) { + metadata = getMetadata(0) + } }) after(() => { @@ -48,9 +52,12 @@ describe('Consume Asset (Brizo)', () => { it('should order the asset', async () => { const accessService = ddo.findServiceByType('Access') - await consumer.requestTokens( - +metadata.base.price * 10 ** -(await ocean.keeper.token.decimals()) - ) + try { + await consumer.requestTokens( + +metadata.base.price * + 10 ** -(await ocean.keeper.token.decimals()) + ) + } catch {} const steps = [] agreementId = await ocean.assets diff --git a/integration/ocean/ConsumeBigAsset.test.ts b/integration/ocean/ConsumeBigAsset.test.ts index 688b7ac..19d07ef 100644 --- a/integration/ocean/ConsumeBigAsset.test.ts +++ b/integration/ocean/ConsumeBigAsset.test.ts @@ -16,24 +16,29 @@ xdescribe('Consume Asset (Large size)', () => { let ddo: DDO let agreementId: string - const baseMetadata = getMetadata() - const metadata = { - ...baseMetadata, - base: { - ...baseMetadata.base, - files: [ - { - url: 'https://speed.hetzner.de/1GB.bin' - } - ] - } - } + let baseMetadata = getMetadata() + let metadata = getMetadata() before(async () => { ocean = await Ocean.getInstance(config) // Accounts ;[publisher, consumer] = await ocean.accounts.list() + + if (!ocean.keeper.dispenser) { + baseMetadata = getMetadata(0) + } + metadata = { + ...baseMetadata, + base: { + ...baseMetadata.base, + files: [ + { + url: 'https://speed.hetzner.de/1GB.bin' + } + ] + } + } }) it('should regiester an asset', async () => { @@ -45,7 +50,12 @@ xdescribe('Consume Asset (Large size)', () => { it('should order the asset', async () => { const accessService = ddo.findServiceByType('Access') - await consumer.requestTokens(metadata.base.price) + try { + await consumer.requestTokens( + +metadata.base.price * + 10 ** -(await ocean.keeper.token.decimals()) + ) + } catch {} agreementId = await ocean.assets.order( ddo.id, diff --git a/integration/ocean/RegisterEscrowAccessSecretStoreTemplate.test.ts b/integration/ocean/RegisterEscrowAccessSecretStoreTemplate.test.ts index 0227df2..9aae941 100644 --- a/integration/ocean/RegisterEscrowAccessSecretStoreTemplate.test.ts +++ b/integration/ocean/RegisterEscrowAccessSecretStoreTemplate.test.ts @@ -18,7 +18,7 @@ describe('Register Escrow Access Secret Store Template', () => { const url = 'https://example.com/did/ocean/test-attr-example.txt' const checksum = 'b'.repeat(32) - const escrowAmount = 12 + let escrowAmount = 12 let templateManagerOwner: Account let publisher: Account @@ -44,6 +44,10 @@ describe('Register Escrow Access Secret Store Template', () => { keeper.conditions.accessSecretStoreCondition lockRewardCondition = keeper.conditions.lockRewardCondition escrowReward = keeper.conditions.escrowReward + + if (!ocean.keeper.dispenser) { + escrowAmount = 0 + } }) describe('Propose and approve template', () => { @@ -169,7 +173,9 @@ describe('Register Escrow Access Secret Store Template', () => { }) it('should fulfill LockRewardCondition', async () => { - await consumer.requestTokens(escrowAmount) + try { + await consumer.requestTokens(escrowAmount) + } catch {} await keeper.token.approve( lockRewardCondition.getAddress(), @@ -259,7 +265,9 @@ describe('Register Escrow Access Secret Store Template', () => { }) it('should fulfill the conditions from consumer side', async () => { - await consumer.requestTokens(escrowAmount) + try { + await consumer.requestTokens(escrowAmount) + } catch {} await ocean.agreements.conditions.lockReward( agreementId, diff --git a/integration/ocean/SearchAsset.test.ts b/integration/ocean/SearchAsset.test.ts index 9281cf2..640f7d5 100644 --- a/integration/ocean/SearchAsset.test.ts +++ b/integration/ocean/SearchAsset.test.ts @@ -14,8 +14,9 @@ describe('Search Asset', () => { const testHash = Math.random() .toString(36) .substr(2) + let price const metadataGenerator = (name: string) => - generateMetadata(`${name}${testHash}`) + generateMetadata(`${name}${testHash}`, price) let test1length let test2length @@ -38,6 +39,10 @@ describe('Search Asset', () => { .length test3length = (await ocean.assets.search(`Test3${testHash}`)).results .length + + if (!ocean.keeper.dispenser) { + price = 0 + } }) it('should regiester some a asset', async () => { diff --git a/integration/utils/ddo-metadata-generator.ts b/integration/utils/ddo-metadata-generator.ts index 47367b0..f84f16e 100644 --- a/integration/utils/ddo-metadata-generator.ts +++ b/integration/utils/ddo-metadata-generator.ts @@ -44,12 +44,17 @@ const metadata: Partial = { } } -export const generateMetadata = (name: string): Partial => ({ +export const generateMetadata = ( + name: string, + price?: number +): Partial => ({ ...metadata, base: { ...metadata.base, - name + name, + price: (price || 21) + '0'.repeat(18) } }) -export const getMetadata = () => generateMetadata('TestAsset') +export const getMetadata = (price?: number) => + generateMetadata('TestAsset', price) diff --git a/src/keeper/contracts/templates/EscrowAccessSecretStoreTemplate.ts b/src/keeper/contracts/templates/EscrowAccessSecretStoreTemplate.ts index 7054bbf..c5a256a 100644 --- a/src/keeper/contracts/templates/EscrowAccessSecretStoreTemplate.ts +++ b/src/keeper/contracts/templates/EscrowAccessSecretStoreTemplate.ts @@ -172,4 +172,8 @@ export class EscrowAccessSecretStoreTemplate extends AgreementTemplate { escrowRewardId } } + + public async getAgreementData(agreementId: string) { + return this.call('getAgreementData', [zeroX(agreementId)]) + } }