mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
convert freParams to variable
This commit is contained in:
parent
e2df76fb90
commit
7a6e8f42b5
@ -26,6 +26,7 @@ describe('Datatoken', () => {
|
|||||||
let datatokenAddress: string
|
let datatokenAddress: string
|
||||||
let fixedRateAddress: string
|
let fixedRateAddress: string
|
||||||
let exchangeId: string
|
let exchangeId: string
|
||||||
|
let freParams: FreCreationParams
|
||||||
|
|
||||||
const NFT_NAME = 'NFTName'
|
const NFT_NAME = 'NFTName'
|
||||||
const NFT_SYMBOL = 'NFTSymbol'
|
const NFT_SYMBOL = 'NFTSymbol'
|
||||||
@ -47,17 +48,6 @@ describe('Datatoken', () => {
|
|||||||
owner: nftOwner
|
owner: nftOwner
|
||||||
}
|
}
|
||||||
|
|
||||||
const FRE_PARAMS: FreCreationParams = {
|
|
||||||
fixedRateAddress: contracts.fixedRateAddress,
|
|
||||||
baseTokenAddress: contracts.daiAddress,
|
|
||||||
owner: nftOwner,
|
|
||||||
marketFeeCollector: nftOwner,
|
|
||||||
baseTokenDecimals: DECIMALS,
|
|
||||||
datatokenDecimals: DECIMALS,
|
|
||||||
fixedRate: FIXED_RATE,
|
|
||||||
marketFee: FEE_ZERO
|
|
||||||
}
|
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
const accounts = await web3.eth.getAccounts()
|
const accounts = await web3.eth.getAccounts()
|
||||||
nftOwner = accounts[0]
|
nftOwner = accounts[0]
|
||||||
@ -66,8 +56,17 @@ describe('Datatoken', () => {
|
|||||||
user3 = accounts[3]
|
user3 = accounts[3]
|
||||||
|
|
||||||
NFT_DATA.owner = nftOwner
|
NFT_DATA.owner = nftOwner
|
||||||
FRE_PARAMS.owner = nftOwner
|
|
||||||
FRE_PARAMS.marketFeeCollector = nftOwner
|
freParams = {
|
||||||
|
fixedRateAddress: contracts.fixedRateAddress,
|
||||||
|
baseTokenAddress: contracts.daiAddress,
|
||||||
|
owner: nftOwner,
|
||||||
|
marketFeeCollector: nftOwner,
|
||||||
|
baseTokenDecimals: DECIMALS,
|
||||||
|
datatokenDecimals: DECIMALS,
|
||||||
|
fixedRate: FIXED_RATE,
|
||||||
|
marketFee: FEE_ZERO
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should deploy contracts', async () => {
|
it('should deploy contracts', async () => {
|
||||||
@ -140,7 +139,7 @@ describe('Datatoken', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('#createFixedRate - should create FRE for the erc20 dt', async () => {
|
it('#createFixedRate - should create FRE for the erc20 dt', async () => {
|
||||||
const fre = await datatoken.createFixedRate(datatokenAddress, nftOwner, FRE_PARAMS)
|
const fre = await datatoken.createFixedRate(datatokenAddress, nftOwner, 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]
|
||||||
@ -149,7 +148,7 @@ describe('Datatoken', () => {
|
|||||||
it('#createFixedRate - should FAIL create FRE if NOT ERC20Deployer', async () => {
|
it('#createFixedRate - should FAIL create FRE if NOT ERC20Deployer', async () => {
|
||||||
assert((await nftDatatoken.isErc20Deployer(nftAddress, user3)) === false)
|
assert((await nftDatatoken.isErc20Deployer(nftAddress, user3)) === false)
|
||||||
try {
|
try {
|
||||||
await datatoken.createFixedRate(datatokenAddress, user3, FRE_PARAMS)
|
await datatoken.createFixedRate(datatokenAddress, user3, freParams)
|
||||||
assert(false)
|
assert(false)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
assert(e.message === 'User is not ERC20 Deployer')
|
assert(e.message === 'User is not ERC20 Deployer')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user