mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
Checking for the decimals on the feeToken
This commit is contained in:
parent
ae2ff1ccde
commit
ece4883743
@ -30,6 +30,7 @@
|
|||||||
"mocha": "TS_NODE_PROJECT='./test/tsconfig.json' mocha --config=test/.mocharc.json --node-env=test --exit",
|
"mocha": "TS_NODE_PROJECT='./test/tsconfig.json' mocha --config=test/.mocharc.json --node-env=test --exit",
|
||||||
"test": "npm run lint && npm run test:unit:cover && npm run test:integration:cover",
|
"test": "npm run lint && npm run test:unit:cover && npm run test:integration:cover",
|
||||||
"test:unit": "npm run mocha -- 'test/unit/**/*.test.ts'",
|
"test:unit": "npm run mocha -- 'test/unit/**/*.test.ts'",
|
||||||
|
"test:fixed": "npm run mocha -- 'test/unit/FixedRateExchange.test.ts'",
|
||||||
"test:integration": "npm run mocha -- 'test/integration/**/*.test.ts'",
|
"test:integration": "npm run mocha -- 'test/integration/**/*.test.ts'",
|
||||||
"test:unit:cover": "nyc --report-dir coverage/unit npm run test:unit",
|
"test:unit:cover": "nyc --report-dir coverage/unit npm run test:unit",
|
||||||
"test:integration:cover": "nyc --report-dir coverage/integration --no-clean npm run test:integration",
|
"test:integration:cover": "nyc --report-dir coverage/integration --no-clean npm run test:integration",
|
||||||
|
@ -1,6 +1,13 @@
|
|||||||
import { BigNumber } from 'ethers'
|
import { BigNumber } from 'ethers'
|
||||||
import ERC721Factory from '@oceanprotocol/contracts/artifacts/contracts/ERC721Factory.sol/ERC721Factory.json'
|
import ERC721Factory from '@oceanprotocol/contracts/artifacts/contracts/ERC721Factory.sol/ERC721Factory.json'
|
||||||
import { generateDtName, ZERO_ADDRESS, sendTx, getEventFromTx } from '../utils'
|
import {
|
||||||
|
generateDtName,
|
||||||
|
ZERO_ADDRESS,
|
||||||
|
sendTx,
|
||||||
|
getEventFromTx,
|
||||||
|
getTokenDecimals,
|
||||||
|
LoggerInstance
|
||||||
|
} from '../utils'
|
||||||
import {
|
import {
|
||||||
AbiItem,
|
AbiItem,
|
||||||
FreCreationParams,
|
FreCreationParams,
|
||||||
@ -553,6 +560,16 @@ export class NftFactory extends SmartContractWithAddress {
|
|||||||
if (!dtParams.name || !dtParams.symbol) {
|
if (!dtParams.name || !dtParams.symbol) {
|
||||||
;({ name, symbol } = generateDtName())
|
;({ name, symbol } = generateDtName())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let feeTokenDecimals = 18
|
||||||
|
if (dtParams.feeToken !== ZERO_ADDRESS) {
|
||||||
|
try {
|
||||||
|
feeTokenDecimals = await getTokenDecimals(this.signer, dtParams.feeToken)
|
||||||
|
} catch (error) {
|
||||||
|
LoggerInstance.error('getTokenDecimals error', error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
templateIndex: dtParams.templateIndex,
|
templateIndex: dtParams.templateIndex,
|
||||||
strings: [dtParams.name || name, dtParams.symbol || symbol],
|
strings: [dtParams.name || name, dtParams.symbol || symbol],
|
||||||
@ -564,7 +581,7 @@ export class NftFactory extends SmartContractWithAddress {
|
|||||||
],
|
],
|
||||||
uints: [
|
uints: [
|
||||||
await this.amountToUnits(null, dtParams.cap, 18),
|
await this.amountToUnits(null, dtParams.cap, 18),
|
||||||
await this.amountToUnits(null, dtParams.feeAmount, 18)
|
await this.amountToUnits(null, dtParams.feeAmount, feeTokenDecimals)
|
||||||
],
|
],
|
||||||
bytess: []
|
bytess: []
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user