mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
added interfaces fixedrate and erc tokens and array creation helpers
This commit is contained in:
parent
6606c6d7d7
commit
9a8be41549
@ -6,6 +6,7 @@ import defaultDatatokensEnterpriseABI from '@oceanprotocol/contracts/artifacts/c
|
|||||||
import Decimal from 'decimal.js'
|
import Decimal from 'decimal.js'
|
||||||
import { LoggerInstance, getFairGasPrice } from '../utils'
|
import { LoggerInstance, getFairGasPrice } from '../utils'
|
||||||
import { Contract } from 'web3-eth-contract'
|
import { Contract } from 'web3-eth-contract'
|
||||||
|
import { FreOrderParams, FreCreationParams } from '../interfaces'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ERC20 ROLES
|
* ERC20 ROLES
|
||||||
@ -24,24 +25,6 @@ export interface OrderParams {
|
|||||||
consumeFeeAmount: string
|
consumeFeeAmount: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FreParams {
|
|
||||||
exchangeContract: string
|
|
||||||
exchangeId: string
|
|
||||||
maxBaseTokenAmount: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface FixedRateParams {
|
|
||||||
baseTokenAddress: string
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface DispenserParams {
|
export interface DispenserParams {
|
||||||
maxTokens: string
|
maxTokens: string
|
||||||
maxBalance: string
|
maxBalance: string
|
||||||
@ -187,8 +170,7 @@ export class Datatoken {
|
|||||||
public async estGasCreateFixedRate(
|
public async estGasCreateFixedRate(
|
||||||
dtAddress: string,
|
dtAddress: string,
|
||||||
address: string,
|
address: string,
|
||||||
fixedPriceAddress: string,
|
fixedRateParams: FreCreationParams,
|
||||||
fixedRateParams: FixedRateParams,
|
|
||||||
contractInstance?: Contract
|
contractInstance?: Contract
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
const dtContract =
|
const dtContract =
|
||||||
@ -204,7 +186,7 @@ export class Datatoken {
|
|||||||
try {
|
try {
|
||||||
estGas = await dtContract.methods
|
estGas = await dtContract.methods
|
||||||
.createFixedRate(
|
.createFixedRate(
|
||||||
fixedPriceAddress,
|
fixedRateParams.fixedRateAddress,
|
||||||
[
|
[
|
||||||
fixedRateParams.baseTokenAddress,
|
fixedRateParams.baseTokenAddress,
|
||||||
address,
|
address,
|
||||||
@ -238,8 +220,7 @@ export class Datatoken {
|
|||||||
public async createFixedRate(
|
public async createFixedRate(
|
||||||
dtAddress: string,
|
dtAddress: string,
|
||||||
address: string,
|
address: string,
|
||||||
fixedPriceAddress: string,
|
fixedRateParams: FreCreationParams
|
||||||
fixedRateParams: FixedRateParams
|
|
||||||
): Promise<TransactionReceipt> {
|
): Promise<TransactionReceipt> {
|
||||||
const dtContract = new this.web3.eth.Contract(this.datatokensABI, dtAddress)
|
const dtContract = new this.web3.eth.Contract(this.datatokensABI, dtAddress)
|
||||||
|
|
||||||
@ -253,7 +234,6 @@ export class Datatoken {
|
|||||||
const estGas = await this.estGasCreateFixedRate(
|
const estGas = await this.estGasCreateFixedRate(
|
||||||
dtAddress,
|
dtAddress,
|
||||||
address,
|
address,
|
||||||
fixedPriceAddress,
|
|
||||||
fixedRateParams,
|
fixedRateParams,
|
||||||
dtContract
|
dtContract
|
||||||
)
|
)
|
||||||
@ -261,7 +241,7 @@ export class Datatoken {
|
|||||||
// Call createFixedRate contract method
|
// Call createFixedRate contract method
|
||||||
const trxReceipt = await dtContract.methods
|
const trxReceipt = await dtContract.methods
|
||||||
.createFixedRate(
|
.createFixedRate(
|
||||||
fixedPriceAddress,
|
fixedRateParams.fixedRateAddress,
|
||||||
[
|
[
|
||||||
fixedRateParams.baseTokenAddress,
|
fixedRateParams.baseTokenAddress,
|
||||||
fixedRateParams.owner,
|
fixedRateParams.owner,
|
||||||
@ -943,7 +923,7 @@ export class Datatoken {
|
|||||||
dtAddress: string,
|
dtAddress: string,
|
||||||
address: string,
|
address: string,
|
||||||
orderParams: OrderParams,
|
orderParams: OrderParams,
|
||||||
freParams: FreParams,
|
freParams: FreOrderParams,
|
||||||
contractInstance?: Contract
|
contractInstance?: Contract
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
const dtContract =
|
const dtContract =
|
||||||
@ -974,7 +954,7 @@ export class Datatoken {
|
|||||||
dtAddress: string,
|
dtAddress: string,
|
||||||
address: string,
|
address: string,
|
||||||
orderParams: OrderParams,
|
orderParams: OrderParams,
|
||||||
freParams: FreParams
|
freParams: FreOrderParams
|
||||||
): Promise<TransactionReceipt> {
|
): Promise<TransactionReceipt> {
|
||||||
const dtContract = new this.web3.eth.Contract(this.datatokensEnterpriseABI, dtAddress)
|
const dtContract = new this.web3.eth.Contract(this.datatokensEnterpriseABI, dtAddress)
|
||||||
try {
|
try {
|
||||||
|
@ -1,10 +1,17 @@
|
|||||||
import { Contract } from 'web3-eth-contract'
|
import { Contract } from 'web3-eth-contract'
|
||||||
import Web3 from 'web3'
|
import Web3 from 'web3'
|
||||||
import BigNumber from 'bignumber.js'
|
|
||||||
import { TransactionReceipt } from 'web3-core'
|
import { TransactionReceipt } from 'web3-core'
|
||||||
import { AbiItem } from 'web3-utils'
|
import { AbiItem } from 'web3-utils'
|
||||||
import defaultFactory721ABI from '@oceanprotocol/contracts/artifacts/contracts/ERC721Factory.sol/ERC721Factory.json'
|
import defaultFactory721ABI from '@oceanprotocol/contracts/artifacts/contracts/ERC721Factory.sol/ERC721Factory.json'
|
||||||
import { LoggerInstance, getFairGasPrice, generateDtName } from '../utils'
|
import {
|
||||||
|
LoggerInstance,
|
||||||
|
getFairGasPrice,
|
||||||
|
generateDtName,
|
||||||
|
getFreCreationParams,
|
||||||
|
getErcCreationParams,
|
||||||
|
getPoolCreationParams
|
||||||
|
} from '../utils'
|
||||||
|
import { FreCreationParams, Erc20CreateParams, PoolCreationParams } from '../interfaces'
|
||||||
|
|
||||||
interface Template {
|
interface Template {
|
||||||
templateAddress: string
|
templateAddress: string
|
||||||
@ -28,47 +35,6 @@ export interface NFTCreateData {
|
|||||||
baseURI: string
|
baseURI: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ErcCreateParams {
|
|
||||||
templateIndex: number
|
|
||||||
minter: string
|
|
||||||
feeManager: string
|
|
||||||
mpFeeAddress: string
|
|
||||||
feeToken: string
|
|
||||||
feeAmount: string
|
|
||||||
cap: string
|
|
||||||
name?: string
|
|
||||||
symbol?: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface PoolParams {
|
|
||||||
ssContract: string
|
|
||||||
basetokenAddress: string
|
|
||||||
basetokenSender: string
|
|
||||||
publisherAddress: string
|
|
||||||
marketFeeCollector: string
|
|
||||||
poolTemplateAddress: string
|
|
||||||
rate: string
|
|
||||||
basetokenDecimals: number
|
|
||||||
vestingAmount: string
|
|
||||||
vestedBlocks: number
|
|
||||||
initialBasetokenLiquidity: string
|
|
||||||
swapFeeLiquidityProvider: number
|
|
||||||
swapFeeMarketPlaceRunner: number
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface FixedRateParams {
|
|
||||||
fixedRateAddress: string
|
|
||||||
baseTokenAddress: string
|
|
||||||
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
|
||||||
*/
|
*/
|
||||||
@ -607,13 +573,13 @@ export class NFTFactory {
|
|||||||
public async estGasCreateNftWithErc(
|
public async estGasCreateNftWithErc(
|
||||||
address: string,
|
address: string,
|
||||||
nftCreateData: NFTCreateData,
|
nftCreateData: NFTCreateData,
|
||||||
ercParams: ErcCreateParams
|
ercParams: Erc20CreateParams
|
||||||
): 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)
|
const ercCreateData = getErcCreationParams(ercParams, this.web3)
|
||||||
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))
|
||||||
@ -635,9 +601,9 @@ export class NFTFactory {
|
|||||||
public async createNftWithErc(
|
public async createNftWithErc(
|
||||||
address: string,
|
address: string,
|
||||||
nftCreateData: NFTCreateData,
|
nftCreateData: NFTCreateData,
|
||||||
ercParams: ErcCreateParams
|
ercParams: Erc20CreateParams
|
||||||
): Promise<TransactionReceipt> {
|
): Promise<TransactionReceipt> {
|
||||||
const ercCreateData = this.getErcCreationParams(ercParams)
|
const ercCreateData = getErcCreationParams(ercParams, this.web3)
|
||||||
|
|
||||||
const estGas = await this.estGasCreateNftWithErc(
|
const estGas = await this.estGasCreateNftWithErc(
|
||||||
address,
|
address,
|
||||||
@ -668,14 +634,14 @@ export class NFTFactory {
|
|||||||
public async estGasCreateNftErcWithPool(
|
public async estGasCreateNftErcWithPool(
|
||||||
address: string,
|
address: string,
|
||||||
nftCreateData: NFTCreateData,
|
nftCreateData: NFTCreateData,
|
||||||
ercParams: ErcCreateParams,
|
ercParams: Erc20CreateParams,
|
||||||
poolParams: PoolParams
|
poolParams: PoolCreationParams
|
||||||
): 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 ercCreateData = getErcCreationParams(ercParams, this.web3)
|
||||||
const poolData = this.getPoolCreationParams(poolParams)
|
const poolData = getPoolCreationParams(poolParams, this.web3)
|
||||||
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))
|
||||||
@ -698,8 +664,8 @@ export class NFTFactory {
|
|||||||
public async createNftErcWithPool(
|
public async createNftErcWithPool(
|
||||||
address: string,
|
address: string,
|
||||||
nftCreateData: NFTCreateData,
|
nftCreateData: NFTCreateData,
|
||||||
ercParams: ErcCreateParams,
|
ercParams: Erc20CreateParams,
|
||||||
poolParams: PoolParams
|
poolParams: PoolCreationParams
|
||||||
): Promise<TransactionReceipt> {
|
): Promise<TransactionReceipt> {
|
||||||
const estGas = await this.estGasCreateNftErcWithPool(
|
const estGas = await this.estGasCreateNftErcWithPool(
|
||||||
address,
|
address,
|
||||||
@ -707,8 +673,8 @@ export class NFTFactory {
|
|||||||
ercParams,
|
ercParams,
|
||||||
poolParams
|
poolParams
|
||||||
)
|
)
|
||||||
const ercCreateData = this.getErcCreationParams(ercParams)
|
const ercCreateData = getErcCreationParams(ercParams, this.web3)
|
||||||
const poolData = this.getPoolCreationParams(poolParams)
|
const poolData = getPoolCreationParams(poolParams, this.web3)
|
||||||
|
|
||||||
// Invoke createToken function of the contract
|
// Invoke createToken function of the contract
|
||||||
const trxReceipt = await this.factory721.methods
|
const trxReceipt = await this.factory721.methods
|
||||||
@ -732,15 +698,15 @@ export class NFTFactory {
|
|||||||
public async estGasCreateNftErcWithFixedRate(
|
public async estGasCreateNftErcWithFixedRate(
|
||||||
address: string,
|
address: string,
|
||||||
nftCreateData: NFTCreateData,
|
nftCreateData: NFTCreateData,
|
||||||
ercParams: ErcCreateParams,
|
ercParams: Erc20CreateParams,
|
||||||
freParams: FixedRateParams
|
freParams: FreCreationParams
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
const gasLimitDefault = this.GASLIMIT_DEFAULT
|
const gasLimitDefault = this.GASLIMIT_DEFAULT
|
||||||
let estGas
|
let estGas
|
||||||
|
|
||||||
const ercCreateData = this.getErcCreationParams(ercParams)
|
const ercCreateData = getErcCreationParams(ercParams, this.web3)
|
||||||
|
|
||||||
const fixedData = this.getFreCreationParams(freParams)
|
const fixedData = getFreCreationParams(freParams, this.web3)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
estGas = await this.factory721.methods
|
estGas = await this.factory721.methods
|
||||||
@ -765,11 +731,11 @@ export class NFTFactory {
|
|||||||
public async createNftErcWithFixedRate(
|
public async createNftErcWithFixedRate(
|
||||||
address: string,
|
address: string,
|
||||||
nftCreateData: NFTCreateData,
|
nftCreateData: NFTCreateData,
|
||||||
ercParams: ErcCreateParams,
|
ercParams: Erc20CreateParams,
|
||||||
freParams: FixedRateParams
|
freParams: FreCreationParams
|
||||||
): Promise<TransactionReceipt> {
|
): Promise<TransactionReceipt> {
|
||||||
const ercCreateData = this.getErcCreationParams(ercParams)
|
const ercCreateData = getErcCreationParams(ercParams, this.web3)
|
||||||
const fixedData = this.getFreCreationParams(freParams)
|
const fixedData = getFreCreationParams(freParams, this.web3)
|
||||||
|
|
||||||
const estGas = await this.estGasCreateNftErcWithFixedRate(
|
const estGas = await this.estGasCreateNftErcWithFixedRate(
|
||||||
address,
|
address,
|
||||||
@ -789,72 +755,4 @@ 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)
|
|
||||||
],
|
|
||||||
bytess: []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
getFreCreationParams(freParams: FixedRateParams): any {
|
|
||||||
if (!freParams.allowedConsumer)
|
|
||||||
freParams.allowedConsumer = '0x0000000000000000000000000000000000000000'
|
|
||||||
const withMint = freParams.withMint ? 1 : 0
|
|
||||||
|
|
||||||
return {
|
|
||||||
fixedPriceAddress: freParams.fixedRateAddress,
|
|
||||||
addresses: [
|
|
||||||
freParams.baseTokenAddress,
|
|
||||||
freParams.owner,
|
|
||||||
freParams.marketFeeCollector,
|
|
||||||
freParams.allowedConsumer
|
|
||||||
],
|
|
||||||
uints: [
|
|
||||||
freParams.baseTokenDecimals,
|
|
||||||
freParams.dataTokenDecimals,
|
|
||||||
freParams.fixedRate,
|
|
||||||
freParams.marketFee,
|
|
||||||
withMint
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
getPoolCreationParams(poolParams: PoolParams): any {
|
|
||||||
return {
|
|
||||||
addresses: [
|
|
||||||
poolParams.ssContract,
|
|
||||||
poolParams.basetokenAddress,
|
|
||||||
poolParams.basetokenSender,
|
|
||||||
poolParams.publisherAddress,
|
|
||||||
poolParams.marketFeeCollector,
|
|
||||||
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]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -2,3 +2,4 @@ export * from './Logger'
|
|||||||
export * from './GasUtils'
|
export * from './GasUtils'
|
||||||
export * from './Logger'
|
export * from './Logger'
|
||||||
export * from './DatatokenName'
|
export * from './DatatokenName'
|
||||||
|
export * from './ContractParams'
|
||||||
|
@ -18,12 +18,11 @@ import {
|
|||||||
Datatoken,
|
Datatoken,
|
||||||
NFTDatatoken,
|
NFTDatatoken,
|
||||||
OrderParams,
|
OrderParams,
|
||||||
FreParams,
|
|
||||||
FixedRateParams,
|
|
||||||
DispenserParams
|
DispenserParams
|
||||||
} from '../../src/datatokens'
|
} from '../../src/datatokens'
|
||||||
import { AbiItem } from 'web3-utils'
|
import { AbiItem } from 'web3-utils'
|
||||||
import { LoggerInstance } from '../../src/utils'
|
import { LoggerInstance } from '../../src/utils'
|
||||||
|
import { FreCreationParams, FreOrderParams } from '../../src/interfaces'
|
||||||
|
|
||||||
const web3 = new Web3('http://127.0.0.1:8545')
|
const web3 = new Web3('http://127.0.0.1:8545')
|
||||||
|
|
||||||
@ -152,7 +151,8 @@ describe('Datatoken', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('#createFixedRate - should create FRE for the erc20 dt', async () => {
|
it('#createFixedRate - should create FRE for the erc20 dt', async () => {
|
||||||
const freParams: FixedRateParams = {
|
const freParams: FreCreationParams = {
|
||||||
|
fixedRateAddress: contractHandler.fixedRateAddress,
|
||||||
baseTokenAddress: contractHandler.daiAddress,
|
baseTokenAddress: contractHandler.daiAddress,
|
||||||
owner: nftOwner,
|
owner: nftOwner,
|
||||||
marketFeeCollector: nftOwner,
|
marketFeeCollector: nftOwner,
|
||||||
@ -161,12 +161,7 @@ describe('Datatoken', () => {
|
|||||||
fixedRate: web3.utils.toWei('1'),
|
fixedRate: web3.utils.toWei('1'),
|
||||||
marketFee: 1e15
|
marketFee: 1e15
|
||||||
}
|
}
|
||||||
const fre = await datatoken.createFixedRate(
|
const fre = await datatoken.createFixedRate(datatokenAddress, nftOwner, freParams)
|
||||||
datatokenAddress,
|
|
||||||
nftOwner,
|
|
||||||
contractHandler.fixedRateAddress,
|
|
||||||
freParams
|
|
||||||
)
|
|
||||||
assert(fre !== null)
|
assert(fre !== null)
|
||||||
fixedRateAddress = fre.events.NewFixedRate.address
|
fixedRateAddress = fre.events.NewFixedRate.address
|
||||||
exchangeId = fre.events.NewFixedRate.returnValues[0]
|
exchangeId = fre.events.NewFixedRate.returnValues[0]
|
||||||
@ -309,7 +304,7 @@ describe('Datatoken', () => {
|
|||||||
consumeFeeToken: '0x0000000000000000000000000000000000000000',
|
consumeFeeToken: '0x0000000000000000000000000000000000000000',
|
||||||
consumeFeeAmount: '0'
|
consumeFeeAmount: '0'
|
||||||
}
|
}
|
||||||
const fre: FreParams = {
|
const fre: FreOrderParams = {
|
||||||
exchangeContract: fixedRateAddress,
|
exchangeContract: fixedRateAddress,
|
||||||
exchangeId: exchangeId,
|
exchangeId: exchangeId,
|
||||||
maxBaseTokenAmount: '1'
|
maxBaseTokenAmount: '1'
|
||||||
|
@ -14,13 +14,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 { LoggerInstance } from '../../src/utils'
|
import { LoggerInstance } from '../../src/utils'
|
||||||
// import { NFTDataToken } from '../../../src/datatokens/NFTDatatoken'
|
// import { NFTDataToken } from '../../../src/datatokens/NFTDatatoken'
|
||||||
|
import { NFTFactory, NFTCreateData } from '../../src/factories/NFTFactory'
|
||||||
import {
|
import {
|
||||||
NFTFactory,
|
FreCreationParams,
|
||||||
NFTCreateData,
|
Erc20CreateParams,
|
||||||
ErcCreateParams,
|
PoolCreationParams
|
||||||
PoolParams,
|
} from '../../src/interfaces'
|
||||||
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')
|
||||||
|
|
||||||
@ -182,7 +181,7 @@ describe('NFT Factory test', () => {
|
|||||||
baseURI: 'https://oceanprotocol.com/nft/'
|
baseURI: 'https://oceanprotocol.com/nft/'
|
||||||
}
|
}
|
||||||
|
|
||||||
const ercParams: ErcCreateParams = {
|
const ercParams: Erc20CreateParams = {
|
||||||
templateIndex: 1,
|
templateIndex: 1,
|
||||||
minter: contracts.accounts[0],
|
minter: contracts.accounts[0],
|
||||||
feeManager: user3,
|
feeManager: user3,
|
||||||
@ -218,7 +217,7 @@ describe('NFT Factory test', () => {
|
|||||||
baseURI: 'https://oceanprotocol.com/nft/'
|
baseURI: 'https://oceanprotocol.com/nft/'
|
||||||
}
|
}
|
||||||
|
|
||||||
const ercParams: ErcCreateParams = {
|
const ercParams: Erc20CreateParams = {
|
||||||
templateIndex: 1,
|
templateIndex: 1,
|
||||||
minter: user2,
|
minter: user2,
|
||||||
feeManager: user3,
|
feeManager: user3,
|
||||||
@ -230,7 +229,7 @@ describe('NFT Factory test', () => {
|
|||||||
symbol: 'ERC20DT1Symbol'
|
symbol: 'ERC20DT1Symbol'
|
||||||
}
|
}
|
||||||
|
|
||||||
const poolParams: PoolParams = {
|
const poolParams: PoolCreationParams = {
|
||||||
ssContract: contracts.sideStakingAddress,
|
ssContract: contracts.sideStakingAddress,
|
||||||
basetokenAddress: contracts.daiAddress,
|
basetokenAddress: contracts.daiAddress,
|
||||||
basetokenSender: contracts.factory721Address,
|
basetokenSender: contracts.factory721Address,
|
||||||
@ -268,7 +267,7 @@ describe('NFT Factory test', () => {
|
|||||||
baseURI: 'https://oceanprotocol.com/nft/'
|
baseURI: 'https://oceanprotocol.com/nft/'
|
||||||
}
|
}
|
||||||
|
|
||||||
const ercParams: ErcCreateParams = {
|
const ercParams: Erc20CreateParams = {
|
||||||
templateIndex: 1,
|
templateIndex: 1,
|
||||||
minter: contracts.accounts[0],
|
minter: contracts.accounts[0],
|
||||||
feeManager: user3,
|
feeManager: user3,
|
||||||
@ -280,7 +279,7 @@ describe('NFT Factory test', () => {
|
|||||||
symbol: 'ERC20DT1Symbol'
|
symbol: 'ERC20DT1Symbol'
|
||||||
}
|
}
|
||||||
|
|
||||||
const freParams: FixedRateParams = {
|
const freParams: FreCreationParams = {
|
||||||
fixedRateAddress: contracts.fixedRateAddress,
|
fixedRateAddress: contracts.fixedRateAddress,
|
||||||
baseTokenAddress: contracts.daiAddress,
|
baseTokenAddress: contracts.daiAddress,
|
||||||
owner: contracts.accounts[0],
|
owner: contracts.accounts[0],
|
||||||
|
@ -13,14 +13,10 @@ 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 {
|
import { NFTFactory, NFTCreateData } from '../../../src/factories/NFTFactory'
|
||||||
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'
|
import { BigNumber } from 'bignumber.js'
|
||||||
|
import { Erc20CreateParams, PoolCreationParams } from '../../../src/interfaces'
|
||||||
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'
|
||||||
@ -185,7 +181,7 @@ describe('Router unit test', () => {
|
|||||||
baseURI: 'https://oceanprotocol.com/nft/'
|
baseURI: 'https://oceanprotocol.com/nft/'
|
||||||
}
|
}
|
||||||
|
|
||||||
const ercParams: ErcCreateParams = {
|
const ercParams: Erc20CreateParams = {
|
||||||
templateIndex: 1,
|
templateIndex: 1,
|
||||||
minter: contracts.accounts[0],
|
minter: contracts.accounts[0],
|
||||||
feeManager: user3,
|
feeManager: user3,
|
||||||
@ -197,7 +193,7 @@ describe('Router unit test', () => {
|
|||||||
symbol: 'ERC20DT1Symbol'
|
symbol: 'ERC20DT1Symbol'
|
||||||
}
|
}
|
||||||
|
|
||||||
const poolParams: PoolParams = {
|
const poolParams: PoolCreationParams = {
|
||||||
ssContract: contracts.sideStakingAddress,
|
ssContract: contracts.sideStakingAddress,
|
||||||
basetokenAddress: contracts.daiAddress,
|
basetokenAddress: contracts.daiAddress,
|
||||||
basetokenSender: contracts.factory721Address,
|
basetokenSender: contracts.factory721Address,
|
||||||
@ -238,7 +234,7 @@ describe('Router unit test', () => {
|
|||||||
baseURI: 'https://oceanprotocol.com/nft2/'
|
baseURI: 'https://oceanprotocol.com/nft2/'
|
||||||
}
|
}
|
||||||
|
|
||||||
const ercParams2: ErcCreateParams = {
|
const ercParams2: Erc20CreateParams = {
|
||||||
templateIndex: 1,
|
templateIndex: 1,
|
||||||
minter: contracts.accounts[0],
|
minter: contracts.accounts[0],
|
||||||
feeManager: user3,
|
feeManager: user3,
|
||||||
@ -250,7 +246,7 @@ describe('Router unit test', () => {
|
|||||||
symbol: 'ERC20DT1Symbol2'
|
symbol: 'ERC20DT1Symbol2'
|
||||||
}
|
}
|
||||||
|
|
||||||
const poolParams2: PoolParams = {
|
const poolParams2: PoolCreationParams = {
|
||||||
ssContract: contracts.sideStakingAddress,
|
ssContract: contracts.sideStakingAddress,
|
||||||
basetokenAddress: contracts.daiAddress,
|
basetokenAddress: contracts.daiAddress,
|
||||||
basetokenSender: contracts.factory721Address,
|
basetokenSender: contracts.factory721Address,
|
||||||
|
@ -15,13 +15,9 @@ 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 {
|
import { NFTFactory, NFTCreateData } from '../../../../src/factories/NFTFactory'
|
||||||
NFTFactory,
|
|
||||||
NFTCreateData,
|
|
||||||
ErcCreateParams,
|
|
||||||
PoolParams
|
|
||||||
} from '../../../../src/factories/NFTFactory'
|
|
||||||
import { Pool } from '../../../../src/pools/balancer/Pool'
|
import { Pool } from '../../../../src/pools/balancer/Pool'
|
||||||
|
import { PoolCreationParams, Erc20CreateParams } from '../../../../src/interfaces'
|
||||||
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'
|
||||||
@ -141,7 +137,7 @@ describe('Pool unit test', () => {
|
|||||||
baseURI: 'https://oceanprotocol.com/nft/'
|
baseURI: 'https://oceanprotocol.com/nft/'
|
||||||
}
|
}
|
||||||
|
|
||||||
const ercParams: ErcCreateParams = {
|
const ercParams: Erc20CreateParams = {
|
||||||
templateIndex: 1,
|
templateIndex: 1,
|
||||||
minter: contracts.accounts[0],
|
minter: contracts.accounts[0],
|
||||||
feeManager: user3,
|
feeManager: user3,
|
||||||
@ -155,7 +151,7 @@ describe('Pool unit test', () => {
|
|||||||
|
|
||||||
const basetokenInitialLiq = await pool.amountToUnits(contracts.daiAddress, '2000')
|
const basetokenInitialLiq = await pool.amountToUnits(contracts.daiAddress, '2000')
|
||||||
|
|
||||||
const poolParams: PoolParams = {
|
const poolParams: PoolCreationParams = {
|
||||||
ssContract: contracts.sideStakingAddress,
|
ssContract: contracts.sideStakingAddress,
|
||||||
basetokenAddress: contracts.daiAddress,
|
basetokenAddress: contracts.daiAddress,
|
||||||
basetokenSender: contracts.factory721Address,
|
basetokenSender: contracts.factory721Address,
|
||||||
@ -585,7 +581,7 @@ describe('Pool unit test', () => {
|
|||||||
baseURI: 'https://oceanprotocol.com/nft/'
|
baseURI: 'https://oceanprotocol.com/nft/'
|
||||||
}
|
}
|
||||||
|
|
||||||
const ercParams: ErcCreateParams = {
|
const ercParams: Erc20CreateParams = {
|
||||||
templateIndex: 1,
|
templateIndex: 1,
|
||||||
minter: contracts.accounts[0],
|
minter: contracts.accounts[0],
|
||||||
feeManager: user3,
|
feeManager: user3,
|
||||||
@ -597,7 +593,7 @@ describe('Pool unit test', () => {
|
|||||||
symbol: 'ERC20DT1Symbol'
|
symbol: 'ERC20DT1Symbol'
|
||||||
}
|
}
|
||||||
|
|
||||||
const poolParams: PoolParams = {
|
const poolParams: PoolCreationParams = {
|
||||||
ssContract: contracts.sideStakingAddress,
|
ssContract: contracts.sideStakingAddress,
|
||||||
basetokenAddress: contracts.usdcAddress,
|
basetokenAddress: contracts.usdcAddress,
|
||||||
basetokenSender: contracts.factory721Address,
|
basetokenSender: contracts.factory721Address,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user