1
0
mirror of https://github.com/oceanprotocol/ocean.js.git synced 2024-11-26 20:39:05 +01:00
This commit is contained in:
alexcos20 2020-08-27 03:33:27 -07:00
parent cc6cf435fe
commit 205a763d97
5 changed files with 6 additions and 17 deletions

View File

@ -1,4 +1,4 @@
const defaultFixedRateExchangeABI = require('@oceanprotocol/contracts/artifacts/FixedRateExchange.json') import defaultFixedRateExchangeABI from '@oceanprotocol/contracts/artifacts/FixedRateExchange.json'
export interface FixedPricedExchange { export interface FixedPricedExchange {
exchangeOwner: string exchangeOwner: string

View File

@ -68,7 +68,6 @@ export class Config {
*/ */
public poolFactoryABI?: any public poolFactoryABI?: any
/** /**
* Pool ABI * Pool ABI
* @type {string} * @type {string}

View File

@ -13,7 +13,7 @@ import {
} from '../Instantiable.abstract' } from '../Instantiable.abstract'
import { Compute } from './Compute' import { Compute } from './Compute'
import { OceanPool } from '../balancer/OceanPool' import { OceanPool } from '../balancer/OceanPool'
import {OceanFixedRateExchange, FixedPricedExchange} from '../exchange/FixRateExchange' import { OceanFixedRateExchange, FixedPricedExchange } from '../exchange/FixRateExchange'
/** /**
* Main interface for Ocean Protocol. * Main interface for Ocean Protocol.
@ -63,7 +63,6 @@ export class Ocean extends Instantiable {
instanceConfig.config.fixedRateExchangeAddress, instanceConfig.config.fixedRateExchangeAddress,
instanceConfig.config.fixedRateExchangeAddressABI, instanceConfig.config.fixedRateExchangeAddressABI,
instanceConfig.config.oceanTokenAddress instanceConfig.config.oceanTokenAddress
) )
instance.versions = await Versions.getInstance(instanceConfig) instance.versions = await Versions.getInstance(instanceConfig)
instance.network = new Network() instance.network = new Network()

View File

@ -9,15 +9,10 @@ export class FixedPricedContractHandler {
public contractAddress: string public contractAddress: string
public web3: Web3 public web3: Web3
constructor( constructor(contractABI: AbiItem | AbiItem[], contractBytecode: string, web3: Web3) {
contractABI: AbiItem | AbiItem[],
contractBytecode: string,
web3: Web3
) {
this.web3 = web3 this.web3 = web3
this.contract = new this.web3.eth.Contract(contractABI) this.contract = new this.web3.eth.Contract(contractABI)
this.contractBytecode = contractBytecode this.contractBytecode = contractBytecode
} }
public async getAccounts() { public async getAccounts() {
@ -25,11 +20,9 @@ export class FixedPricedContractHandler {
} }
public async deployContracts() { public async deployContracts() {
let estGas
await this.getAccounts() await this.getAccounts()
// get est gascost // get est gascost
estGas = await this.contract const estGas = await this.contract
.deploy({ .deploy({
data: this.contractBytecode, data: this.contractBytecode,
arguments: [] arguments: []
@ -52,7 +45,5 @@ export class FixedPricedContractHandler {
.then(function (contract) { .then(function (contract) {
return contract.options.address return contract.options.address
}) })
} }
} }

View File

@ -11,9 +11,9 @@ import {
import Web3 from 'web3' import Web3 from 'web3'
import factory from '@oceanprotocol/contracts/artifacts/DTFactory.json' import factory from '@oceanprotocol/contracts/artifacts/DTFactory.json'
import datatokensTemplate from '@oceanprotocol/contracts/artifacts/DataTokenTemplate.json' import datatokensTemplate from '@oceanprotocol/contracts/artifacts/DataTokenTemplate.json'
import FixedRateExchangeContract = require('@oceanprotocol/contracts/artifacts/FixedRateExchange.json')
import BigNumber from 'bignumber.js' import BigNumber from 'bignumber.js'
import FixedRateExchangeContract = require('@oceanprotocol/contracts/artifacts/FixedRateExchange.json')
const web3 = new Web3('http://127.0.0.1:8545') const web3 = new Web3('http://127.0.0.1:8545')
describe('FixedRateExchange flow', () => { describe('FixedRateExchange flow', () => {