mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
fixed some tests
This commit is contained in:
parent
193c3bedd1
commit
7e766a585f
@ -660,9 +660,9 @@ 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 ercParams input data for ERC20 Creation
|
* @param ercParams input data for ERC20 Creation
|
||||||
* @param _PoolData input data for Pool Creation
|
* @param poolParams input data for Pool Creation
|
||||||
* @return {Promise<TransactionReceipt>} transaction receipt
|
* @return {Promise<TransactionReceipt>} transaction receipt
|
||||||
*/
|
*/
|
||||||
public async estGasCreateNftErcWithPool(
|
public async estGasCreateNftErcWithPool(
|
||||||
@ -690,9 +690,9 @@ export class NFTFactory {
|
|||||||
* Creates a new NFT, then a ERC20, then a Pool, all in one call
|
* Creates a new NFT, then a ERC20, then a Pool, all in one call
|
||||||
* Use this carefully, because if Pool creation fails, you are still going to pay a lot of gas
|
* Use this carefully, because if Pool 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 _PoolData input data for Pool Creation
|
* @param poolParams input data for Pool Creation
|
||||||
* @return {Promise<TransactionReceipt>} transaction receipt
|
* @return {Promise<TransactionReceipt>} transaction receipt
|
||||||
*/
|
*/
|
||||||
public async createNftErcWithPool(
|
public async createNftErcWithPool(
|
||||||
@ -710,6 +710,10 @@ export class NFTFactory {
|
|||||||
poolData
|
poolData
|
||||||
)
|
)
|
||||||
|
|
||||||
|
console.log('estGas', estGas)
|
||||||
|
console.log('ercCreateData', ercCreateData)
|
||||||
|
console.log('poolData', poolData)
|
||||||
|
|
||||||
// Invoke createToken function of the contract
|
// Invoke createToken function of the contract
|
||||||
const trxReceipt = await this.factory721.methods
|
const trxReceipt = await this.factory721.methods
|
||||||
.createNftErcWithPool(nftCreateData, ercCreateData, poolData)
|
.createNftErcWithPool(nftCreateData, ercCreateData, poolData)
|
||||||
@ -810,7 +814,7 @@ export class NFTFactory {
|
|||||||
this.web3.utils.toWei(ercParams.cap),
|
this.web3.utils.toWei(ercParams.cap),
|
||||||
this.web3.utils.toWei(ercParams.feeAmount)
|
this.web3.utils.toWei(ercParams.feeAmount)
|
||||||
],
|
],
|
||||||
bytes: []
|
bytess: []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -821,7 +825,7 @@ export class NFTFactory {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
fixedPriceAddress: freParams.fixedRateAddress,
|
fixedPriceAddress: freParams.fixedRateAddress,
|
||||||
address: [
|
addresses: [
|
||||||
freParams.baseTokenAddress,
|
freParams.baseTokenAddress,
|
||||||
freParams.owner,
|
freParams.owner,
|
||||||
freParams.marketFeeCollector,
|
freParams.marketFeeCollector,
|
||||||
@ -839,17 +843,6 @@ export class NFTFactory {
|
|||||||
|
|
||||||
getPoolCreationParams(poolParams: PoolParams): any {
|
getPoolCreationParams(poolParams: PoolParams): any {
|
||||||
return {
|
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: [
|
addresses: [
|
||||||
poolParams.ssContract,
|
poolParams.ssContract,
|
||||||
poolParams.basetokenAddress,
|
poolParams.basetokenAddress,
|
||||||
@ -857,7 +850,15 @@ export class NFTFactory {
|
|||||||
poolParams.publisherAddress,
|
poolParams.publisherAddress,
|
||||||
poolParams.marketFeeCollector,
|
poolParams.marketFeeCollector,
|
||||||
poolParams.poolTemplateAddress
|
poolParams.poolTemplateAddress
|
||||||
]
|
],
|
||||||
|
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]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -261,7 +261,7 @@ 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:NFTCreateData = {
|
const nftData: NFTCreateData = {
|
||||||
name: '72120Bundle',
|
name: '72120Bundle',
|
||||||
symbol: '72Bundle',
|
symbol: '72Bundle',
|
||||||
templateIndex: 1,
|
templateIndex: 1,
|
||||||
@ -270,7 +270,7 @@ describe('NFT Factory test', () => {
|
|||||||
|
|
||||||
const ercParams: ErcCreateParams = {
|
const ercParams: ErcCreateParams = {
|
||||||
templateIndex: 1,
|
templateIndex: 1,
|
||||||
minter: contracts.accounts[0],,
|
minter: contracts.accounts[0],
|
||||||
feeManager: user3,
|
feeManager: user3,
|
||||||
mpFeeAddress: user2,
|
mpFeeAddress: user2,
|
||||||
feeToken: '0x0000000000000000000000000000000000000000',
|
feeToken: '0x0000000000000000000000000000000000000000',
|
||||||
@ -280,9 +280,8 @@ describe('NFT Factory test', () => {
|
|||||||
symbol: 'ERC20DT1Symbol'
|
symbol: 'ERC20DT1Symbol'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const freParams: FixedRateParams = {
|
const freParams: FixedRateParams = {
|
||||||
fixedRateAddress:contracts.fixedRateAddress,
|
fixedRateAddress: contracts.fixedRateAddress,
|
||||||
baseTokenAddress: contracts.daiAddress,
|
baseTokenAddress: contracts.daiAddress,
|
||||||
owner: contracts.accounts[0],
|
owner: contracts.accounts[0],
|
||||||
marketFeeCollector: contracts.accounts[0],
|
marketFeeCollector: contracts.accounts[0],
|
||||||
@ -372,6 +371,7 @@ describe('NFT Factory test', () => {
|
|||||||
expect(await dtContract.methods.balanceOf(user2).call()).to.equal('0')
|
expect(await dtContract.methods.balanceOf(user2).call()).to.equal('0')
|
||||||
expect(await dtContract2.methods.balanceOf(user2).call()).to.equal('0')
|
expect(await dtContract2.methods.balanceOf(user2).call()).to.equal('0')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('#checkDatatoken - should confirm if DT is from the factory', async () => {
|
it('#checkDatatoken - should confirm if DT is from the factory', async () => {
|
||||||
assert((await nftFactory.checkDatatoken(dtAddress)) === true)
|
assert((await nftFactory.checkDatatoken(dtAddress)) === true)
|
||||||
assert((await nftFactory.checkDatatoken(dtAddress2)) === true)
|
assert((await nftFactory.checkDatatoken(dtAddress2)) === true)
|
||||||
|
@ -13,8 +13,14 @@ import MockERC20 from '@oceanprotocol/contracts/artifacts/contracts/utils/mock/M
|
|||||||
import OPFCommunityFeeCollector from '@oceanprotocol/contracts/artifacts/contracts/communityFee/OPFCommunityFeeCollector.sol/OPFCommunityFeeCollector.json'
|
import OPFCommunityFeeCollector from '@oceanprotocol/contracts/artifacts/contracts/communityFee/OPFCommunityFeeCollector.sol/OPFCommunityFeeCollector.json'
|
||||||
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 { NFTFactory } from '../../../src/factories/NFTFactory'
|
import {
|
||||||
|
NFTFactory,
|
||||||
|
NFTCreateData,
|
||||||
|
ErcCreateParams,
|
||||||
|
PoolParams
|
||||||
|
} from '../../../src/factories/NFTFactory'
|
||||||
import { Router } from '../../../src/pools/Router'
|
import { Router } from '../../../src/pools/Router'
|
||||||
|
import { BigNumber } from 'bignumber.js'
|
||||||
const { keccak256 } = require('@ethersproject/keccak256')
|
const { keccak256 } = require('@ethersproject/keccak256')
|
||||||
const web3 = new Web3('http://127.0.0.1:8545')
|
const web3 = new Web3('http://127.0.0.1:8545')
|
||||||
const communityCollector = '0xeE9300b7961e0a01d9f0adb863C7A227A07AaD75'
|
const communityCollector = '0xeE9300b7961e0a01d9f0adb863C7A227A07AaD75'
|
||||||
@ -172,45 +178,39 @@ describe('Router unit test', () => {
|
|||||||
|
|
||||||
// CREATE A FIRST POOL
|
// CREATE A FIRST POOL
|
||||||
// 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: contracts.accounts[0],
|
||||||
user3,
|
feeToken: '0x0000000000000000000000000000000000000000',
|
||||||
contracts.accounts[0],
|
cap: '1000000',
|
||||||
'0x0000000000000000000000000000000000000000'
|
feeAmount: '0',
|
||||||
],
|
name: 'ERC20B1',
|
||||||
uints: [web3.utils.toWei('1000000'), 0],
|
symbol: 'ERC20DT1Symbol'
|
||||||
bytess: []
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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 nftFactory = new NFTFactory(
|
const nftFactory = new NFTFactory(
|
||||||
@ -222,8 +222,8 @@ describe('Router unit test', () => {
|
|||||||
const txReceipt = await nftFactory.createNftErcWithPool(
|
const txReceipt = await nftFactory.createNftErcWithPool(
|
||||||
contracts.accounts[0],
|
contracts.accounts[0],
|
||||||
nftData,
|
nftData,
|
||||||
ercData,
|
ercParams,
|
||||||
poolData
|
poolParams
|
||||||
)
|
)
|
||||||
|
|
||||||
const erc20Token = txReceipt.events.TokenCreated.returnValues.newTokenAddress
|
const erc20Token = txReceipt.events.TokenCreated.returnValues.newTokenAddress
|
||||||
@ -231,52 +231,46 @@ describe('Router unit test', () => {
|
|||||||
|
|
||||||
// CREATE A SECOND POOL
|
// CREATE A SECOND POOL
|
||||||
|
|
||||||
const nftData2 = {
|
const nftData2: NFTCreateData = {
|
||||||
name: '72120Bundle2',
|
name: '72120Bundle2',
|
||||||
symbol: '72Bundle2',
|
symbol: '72Bundle2',
|
||||||
templateIndex: 1,
|
templateIndex: 1,
|
||||||
baseURI: 'https://oceanprotocol.com/nft2/'
|
baseURI: 'https://oceanprotocol.com/nft2/'
|
||||||
}
|
}
|
||||||
const ercData2 = {
|
|
||||||
|
const ercParams2: ErcCreateParams = {
|
||||||
templateIndex: 1,
|
templateIndex: 1,
|
||||||
strings: ['ERC20B12', 'ERC20DT1Symbol2'],
|
minter: contracts.accounts[0],
|
||||||
addresses: [
|
feeManager: user3,
|
||||||
contracts.accounts[0],
|
mpFeeAddress: contracts.accounts[0],
|
||||||
user3,
|
feeToken: '0x0000000000000000000000000000000000000000',
|
||||||
contracts.accounts[0],
|
cap: '1000000',
|
||||||
'0x0000000000000000000000000000000000000000'
|
feeAmount: '0',
|
||||||
],
|
name: 'ERC20B12',
|
||||||
uints: [web3.utils.toWei('1000000'), 0],
|
symbol: 'ERC20DT1Symbol2'
|
||||||
bytess: []
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const poolData2 = {
|
const poolParams2: 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 txReceipt2 = await nftFactory.createNftErcWithPool(
|
const txReceipt2 = await nftFactory.createNftErcWithPool(
|
||||||
contracts.accounts[0],
|
contracts.accounts[0],
|
||||||
nftData2,
|
nftData2,
|
||||||
ercData2,
|
ercParams2,
|
||||||
poolData2
|
poolParams2
|
||||||
)
|
)
|
||||||
|
|
||||||
const erc20Token2 = txReceipt2.events.TokenCreated.returnValues.newTokenAddress
|
const erc20Token2 = txReceipt2.events.TokenCreated.returnValues.newTokenAddress
|
||||||
|
@ -15,7 +15,12 @@ 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 OPFCollector from '@oceanprotocol/contracts/artifacts/contracts/communityFee/OPFCommunityFeeCollector.sol/OPFCommunityFeeCollector.json'
|
import OPFCollector from '@oceanprotocol/contracts/artifacts/contracts/communityFee/OPFCommunityFeeCollector.sol/OPFCommunityFeeCollector.json'
|
||||||
import { LoggerInstance } from '../../../../src/utils'
|
import { LoggerInstance } from '../../../../src/utils'
|
||||||
import { NFTFactory } from '../../../../src/factories/NFTFactory'
|
import {
|
||||||
|
NFTFactory,
|
||||||
|
NFTCreateData,
|
||||||
|
ErcCreateParams,
|
||||||
|
PoolParams
|
||||||
|
} from '../../../../src/factories/NFTFactory'
|
||||||
import { Pool } from '../../../../src/pools/balancer/Pool'
|
import { Pool } from '../../../../src/pools/balancer/Pool'
|
||||||
const { keccak256 } = require('@ethersproject/keccak256')
|
const { keccak256 } = require('@ethersproject/keccak256')
|
||||||
const web3 = new Web3('http://127.0.0.1:8545')
|
const web3 = new Web3('http://127.0.0.1:8545')
|
||||||
@ -129,47 +134,41 @@ describe('Pool unit test', () => {
|
|||||||
it('#create a pool', async () => {
|
it('#create a pool', async () => {
|
||||||
// CREATE A POOL
|
// CREATE A POOL
|
||||||
// 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: contracts.accounts[0],
|
||||||
user3,
|
feeToken: '0x0000000000000000000000000000000000000000',
|
||||||
contracts.accounts[0],
|
cap: '1000000',
|
||||||
'0x0000000000000000000000000000000000000000'
|
feeAmount: '0',
|
||||||
],
|
name: 'ERC20B1',
|
||||||
uints: [web3.utils.toWei('1000000'), 0],
|
symbol: 'ERC20DT1Symbol'
|
||||||
bytess: []
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const basetokenInitialLiq = await pool.amountToUnits(contracts.daiAddress, '2000')
|
const basetokenInitialLiq = await pool.amountToUnits(contracts.daiAddress, '2000')
|
||||||
|
|
||||||
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 nftFactory = new NFTFactory(
|
const nftFactory = new NFTFactory(
|
||||||
@ -181,8 +180,8 @@ describe('Pool unit test', () => {
|
|||||||
const txReceipt = await nftFactory.createNftErcWithPool(
|
const txReceipt = await nftFactory.createNftErcWithPool(
|
||||||
contracts.accounts[0],
|
contracts.accounts[0],
|
||||||
nftData,
|
nftData,
|
||||||
ercData,
|
ercParams,
|
||||||
poolData
|
poolParams
|
||||||
)
|
)
|
||||||
|
|
||||||
erc20Token = txReceipt.events.TokenCreated.returnValues.newTokenAddress
|
erc20Token = txReceipt.events.TokenCreated.returnValues.newTokenAddress
|
||||||
@ -579,48 +578,44 @@ describe('Pool unit test', () => {
|
|||||||
it('#create a pool', async () => {
|
it('#create a pool', async () => {
|
||||||
// CREATE A POOL
|
// CREATE A POOL
|
||||||
// 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: contracts.accounts[0],
|
||||||
user3,
|
feeToken: '0x0000000000000000000000000000000000000000',
|
||||||
contracts.accounts[0],
|
cap: '1000000',
|
||||||
'0x0000000000000000000000000000000000000000'
|
feeAmount: '0',
|
||||||
],
|
name: 'ERC20B1',
|
||||||
uints: [web3.utils.toWei('1000000'), 0],
|
symbol: 'ERC20DT1Symbol'
|
||||||
bytess: []
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const basetokenInitialLiq = Number(
|
const basetokenInitialLiq = Number(
|
||||||
await pool.amountToUnits(contracts.usdcAddress, '2000')
|
await pool.amountToUnits(contracts.usdcAddress, '2000')
|
||||||
)
|
)
|
||||||
console.log(basetokenInitialLiq.toString())
|
console.log(basetokenInitialLiq.toString())
|
||||||
const poolData = {
|
|
||||||
addresses: [
|
const poolParams: PoolParams = {
|
||||||
contracts.sideStakingAddress,
|
ssContract: contracts.sideStakingAddress,
|
||||||
contracts.usdcAddress,
|
basetokenAddress: contracts.usdcAddress,
|
||||||
contracts.factory721Address,
|
basetokenSender: contracts.factory721Address,
|
||||||
contracts.accounts[0],
|
publisherAddress: contracts.accounts[0],
|
||||||
contracts.accounts[0],
|
marketFeeCollector: contracts.accounts[0],
|
||||||
contracts.poolTemplateAddress
|
poolTemplateAddress: contracts.poolTemplateAddress,
|
||||||
],
|
rate: '1',
|
||||||
ssParams: [
|
basetokenDecimals: await usdcContract.methods.decimals().call(),
|
||||||
web3.utils.toWei('1'), // rate
|
vestingAmount: '10000',
|
||||||
await usdcContract.methods.decimals().call(), // basetokenDecimals
|
vestedBlocks: 2500000,
|
||||||
web3.utils.toWei('10000'),
|
initialBasetokenLiquidity: basetokenInitialLiq.toString(),
|
||||||
2500000, // vested blocks
|
swapFeeLiquidityProvider: 1e15,
|
||||||
basetokenInitialLiq // baseToken initial pool liquidity
|
swapFeeMarketPlaceRunner: 1e15
|
||||||
],
|
|
||||||
swapFees: [
|
|
||||||
1e15, //
|
|
||||||
1e15
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const nftFactory = new NFTFactory(
|
const nftFactory = new NFTFactory(
|
||||||
@ -632,8 +627,8 @@ describe('Pool unit test', () => {
|
|||||||
const txReceipt = await nftFactory.createNftErcWithPool(
|
const txReceipt = await nftFactory.createNftErcWithPool(
|
||||||
contracts.accounts[0],
|
contracts.accounts[0],
|
||||||
nftData,
|
nftData,
|
||||||
ercData,
|
ercParams,
|
||||||
poolData
|
poolParams
|
||||||
)
|
)
|
||||||
|
|
||||||
erc20Token = txReceipt.events.TokenCreated.returnValues.newTokenAddress
|
erc20Token = txReceipt.events.TokenCreated.returnValues.newTokenAddress
|
||||||
|
Loading…
x
Reference in New Issue
Block a user