mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
move functions from ContractUtils to Datatoken
This commit is contained in:
parent
ad560ce4ef
commit
252ff6a0f4
@ -5,7 +5,7 @@ import { Contract } from 'web3-eth-contract'
|
|||||||
import Decimal from 'decimal.js'
|
import Decimal from 'decimal.js'
|
||||||
import ERC20Template from '@oceanprotocol/contracts/artifacts/contracts/templates/ERC20Template.sol/ERC20Template.json'
|
import ERC20Template from '@oceanprotocol/contracts/artifacts/contracts/templates/ERC20Template.sol/ERC20Template.json'
|
||||||
import ERC20TemplateEnterprise from '@oceanprotocol/contracts/artifacts/contracts/templates/ERC20TemplateEnterprise.sol/ERC20TemplateEnterprise.json'
|
import ERC20TemplateEnterprise from '@oceanprotocol/contracts/artifacts/contracts/templates/ERC20TemplateEnterprise.sol/ERC20TemplateEnterprise.json'
|
||||||
import { LoggerInstance, getFreOrderParams, estimateGas, ZERO_ADDRESS } from '../../utils'
|
import { LoggerInstance, estimateGas, ZERO_ADDRESS } from '../../utils'
|
||||||
import {
|
import {
|
||||||
ConsumeMarketFee,
|
ConsumeMarketFee,
|
||||||
FreOrderParams,
|
FreOrderParams,
|
||||||
@ -907,7 +907,7 @@ export class Datatoken extends SmartContract {
|
|||||||
): Promise<TransactionReceipt> {
|
): Promise<TransactionReceipt> {
|
||||||
const dtContract = this.getContract(dtAddress, null, this.abiEnterprise)
|
const dtContract = this.getContract(dtAddress, null, this.abiEnterprise)
|
||||||
try {
|
try {
|
||||||
const freContractParams = getFreOrderParams(freParams)
|
const freContractParams = this.getFreOrderParams(freParams)
|
||||||
|
|
||||||
const estGas = await estimateGas(
|
const estGas = await estimateGas(
|
||||||
address,
|
address,
|
||||||
@ -1243,4 +1243,14 @@ export class Datatoken extends SmartContract {
|
|||||||
}
|
}
|
||||||
return returnValues
|
return returnValues
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getFreOrderParams(freParams: FreOrderParams): any {
|
||||||
|
return {
|
||||||
|
exchangeContract: freParams.exchangeContract,
|
||||||
|
exchangeId: freParams.exchangeId,
|
||||||
|
maxBaseTokenAmount: Web3.utils.toWei(freParams.maxBaseTokenAmount),
|
||||||
|
swapMarketFee: Web3.utils.toWei(freParams.swapMarketFee),
|
||||||
|
marketFeeAddress: freParams.marketFeeAddress
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,16 +32,6 @@ export async function getFairGasPrice(web3: Web3, config: Config): Promise<strin
|
|||||||
else return x.toString(10)
|
else return x.toString(10)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getFreOrderParams(freParams: FreOrderParams): any {
|
|
||||||
return {
|
|
||||||
exchangeContract: freParams.exchangeContract,
|
|
||||||
exchangeId: freParams.exchangeId,
|
|
||||||
maxBaseTokenAmount: Web3.utils.toWei(freParams.maxBaseTokenAmount),
|
|
||||||
swapMarketFee: Web3.utils.toWei(freParams.swapMarketFee),
|
|
||||||
marketFeeAddress: freParams.marketFeeAddress
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function unitsToAmount(
|
export async function unitsToAmount(
|
||||||
web3: Web3,
|
web3: Web3,
|
||||||
token: string,
|
token: string,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user