mirror of
https://github.com/oceanprotocol/ocean-subgraph.git
synced 2024-12-02 05:57:29 +01:00
Adding additional test
This commit is contained in:
parent
dbd4ca3330
commit
8b053a9af2
@ -94,7 +94,7 @@ describe('Fixed Rate Exchange tests', async () => {
|
||||
cap,
|
||||
feeAmount,
|
||||
paymentCollector: ZERO_ADDRESS,
|
||||
feeToken: addresses.MockUSDC.toLowerCase(),
|
||||
feeToken: ZERO_ADDRESS,
|
||||
minter: publisher,
|
||||
mpFeeAddress: marketPlaceFeeAddress
|
||||
}
|
||||
@ -198,6 +198,72 @@ describe('Fixed Rate Exchange tests', async () => {
|
||||
)
|
||||
})
|
||||
|
||||
it('Deploying a Fixed Rate Exchange with USDC as feeToken', async () => {
|
||||
const usdcSwapFee = '1'
|
||||
|
||||
const nftParams: NftCreateData = {
|
||||
name: nftName,
|
||||
symbol: nftSymbol,
|
||||
templateIndex: 1,
|
||||
tokenURI,
|
||||
transferable: true,
|
||||
owner: publisher
|
||||
}
|
||||
const erc20Params: DatatokenCreateParams = {
|
||||
templateIndex,
|
||||
cap,
|
||||
feeAmount,
|
||||
paymentCollector: ZERO_ADDRESS,
|
||||
feeToken: addresses.MockUSDC, // Testing if the decimals are correct when using USDC as the feeToken
|
||||
minter: publisher,
|
||||
mpFeeAddress: marketPlaceFeeAddress
|
||||
}
|
||||
const fixedRateParams: FreCreationParams = {
|
||||
fixedRateAddress,
|
||||
baseTokenAddress,
|
||||
owner: publisher,
|
||||
marketFeeCollector: marketPlaceFeeAddress,
|
||||
baseTokenDecimals: 18,
|
||||
datatokenDecimals: 18,
|
||||
fixedRate: price,
|
||||
marketFee: usdcSwapFee,
|
||||
allowedConsumer: ZERO_ADDRESS,
|
||||
withMint: false
|
||||
}
|
||||
|
||||
const result = await Factory.createNftWithDatatokenWithFixedRate(
|
||||
publisher,
|
||||
nftParams,
|
||||
erc20Params,
|
||||
fixedRateParams
|
||||
)
|
||||
|
||||
const secondDatatokenAddress =
|
||||
result.events.TokenCreated.returnValues[0].toLowerCase()
|
||||
|
||||
const dtQuery = {
|
||||
query: `query {
|
||||
token(id: "${secondDatatokenAddress}"){
|
||||
publishMarketFeeAddress,
|
||||
publishMarketFeeAmount
|
||||
}}`
|
||||
}
|
||||
const dtResponse = await fetch(subgraphUrl, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(dtQuery)
|
||||
})
|
||||
const secondDt = (await dtResponse.json()).data.token
|
||||
|
||||
assert(secondDt, 'No datatoken')
|
||||
console.log('publishMarketFeeAmount', dt.publishMarketFeeAmount)
|
||||
console.log('usdcSwapFee', usdcSwapFee)
|
||||
|
||||
assert(
|
||||
dt.publishMarketFeeAmount === usdcSwapFee,
|
||||
'incorrect value for: publishMarketFeeAmount'
|
||||
)
|
||||
})
|
||||
|
||||
it('Test DT Fields after deploying Fixed rate exchange', async () => {
|
||||
// Check Datatoken Values
|
||||
const dtQuery = {
|
||||
|
Loading…
Reference in New Issue
Block a user