mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
rename nft and datatoken variables
This commit is contained in:
parent
978fc0bc5d
commit
41c7a34fa5
@ -108,8 +108,8 @@ describe('Marketplace flow tests', async () => {
|
|||||||
let consumerAccount: string
|
let consumerAccount: string
|
||||||
let liquidityAccount: string
|
let liquidityAccount: string
|
||||||
let contracts: Addresses
|
let contracts: Addresses
|
||||||
let erc721Address: string
|
let poolNftAddress: string
|
||||||
let datatokenAddress: string
|
let poolDatatokenAddress: string
|
||||||
let poolAddress: string
|
let poolAddress: string
|
||||||
|
|
||||||
const NFT_SYMBOL = 'DT1'
|
const NFT_SYMBOL = 'DT1'
|
||||||
@ -258,12 +258,12 @@ describe('Marketplace flow tests', async () => {
|
|||||||
poolParams
|
poolParams
|
||||||
)
|
)
|
||||||
|
|
||||||
erc721Address = tx.events.NFTCreated.returnValues[0]
|
poolNftAddress = tx.events.NFTCreated.returnValues[0]
|
||||||
datatokenAddress = tx.events.TokenCreated.returnValues[0]
|
poolDatatokenAddress = tx.events.TokenCreated.returnValues[0]
|
||||||
poolAddress = tx.events.NewPool.returnValues[0]
|
poolAddress = tx.events.NewPool.returnValues[0]
|
||||||
|
|
||||||
console.log(`NFT address: ${erc721Address}`)
|
console.log(`NFT address: ${poolNftAddress}`)
|
||||||
console.log(`Datatoken address: ${datatokenAddress}`)
|
console.log(`Datatoken address: ${poolDatatokenAddress}`)
|
||||||
console.log(`Pool address: ${poolAddress}`)
|
console.log(`Pool address: ${poolAddress}`)
|
||||||
})
|
})
|
||||||
/// ```
|
/// ```
|
||||||
@ -276,12 +276,12 @@ describe('Marketplace flow tests', async () => {
|
|||||||
DDO.chainId = await web3.eth.getChainId()
|
DDO.chainId = await web3.eth.getChainId()
|
||||||
DDO.id =
|
DDO.id =
|
||||||
'did:op:' +
|
'did:op:' +
|
||||||
SHA256(web3.utils.toChecksumAddress(erc721Address) + DDO.chainId.toString(10))
|
SHA256(web3.utils.toChecksumAddress(poolNftAddress) + DDO.chainId.toString(10))
|
||||||
DDO.nftAddress = erc721Address
|
DDO.nftAddress = poolNftAddress
|
||||||
// encrypt file(s) using provider
|
// encrypt file(s) using provider
|
||||||
const encryptedFiles = await ProviderInstance.encrypt(ASSET_URL, providerUrl)
|
const encryptedFiles = await ProviderInstance.encrypt(ASSET_URL, providerUrl)
|
||||||
DDO.services[0].files = await encryptedFiles
|
DDO.services[0].files = await encryptedFiles
|
||||||
DDO.services[0].datatokenAddress = datatokenAddress
|
DDO.services[0].datatokenAddress = poolDatatokenAddress
|
||||||
|
|
||||||
console.log(`DID: ${DDO.id}`)
|
console.log(`DID: ${DDO.id}`)
|
||||||
|
|
||||||
@ -289,7 +289,7 @@ describe('Marketplace flow tests', async () => {
|
|||||||
const encryptedDDO = await providerResponse
|
const encryptedDDO = await providerResponse
|
||||||
const metadataHash = getHash(JSON.stringify(DDO))
|
const metadataHash = getHash(JSON.stringify(DDO))
|
||||||
await nft.setMetadata(
|
await nft.setMetadata(
|
||||||
erc721Address,
|
poolNftAddress,
|
||||||
publisherAccount,
|
publisherAccount,
|
||||||
0,
|
0,
|
||||||
providerUrl,
|
providerUrl,
|
||||||
@ -316,7 +316,7 @@ describe('Marketplace flow tests', async () => {
|
|||||||
const pool = new Pool(web3)
|
const pool = new Pool(web3)
|
||||||
const prices = await pool.getAmountInExactOut(
|
const prices = await pool.getAmountInExactOut(
|
||||||
poolAddress,
|
poolAddress,
|
||||||
datatokenAddress,
|
poolDatatokenAddress,
|
||||||
contracts.oceanAddress,
|
contracts.oceanAddress,
|
||||||
'1',
|
'1',
|
||||||
'0.01'
|
'0.01'
|
||||||
@ -337,7 +337,7 @@ describe('Marketplace flow tests', async () => {
|
|||||||
consumerAccount
|
consumerAccount
|
||||||
)
|
)
|
||||||
console.log(`Consumer OCEAN balance before swap: ${consumerOCEANBalance}`)
|
console.log(`Consumer OCEAN balance before swap: ${consumerOCEANBalance}`)
|
||||||
let consumerDTBalance = await balance(web3, datatokenAddress, consumerAccount)
|
let consumerDTBalance = await balance(web3, poolDatatokenAddress, consumerAccount)
|
||||||
console.log(`Consumer ${NFT_SYMBOL} balance before swap: ${consumerDTBalance}`)
|
console.log(`Consumer ${NFT_SYMBOL} balance before swap: ${consumerDTBalance}`)
|
||||||
|
|
||||||
await approve(web3, consumerAccount, contracts.oceanAddress, poolAddress, '100')
|
await approve(web3, consumerAccount, contracts.oceanAddress, poolAddress, '100')
|
||||||
@ -345,7 +345,7 @@ describe('Marketplace flow tests', async () => {
|
|||||||
const pool = new Pool(web3)
|
const pool = new Pool(web3)
|
||||||
const tokenInOutMarket: TokenInOutMarket = {
|
const tokenInOutMarket: TokenInOutMarket = {
|
||||||
tokenIn: contracts.oceanAddress,
|
tokenIn: contracts.oceanAddress,
|
||||||
tokenOut: datatokenAddress,
|
tokenOut: poolDatatokenAddress,
|
||||||
marketFeeAddress: consumerAccount
|
marketFeeAddress: consumerAccount
|
||||||
}
|
}
|
||||||
const amountsInOutMaxFee: AmountsOutMaxFee = {
|
const amountsInOutMaxFee: AmountsOutMaxFee = {
|
||||||
@ -362,7 +362,7 @@ describe('Marketplace flow tests', async () => {
|
|||||||
|
|
||||||
consumerOCEANBalance = await balance(web3, contracts.oceanAddress, consumerAccount)
|
consumerOCEANBalance = await balance(web3, contracts.oceanAddress, consumerAccount)
|
||||||
console.log(`Consumer OCEAN balance after swap: ${consumerOCEANBalance}`)
|
console.log(`Consumer OCEAN balance after swap: ${consumerOCEANBalance}`)
|
||||||
consumerDTBalance = await balance(web3, datatokenAddress, consumerAccount)
|
consumerDTBalance = await balance(web3, poolDatatokenAddress, consumerAccount)
|
||||||
console.log(`Consumer ${NFT_SYMBOL} balance after swap: ${consumerDTBalance}`)
|
console.log(`Consumer ${NFT_SYMBOL} balance after swap: ${consumerDTBalance}`)
|
||||||
|
|
||||||
const resolvedDDO = await aquarius.waitForAqua(DDO.id)
|
const resolvedDDO = await aquarius.waitForAqua(DDO.id)
|
||||||
@ -389,7 +389,7 @@ describe('Marketplace flow tests', async () => {
|
|||||||
}
|
}
|
||||||
// make the payment
|
// make the payment
|
||||||
const txid = await datatoken.startOrder(
|
const txid = await datatoken.startOrder(
|
||||||
datatokenAddress,
|
poolDatatokenAddress,
|
||||||
consumerAccount,
|
consumerAccount,
|
||||||
consumerAccount,
|
consumerAccount,
|
||||||
0,
|
0,
|
||||||
@ -410,7 +410,7 @@ describe('Marketplace flow tests', async () => {
|
|||||||
|
|
||||||
consumerOCEANBalance = await balance(web3, contracts.oceanAddress, consumerAccount)
|
consumerOCEANBalance = await balance(web3, contracts.oceanAddress, consumerAccount)
|
||||||
console.log(`Consumer OCEAN balance after order: ${consumerOCEANBalance}`)
|
console.log(`Consumer OCEAN balance after order: ${consumerOCEANBalance}`)
|
||||||
consumerDTBalance = await balance(web3, datatokenAddress, consumerAccount)
|
consumerDTBalance = await balance(web3, poolDatatokenAddress, consumerAccount)
|
||||||
console.log(`Consumer ${NFT_SYMBOL} balance after order: ${consumerDTBalance}`)
|
console.log(`Consumer ${NFT_SYMBOL} balance after order: ${consumerDTBalance}`)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -420,5 +420,5 @@ describe('Marketplace flow tests', async () => {
|
|||||||
assert.fail('Download failed')
|
assert.fail('Download failed')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
|
||||||
/// ```
|
/// ```
|
||||||
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user