From 525f2e5ac01e3f34c00211f44317f6d79bb99379 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Mon, 19 Oct 2020 09:53:25 +0200 Subject: [PATCH] search for pools on-chain --- src/balancer/OceanPool.ts | 13 ++----------- src/ocean/Ocean.ts | 3 +-- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/balancer/OceanPool.ts b/src/balancer/OceanPool.ts index cb97dc12f..93a21fc79 100644 --- a/src/balancer/OceanPool.ts +++ b/src/balancer/OceanPool.ts @@ -4,8 +4,7 @@ import { TransactionReceipt } from 'web3-core' import { Pool } from './Pool' import { EventData, Filter } from 'web3-eth-contract' import BigNumber from 'bignumber.js' -import { MetadataCache } from '../metadatacache/MetadataCache' -import { didNoZeroX, didPrefixed } from '../utils' + declare type PoolTransactionType = 'swap' | 'join' | 'exit' const POOL_MAX_AMOUNT_IN_LIMIT = 0.25 // maximum 1/4 of the pool reserve @@ -41,21 +40,19 @@ export interface PoolTransaction { export class OceanPool extends Pool { public oceanAddress: string = null public dtAddress: string = null - public MetadataCache: MetadataCache = null + constructor( web3: Web3, factoryABI: AbiItem | AbiItem[] = null, poolABI: AbiItem | AbiItem[] = null, factoryAddress: string = null, oceanAddress: string = null, - MetadataCache: MetadataCache = null, gaslimit?: number ) { super(web3, factoryABI, poolABI, factoryAddress, gaslimit) if (oceanAddress) { this.oceanAddress = oceanAddress } - this.MetadataCache = MetadataCache } /** @@ -813,13 +810,7 @@ export class OceanPool extends Pool { * @return {String[]} */ public async searchPoolforDT(dtAddress: string): Promise { - const did = didPrefixed(didNoZeroX(dtAddress)) const result: string[] = [] - try { - const ddo = await this.MetadataCache.retrieveDDO(did) - return ddo.price.pools - } catch (e) {} - // fallback in case we don't have the asset registred in aqua const factory = new this.web3.eth.Contract(this.factoryABI, this.factoryAddress) const events = await factory.getPastEvents('BPoolRegistered', { filter: {}, diff --git a/src/ocean/Ocean.ts b/src/ocean/Ocean.ts index b157c7d9b..1c4d43779 100644 --- a/src/ocean/Ocean.ts +++ b/src/ocean/Ocean.ts @@ -57,8 +57,7 @@ export class Ocean extends Instantiable { instanceConfig.config.poolFactoryABI, instanceConfig.config.poolABI, instanceConfig.config.poolFactoryAddress, - instanceConfig.config.oceanTokenAddress, - instance.metadatacache + instanceConfig.config.oceanTokenAddress ) instance.fixedRateExchange = new OceanFixedRateExchange( instanceConfig.config.web3Provider,