From e5c718604c65a13a8e535b88a4cbc7106913c8e9 Mon Sep 17 00:00:00 2001 From: Bogdan Fazakas Date: Tue, 9 Nov 2021 11:21:25 +0200 Subject: [PATCH] deleted old pool files --- src/pools/balancer/OceanPool.ts | 34 --------------------- src/pools/balancer/PoolFactory.ts | 51 ------------------------------- 2 files changed, 85 deletions(-) delete mode 100644 src/pools/balancer/OceanPool.ts delete mode 100644 src/pools/balancer/PoolFactory.ts diff --git a/src/pools/balancer/OceanPool.ts b/src/pools/balancer/OceanPool.ts deleted file mode 100644 index 5201146c..00000000 --- a/src/pools/balancer/OceanPool.ts +++ /dev/null @@ -1,34 +0,0 @@ -import Web3 from 'web3' -import { AbiItem } from 'web3-utils' -import { Contract } from 'web3-eth-contract' -import defaultPoolABI from '@oceanprotocol/contracts/artifacts/contracts/interfaces/IPool.sol/IPool.json' -import defaultERC20ABI from '@oceanprotocol/contracts/artifacts/contracts/interfaces/IERC20.sol/IERC20.json' -import { PoolFactory } from './PoolFactory' -import { LoggerInstance } from '../../utils' - -export class OceanPool extends PoolFactory { - public oceanAddress: string = null - public dtAddress: string = null - public startBlock: number - public vaultABI: AbiItem | AbiItem[] - public vaultAddress: string - public vault: Contract - public poolABI: AbiItem | AbiItem[] - public erc20ABI: AbiItem | AbiItem[] - - constructor( - web3: Web3, - routerAddress: string = null, - oceanAddress: string = null, - startBlock?: number - ) { - super(web3, routerAddress) - - this.poolABI = defaultPoolABI.abi as AbiItem[] - this.erc20ABI = defaultERC20ABI.abi as AbiItem[] - this.vault = new this.web3.eth.Contract(this.vaultABI, this.vaultAddress) - - if (startBlock) this.startBlock = startBlock - else this.startBlock = 0 - } -} diff --git a/src/pools/balancer/PoolFactory.ts b/src/pools/balancer/PoolFactory.ts deleted file mode 100644 index a1f99e93..00000000 --- a/src/pools/balancer/PoolFactory.ts +++ /dev/null @@ -1,51 +0,0 @@ -import Web3 from 'web3' -import { AbiItem } from 'web3-utils' -import { Contract } from 'web3-eth-contract' -import defaultRouterABI from '@oceanprotocol/contracts/artifacts/contracts/interfaces/IFactoryRouter.sol/IFactoryRouter.json' -import { LoggerInstance } from '../../utils' -import { TransactionReceipt } from 'web3-eth' - -export class PoolFactory { - public GASLIMIT_DEFAULT = 1000000 - public web3: Web3 = null - public routerABI: AbiItem | AbiItem[] - - public routerAddress: string - - public router: Contract - - /** - * Instantiate PoolFactory. - * @param {String} routerAddress - * @param {AbiItem | AbiItem[]} routerABI - * @param {Web3} web3 - */ - constructor(web3: Web3, routerAddress: string, routerABI?: AbiItem | AbiItem[]) { - this.web3 = web3 - this.routerAddress = routerAddress - this.routerABI = routerABI || (defaultRouterABI.abi as AbiItem[]) - this.router = new this.web3.eth.Contract(this.routerABI, this.routerAddress) - } - - public async deployPool( - account: string, - tokens: string[], - weightsInWei: string[], - swapFeePercentage: number, - swapMarketFee: number, - owner: string - ): Promise { - const gasLimitDefault = this.GASLIMIT_DEFAULT - let estGas - try { - estGas = await this.router.methods - .deployPool(tokens, weightsInWei, swapFeePercentage, swapMarketFee, owner) - .estimateGas({ from: account }, (err, estGas) => (err ? gasLimitDefault : estGas)) - } catch (e) { - LoggerInstance.log('Error estimate gas deployPool') - LoggerInstance.log(e) - estGas = gasLimitDefault - } - return estGas - } -}