mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
rename from erc20 to nft in comments
This commit is contained in:
parent
3b3cd6e2e7
commit
29c581fde2
@ -15,7 +15,7 @@ export class Nft extends SmartContract {
|
|||||||
* Estimate gas cost for createDatatoken token creation
|
* Estimate gas cost for createDatatoken token creation
|
||||||
* @param {String} nftAddress NFT address
|
* @param {String} nftAddress NFT address
|
||||||
* @param {String} address User address
|
* @param {String} address User address
|
||||||
* @param {String} minter User set as initial minter for the ERC20
|
* @param {String} minter User set as initial minter for the Datatoken
|
||||||
* @param {String} paymentCollector initial paymentCollector for this DT
|
* @param {String} paymentCollector initial paymentCollector for this DT
|
||||||
* @param {String} mpFeeAddress Consume marketplace fee address
|
* @param {String} mpFeeAddress Consume marketplace fee address
|
||||||
* @param {String} feeToken address of the token marketplace wants to add fee on top
|
* @param {String} feeToken address of the token marketplace wants to add fee on top
|
||||||
@ -54,10 +54,10 @@ export class Nft extends SmartContract {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create new ERC20 datatoken - only user with DatatokenDeployer permission can succeed
|
* Create new ERC20 Datatoken - only user with DatatokenDeployer permission can succeed
|
||||||
* @param {String} nftAddress NFT address
|
* @param {String} nftAddress NFT address
|
||||||
* @param {String} address User address
|
* @param {String} address User address
|
||||||
* @param {String} minter User set as initial minter for the ERC20
|
* @param {String} minter User set as initial minter for the Datatoken
|
||||||
* @param {String} paymentCollector initial paymentCollector for this DT
|
* @param {String} paymentCollector initial paymentCollector for this DT
|
||||||
* @param {String} mpFeeAddress Consume marketplace fee address
|
* @param {String} mpFeeAddress Consume marketplace fee address
|
||||||
* @param {String} feeToken address of the token marketplace wants to add fee on top
|
* @param {String} feeToken address of the token marketplace wants to add fee on top
|
||||||
@ -66,7 +66,7 @@ export class Nft extends SmartContract {
|
|||||||
* @param {String} name Token name
|
* @param {String} name Token name
|
||||||
* @param {String} symbol Token symbol
|
* @param {String} symbol Token symbol
|
||||||
* @param {Number} templateIndex NFT template index
|
* @param {Number} templateIndex NFT template index
|
||||||
* @return {Promise<string>} ERC20 datatoken address
|
* @return {Promise<string>} ERC20 Datatoken address
|
||||||
*/
|
*/
|
||||||
public async createDatatoken(
|
public async createDatatoken(
|
||||||
nftAddress: string,
|
nftAddress: string,
|
||||||
@ -587,7 +587,7 @@ export class Nft extends SmartContract {
|
|||||||
/**
|
/**
|
||||||
* This function allows to remove all ROLES at NFT level: Managers, DatatokenDeployer, MetadataUpdater, StoreUpdater
|
* This function allows to remove all ROLES at NFT level: Managers, DatatokenDeployer, MetadataUpdater, StoreUpdater
|
||||||
* Even NFT Owner has to readd himself as Manager
|
* Even NFT Owner has to readd himself as Manager
|
||||||
* Permissions at erc20 level stay.
|
* Permissions at Datatoken level stay.
|
||||||
* Only NFT Owner can call it.
|
* Only NFT Owner can call it.
|
||||||
* @param {String} nftAddress NFT contract address
|
* @param {String} nftAddress NFT contract address
|
||||||
* @param {String} address NFT Owner adress
|
* @param {String} address NFT Owner adress
|
||||||
@ -645,7 +645,7 @@ export class Nft extends SmartContract {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Transfers the NFT
|
* Transfers the NFT
|
||||||
* will clean all permissions both on NFT and erc20 level.
|
* will clean all permissions both on NFT and Datatoken level.
|
||||||
* @param {String} nftAddress NFT contract address
|
* @param {String} nftAddress NFT contract address
|
||||||
* @param {String} nftOwner Current NFT Owner adress
|
* @param {String} nftOwner Current NFT Owner adress
|
||||||
* @param {String} nftReceiver User which will receive the NFT, will also be set as Manager
|
* @param {String} nftReceiver User which will receive the NFT, will also be set as Manager
|
||||||
@ -715,7 +715,7 @@ export class Nft extends SmartContract {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* safeTransferNFT Used for transferring the NFT, can be used by an approved relayer
|
* safeTransferNFT Used for transferring the NFT, can be used by an approved relayer
|
||||||
* will clean all permissions both on NFT and erc20 level.
|
* will clean all permissions both on NFT and Datatoken level.
|
||||||
* @param {String} nftAddress NFT contract address
|
* @param {String} nftAddress NFT contract address
|
||||||
* @param {String} nftOwner Current NFT Owner adress
|
* @param {String} nftOwner Current NFT Owner adress
|
||||||
* @param {String} nftReceiver User which will receive the NFT, will also be set as Manager
|
* @param {String} nftReceiver User which will receive the NFT, will also be set as Manager
|
||||||
@ -796,7 +796,7 @@ export class Nft extends SmartContract {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* safeTransferNFT Used for transferring the NFT, can be used by an approved relayer
|
* safeTransferNFT Used for transferring the NFT, can be used by an approved relayer
|
||||||
* will clean all permissions both on NFT and erc20 level.
|
* will clean all permissions both on NFT and Datatoken level.
|
||||||
* @param {String} nftAddress NFT contract address
|
* @param {String} nftAddress NFT contract address
|
||||||
* @param {String} address Caller address NFT Owner adress
|
* @param {String} address Caller address NFT Owner adress
|
||||||
* @return {Promise<TransactionReceipt>} trxReceipt
|
* @return {Promise<TransactionReceipt>} trxReceipt
|
||||||
|
@ -39,7 +39,7 @@ export async function estApprove(
|
|||||||
* @param {String} account
|
* @param {String} account
|
||||||
* @param {String} tokenAddress
|
* @param {String} tokenAddress
|
||||||
* @param {String} spender
|
* @param {String} spender
|
||||||
* @param {String} amount amount of ERC20 tokens (always expressed as wei)
|
* @param {String} amount amount of ERC20 Datatokens (always expressed as wei)
|
||||||
* @param {boolean} force if true, will overwrite any previous allowence. Else, will check if allowence is enough and will not send a transaction if it's not needed
|
* @param {boolean} force if true, will overwrite any previous allowence. Else, will check if allowence is enough and will not send a transaction if it's not needed
|
||||||
* @param {number} tokenDecimals optional number of decimals of the token
|
* @param {number} tokenDecimals optional number of decimals of the token
|
||||||
*/
|
*/
|
||||||
@ -110,7 +110,7 @@ export async function estTransfer(
|
|||||||
* @param {String} account
|
* @param {String} account
|
||||||
* @param {String} tokenAddress
|
* @param {String} tokenAddress
|
||||||
* @param {String} recipient
|
* @param {String} recipient
|
||||||
* @param {String} amount amount of ERC20 tokens (not as wei)
|
* @param {String} amount amount of ERC20 Datatokens (not as wei)
|
||||||
* @param {String} force if true, will overwrite any previous allowence. Else, will check if allowence is enough and will not send a transaction if it's not needed
|
* @param {String} force if true, will overwrite any previous allowence. Else, will check if allowence is enough and will not send a transaction if it's not needed
|
||||||
*/
|
*/
|
||||||
export async function transfer(
|
export async function transfer(
|
||||||
@ -144,7 +144,7 @@ export async function transfer(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Allowance for any erc20
|
* Get Allowance for any Datatoken
|
||||||
* @param {Web3} web3
|
* @param {Web3} web3
|
||||||
* @param {String } tokenAdress
|
* @param {String } tokenAdress
|
||||||
* @param {String} account
|
* @param {String} account
|
||||||
@ -165,7 +165,7 @@ export async function allowance(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get balance for any erc20
|
* Get balance for any Datatoken
|
||||||
* @param {Web3} web3
|
* @param {Web3} web3
|
||||||
* @param {String} tokenAdress
|
* @param {String} tokenAdress
|
||||||
* @param {String} owner
|
* @param {String} owner
|
||||||
@ -185,7 +185,7 @@ export async function balance(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get decimals for any erc20
|
* Get decimals for any Datatoken
|
||||||
* @param {Web3} web3
|
* @param {Web3} web3
|
||||||
* @param {String} tokenAdress
|
* @param {String} tokenAdress
|
||||||
* @return {Promise<number>} Number of decimals of the token
|
* @return {Promise<number>} Number of decimals of the token
|
||||||
|
@ -87,7 +87,7 @@ export const deployContracts = async (web3: Web3, owner: string): Promise<Addres
|
|||||||
owner
|
owner
|
||||||
))
|
))
|
||||||
|
|
||||||
// deploy ERC20 template
|
// deploy Datatoken template
|
||||||
addresses.erc20TemplateAddress =
|
addresses.erc20TemplateAddress =
|
||||||
configAddresses.ERC20Template['1'] ||
|
configAddresses.ERC20Template['1'] ||
|
||||||
(await estimateGasAndDeployContract(
|
(await estimateGasAndDeployContract(
|
||||||
|
@ -278,7 +278,7 @@ describe('Marketplace flow tests', async () => {
|
|||||||
swapFeeMarketRunner: '0.001'
|
swapFeeMarketRunner: '0.001'
|
||||||
}
|
}
|
||||||
/// ```
|
/// ```
|
||||||
/// Before we call the contract we have to call `approve` so that the contract can move our tokens. This is standard when using any ERC20 tokens
|
/// Before we call the contract we have to call `approve` so that the contract can move our tokens. This is standard when using any ERC20 Datatokens
|
||||||
/// ```Typescript
|
/// ```Typescript
|
||||||
await approve(
|
await approve(
|
||||||
web3,
|
web3,
|
||||||
@ -353,7 +353,7 @@ describe('Marketplace flow tests', async () => {
|
|||||||
const pool = new Pool(web3)
|
const pool = new Pool(web3)
|
||||||
|
|
||||||
/// ```
|
/// ```
|
||||||
/// Before we call the contract we have to call `approve` so that the contract can move our tokens. This is standard when using any ERC20 tokens
|
/// Before we call the contract we have to call `approve` so that the contract can move our tokens. This is standard when using any ERC20 Datatokens
|
||||||
/// ```Typescript
|
/// ```Typescript
|
||||||
await approve(web3, stakerAccount, addresses.Ocean, poolAddress, '5', true)
|
await approve(web3, stakerAccount, addresses.Ocean, poolAddress, '5', true)
|
||||||
|
|
||||||
@ -402,7 +402,7 @@ describe('Marketplace flow tests', async () => {
|
|||||||
console.log(`Consumer ${POOL_NFT_SYMBOL} balance before swap: ${consumerDTBalance}`)
|
console.log(`Consumer ${POOL_NFT_SYMBOL} balance before swap: ${consumerDTBalance}`)
|
||||||
|
|
||||||
/// ```
|
/// ```
|
||||||
/// Before we call the contract we have to call `approve` so that the contract can move our tokens. This is standard when using any ERC20 tokens
|
/// Before we call the contract we have to call `approve` so that the contract can move our tokens. This is standard when using any ERC20 Datatokens
|
||||||
/// ```Typescript
|
/// ```Typescript
|
||||||
await approve(web3, consumerAccount, addresses.Ocean, poolAddress, '100')
|
await approve(web3, consumerAccount, addresses.Ocean, poolAddress, '100')
|
||||||
|
|
||||||
@ -644,7 +644,7 @@ describe('Marketplace flow tests', async () => {
|
|||||||
console.log(`Consumer ${FRE_NFT_SYMBOL} balance before swap: ${consumerDTBalance}`)
|
console.log(`Consumer ${FRE_NFT_SYMBOL} balance before swap: ${consumerDTBalance}`)
|
||||||
|
|
||||||
/// ```
|
/// ```
|
||||||
/// Before we call the contract we have to call `approve` so that the contract can move our tokens. This is standard when using any ERC20 tokens
|
/// Before we call the contract we have to call `approve` so that the contract can move our tokens. This is standard when using any ERC20 Datatokens
|
||||||
/// ```Typescript
|
/// ```Typescript
|
||||||
await approve(web3, consumerAccount, addresses.Ocean, freAddress, '100')
|
await approve(web3, consumerAccount, addresses.Ocean, freAddress, '100')
|
||||||
await approve(
|
await approve(
|
||||||
|
@ -95,7 +95,7 @@ describe('Publish tests', async () => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should publish a dataset with pool (create NFT + ERC20 + pool) and with Metdata proof', async () => {
|
it('should publish a dataset with pool (create NFT + Datatoken + pool) and with Metdata proof', async () => {
|
||||||
const poolDdo: DDO = { ...genericAsset }
|
const poolDdo: DDO = { ...genericAsset }
|
||||||
|
|
||||||
const nftParams: NftCreateData = {
|
const nftParams: NftCreateData = {
|
||||||
@ -179,7 +179,7 @@ describe('Publish tests', async () => {
|
|||||||
assert(resolvedDDO, 'Cannot fetch DDO from Aquarius')
|
assert(resolvedDDO, 'Cannot fetch DDO from Aquarius')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should publish a dataset with fixed price (create NFT + ERC20 + fixed price) with an explicit empty Metadata Proof', async () => {
|
it('should publish a dataset with fixed price (create NFT + Datoken + fixed price) with an explicit empty Metadata Proof', async () => {
|
||||||
const fixedPriceDdo: DDO = { ...genericAsset }
|
const fixedPriceDdo: DDO = { ...genericAsset }
|
||||||
|
|
||||||
const nftParams: NftCreateData = {
|
const nftParams: NftCreateData = {
|
||||||
@ -258,7 +258,7 @@ describe('Publish tests', async () => {
|
|||||||
assert(resolvedDDO, 'Cannot fetch DDO from Aquarius')
|
assert(resolvedDDO, 'Cannot fetch DDO from Aquarius')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should publish a dataset with dispenser (create NFT + ERC20 + dispenser) with no defined MetadataProof', async () => {
|
it('should publish a dataset with dispenser (create NFT + Datatoken + dispenser) with no defined MetadataProof', async () => {
|
||||||
const dispenserDdo: DDO = { ...genericAsset }
|
const dispenserDdo: DDO = { ...genericAsset }
|
||||||
|
|
||||||
const nftParams: NftCreateData = {
|
const nftParams: NftCreateData = {
|
||||||
|
@ -72,7 +72,7 @@ describe('Simple Publish & consume test', async () => {
|
|||||||
consumerAccount = accounts[1]
|
consumerAccount = accounts[1]
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should publish a dataset (create NFT + ERC20)', async () => {
|
it('should publish a dataset (create NFT + Datatoken)', async () => {
|
||||||
const nft = new Nft(web3)
|
const nft = new Nft(web3)
|
||||||
const datatoken = new Datatoken(web3)
|
const datatoken = new Datatoken(web3)
|
||||||
const Factory = new NftFactory(addresses.ERC721Factory, web3)
|
const Factory = new NftFactory(addresses.ERC721Factory, web3)
|
||||||
@ -131,7 +131,7 @@ describe('Simple Publish & consume test', async () => {
|
|||||||
const resolvedDDO = await aquarius.waitForAqua(ddo.id)
|
const resolvedDDO = await aquarius.waitForAqua(ddo.id)
|
||||||
assert(resolvedDDO, 'Cannot fetch DDO from Aquarius')
|
assert(resolvedDDO, 'Cannot fetch DDO from Aquarius')
|
||||||
|
|
||||||
// mint 1 ERC20 and send it to the consumer
|
// mint 1 Datatoken and send it to the consumer
|
||||||
await datatoken.mint(datatokenAddress, publisherAccount, '1', consumerAccount)
|
await datatoken.mint(datatokenAddress, publisherAccount, '1', consumerAccount)
|
||||||
|
|
||||||
// initialize provider
|
// initialize provider
|
||||||
|
@ -359,7 +359,7 @@ describe('Nft Factory test', () => {
|
|||||||
assert(nftTemplate.isActive === true)
|
assert(nftTemplate.isActive === true)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('#addTokenTemplate - should add a new erc20 token template', async () => {
|
it('#addTokenTemplate - should add a new Datatokent template', async () => {
|
||||||
const currentTokenTemplateCount = await nftFactory.getCurrentTokenTemplateCount()
|
const currentTokenTemplateCount = await nftFactory.getCurrentTokenTemplateCount()
|
||||||
|
|
||||||
await nftFactory.addTokenTemplate(factoryOwner, contracts.erc20TemplateAddress)
|
await nftFactory.addTokenTemplate(factoryOwner, contracts.erc20TemplateAddress)
|
||||||
@ -369,7 +369,7 @@ describe('Nft Factory test', () => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('#disableTokenTemplate - should disable an erc20 token template', async () => {
|
it('#disableTokenTemplate - should disable an Datatoken template', async () => {
|
||||||
const currentTokenTemplateCount = await nftFactory.getCurrentTokenTemplateCount()
|
const currentTokenTemplateCount = await nftFactory.getCurrentTokenTemplateCount()
|
||||||
|
|
||||||
let tokenTemplate = await nftFactory.getTokenTemplate(currentTokenTemplateCount)
|
let tokenTemplate = await nftFactory.getTokenTemplate(currentTokenTemplateCount)
|
||||||
@ -381,7 +381,7 @@ describe('Nft Factory test', () => {
|
|||||||
assert(tokenTemplate.isActive === false)
|
assert(tokenTemplate.isActive === false)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('#reactivateTokenTemplate - should reactivate an previously disabled erc20 token template', async () => {
|
it('#reactivateTokenTemplate - should reactivate an previously disabled Datatoken template', async () => {
|
||||||
const currentTokenTemplateCount = await nftFactory.getCurrentTokenTemplateCount()
|
const currentTokenTemplateCount = await nftFactory.getCurrentTokenTemplateCount()
|
||||||
|
|
||||||
let tokenTemplate = await nftFactory.getTokenTemplate(currentTokenTemplateCount)
|
let tokenTemplate = await nftFactory.getTokenTemplate(currentTokenTemplateCount)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user