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 {
exchangeOwner: string
@ -101,7 +101,7 @@ export class OceanFixedRateExchange {
if (err) console.log('FixedPriceExchange: ' + err)
return estGas
})
const trxReceipt = await this.contract.methods
.swap(exchangeId, this.web3.utils.toWei(String(dataTokenAmount)))
.send({

View File

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

View File

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

View File

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

View File

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