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:
parent
0ecc973e08
commit
08552eb446
@ -25,6 +25,17 @@ describe('Router unit test', () => {
|
|||||||
const FEE = '0.001'
|
const FEE = '0.001'
|
||||||
const FEE_ZERO = '0'
|
const FEE_ZERO = '0'
|
||||||
const DAI_AMOUNT = web3.utils.toWei('2')
|
const DAI_AMOUNT = web3.utils.toWei('2')
|
||||||
|
const CAP_AMOUNT = '1000000'
|
||||||
|
const VESTING_AMOUNT = '10000'
|
||||||
|
const TOKEN_DECIMALS = 18
|
||||||
|
const VESTED_BLOCKS = 2500000
|
||||||
|
const BASE_TOKEN_LIQUIDITY = '2000'
|
||||||
|
const EXCHANGE_IDS = keccak256('0x00')
|
||||||
|
const AMOUNTS_IN = web3.utils.toWei('1')
|
||||||
|
const AMOUNTS_OUT = web3.utils.toWei('0.1')
|
||||||
|
const MAX_PRICE = web3.utils.toWei('10')
|
||||||
|
const SWAP_MARKET_FEE = web3.utils.toWei('0.1')
|
||||||
|
|
||||||
|
|
||||||
const NFT_DATA: NftCreateData = {
|
const NFT_DATA: NftCreateData = {
|
||||||
name: NFT_NAME,
|
name: NFT_NAME,
|
||||||
@ -104,7 +115,7 @@ describe('Router unit test', () => {
|
|||||||
paymentCollector: user2,
|
paymentCollector: user2,
|
||||||
mpFeeAddress: factoryOwner,
|
mpFeeAddress: factoryOwner,
|
||||||
feeToken: ZERO_ADDRESS,
|
feeToken: ZERO_ADDRESS,
|
||||||
cap: '0',
|
cap: CAP_AMOUNT,
|
||||||
feeAmount: FEE_ZERO,
|
feeAmount: FEE_ZERO,
|
||||||
name: ERC20_NAME,
|
name: ERC20_NAME,
|
||||||
symbol: ERC20_SYMBOL
|
symbol: ERC20_SYMBOL
|
||||||
@ -118,10 +129,10 @@ describe('Router unit test', () => {
|
|||||||
marketFeeCollector: factoryOwner,
|
marketFeeCollector: factoryOwner,
|
||||||
poolTemplateAddress: contracts.poolTemplateAddress,
|
poolTemplateAddress: contracts.poolTemplateAddress,
|
||||||
rate: RATE,
|
rate: RATE,
|
||||||
baseTokenDecimals: 18,
|
baseTokenDecimals: TOKEN_DECIMALS,
|
||||||
vestingAmount: '10000',
|
vestingAmount: VESTING_AMOUNT,
|
||||||
vestedBlocks: 2500000,
|
vestedBlocks: VESTED_BLOCKS,
|
||||||
initialBaseTokenLiquidity: '2000',
|
initialBaseTokenLiquidity: BASE_TOKEN_LIQUIDITY,
|
||||||
swapFeeLiquidityProvider: FEE,
|
swapFeeLiquidityProvider: FEE,
|
||||||
swapFeeMarketRunner: FEE
|
swapFeeMarketRunner: FEE
|
||||||
}
|
}
|
||||||
@ -160,28 +171,28 @@ describe('Router unit test', () => {
|
|||||||
// 2 - FixedRateExchange
|
// 2 - FixedRateExchange
|
||||||
// 3 - Dispenser
|
// 3 - Dispenser
|
||||||
const operations1: Operation = {
|
const operations1: Operation = {
|
||||||
exchangeIds: keccak256('0x00'), // used only for FixedRate or Dispenser, but needs to be filled even for pool
|
exchangeIds: EXCHANGE_IDS, // used only for FixedRate or Dispenser, but needs to be filled even for pool
|
||||||
source: pool1, // pool Address
|
source: pool1, // pool Address
|
||||||
operation: 0, // swapExactAmountIn
|
operation: 0, // swapExactAmountIn
|
||||||
tokenIn: contracts.daiAddress,
|
tokenIn: contracts.daiAddress,
|
||||||
amountsIn: web3.utils.toWei('1'), // when swapExactAmountIn is EXACT amount IN
|
amountsIn: AMOUNTS_IN, // when swapExactAmountIn is EXACT amount IN
|
||||||
tokenOut: erc20TokenAddress,
|
tokenOut: erc20TokenAddress,
|
||||||
amountsOut: web3.utils.toWei('0.1'), // when swapExactAmountIn is MIN amount OUT
|
amountsOut: AMOUNTS_OUT, // when swapExactAmountIn is MIN amount OUT
|
||||||
maxPrice: web3.utils.toWei('10'), // max price (only for pools),
|
maxPrice: MAX_PRICE, // max price (only for pools),
|
||||||
swapMarketFee: web3.utils.toWei('0.1'),
|
swapMarketFee: SWAP_MARKET_FEE,
|
||||||
marketFeeAddress: factoryOwner
|
marketFeeAddress: factoryOwner
|
||||||
}
|
}
|
||||||
|
|
||||||
const operations2: Operation = {
|
const operations2: Operation = {
|
||||||
exchangeIds: keccak256('0x00'), // used only for FixedRate or Dispenser, but needs to be filled even for pool
|
exchangeIds: EXCHANGE_IDS, // used only for FixedRate or Dispenser, but needs to be filled even for pool
|
||||||
source: pool2, // pool Address
|
source: pool2, // pool Address
|
||||||
operation: 0, // swapExactAmountIn
|
operation: 0, // swapExactAmountIn
|
||||||
tokenIn: contracts.daiAddress,
|
tokenIn: contracts.daiAddress,
|
||||||
amountsIn: web3.utils.toWei('1'), // when swapExactAmountIn is EXACT amount IN
|
amountsIn: AMOUNTS_IN, // when swapExactAmountIn is EXACT amount IN
|
||||||
tokenOut: erc20Token2Address,
|
tokenOut: erc20Token2Address,
|
||||||
amountsOut: web3.utils.toWei('0.1'), // when swapExactAmountIn is MIN amount OUT
|
amountsOut: AMOUNTS_OUT, // when swapExactAmountIn is MIN amount OUT
|
||||||
maxPrice: web3.utils.toWei('10'), // max price (only for pools)
|
maxPrice: MAX_PRICE, // max price (only for pools),
|
||||||
swapMarketFee: web3.utils.toWei('0.1'),
|
swapMarketFee: SWAP_MARKET_FEE,
|
||||||
marketFeeAddress: factoryOwner
|
marketFeeAddress: factoryOwner
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user