1
0
mirror of https://github.com/oceanprotocol/ocean.js.git synced 2024-11-26 20:39:05 +01:00

refactor constants

This commit is contained in:
Miquel A. Cabot 2022-04-06 18:40:27 +02:00
parent a0a5230794
commit 3660f5c913

View File

@ -26,6 +26,25 @@ describe('Fixed Rate unit test', () => {
let dtContract: Contract
let daiContract: Contract
let usdcContract: Contract
let ercParams: Erc20CreateParams
const CAP_AMOUNT = '1000000'
const NFT_NAME = '72120Bundle'
const NFT_SYMBOL = '72Bundle'
const NFT_TOKEN_URI = 'https://oceanprotocol.com/nft/'
const ERC20_NAME = 'ERC20B1'
const ERC20_SYMBOL = 'ERC20DT1Symbol'
const FEE = '0.001'
const FEE_ZERO = '0'
const NFT_DATA: NftCreateData = {
name: NFT_NAME,
symbol: NFT_SYMBOL,
templateIndex: 1,
tokenURI: NFT_TOKEN_URI,
transferable: true,
owner: factoryOwner
}
before(async () => {
const accounts = await web3.eth.getAccounts()
@ -33,6 +52,20 @@ describe('Fixed Rate unit test', () => {
user1 = accounts[1]
user2 = accounts[2]
exchangeOwner = accounts[0]
NFT_DATA.owner = factoryOwner
ercParams = {
templateIndex: 1,
minter: factoryOwner,
paymentCollector: user2,
mpFeeAddress: factoryOwner,
feeToken: ZERO_ADDRESS,
cap: CAP_AMOUNT,
feeAmount: FEE_ZERO,
name: ERC20_NAME,
symbol: ERC20_SYMBOL
}
})
it('should deploy contracts', async () => {
@ -56,27 +89,6 @@ describe('Fixed Rate unit test', () => {
const nftFactory = new NftFactory(contracts.erc721FactoryAddress, web3)
const nftData: NftCreateData = {
name: '72120Bundle',
symbol: '72Bundle',
templateIndex: 1,
tokenURI: 'https://oceanprotocol.com/nft/',
transferable: true,
owner: factoryOwner
}
const ercParams: Erc20CreateParams = {
templateIndex: 1,
minter: factoryOwner,
paymentCollector: user2,
mpFeeAddress: factoryOwner,
feeToken: ZERO_ADDRESS,
cap: '1000000',
feeAmount: '0',
name: 'ERC20B1',
symbol: 'ERC20DT1Symbol'
}
const freParams: FreCreationParams = {
fixedRateAddress: contracts.fixedRateAddress,
baseTokenAddress: contracts.daiAddress,
@ -85,14 +97,14 @@ describe('Fixed Rate unit test', () => {
baseTokenDecimals: 18,
datatokenDecimals: 18,
fixedRate: '1',
marketFee: '0.001',
marketFee: FEE,
allowedConsumer: ZERO_ADDRESS,
withMint: false
}
const txReceipt = await nftFactory.createNftErc20WithFixedRate(
exchangeOwner,
nftData,
NFT_DATA,
ercParams,
freParams
)
@ -384,27 +396,6 @@ describe('Fixed Rate unit test', () => {
const nftFactory = new NftFactory(contracts.erc721FactoryAddress, web3)
const nftData: NftCreateData = {
name: '72120Bundle',
symbol: '72Bundle',
templateIndex: 1,
tokenURI: 'https://oceanprotocol.com/nft/',
transferable: true,
owner: factoryOwner
}
const ercParams: Erc20CreateParams = {
templateIndex: 1,
minter: factoryOwner,
paymentCollector: user2,
mpFeeAddress: factoryOwner,
feeToken: ZERO_ADDRESS,
cap: '1000000',
feeAmount: '0',
name: 'ERC20B1',
symbol: 'ERC20DT1Symbol'
}
const freParams: FreCreationParams = {
fixedRateAddress: contracts.fixedRateAddress,
baseTokenAddress: contracts.usdcAddress,
@ -420,7 +411,7 @@ describe('Fixed Rate unit test', () => {
const txReceipt = await nftFactory.createNftErc20WithFixedRate(
exchangeOwner,
nftData,
NFT_DATA,
ercParams,
freParams
)