mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
refactor nftfactory interfaces
This commit is contained in:
parent
19289b7b86
commit
193c3bedd1
@ -11,7 +11,7 @@ interface Template {
|
|||||||
isActive: boolean
|
isActive: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
interface TokenOrder {
|
export interface TokenOrder {
|
||||||
tokenAddress: string
|
tokenAddress: string
|
||||||
consumer: string
|
consumer: string
|
||||||
amount: string | number
|
amount: string | number
|
||||||
@ -21,32 +21,54 @@ interface TokenOrder {
|
|||||||
consumeFeeAmount: number
|
consumeFeeAmount: number
|
||||||
}
|
}
|
||||||
|
|
||||||
interface NFTCreateData {
|
export interface NFTCreateData {
|
||||||
name: string
|
name: string
|
||||||
symbol: string
|
symbol: string
|
||||||
templateIndex: number
|
templateIndex: number
|
||||||
baseURI: string
|
baseURI: string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ErcCreateData {
|
export interface ErcCreateParams {
|
||||||
templateIndex: number
|
templateIndex: number
|
||||||
strings: string[]
|
minter: string
|
||||||
addresses: string[]
|
feeManager: string
|
||||||
uints: (string | number)[]
|
mpFeeAddress: string
|
||||||
bytess: string[]
|
feeToken: string
|
||||||
|
feeAmount: string
|
||||||
|
cap: string
|
||||||
|
name?: string
|
||||||
|
symbol?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface PoolData {
|
export interface PoolParams {
|
||||||
addresses: string[]
|
ssContract: string
|
||||||
ssParams: (string | number | BigNumber)[]
|
basetokenAddress: string
|
||||||
swapFees: number[]
|
basetokenSender: string
|
||||||
|
publisherAddress: string
|
||||||
|
marketFeeCollector: string
|
||||||
|
poolTemplateAddress: string
|
||||||
|
rate: string
|
||||||
|
basetokenDecimals: number
|
||||||
|
vestingAmount: string
|
||||||
|
vestedBlocks: number
|
||||||
|
initialBasetokenLiquidity: string
|
||||||
|
swapFeeLiquidityProvider: number
|
||||||
|
swapFeeMarketPlaceRunner: number
|
||||||
}
|
}
|
||||||
|
|
||||||
interface FixedData {
|
export interface FixedRateParams {
|
||||||
fixedPriceAddress: string
|
fixedRateAddress: string
|
||||||
addresses: string[]
|
baseTokenAddress: string
|
||||||
uints: (string | number)[]
|
owner: string
|
||||||
|
marketFeeCollector: string
|
||||||
|
baseTokenDecimals: number
|
||||||
|
dataTokenDecimals: number
|
||||||
|
fixedRate: string
|
||||||
|
marketFee: number
|
||||||
|
withMint?: boolean // add FixedPriced contract as minter if withMint == true
|
||||||
|
allowedConsumer?: string // only account that consume the exhchange
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides an interface for NFT Factory contract
|
* Provides an interface for NFT Factory contract
|
||||||
*/
|
*/
|
||||||
@ -585,12 +607,13 @@ export class NFTFactory {
|
|||||||
public async estGasCreateNftWithErc(
|
public async estGasCreateNftWithErc(
|
||||||
address: string,
|
address: string,
|
||||||
nftCreateData: NFTCreateData,
|
nftCreateData: NFTCreateData,
|
||||||
ercCreateData: ErcCreateData
|
ercParams: ErcCreateParams
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
// Get estimated gas value
|
// Get estimated gas value
|
||||||
const gasLimitDefault = this.GASLIMIT_DEFAULT
|
const gasLimitDefault = this.GASLIMIT_DEFAULT
|
||||||
let estGas
|
let estGas
|
||||||
try {
|
try {
|
||||||
|
const ercCreateData = this.getErcCreationParams(ercParams)
|
||||||
estGas = await this.factory721.methods
|
estGas = await this.factory721.methods
|
||||||
.createNftWithErc(nftCreateData, ercCreateData)
|
.createNftWithErc(nftCreateData, ercCreateData)
|
||||||
.estimateGas({ from: address }, (err, estGas) => (err ? gasLimitDefault : estGas))
|
.estimateGas({ from: address }, (err, estGas) => (err ? gasLimitDefault : estGas))
|
||||||
@ -612,8 +635,10 @@ export class NFTFactory {
|
|||||||
public async createNftWithErc(
|
public async createNftWithErc(
|
||||||
address: string,
|
address: string,
|
||||||
nftCreateData: NFTCreateData,
|
nftCreateData: NFTCreateData,
|
||||||
ercCreateData: ErcCreateData
|
ercParams: ErcCreateParams
|
||||||
): Promise<TransactionReceipt> {
|
): Promise<TransactionReceipt> {
|
||||||
|
const ercCreateData = this.getErcCreationParams(ercParams)
|
||||||
|
|
||||||
const estGas = await this.estGasCreateNftWithErc(
|
const estGas = await this.estGasCreateNftWithErc(
|
||||||
address,
|
address,
|
||||||
nftCreateData,
|
nftCreateData,
|
||||||
@ -636,19 +661,21 @@ export class NFTFactory {
|
|||||||
* Estimate gas cost for createNftErcWithPool method
|
* Estimate gas cost for createNftErcWithPool method
|
||||||
* @param address Caller address
|
* @param address Caller address
|
||||||
* @param _NftCreateData input data for NFT Creation
|
* @param _NftCreateData input data for NFT Creation
|
||||||
* @param _ErcCreateData input data for ERC20 Creation
|
* @param ercParams input data for ERC20 Creation
|
||||||
* @param _PoolData input data for Pool Creation
|
* @param _PoolData input data for Pool Creation
|
||||||
* @return {Promise<TransactionReceipt>} transaction receipt
|
* @return {Promise<TransactionReceipt>} transaction receipt
|
||||||
*/
|
*/
|
||||||
public async estGasCreateNftErcWithPool(
|
public async estGasCreateNftErcWithPool(
|
||||||
address: string,
|
address: string,
|
||||||
nftCreateData: NFTCreateData,
|
nftCreateData: NFTCreateData,
|
||||||
ercCreateData: ErcCreateData,
|
ercParams: ErcCreateParams,
|
||||||
poolData: PoolData
|
poolParams: PoolParams
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
const gasLimitDefault = this.GASLIMIT_DEFAULT
|
const gasLimitDefault = this.GASLIMIT_DEFAULT
|
||||||
let estGas
|
let estGas
|
||||||
try {
|
try {
|
||||||
|
const ercCreateData = this.getErcCreationParams(ercParams)
|
||||||
|
const poolData = this.getPoolCreationParams(poolParams)
|
||||||
estGas = await this.factory721.methods
|
estGas = await this.factory721.methods
|
||||||
.createNftErcWithPool(nftCreateData, ercCreateData, poolData)
|
.createNftErcWithPool(nftCreateData, ercCreateData, poolData)
|
||||||
.estimateGas({ from: address }, (err, estGas) => (err ? gasLimitDefault : estGas))
|
.estimateGas({ from: address }, (err, estGas) => (err ? gasLimitDefault : estGas))
|
||||||
@ -671,9 +698,11 @@ export class NFTFactory {
|
|||||||
public async createNftErcWithPool(
|
public async createNftErcWithPool(
|
||||||
address: string,
|
address: string,
|
||||||
nftCreateData: NFTCreateData,
|
nftCreateData: NFTCreateData,
|
||||||
ercCreateData: ErcCreateData,
|
ercParams: ErcCreateParams,
|
||||||
poolData: PoolData
|
poolParams: PoolParams
|
||||||
): Promise<TransactionReceipt> {
|
): Promise<TransactionReceipt> {
|
||||||
|
const ercCreateData = this.getErcCreationParams(ercParams)
|
||||||
|
const poolData = this.getPoolCreationParams(poolParams)
|
||||||
const estGas = await this.estGasCreateNftErcWithPool(
|
const estGas = await this.estGasCreateNftErcWithPool(
|
||||||
address,
|
address,
|
||||||
nftCreateData,
|
nftCreateData,
|
||||||
@ -695,20 +724,24 @@ export class NFTFactory {
|
|||||||
|
|
||||||
/** Estimate gas cost for createNftErcWithFixedRate method
|
/** Estimate gas cost for createNftErcWithFixedRate method
|
||||||
* @param address Caller address
|
* @param address Caller address
|
||||||
* @param _NftCreateData input data for NFT Creation
|
* @param nftCreateData input data for NFT Creation
|
||||||
* @param _ErcCreateData input data for ERC20 Creation
|
* @param ercParams input data for ERC20 Creation
|
||||||
* @param _FixedData input data for FixedRate Creation
|
* @param freParams input data for FixedRate Creation
|
||||||
* @return {Promise<TransactionReceipt>} transaction receipt
|
* @return {Promise<TransactionReceipt>} transaction receipt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public async estGasCreateNftErcWithFixedRate(
|
public async estGasCreateNftErcWithFixedRate(
|
||||||
address: string,
|
address: string,
|
||||||
nftCreateData: NFTCreateData,
|
nftCreateData: NFTCreateData,
|
||||||
ercCreateData: ErcCreateData,
|
ercParams: ErcCreateParams,
|
||||||
fixedData: FixedData
|
freParams: FixedRateParams
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
const gasLimitDefault = this.GASLIMIT_DEFAULT
|
const gasLimitDefault = this.GASLIMIT_DEFAULT
|
||||||
let estGas
|
let estGas
|
||||||
|
|
||||||
|
const ercCreateData = this.getErcCreationParams(ercParams)
|
||||||
|
|
||||||
|
const fixedData = this.getFreCreationParams(freParams)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
estGas = await this.factory721.methods
|
estGas = await this.factory721.methods
|
||||||
.createNftErcWithFixedRate(nftCreateData, ercCreateData, fixedData)
|
.createNftErcWithFixedRate(nftCreateData, ercCreateData, fixedData)
|
||||||
@ -724,24 +757,27 @@ export class NFTFactory {
|
|||||||
* Creates a new NFT, then a ERC20, then a FixedRateExchange, all in one call
|
* Creates a new NFT, then a ERC20, then a FixedRateExchange, all in one call
|
||||||
* Use this carefully, because if Fixed Rate creation fails, you are still going to pay a lot of gas
|
* Use this carefully, because if Fixed Rate creation fails, you are still going to pay a lot of gas
|
||||||
* @param address Caller address
|
* @param address Caller address
|
||||||
* @param _NftCreateData input data for NFT Creation
|
* @param nftCreateData input data for NFT Creation
|
||||||
* @param _ErcCreateData input data for ERC20 Creation
|
* @param ercParams input data for ERC20 Creation
|
||||||
* @param _FixedData input data for FixedRate Creation
|
* @param freParams input data for FixedRate Creation
|
||||||
* @return {Promise<TransactionReceipt>} transaction receipt
|
* @return {Promise<TransactionReceipt>} transaction receipt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public async createNftErcWithFixedRate(
|
public async createNftErcWithFixedRate(
|
||||||
address: string,
|
address: string,
|
||||||
nftCreateData: NFTCreateData,
|
nftCreateData: NFTCreateData,
|
||||||
ercCreateData: ErcCreateData,
|
ercParams: ErcCreateParams,
|
||||||
fixedData: FixedData
|
freParams: FixedRateParams
|
||||||
): Promise<TransactionReceipt> {
|
): Promise<TransactionReceipt> {
|
||||||
|
const ercCreateData = this.getErcCreationParams(ercParams)
|
||||||
|
const fixedData = this.getFreCreationParams(freParams)
|
||||||
|
|
||||||
const estGas = await this.estGasCreateNftErcWithFixedRate(
|
const estGas = await this.estGasCreateNftErcWithFixedRate(
|
||||||
address,
|
address,
|
||||||
nftCreateData,
|
nftCreateData,
|
||||||
ercCreateData,
|
ercParams,
|
||||||
fixedData
|
freParams
|
||||||
)
|
)
|
||||||
|
|
||||||
// Invoke createToken function of the contract
|
// Invoke createToken function of the contract
|
||||||
const trxReceipt = await this.factory721.methods
|
const trxReceipt = await this.factory721.methods
|
||||||
.createNftErcWithFixedRate(nftCreateData, ercCreateData, fixedData)
|
.createNftErcWithFixedRate(nftCreateData, ercCreateData, fixedData)
|
||||||
@ -753,4 +789,75 @@ export class NFTFactory {
|
|||||||
|
|
||||||
return trxReceipt
|
return trxReceipt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getErcCreationParams(ercParams: ErcCreateParams): any {
|
||||||
|
let name, symbol
|
||||||
|
// Generate name & symbol if not present
|
||||||
|
if (!ercParams.name || !ercParams.symbol) {
|
||||||
|
;({ name, symbol } = generateDtName())
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
templateIndex: ercParams.templateIndex,
|
||||||
|
strings: [ercParams.name || name, ercParams.symbol || symbol],
|
||||||
|
addresses: [
|
||||||
|
ercParams.minter,
|
||||||
|
ercParams.feeManager,
|
||||||
|
ercParams.mpFeeAddress,
|
||||||
|
ercParams.feeToken
|
||||||
|
],
|
||||||
|
uints: [
|
||||||
|
this.web3.utils.toWei(ercParams.cap),
|
||||||
|
this.web3.utils.toWei(ercParams.feeAmount)
|
||||||
|
],
|
||||||
|
bytes: []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getFreCreationParams(freParams: FixedRateParams): any {
|
||||||
|
if (!freParams.allowedConsumer)
|
||||||
|
freParams.allowedConsumer = '0x0000000000000000000000000000000000000000'
|
||||||
|
const withMint = freParams.withMint ? 1 : 0
|
||||||
|
|
||||||
|
return {
|
||||||
|
fixedPriceAddress: freParams.fixedRateAddress,
|
||||||
|
address: [
|
||||||
|
freParams.baseTokenAddress,
|
||||||
|
freParams.owner,
|
||||||
|
freParams.marketFeeCollector,
|
||||||
|
freParams.allowedConsumer
|
||||||
|
],
|
||||||
|
uints: [
|
||||||
|
freParams.baseTokenDecimals,
|
||||||
|
freParams.dataTokenDecimals,
|
||||||
|
freParams.fixedRate,
|
||||||
|
freParams.marketFee,
|
||||||
|
withMint
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getPoolCreationParams(poolParams: PoolParams): any {
|
||||||
|
return {
|
||||||
|
ssParams: [
|
||||||
|
this.web3.utils.toWei(poolParams.rate),
|
||||||
|
poolParams.basetokenDecimals,
|
||||||
|
this.web3.utils.toWei(poolParams.vestingAmount),
|
||||||
|
poolParams.vestedBlocks,
|
||||||
|
this.web3.utils.toWei(poolParams.initialBasetokenLiquidity)
|
||||||
|
],
|
||||||
|
swapFees: [
|
||||||
|
poolParams.swapFeeLiquidityProvider,
|
||||||
|
poolParams.swapFeeMarketPlaceRunner
|
||||||
|
],
|
||||||
|
addresses: [
|
||||||
|
poolParams.ssContract,
|
||||||
|
poolParams.basetokenAddress,
|
||||||
|
poolParams.basetokenSender,
|
||||||
|
poolParams.publisherAddress,
|
||||||
|
poolParams.marketFeeCollector,
|
||||||
|
poolParams.poolTemplateAddress
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,13 @@ import MockERC20 from '@oceanprotocol/contracts/artifacts/contracts/utils/mock/M
|
|||||||
import PoolTemplate from '@oceanprotocol/contracts/artifacts/contracts/pools/balancer/BPool.sol/BPool.json'
|
import PoolTemplate from '@oceanprotocol/contracts/artifacts/contracts/pools/balancer/BPool.sol/BPool.json'
|
||||||
import { LoggerInstance } from '../../src/utils'
|
import { LoggerInstance } from '../../src/utils'
|
||||||
// import { NFTDataToken } from '../../../src/datatokens/NFTDatatoken'
|
// import { NFTDataToken } from '../../../src/datatokens/NFTDatatoken'
|
||||||
import { NFTFactory } from '../../src/factories/NFTFactory'
|
import {
|
||||||
|
NFTFactory,
|
||||||
|
NFTCreateData,
|
||||||
|
ErcCreateParams,
|
||||||
|
PoolParams,
|
||||||
|
FixedRateParams
|
||||||
|
} from '../../src/factories/NFTFactory'
|
||||||
|
|
||||||
const web3 = new Web3('http://127.0.0.1:8545')
|
const web3 = new Web3('http://127.0.0.1:8545')
|
||||||
|
|
||||||
@ -169,29 +175,29 @@ describe('NFT Factory test', () => {
|
|||||||
|
|
||||||
it('#createNftwithErc - should create an NFT and a Datatoken ', async () => {
|
it('#createNftwithErc - should create an NFT and a Datatoken ', async () => {
|
||||||
// we prepare transaction parameters objects
|
// we prepare transaction parameters objects
|
||||||
const nftData = {
|
const nftData: NFTCreateData = {
|
||||||
name: '72120Bundle',
|
name: '72120Bundle',
|
||||||
symbol: '72Bundle',
|
symbol: '72Bundle',
|
||||||
templateIndex: 1,
|
templateIndex: 1,
|
||||||
baseURI: 'https://oceanprotocol.com/nft/'
|
baseURI: 'https://oceanprotocol.com/nft/'
|
||||||
}
|
}
|
||||||
const ercData = {
|
|
||||||
|
const ercParams: ErcCreateParams = {
|
||||||
templateIndex: 1,
|
templateIndex: 1,
|
||||||
strings: ['ERC20B1', 'ERC20DT1Symbol'],
|
minter: contracts.accounts[0],
|
||||||
addresses: [
|
feeManager: user3,
|
||||||
contracts.accounts[0],
|
mpFeeAddress: user2,
|
||||||
user3,
|
feeToken: '0x0000000000000000000000000000000000000000',
|
||||||
user2,
|
cap: '10000',
|
||||||
'0x0000000000000000000000000000000000000000'
|
feeAmount: '0',
|
||||||
],
|
name: 'ERC20B1',
|
||||||
uints: [web3.utils.toWei('10000'), 0],
|
symbol: 'ERC20DT1Symbol'
|
||||||
bytess: []
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const txReceipt = await nftFactory.createNftWithErc(
|
const txReceipt = await nftFactory.createNftWithErc(
|
||||||
contracts.accounts[0],
|
contracts.accounts[0],
|
||||||
nftData,
|
nftData,
|
||||||
ercData
|
ercParams
|
||||||
)
|
)
|
||||||
|
|
||||||
// EVENTS HAVE BEEN EMITTED
|
// EVENTS HAVE BEEN EMITTED
|
||||||
@ -205,47 +211,46 @@ describe('NFT Factory test', () => {
|
|||||||
|
|
||||||
it('#createNftErcWithPool- should create an NFT, a Datatoken and a pool DT/DAI', async () => {
|
it('#createNftErcWithPool- should create an NFT, a Datatoken and a pool DT/DAI', async () => {
|
||||||
// we prepare transaction parameters objects
|
// we prepare transaction parameters objects
|
||||||
const nftData = {
|
const nftData: NFTCreateData = {
|
||||||
name: '72120Bundle',
|
name: '72120Bundle',
|
||||||
symbol: '72Bundle',
|
symbol: '72Bundle',
|
||||||
templateIndex: 1,
|
templateIndex: 1,
|
||||||
baseURI: 'https://oceanprotocol.com/nft/'
|
baseURI: 'https://oceanprotocol.com/nft/'
|
||||||
}
|
}
|
||||||
const ercData = {
|
|
||||||
|
const ercParams: ErcCreateParams = {
|
||||||
templateIndex: 1,
|
templateIndex: 1,
|
||||||
strings: ['ERC20B1', 'ERC20DT1Symbol'],
|
minter: user2,
|
||||||
addresses: [user2, user3, user2, '0x0000000000000000000000000000000000000000'],
|
feeManager: user3,
|
||||||
uints: [web3.utils.toWei('1000000'), 0],
|
mpFeeAddress: user2,
|
||||||
bytess: []
|
feeToken: '0x0000000000000000000000000000000000000000',
|
||||||
|
cap: '1000000',
|
||||||
|
feeAmount: '0',
|
||||||
|
name: 'ERC20B1',
|
||||||
|
symbol: 'ERC20DT1Symbol'
|
||||||
}
|
}
|
||||||
|
|
||||||
const poolData = {
|
const poolParams: PoolParams = {
|
||||||
addresses: [
|
ssContract: contracts.sideStakingAddress,
|
||||||
contracts.sideStakingAddress,
|
basetokenAddress: contracts.daiAddress,
|
||||||
contracts.daiAddress,
|
basetokenSender: contracts.factory721Address,
|
||||||
contracts.factory721Address,
|
publisherAddress: contracts.accounts[0],
|
||||||
contracts.accounts[0],
|
marketFeeCollector: contracts.accounts[0],
|
||||||
contracts.accounts[0],
|
poolTemplateAddress: contracts.poolTemplateAddress,
|
||||||
contracts.poolTemplateAddress
|
rate: '1',
|
||||||
],
|
basetokenDecimals: 18,
|
||||||
ssParams: [
|
vestingAmount: '10000',
|
||||||
web3.utils.toWei('1'), // rate
|
vestedBlocks: 2500000,
|
||||||
18, // basetokenDecimals
|
initialBasetokenLiquidity: '2000',
|
||||||
web3.utils.toWei('10000'),
|
swapFeeLiquidityProvider: 1e15,
|
||||||
2500000, // vested blocks
|
swapFeeMarketPlaceRunner: 1e15
|
||||||
web3.utils.toWei('2000') // baseToken initial pool liquidity
|
|
||||||
],
|
|
||||||
swapFees: [
|
|
||||||
1e15, //
|
|
||||||
1e15
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const txReceipt = await nftFactory.createNftErcWithPool(
|
const txReceipt = await nftFactory.createNftErcWithPool(
|
||||||
contracts.accounts[0],
|
contracts.accounts[0],
|
||||||
nftData,
|
nftData,
|
||||||
ercData,
|
ercParams,
|
||||||
poolData
|
poolParams
|
||||||
)
|
)
|
||||||
|
|
||||||
// EVENTS HAVE BEEN EMITTED
|
// EVENTS HAVE BEEN EMITTED
|
||||||
@ -256,41 +261,44 @@ describe('NFT Factory test', () => {
|
|||||||
|
|
||||||
it('#createNftErcWithFixedRate- should create an NFT, a datatoken and create a Fixed Rate Exchange', async () => {
|
it('#createNftErcWithFixedRate- should create an NFT, a datatoken and create a Fixed Rate Exchange', async () => {
|
||||||
// we prepare transaction parameters objects
|
// we prepare transaction parameters objects
|
||||||
const nftData = {
|
const nftData:NFTCreateData = {
|
||||||
name: '72120Bundle',
|
name: '72120Bundle',
|
||||||
symbol: '72Bundle',
|
symbol: '72Bundle',
|
||||||
templateIndex: 1,
|
templateIndex: 1,
|
||||||
baseURI: 'https://oceanprotocol.com/nft/'
|
baseURI: 'https://oceanprotocol.com/nft/'
|
||||||
}
|
}
|
||||||
const ercData = {
|
|
||||||
|
const ercParams: ErcCreateParams = {
|
||||||
templateIndex: 1,
|
templateIndex: 1,
|
||||||
strings: ['ERC20B1', 'ERC20DT1Symbol'],
|
minter: contracts.accounts[0],,
|
||||||
addresses: [
|
feeManager: user3,
|
||||||
contracts.accounts[0],
|
mpFeeAddress: user2,
|
||||||
user3,
|
feeToken: '0x0000000000000000000000000000000000000000',
|
||||||
user2,
|
cap: '1000000',
|
||||||
'0x0000000000000000000000000000000000000000'
|
feeAmount: '0',
|
||||||
],
|
name: 'ERC20B1',
|
||||||
uints: [web3.utils.toWei('1000000'), 0],
|
symbol: 'ERC20DT1Symbol'
|
||||||
bytess: []
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const fixedData = {
|
|
||||||
fixedPriceAddress: contracts.fixedRateAddress,
|
const freParams: FixedRateParams = {
|
||||||
addresses: [
|
fixedRateAddress:contracts.fixedRateAddress,
|
||||||
contracts.daiAddress,
|
baseTokenAddress: contracts.daiAddress,
|
||||||
contracts.accounts[0],
|
owner: contracts.accounts[0],
|
||||||
contracts.accounts[0],
|
marketFeeCollector: contracts.accounts[0],
|
||||||
contracts.accounts[0]
|
baseTokenDecimals: 18,
|
||||||
],
|
dataTokenDecimals: 18,
|
||||||
uints: [18, 18, web3.utils.toWei('1'), 1e15, 0]
|
fixedRate: '1',
|
||||||
|
marketFee: 1e15,
|
||||||
|
allowedConsumer: contracts.accounts[0],
|
||||||
|
withMint: false
|
||||||
}
|
}
|
||||||
|
|
||||||
const txReceipt = await nftFactory.createNftErcWithFixedRate(
|
const txReceipt = await nftFactory.createNftErcWithFixedRate(
|
||||||
contracts.accounts[0],
|
contracts.accounts[0],
|
||||||
nftData,
|
nftData,
|
||||||
ercData,
|
ercParams,
|
||||||
fixedData
|
freParams
|
||||||
)
|
)
|
||||||
|
|
||||||
// EVENTS HAVE BEEN EMITTED
|
// EVENTS HAVE BEEN EMITTED
|
||||||
|
Loading…
x
Reference in New Issue
Block a user