mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
rename ERC20Deployer to DatatokenDeployer
This commit is contained in:
parent
01859a52f8
commit
eedb1b4232
@ -192,7 +192,7 @@ export class Datatoken extends SmartContract {
|
||||
|
||||
const withMint = fixedRateParams.withMint ? 1 : 0
|
||||
|
||||
// should check ERC20Deployer role using NFT level ..
|
||||
// should check DatatokenDeployer role using NFT level ..
|
||||
|
||||
const estGas = await estimateGas(
|
||||
address,
|
||||
@ -296,7 +296,7 @@ export class Datatoken extends SmartContract {
|
||||
|
||||
if (!dispenserParams.withMint) dispenserParams.withMint = false
|
||||
|
||||
// should check ERC20Deployer role using NFT level ..
|
||||
// should check DatatokenDeployer role using NFT level ..
|
||||
|
||||
const estGas = await estimateGas(
|
||||
address,
|
||||
@ -389,7 +389,7 @@ export class Datatoken extends SmartContract {
|
||||
|
||||
/**
|
||||
* Add Minter for an ERC20 datatoken
|
||||
* only ERC20Deployer can succeed
|
||||
* only DatatokenDeployer can succeed
|
||||
* @param {String} dtAddress Datatoken address
|
||||
* @param {String} address User address
|
||||
* @param {String} minter User which is going to be a Minter
|
||||
@ -403,7 +403,7 @@ export class Datatoken extends SmartContract {
|
||||
const dtContract = this.getContract(dtAddress)
|
||||
|
||||
if ((await this.isDatatokenDeployer(dtAddress, address)) !== true) {
|
||||
throw new Error(`Caller is not ERC20Deployer`)
|
||||
throw new Error(`Caller is not DatatokenDeployer`)
|
||||
}
|
||||
// Estimate gas cost for addMinter method
|
||||
const estGas = await estimateGas(address, dtContract.methods.addMinter, minter)
|
||||
@ -434,14 +434,14 @@ export class Datatoken extends SmartContract {
|
||||
): Promise<any> {
|
||||
const dtContract = contractInstance || this.getContract(dtAddress)
|
||||
|
||||
// should check ERC20Deployer role using NFT level ..
|
||||
// should check DatatokenDeployer role using NFT level ..
|
||||
|
||||
return estimateGas(address, dtContract.methods.removeMinter, minter)
|
||||
}
|
||||
|
||||
/**
|
||||
* Revoke Minter permission for an ERC20 datatoken
|
||||
* only ERC20Deployer can succeed
|
||||
* only DatatokenDeployer can succeed
|
||||
* @param {String} dtAddress Datatoken address
|
||||
* @param {String} address User address
|
||||
* @param {String} minter User which will be removed from Minter permission
|
||||
@ -456,7 +456,7 @@ export class Datatoken extends SmartContract {
|
||||
const dtContract = this.getContract(dtAddress)
|
||||
|
||||
if ((await this.isDatatokenDeployer(dtAddress, address)) !== true) {
|
||||
throw new Error(`Caller is not ERC20Deployer`)
|
||||
throw new Error(`Caller is not DatatokenDeployer`)
|
||||
}
|
||||
|
||||
const estGas = await estimateGas(address, dtContract.methods.removeMinter, minter)
|
||||
@ -492,7 +492,7 @@ export class Datatoken extends SmartContract {
|
||||
|
||||
/**
|
||||
* Add addPaymentManager (can set who's going to collect fee when consuming orders)
|
||||
* only ERC20Deployer can succeed
|
||||
* only DatatokenDeployer can succeed
|
||||
* @param {String} dtAddress Datatoken address
|
||||
* @param {String} address User address
|
||||
* @param {String} paymentManager User which is going to be a Minter
|
||||
@ -506,7 +506,7 @@ export class Datatoken extends SmartContract {
|
||||
const dtContract = this.getContract(dtAddress)
|
||||
|
||||
if ((await this.isDatatokenDeployer(dtAddress, address)) !== true) {
|
||||
throw new Error(`Caller is not ERC20Deployer`)
|
||||
throw new Error(`Caller is not DatatokenDeployer`)
|
||||
}
|
||||
|
||||
const estGas = await estimateGas(
|
||||
@ -546,7 +546,7 @@ export class Datatoken extends SmartContract {
|
||||
|
||||
/**
|
||||
* Revoke paymentManager permission for an ERC20 datatoken
|
||||
* only ERC20Deployer can succeed
|
||||
* only DatatokenDeployer can succeed
|
||||
* @param {String} dtAddress Datatoken address
|
||||
* @param {String} address User address
|
||||
* @param {String} paymentManager User which will be removed from paymentManager permission
|
||||
@ -560,7 +560,7 @@ export class Datatoken extends SmartContract {
|
||||
const dtContract = this.getContract(dtAddress)
|
||||
|
||||
if ((await this.isDatatokenDeployer(dtAddress, address)) !== true) {
|
||||
throw new Error(`Caller is not ERC20Deployer`)
|
||||
throw new Error(`Caller is not DatatokenDeployer`)
|
||||
}
|
||||
|
||||
const estGas = await estimateGas(
|
||||
@ -1012,7 +1012,7 @@ export class Datatoken extends SmartContract {
|
||||
|
||||
/** setData
|
||||
* This function allows to store data with a preset key (keccak256(ERC20Address)) into NFT 725 Store
|
||||
* only ERC20Deployer can succeed
|
||||
* only DatatokenDeployer can succeed
|
||||
* @param {String} dtAddress Datatoken address
|
||||
* @param {String} address User address
|
||||
* @param {String} value Data to be stored into 725Y standard
|
||||
|
@ -54,7 +54,7 @@ export class Nft extends SmartContract {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create new ERC20 datatoken - only user with ERC20Deployer permission can succeed
|
||||
* Create new ERC20 datatoken - only user with DatatokenDeployer permission can succeed
|
||||
* @param {String} nftAddress NFT address
|
||||
* @param {String} address User address
|
||||
* @param {String} minter User set as initial minter for the ERC20
|
||||
@ -82,7 +82,7 @@ export class Nft extends SmartContract {
|
||||
templateIndex?: number
|
||||
): Promise<string> {
|
||||
if ((await this.getNftPermissions(nftAddress, address)).deployERC20 !== true) {
|
||||
throw new Error(`Caller is not ERC20Deployer`)
|
||||
throw new Error(`Caller is not DatatokenDeployer`)
|
||||
}
|
||||
if (!templateIndex) templateIndex = 1
|
||||
|
||||
@ -221,31 +221,35 @@ export class Nft extends SmartContract {
|
||||
* Estimate gas cost for addToCreateERC20List method
|
||||
* @param {String} nftAddress NFT contract address
|
||||
* @param {String} address NFT Manager adress
|
||||
* @param {String} erc20Deployer User adress which is going to have erc20Deployer permission
|
||||
* @param {String} datatokenDeployer User adress which is going to have DatatokenDeployer permission
|
||||
* @param {Contract} nftContract optional contract instance
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
public async estGasGasAddDatatokenDeployer(
|
||||
nftAddress: string,
|
||||
address: string,
|
||||
erc20Deployer: string,
|
||||
datatokenDeployer: string,
|
||||
contractInstance?: Contract
|
||||
): Promise<any> {
|
||||
const nftContract = contractInstance || this.getContract(nftAddress)
|
||||
return estimateGas(address, nftContract.methods.addToCreateERC20List, erc20Deployer)
|
||||
return estimateGas(
|
||||
address,
|
||||
nftContract.methods.addToCreateERC20List,
|
||||
datatokenDeployer
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Add ERC20Deployer permission - only Manager can succeed
|
||||
* Add DatatokenDeployer permission - only Manager can succeed
|
||||
* @param {String} nftAddress NFT contract address
|
||||
* @param {String} address NFT Manager adress
|
||||
* @param {String} erc20Deployer User adress which is going to have erc20Deployer permission
|
||||
* @param {String} datatokenDeployer User adress which is going to have DatatokenDeployer permission
|
||||
* @return {Promise<TransactionReceipt>} trxReceipt
|
||||
*/
|
||||
public async addDatatokenDeployer(
|
||||
nftAddress: string,
|
||||
address: string,
|
||||
erc20Deployer: string
|
||||
datatokenDeployer: string
|
||||
): Promise<TransactionReceipt> {
|
||||
const nftContract = this.getContract(nftAddress)
|
||||
|
||||
@ -257,12 +261,12 @@ export class Nft extends SmartContract {
|
||||
const estGas = await estimateGas(
|
||||
address,
|
||||
nftContract.methods.addToCreateERC20List,
|
||||
erc20Deployer
|
||||
datatokenDeployer
|
||||
)
|
||||
|
||||
// Invoke addToCreateERC20List function of the contract
|
||||
const trxReceipt = await nftContract.methods
|
||||
.addToCreateERC20List(erc20Deployer)
|
||||
.addToCreateERC20List(datatokenDeployer)
|
||||
.send({
|
||||
from: address,
|
||||
gas: estGas + 1,
|
||||
@ -276,14 +280,14 @@ export class Nft extends SmartContract {
|
||||
* Estimate gas cost for removeFromCreateERC20List method
|
||||
* @param {String} nftAddress NFT contract address
|
||||
* @param {String} address NFT Manager adress
|
||||
* @param {String} erc20Deployer Address of the user to be revoked ERC20Deployer Permission
|
||||
* @param {String} datatokenDeployer Address of the user to be revoked DatatokenDeployer Permission
|
||||
* @param {Contract} nftContract optional contract instance
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
public async estGasGasRemoveDatatokenDeployer(
|
||||
nftAddress: string,
|
||||
address: string,
|
||||
erc20Deployer: string,
|
||||
datatokenDeployer: string,
|
||||
contractInstance?: Contract
|
||||
): Promise<any> {
|
||||
const nftContract = contractInstance || this.getContract(nftAddress)
|
||||
@ -291,40 +295,40 @@ export class Nft extends SmartContract {
|
||||
return estimateGas(
|
||||
address,
|
||||
nftContract.methods.removeFromCreateERC20List,
|
||||
erc20Deployer
|
||||
datatokenDeployer
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove ERC20Deployer permission - only Manager can succeed
|
||||
* Remove DatatokenDeployer permission - only Manager can succeed
|
||||
* @param {String} nftAddress NFT contract address
|
||||
* @param {String} address NFT Manager adress
|
||||
* @param {String} erc20Deployer Address of the user to be revoked ERC20Deployer Permission
|
||||
* @param {String} datatokenDeployer Address of the user to be revoked DatatokenDeployer Permission
|
||||
* @return {Promise<TransactionReceipt>} trxReceipt
|
||||
*/
|
||||
public async removeDatatokenDeployer(
|
||||
nftAddress: string,
|
||||
address: string,
|
||||
erc20Deployer: string
|
||||
datatokenDeployer: string
|
||||
): Promise<TransactionReceipt> {
|
||||
const nftContract = this.getContract(nftAddress)
|
||||
|
||||
if (
|
||||
(await this.getNftPermissions(nftAddress, address)).manager !== true ||
|
||||
(address === erc20Deployer &&
|
||||
(address === datatokenDeployer &&
|
||||
(await this.getNftPermissions(nftAddress, address)).deployERC20 !== true)
|
||||
) {
|
||||
throw new Error(`Caller is not Manager nor ERC20Deployer`)
|
||||
throw new Error(`Caller is not Manager nor DatatokenDeployer`)
|
||||
}
|
||||
const estGas = await estimateGas(
|
||||
address,
|
||||
nftContract.methods.removeFromCreateERC20List,
|
||||
erc20Deployer
|
||||
datatokenDeployer
|
||||
)
|
||||
|
||||
// Call removeFromCreateERC20List function of the contract
|
||||
const trxReceipt = await nftContract.methods
|
||||
.removeFromCreateERC20List(erc20Deployer)
|
||||
.removeFromCreateERC20List(datatokenDeployer)
|
||||
.send({
|
||||
from: address,
|
||||
gas: estGas + 1,
|
||||
@ -581,7 +585,7 @@ export class Nft extends SmartContract {
|
||||
}
|
||||
|
||||
/**
|
||||
* This function allows to remove all ROLES at NFT level: Managers, ERC20Deployer, 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
|
||||
* Permissions at erc20 level stay.
|
||||
* Only NFT Owner can call it.
|
||||
@ -1030,7 +1034,7 @@ export class Nft extends SmartContract {
|
||||
return await nftContract.methods.getMetaData().call()
|
||||
}
|
||||
|
||||
/** Get users ERC20Deployer role
|
||||
/** Get users DatatokenDeployer role
|
||||
* @param {String} nftAddress NFT contract address
|
||||
* @param {String} address user adress
|
||||
* @return {Promise<boolean>}
|
||||
|
@ -18,7 +18,7 @@ describe('Datatoken', () => {
|
||||
let user1: string
|
||||
let user2: string
|
||||
let user3: string
|
||||
let erc20DeployerUser: string
|
||||
let datatokenDeployer: string
|
||||
let contracts: Addresses
|
||||
let nftDatatoken: Nft
|
||||
let datatoken: Datatoken
|
||||
@ -44,7 +44,7 @@ describe('Datatoken', () => {
|
||||
user1 = accounts[1]
|
||||
user2 = accounts[2]
|
||||
user3 = accounts[3]
|
||||
erc20DeployerUser = accounts[4]
|
||||
datatokenDeployer = accounts[4]
|
||||
|
||||
nftData.owner = nftOwner
|
||||
})
|
||||
@ -72,7 +72,7 @@ describe('Datatoken', () => {
|
||||
})
|
||||
|
||||
it('#createDatatoken - should create a new ERC20 DT from NFT contract', async () => {
|
||||
await nftDatatoken.addDatatokenDeployer(nftAddress, nftOwner, erc20DeployerUser)
|
||||
await nftDatatoken.addDatatokenDeployer(nftAddress, nftOwner, datatokenDeployer)
|
||||
datatokenAddress = await nftDatatoken.createDatatoken(
|
||||
nftAddress,
|
||||
nftOwner,
|
||||
@ -102,7 +102,7 @@ describe('Datatoken', () => {
|
||||
}
|
||||
})
|
||||
|
||||
it('#addMinter - should add user1 as minter, if user has ERC20Deployer permission', async () => {
|
||||
it('#addMinter - should add user1 as minter, if user has DatatokenDeployer permission', async () => {
|
||||
assert((await nftDatatoken.isDatatokenDeployer(nftAddress, nftOwner)) === true)
|
||||
assert((await datatoken.getDTPermissions(datatokenAddress, user1)).minter === false)
|
||||
|
||||
@ -111,7 +111,7 @@ describe('Datatoken', () => {
|
||||
assert((await datatoken.getDTPermissions(datatokenAddress, user1)).minter === true)
|
||||
})
|
||||
|
||||
it('#addMinter - should FAIL TO add user1 as minter, if user has ERC20Deployer permission', async () => {
|
||||
it('#addMinter - should FAIL TO add user1 as minter, if user has DatatokenDeployer permission', async () => {
|
||||
assert((await nftDatatoken.isDatatokenDeployer(nftAddress, user3)) === false)
|
||||
assert((await datatoken.getDTPermissions(datatokenAddress, user2)).minter === false)
|
||||
|
||||
@ -119,7 +119,7 @@ describe('Datatoken', () => {
|
||||
await datatoken.addMinter(datatokenAddress, user3, user2)
|
||||
assert(false)
|
||||
} catch (e) {
|
||||
assert(e.message === 'Caller is not ERC20Deployer')
|
||||
assert(e.message === 'Caller is not DatatokenDeployer')
|
||||
}
|
||||
|
||||
assert((await datatoken.getDTPermissions(datatokenAddress, user2)).minter === false)
|
||||
@ -139,7 +139,7 @@ describe('Datatoken', () => {
|
||||
exchangeId = fre.events.NewFixedRate.returnValues[0]
|
||||
})
|
||||
|
||||
it('#createFixedRate - should FAIL create FRE if NOT ERC20Deployer', async () => {
|
||||
it('#createFixedRate - should FAIL create FRE if NOT DatatokenDeployer', async () => {
|
||||
assert((await nftDatatoken.isDatatokenDeployer(nftAddress, user3)) === false)
|
||||
try {
|
||||
await datatoken.createFixedRate(datatokenAddress, user3, freParams)
|
||||
@ -183,7 +183,7 @@ describe('Datatoken', () => {
|
||||
}
|
||||
})
|
||||
|
||||
it('#removeMinter - should FAIL to remove user1 as minter, if caller is NOT ERC20Deployer', async () => {
|
||||
it('#removeMinter - should FAIL to remove user1 as minter, if caller is NOT DatatokenDeployer', async () => {
|
||||
assert((await nftDatatoken.isDatatokenDeployer(nftAddress, user2)) === false)
|
||||
assert((await datatoken.getDTPermissions(datatokenAddress, user1)).minter === true)
|
||||
|
||||
@ -191,12 +191,12 @@ describe('Datatoken', () => {
|
||||
await datatoken.removeMinter(datatokenAddress, user2, user1)
|
||||
assert(false)
|
||||
} catch (e) {
|
||||
assert(e.message === 'Caller is not ERC20Deployer')
|
||||
assert(e.message === 'Caller is not DatatokenDeployer')
|
||||
}
|
||||
assert((await datatoken.getDTPermissions(datatokenAddress, user1)).minter === true)
|
||||
})
|
||||
|
||||
it('#removeMinter - should remove user1 as minter, if nftDatatoken has ERC20Deployer permission', async () => {
|
||||
it('#removeMinter - should remove user1 as minter, if nftDatatoken has DatatokenDeployer permission', async () => {
|
||||
assert((await nftDatatoken.isDatatokenDeployer(nftAddress, nftOwner)) === true)
|
||||
assert((await datatoken.getDTPermissions(datatokenAddress, user1)).minter === true)
|
||||
|
||||
@ -205,7 +205,7 @@ describe('Datatoken', () => {
|
||||
assert((await datatoken.getDTPermissions(datatokenAddress, user1)).minter === false)
|
||||
})
|
||||
|
||||
it('#addPaymentManager - should FAIL TO add user2 as paymentManager, if caller is NOT ERC20Deployer', async () => {
|
||||
it('#addPaymentManager - should FAIL TO add user2 as paymentManager, if caller is NOT DatatokenDeployer', async () => {
|
||||
assert((await nftDatatoken.isDatatokenDeployer(nftAddress, user1)) === false)
|
||||
assert(
|
||||
(await datatoken.getDTPermissions(datatokenAddress, user2)).paymentManager === false
|
||||
@ -215,14 +215,14 @@ describe('Datatoken', () => {
|
||||
await datatoken.addPaymentManager(datatokenAddress, user1, user2)
|
||||
assert(false)
|
||||
} catch (e) {
|
||||
assert(e.message === 'Caller is not ERC20Deployer')
|
||||
assert(e.message === 'Caller is not DatatokenDeployer')
|
||||
}
|
||||
assert(
|
||||
(await datatoken.getDTPermissions(datatokenAddress, user2)).paymentManager === false
|
||||
)
|
||||
})
|
||||
|
||||
it('#addPaymentManager - should add user2 as paymentManager, if caller has ERC20Deployer permission', async () => {
|
||||
it('#addPaymentManager - should add user2 as paymentManager, if caller has DatatokenDeployer permission', async () => {
|
||||
assert((await nftDatatoken.isDatatokenDeployer(nftAddress, nftOwner)) === true)
|
||||
assert(
|
||||
(await datatoken.getDTPermissions(datatokenAddress, user2)).paymentManager === false
|
||||
@ -235,7 +235,7 @@ describe('Datatoken', () => {
|
||||
)
|
||||
})
|
||||
|
||||
it('#removePaymentManager - should FAIL TO remove user2 as paymentManager, if nftDatatoken has ERC20Deployer permission', async () => {
|
||||
it('#removePaymentManager - should FAIL TO remove user2 as paymentManager, if nftDatatoken has DatatokenDeployer permission', async () => {
|
||||
assert((await nftDatatoken.isDatatokenDeployer(nftAddress, user1)) === false)
|
||||
assert(
|
||||
(await datatoken.getDTPermissions(datatokenAddress, user2)).paymentManager === true
|
||||
@ -244,7 +244,7 @@ describe('Datatoken', () => {
|
||||
await datatoken.removePaymentManager(datatokenAddress, user1, user2)
|
||||
assert(false)
|
||||
} catch (e) {
|
||||
assert(e.message === 'Caller is not ERC20Deployer')
|
||||
assert(e.message === 'Caller is not DatatokenDeployer')
|
||||
}
|
||||
|
||||
assert(
|
||||
@ -252,7 +252,7 @@ describe('Datatoken', () => {
|
||||
)
|
||||
})
|
||||
|
||||
it('#removePaymentManager - should remove user2 as paymentManager, if Caller has ERC20Deployer permission', async () => {
|
||||
it('#removePaymentManager - should remove user2 as paymentManager, if Caller has DatatokenDeployer permission', async () => {
|
||||
assert((await nftDatatoken.isDatatokenDeployer(nftAddress, nftOwner)) === true)
|
||||
assert(
|
||||
(await datatoken.getDTPermissions(datatokenAddress, user2)).paymentManager === true
|
||||
@ -302,11 +302,11 @@ describe('Datatoken', () => {
|
||||
|
||||
it('#setPaymentCollector - should set a new paymentCollector, if ERC 20 DEPLOYER', async () => {
|
||||
assert(
|
||||
(await nftDatatoken.getNftPermissions(nftAddress, erc20DeployerUser))
|
||||
(await nftDatatoken.getNftPermissions(nftAddress, datatokenDeployer))
|
||||
.deployERC20 === true
|
||||
)
|
||||
|
||||
await datatoken.setPaymentCollector(datatokenAddress, erc20DeployerUser, user3)
|
||||
await datatoken.setPaymentCollector(datatokenAddress, datatokenDeployer, user3)
|
||||
|
||||
assert((await datatoken.getPaymentCollector(datatokenAddress)) === user3)
|
||||
})
|
||||
@ -546,7 +546,7 @@ describe('Datatoken', () => {
|
||||
assert(address, 'Not able to get the parent NFT address')
|
||||
})
|
||||
|
||||
it('#setData - should set a value into 725Y standard, if Caller has ERC20Deployer permission', async () => {
|
||||
it('#setData - should set a value into 725Y standard, if Caller has DatatokenDeployer permission', async () => {
|
||||
const data = web3.utils.asciiToHex('SomeData')
|
||||
|
||||
assert((await nftDatatoken.isDatatokenDeployer(nftAddress, nftOwner)) === true)
|
||||
@ -557,7 +557,7 @@ describe('Datatoken', () => {
|
||||
assert((await nftDatatoken.getData(nftAddress, key)) === data)
|
||||
})
|
||||
|
||||
it('#setData - should FAIL to set a value into 725Y standard, if Caller has NOT ERC20Deployer permission', async () => {
|
||||
it('#setData - should FAIL to set a value into 725Y standard, if Caller has NOT DatatokenDeployer permission', async () => {
|
||||
const data = web3.utils.asciiToHex('NewData')
|
||||
const OldData = web3.utils.asciiToHex('SomeData')
|
||||
assert((await nftDatatoken.isDatatokenDeployer(nftAddress, user1)) === false)
|
||||
|
@ -67,7 +67,7 @@ describe('NFT', () => {
|
||||
assert(erc20Address !== null)
|
||||
})
|
||||
|
||||
it('#createDatatoken - should fail to create a new ERC20 DT if not ERC20Deployer', async () => {
|
||||
it('#createDatatoken - should fail to create a new ERC20 DT if not DatatokenDeployer', async () => {
|
||||
try {
|
||||
await nftDatatoken.createDatatoken(
|
||||
nftAddress,
|
||||
@ -84,7 +84,7 @@ describe('NFT', () => {
|
||||
)
|
||||
assert(false)
|
||||
} catch (e) {
|
||||
assert(e.message === 'Caller is not ERC20Deployer')
|
||||
assert(e.message === 'Caller is not DatatokenDeployer')
|
||||
}
|
||||
})
|
||||
|
||||
@ -123,8 +123,8 @@ describe('NFT', () => {
|
||||
}
|
||||
})
|
||||
|
||||
// ERC20Deployer
|
||||
it('#addDatatokenDeployer -should add ERC20deployer if Manager', async () => {
|
||||
// DatatokenDeployer
|
||||
it('#addDatatokenDeployer -should add DatatokenDeployer if Manager', async () => {
|
||||
assert((await nftDatatoken.isDatatokenDeployer(nftAddress, user1)) === false)
|
||||
|
||||
await nftDatatoken.addDatatokenDeployer(nftAddress, nftOwner, user1)
|
||||
@ -132,7 +132,7 @@ describe('NFT', () => {
|
||||
assert((await nftDatatoken.isDatatokenDeployer(nftAddress, user1)) === true)
|
||||
})
|
||||
|
||||
it('#addDatatokenDeployer - should fail to add ERC20deployer if NOT Manager', async () => {
|
||||
it('#addDatatokenDeployer - should fail to add DatatokenDeployer if NOT Manager', async () => {
|
||||
try {
|
||||
await nftDatatoken.addDatatokenDeployer(nftAddress, user1, user1)
|
||||
assert(false)
|
||||
@ -141,7 +141,7 @@ describe('NFT', () => {
|
||||
}
|
||||
})
|
||||
|
||||
it('#removeDatatokenDeployer - remove ERC20deployer if Manager', async () => {
|
||||
it('#removeDatatokenDeployer - remove DatatokenDeployer if Manager', async () => {
|
||||
assert((await nftDatatoken.isDatatokenDeployer(nftAddress, user1)) === true)
|
||||
|
||||
await nftDatatoken.removeDatatokenDeployer(nftAddress, nftOwner, user1)
|
||||
@ -149,25 +149,25 @@ describe('NFT', () => {
|
||||
assert((await nftDatatoken.isDatatokenDeployer(nftAddress, user1)) === false)
|
||||
})
|
||||
|
||||
it('#removeDatatokenDeployer - should fail and remove ERC20deployer if NOT Manager nor himself an ERC20Deployer', async () => {
|
||||
it('#removeDatatokenDeployer - should fail and remove DatatokenDeployer if NOT Manager nor himself an DatatokenDeployer', async () => {
|
||||
await nftDatatoken.addDatatokenDeployer(nftAddress, nftOwner, user1)
|
||||
assert((await nftDatatoken.isDatatokenDeployer(nftAddress, user1)) === true)
|
||||
try {
|
||||
await nftDatatoken.removeDatatokenDeployer(nftAddress, user1, user1)
|
||||
assert(false)
|
||||
} catch (e) {
|
||||
assert(e.message === 'Caller is not Manager nor ERC20Deployer')
|
||||
assert(e.message === 'Caller is not Manager nor DatatokenDeployer')
|
||||
}
|
||||
assert((await nftDatatoken.isDatatokenDeployer(nftAddress, user1)) === true)
|
||||
})
|
||||
|
||||
it('#removeDatatokenDeployer - should fail to remove himself as an ERC20Deployer', async () => {
|
||||
it('#removeDatatokenDeployer - should fail to remove himself as an DatatokenDeployer', async () => {
|
||||
assert((await nftDatatoken.isDatatokenDeployer(nftAddress, user1)) === true)
|
||||
try {
|
||||
await nftDatatoken.removeDatatokenDeployer(nftAddress, user1, user1)
|
||||
assert(false)
|
||||
} catch (e) {
|
||||
assert(e.message === 'Caller is not Manager nor ERC20Deployer')
|
||||
assert(e.message === 'Caller is not Manager nor DatatokenDeployer')
|
||||
}
|
||||
assert((await nftDatatoken.isDatatokenDeployer(nftAddress, user1)) === true)
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user