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

rename erc20 to datatoken in Router test

This commit is contained in:
Miquel A. Cabot 2022-06-10 11:13:52 +02:00
parent a1bb98bbfb
commit 3b3cd6e2e7

View File

@ -25,8 +25,8 @@ describe('Router unit test', () => {
const NFT_NAME = '72120Bundle' const NFT_NAME = '72120Bundle'
const NFT_SYMBOL = '72Bundle' const NFT_SYMBOL = '72Bundle'
const NFT_TOKEN_URI = 'https://oceanprotocol.com/nft/' const NFT_TOKEN_URI = 'https://oceanprotocol.com/nft/'
const ERC20_NAME = 'ERC20B1' const DATATOKEN_NAME = 'ERC20B1'
const ERC20_SYMBOL = 'ERC20DT1Symbol' const DATATOKEN_SYMBOL = 'ERC20DT1Symbol'
const RATE = '1' const RATE = '1'
const FEE = '0.001' const FEE = '0.001'
const FEE_ZERO = '0' const FEE_ZERO = '0'
@ -59,8 +59,8 @@ describe('Router unit test', () => {
feeToken: ZERO_ADDRESS, feeToken: ZERO_ADDRESS,
cap: CAP_AMOUNT, cap: CAP_AMOUNT,
feeAmount: FEE_ZERO, feeAmount: FEE_ZERO,
name: ERC20_NAME, name: DATATOKEN_NAME,
symbol: ERC20_SYMBOL symbol: DATATOKEN_SYMBOL
} }
before(async () => { before(async () => {
@ -159,7 +159,7 @@ describe('Router unit test', () => {
poolParams poolParams
) )
const erc20TokenAddress = txReceipt.events.TokenCreated.returnValues.newTokenAddress const datatokenAddress = txReceipt.events.TokenCreated.returnValues.newTokenAddress
const pool1 = txReceipt.events.NewPool.returnValues.poolAddress const pool1 = txReceipt.events.NewPool.returnValues.poolAddress
// CREATE A SECOND POOL // CREATE A SECOND POOL
@ -170,13 +170,13 @@ describe('Router unit test', () => {
poolParams poolParams
) )
const erc20Token2Address = txReceipt2.events.TokenCreated.returnValues.newTokenAddress const datatoken2Address = txReceipt2.events.TokenCreated.returnValues.newTokenAddress
const pool2 = txReceipt2.events.NewPool.returnValues.poolAddress const pool2 = txReceipt2.events.NewPool.returnValues.poolAddress
// user1 has no dt1 // user1 has no dt1
expect(await balance(web3, erc20TokenAddress, user1)).to.equal('0') expect(await balance(web3, datatokenAddress, user1)).to.equal('0')
// user1 has no dt2 // user1 has no dt2
expect(await balance(web3, erc20Token2Address, user1)).to.equal('0') expect(await balance(web3, datatoken2Address, user1)).to.equal('0')
// we now can prepare the Operations objects // we now can prepare the Operations objects
@ -190,7 +190,7 @@ describe('Router unit test', () => {
operation: 0, // swapExactAmountIn operation: 0, // swapExactAmountIn
tokenIn: contracts.daiAddress, tokenIn: contracts.daiAddress,
amountsIn: AMOUNTS_IN, // when swapExactAmountIn is EXACT amount IN amountsIn: AMOUNTS_IN, // when swapExactAmountIn is EXACT amount IN
tokenOut: erc20TokenAddress, tokenOut: datatokenAddress,
amountsOut: AMOUNTS_OUT, // when swapExactAmountIn is MIN amount OUT amountsOut: AMOUNTS_OUT, // when swapExactAmountIn is MIN amount OUT
maxPrice: MAX_PRICE, // max price (only for pools), maxPrice: MAX_PRICE, // max price (only for pools),
swapMarketFee: SWAP_MARKET_FEE, swapMarketFee: SWAP_MARKET_FEE,
@ -203,7 +203,7 @@ describe('Router unit test', () => {
operation: 0, // swapExactAmountIn operation: 0, // swapExactAmountIn
tokenIn: contracts.daiAddress, tokenIn: contracts.daiAddress,
amountsIn: AMOUNTS_IN, // when swapExactAmountIn is EXACT amount IN amountsIn: AMOUNTS_IN, // when swapExactAmountIn is EXACT amount IN
tokenOut: erc20Token2Address, tokenOut: datatoken2Address,
amountsOut: AMOUNTS_OUT, // when swapExactAmountIn is MIN amount OUT amountsOut: AMOUNTS_OUT, // when swapExactAmountIn is MIN amount OUT
maxPrice: MAX_PRICE, // max price (only for pools), maxPrice: MAX_PRICE, // max price (only for pools),
swapMarketFee: SWAP_MARKET_FEE, swapMarketFee: SWAP_MARKET_FEE,
@ -213,7 +213,7 @@ describe('Router unit test', () => {
await router.buyDTBatch(user1, [operations1, operations2]) await router.buyDTBatch(user1, [operations1, operations2])
// user1 got his dts // user1 got his dts
expect(+(await balance(web3, erc20TokenAddress, user1))).gt(0) expect(+(await balance(web3, datatokenAddress, user1))).gt(0)
expect(+(await balance(web3, erc20Token2Address, user1))).gt(0) expect(+(await balance(web3, datatoken2Address, user1))).gt(0)
}) })
}) })