diff --git a/test/unit/pools/fixedRate/FixedRateExchange.test.ts b/test/unit/pools/fixedRate/FixedRateExchange.test.ts index c9333dbe..a0446e73 100644 --- a/test/unit/pools/fixedRate/FixedRateExchange.test.ts +++ b/test/unit/pools/fixedRate/FixedRateExchange.test.ts @@ -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 )