1
0
mirror of https://github.com/oceanprotocol/ocean.js.git synced 2024-11-26 20:39:05 +01:00

bump contracts to 0.5.0

This commit is contained in:
alexcos20 2020-09-30 23:10:03 -07:00
parent b013d970ae
commit 9bbff39cf0
3 changed files with 14 additions and 8 deletions

6
package-lock.json generated
View File

@ -939,9 +939,9 @@
}
},
"@oceanprotocol/contracts": {
"version": "0.4.4",
"resolved": "https://registry.npmjs.org/@oceanprotocol/contracts/-/contracts-0.4.4.tgz",
"integrity": "sha512-0+Tp6UdoDTBJZp4yX3kkSrV+CcOS/hJ3SJ4HuWiL5FE5Nlj3JCeV86iuWPkFuXzIdgri00DaGvQhP58knzJ2Uw=="
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/@oceanprotocol/contracts/-/contracts-0.5.0.tgz",
"integrity": "sha512-6HQVP/Dvbh5b+wdu0rBR78pDwH4I+KeVaK80U5q47R/CvuSin5VpGSii3ZiCLY+O6JRxzjAMzCYo9ugL1cXvbg=="
},
"@octokit/auth-token": {
"version": "2.4.2",

View File

@ -42,7 +42,7 @@
},
"dependencies": {
"@ethereum-navigator/navigator": "^0.5.0",
"@oceanprotocol/contracts": "^0.4.4",
"@oceanprotocol/contracts": "^0.5.0",
"decimal.js": "^10.2.0",
"fs": "0.0.1-security",
"lzma": "^2.3.2",

View File

@ -205,10 +205,13 @@ export class OceanFixedRateExchange {
exchangeId: string,
address: string
): Promise<TransactionReceipt> {
const exchange = await this.getExchange(exchangeId)
if (!exchange) return null
if (exchange.active === true) return null
let estGas
try {
estGas = await this.contract.methods
.activate(exchangeId)
.toggleExchangeState(exchangeId)
.estimateGas(function (err, estGas) {
if (err) {
// console.log('FixedPriceExchange: ' + err)
@ -219,7 +222,7 @@ export class OceanFixedRateExchange {
} catch (e) {
estGas = DEFAULT_GAS_LIMIT
}
const trxReceipt = await this.contract.methods.activate(exchangeId).send({
const trxReceipt = await this.contract.methods.toggleExchangeState(exchangeId).send({
from: address,
gas: estGas + 1
})
@ -236,10 +239,13 @@ export class OceanFixedRateExchange {
exchangeId: string,
address: string
): Promise<TransactionReceipt> {
const exchange = await this.getExchange(exchangeId)
if (!exchange) return null
if (exchange.active === false) return null
let estGas
try {
estGas = await this.contract.methods
.deactivate(exchangeId)
.toggleExchangeState(exchangeId)
.estimateGas(function (err, estGas) {
if (err) {
// console.log('FixedPriceExchange: ' + err)
@ -250,7 +256,7 @@ export class OceanFixedRateExchange {
} catch (e) {
estGas = DEFAULT_GAS_LIMIT
}
const trxReceipt = await this.contract.methods.deactivate(exchangeId).send({
const trxReceipt = await this.contract.methods.toggleExchangeState(exchangeId).send({
from: address,
gas: estGas + 1
})