mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
update erc20 datatoken and tests
This commit is contained in:
parent
aa9c02af3f
commit
fa2e44d82b
32
package-lock.json
generated
32
package-lock.json
generated
@ -12552,9 +12552,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/hardhat": {
|
"node_modules/hardhat": {
|
||||||
"version": "2.6.8",
|
"version": "2.7.0",
|
||||||
"resolved": "https://registry.npmjs.org/hardhat/-/hardhat-2.6.8.tgz",
|
"resolved": "https://registry.npmjs.org/hardhat/-/hardhat-2.7.0.tgz",
|
||||||
"integrity": "sha512-iRVd5DgcIVV3rNXMlogOfwlXAhHp7Wy/OjjFiUhTey8Unvo6oq5+Is5ANiKVN+Iw07Pcb/HpkGt7jCB6a4ITgg==",
|
"integrity": "sha512-DqweY3KH5gwExoZ8EtsAfioj0Hk0NBXWXT3fMXWkiQNfyYBoZLrqdPNkbJ/E2LD4mZ+BKF7v/1chYR9ZCn2Z+g==",
|
||||||
"peer": true,
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ethereumjs/block": "^3.4.0",
|
"@ethereumjs/block": "^3.4.0",
|
||||||
@ -12602,7 +12602,7 @@
|
|||||||
"stacktrace-parser": "^0.1.10",
|
"stacktrace-parser": "^0.1.10",
|
||||||
"true-case-path": "^2.2.1",
|
"true-case-path": "^2.2.1",
|
||||||
"tsort": "0.0.1",
|
"tsort": "0.0.1",
|
||||||
"uuid": "^3.3.2",
|
"uuid": "^8.3.2",
|
||||||
"ws": "^7.4.6"
|
"ws": "^7.4.6"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
@ -13248,16 +13248,6 @@
|
|||||||
"node": ">=6"
|
"node": ">=6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/hardhat/node_modules/uuid": {
|
|
||||||
"version": "3.4.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
|
|
||||||
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
|
|
||||||
"deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.",
|
|
||||||
"peer": true,
|
|
||||||
"bin": {
|
|
||||||
"uuid": "bin/uuid"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/hardhat/node_modules/which": {
|
"node_modules/hardhat/node_modules/which": {
|
||||||
"version": "1.3.1",
|
"version": "1.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
|
||||||
@ -35400,9 +35390,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"hardhat": {
|
"hardhat": {
|
||||||
"version": "2.6.8",
|
"version": "2.7.0",
|
||||||
"resolved": "https://registry.npmjs.org/hardhat/-/hardhat-2.6.8.tgz",
|
"resolved": "https://registry.npmjs.org/hardhat/-/hardhat-2.7.0.tgz",
|
||||||
"integrity": "sha512-iRVd5DgcIVV3rNXMlogOfwlXAhHp7Wy/OjjFiUhTey8Unvo6oq5+Is5ANiKVN+Iw07Pcb/HpkGt7jCB6a4ITgg==",
|
"integrity": "sha512-DqweY3KH5gwExoZ8EtsAfioj0Hk0NBXWXT3fMXWkiQNfyYBoZLrqdPNkbJ/E2LD4mZ+BKF7v/1chYR9ZCn2Z+g==",
|
||||||
"peer": true,
|
"peer": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@ethereumjs/block": "^3.4.0",
|
"@ethereumjs/block": "^3.4.0",
|
||||||
@ -35450,7 +35440,7 @@
|
|||||||
"stacktrace-parser": "^0.1.10",
|
"stacktrace-parser": "^0.1.10",
|
||||||
"true-case-path": "^2.2.1",
|
"true-case-path": "^2.2.1",
|
||||||
"tsort": "0.0.1",
|
"tsort": "0.0.1",
|
||||||
"uuid": "^3.3.2",
|
"uuid": "^8.3.2",
|
||||||
"ws": "^7.4.6"
|
"ws": "^7.4.6"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -35941,12 +35931,6 @@
|
|||||||
"has-flag": "^3.0.0"
|
"has-flag": "^3.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"uuid": {
|
|
||||||
"version": "3.4.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
|
|
||||||
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
|
|
||||||
"peer": true
|
|
||||||
},
|
|
||||||
"which": {
|
"which": {
|
||||||
"version": "1.3.1",
|
"version": "1.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
|
||||||
|
@ -523,7 +523,7 @@ export class Datatoken {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Estimate gas for addFeeManager method
|
* Estimate gas for addPaymentManager method
|
||||||
* @param {String} dtAddress Datatoken address
|
* @param {String} dtAddress Datatoken address
|
||||||
* @param {String} address User address
|
* @param {String} address User address
|
||||||
* @param {String} paymentManager User which is going to be a Minter
|
* @param {String} paymentManager User which is going to be a Minter
|
||||||
@ -544,7 +544,7 @@ export class Datatoken {
|
|||||||
let estGas
|
let estGas
|
||||||
try {
|
try {
|
||||||
estGas = await dtContract.methods
|
estGas = await dtContract.methods
|
||||||
.addFeeManager(paymentManager)
|
.addPaymentManager(paymentManager)
|
||||||
.estimateGas({ from: address }, (err, estGas) => (err ? gasLimitDefault : estGas))
|
.estimateGas({ from: address }, (err, estGas) => (err ? gasLimitDefault : estGas))
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
estGas = gasLimitDefault
|
estGas = gasLimitDefault
|
||||||
@ -554,7 +554,7 @@ export class Datatoken {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add addPaymentManager for an ERC20 datatoken
|
* Add addPaymentManager (can set who's going to collect fee when consuming orders)
|
||||||
* only ERC20Deployer can succeed
|
* only ERC20Deployer can succeed
|
||||||
* @param {String} dtAddress Datatoken address
|
* @param {String} dtAddress Datatoken address
|
||||||
* @param {String} address User address
|
* @param {String} address User address
|
||||||
@ -588,17 +588,17 @@ export class Datatoken {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Estimate gas for removeFeeManager method
|
* Estimate gas for removePaymentManager method
|
||||||
* @param {String} dtAddress Datatoken address
|
* @param {String} dtAddress Datatoken address
|
||||||
* @param {String} address User address
|
* @param {String} address User address
|
||||||
* @param {String} feeManager User which will be removed from FeeManager permission
|
* @param {String} paymentManager User which will be removed from paymentManager permission
|
||||||
* @param {Contract} contractInstance optional contract instance
|
* @param {Contract} contractInstance optional contract instance
|
||||||
* @return {Promise<any>}
|
* @return {Promise<any>}
|
||||||
*/
|
*/
|
||||||
public async estGasRemoveFeeManager(
|
public async estGasRemovePaymentManager(
|
||||||
dtAddress: string,
|
dtAddress: string,
|
||||||
address: string,
|
address: string,
|
||||||
feeManager: string,
|
paymentManager: string,
|
||||||
contractInstance?: Contract
|
contractInstance?: Contract
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
const dtContract =
|
const dtContract =
|
||||||
@ -608,7 +608,7 @@ export class Datatoken {
|
|||||||
let estGas
|
let estGas
|
||||||
try {
|
try {
|
||||||
estGas = await dtContract.methods
|
estGas = await dtContract.methods
|
||||||
.removeFeeManager(feeManager)
|
.removePaymentManager(paymentManager)
|
||||||
.estimateGas({ from: address }, (err, estGas) => (err ? gasLimitDefault : estGas))
|
.estimateGas({ from: address }, (err, estGas) => (err ? gasLimitDefault : estGas))
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
estGas = gasLimitDefault
|
estGas = gasLimitDefault
|
||||||
@ -617,50 +617,52 @@ export class Datatoken {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Revoke FeeManager permission for an ERC20 datatoken
|
* Revoke paymentManager permission for an ERC20 datatoken
|
||||||
* only ERC20Deployer can succeed
|
* only ERC20Deployer can succeed
|
||||||
* @param {String} dtAddress Datatoken address
|
* @param {String} dtAddress Datatoken address
|
||||||
* @param {String} address User address
|
* @param {String} address User address
|
||||||
* @param {String} feeManager User which will be removed from FeeManager permission
|
* @param {String} paymentManager User which will be removed from paymentManager permission
|
||||||
* @return {Promise<TransactionReceipt>} trxReceipt
|
* @return {Promise<TransactionReceipt>} trxReceipt
|
||||||
*/
|
*/
|
||||||
public async removeFeeManager(
|
public async removePaymentManager(
|
||||||
dtAddress: string,
|
dtAddress: string,
|
||||||
address: string,
|
address: string,
|
||||||
feeManager: string
|
paymentManager: string
|
||||||
): Promise<TransactionReceipt> {
|
): Promise<TransactionReceipt> {
|
||||||
const dtContract = new this.web3.eth.Contract(this.datatokensABI, dtAddress)
|
const dtContract = new this.web3.eth.Contract(this.datatokensABI, dtAddress)
|
||||||
|
|
||||||
// should check ERC20Deployer role using erc721 level ..
|
// should check ERC20Deployer role using erc721 level ..
|
||||||
const estGas = await this.estGasRemoveFeeManager(
|
const estGas = await this.estGasRemovePaymentManager(
|
||||||
dtAddress,
|
dtAddress,
|
||||||
address,
|
address,
|
||||||
feeManager,
|
paymentManager,
|
||||||
dtContract
|
dtContract
|
||||||
)
|
)
|
||||||
|
|
||||||
// Call removeFeeManager function of the contract
|
// Call removeFeeManager function of the contract
|
||||||
const trxReceipt = await dtContract.methods.removeFeeManager(feeManager).send({
|
const trxReceipt = await dtContract.methods
|
||||||
from: address,
|
.removePaymentManager(paymentManager)
|
||||||
gas: estGas + 1,
|
.send({
|
||||||
gasPrice: await getFairGasPrice(this.web3)
|
from: address,
|
||||||
})
|
gas: estGas + 1,
|
||||||
|
gasPrice: await getFairGasPrice(this.web3)
|
||||||
|
})
|
||||||
|
|
||||||
return trxReceipt
|
return trxReceipt
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Estimate gas for setFeeCollector method
|
* Estimate gas for setPaymentCollector method
|
||||||
* @param dtAddress datatoken address where we want to clean permissions address
|
* @param dtAddress datatoken address
|
||||||
* @param address Caller address
|
* @param address Caller address
|
||||||
* @param feeCollector User to be set as new fee collector
|
* @param paymentCollector User to be set as new payment collector
|
||||||
* @param {Contract} contractInstance optional contract instance
|
* @param {Contract} contractInstance optional contract instance
|
||||||
* @return {Promise<any>}
|
* @return {Promise<any>}
|
||||||
*/
|
*/
|
||||||
public async estGasSetFeeCollector(
|
public async estGasSetPaymentCollector(
|
||||||
dtAddress: string,
|
dtAddress: string,
|
||||||
address: string,
|
address: string,
|
||||||
feeCollector: string,
|
paymentCollector: string,
|
||||||
contractInstance?: Contract
|
contractInstance?: Contract
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
const dtContract =
|
const dtContract =
|
||||||
@ -670,7 +672,7 @@ export class Datatoken {
|
|||||||
let estGas
|
let estGas
|
||||||
try {
|
try {
|
||||||
estGas = await dtContract.methods
|
estGas = await dtContract.methods
|
||||||
.setFeeCollector(feeCollector)
|
.setPaymentCollector(paymentCollector)
|
||||||
.estimateGas({ from: address }, (err, estGas) => (err ? gasLimitDefault : estGas))
|
.estimateGas({ from: address }, (err, estGas) => (err ? gasLimitDefault : estGas))
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
estGas = gasLimitDefault
|
estGas = gasLimitDefault
|
||||||
@ -679,48 +681,51 @@ export class Datatoken {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a new fee Collector, if feeCollector is address(0), feeCollector is NFT Owner
|
* This function allows to set a new PaymentCollector (receives DT when consuming)
|
||||||
|
* If not set the paymentCollector is the NFT Owner
|
||||||
* only NFT owner can call
|
* only NFT owner can call
|
||||||
* @param dtAddress datatoken address where we want to clean permissions address
|
* @param dtAddress datatoken address
|
||||||
* @param address Caller address
|
* @param address Caller address
|
||||||
* @param feeCollector User to be set as new fee collector
|
* @param paymentCollector User to be set as new payment collector
|
||||||
* @return {Promise<TransactionReceipt>} trxReceipt
|
* @return {Promise<TransactionReceipt>} trxReceipt
|
||||||
*/
|
*/
|
||||||
public async setFeeCollector(
|
public async setPaymentCollector(
|
||||||
dtAddress: string,
|
dtAddress: string,
|
||||||
address: string,
|
address: string,
|
||||||
feeCollector: string
|
paymentCollector: string
|
||||||
): Promise<TransactionReceipt> {
|
): Promise<TransactionReceipt> {
|
||||||
const dtContract = new this.web3.eth.Contract(this.datatokensABI, dtAddress)
|
const dtContract = new this.web3.eth.Contract(this.datatokensABI, dtAddress)
|
||||||
if ((await this.getDTPermissions(dtAddress, address)).paymentManager !== true) {
|
if ((await this.getDTPermissions(dtAddress, address)).paymentManager !== true) {
|
||||||
throw new Error(`Caller is not Fee Manager`)
|
throw new Error(`Caller is not Fee Manager`)
|
||||||
}
|
}
|
||||||
|
|
||||||
const estGas = await this.estGasSetFeeCollector(
|
const estGas = await this.estGasSetPaymentCollector(
|
||||||
dtAddress,
|
dtAddress,
|
||||||
address,
|
address,
|
||||||
feeCollector,
|
paymentCollector,
|
||||||
dtContract
|
dtContract
|
||||||
)
|
)
|
||||||
|
|
||||||
// Call setFeeCollector method of the contract
|
// Call setFeeCollector method of the contract
|
||||||
const trxReceipt = await dtContract.methods.setFeeCollector(feeCollector).send({
|
const trxReceipt = await dtContract.methods
|
||||||
from: address,
|
.setPaymentCollector(paymentCollector)
|
||||||
gas: estGas + 1,
|
.send({
|
||||||
gasPrice: await getFairGasPrice(this.web3)
|
from: address,
|
||||||
})
|
gas: estGas + 1,
|
||||||
|
gasPrice: await getFairGasPrice(this.web3)
|
||||||
|
})
|
||||||
|
|
||||||
return trxReceipt
|
return trxReceipt
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get Fee Collector
|
/** getPaymentCollector - It returns the current paymentCollector
|
||||||
* @param dtAddress datatoken address
|
* @param dtAddress datatoken address
|
||||||
* @return {Promise<string>}
|
* @return {Promise<string>}
|
||||||
*/
|
*/
|
||||||
public async getFeeCollector(dtAddress: string): Promise<string> {
|
public async getPaymentCollector(dtAddress: string): Promise<string> {
|
||||||
const dtContract = new this.web3.eth.Contract(this.datatokensABI, dtAddress)
|
const dtContract = new this.web3.eth.Contract(this.datatokensABI, dtAddress)
|
||||||
const feeCollector = await dtContract.methods.getFeeCollector().call()
|
const paymentCollector = await dtContract.methods.getPaymentCollector().call()
|
||||||
return feeCollector
|
return paymentCollector
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1132,7 +1137,7 @@ export class Datatoken {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean erc20level Permissions (minters, feeManagers and reset the feeCollector) for an ERC20 datatoken
|
* Clean erc20level Permissions (minters, paymentManager and reset the paymentCollector) for an ERC20 datatoken
|
||||||
* Only NFT Owner (at 721 level) can call it.
|
* Only NFT Owner (at 721 level) can call it.
|
||||||
* @param dtAddress Datatoken address where we want to clean permissions
|
* @param dtAddress Datatoken address where we want to clean permissions
|
||||||
* @param address User adress
|
* @param address User adress
|
||||||
|
@ -191,54 +191,54 @@ describe('Datatoken', () => {
|
|||||||
assert((await datatoken.getDTPermissions(datatokenAddress, user1)).minter === false)
|
assert((await datatoken.getDTPermissions(datatokenAddress, user1)).minter === false)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('#addFeeManager - should add user2 as feeManager, if nftDatatoken has ERC20Deployer permission', async () => {
|
it('#addPaymentManager - should add user2 as paymentManager, if nftDatatoken has ERC20Deployer permission', async () => {
|
||||||
assert((await nftDatatoken.isErc20Deployer(nftAddress, nftOwner)) === true)
|
assert((await nftDatatoken.isErc20Deployer(nftAddress, nftOwner)) === true)
|
||||||
assert(
|
assert(
|
||||||
(await datatoken.getDTPermissions(datatokenAddress, user2)).feeManager === false
|
(await datatoken.getDTPermissions(datatokenAddress, user2)).paymentManager === false
|
||||||
)
|
)
|
||||||
|
|
||||||
await datatoken.addFeeManager(datatokenAddress, nftOwner, user2)
|
await datatoken.addPaymentManager(datatokenAddress, nftOwner, user2)
|
||||||
|
|
||||||
assert(
|
assert(
|
||||||
(await datatoken.getDTPermissions(datatokenAddress, user2)).feeManager === true
|
(await datatoken.getDTPermissions(datatokenAddress, user2)).paymentManager === true
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('#removeFeeManager - should remove user2 as feeManager, if nftDatatoken has ERC20Deployer permission', async () => {
|
it('#removePaymentManager - should remove user2 as paymentManager, if nftDatatoken has ERC20Deployer permission', async () => {
|
||||||
assert((await nftDatatoken.isErc20Deployer(nftAddress, nftOwner)) === true)
|
assert((await nftDatatoken.isErc20Deployer(nftAddress, nftOwner)) === true)
|
||||||
assert(
|
assert(
|
||||||
(await datatoken.getDTPermissions(datatokenAddress, user2)).feeManager === true
|
(await datatoken.getDTPermissions(datatokenAddress, user2)).paymentManager === true
|
||||||
)
|
)
|
||||||
|
|
||||||
await datatoken.removeFeeManager(datatokenAddress, nftOwner, user2)
|
await datatoken.removePaymentManager(datatokenAddress, nftOwner, user2)
|
||||||
|
|
||||||
assert(
|
assert(
|
||||||
(await datatoken.getDTPermissions(datatokenAddress, user2)).feeManager === false
|
(await datatoken.getDTPermissions(datatokenAddress, user2)).paymentManager === false
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('#setFeeCollector - should fail to set a new feeCollector, if NOT Fee Manager', async () => {
|
it('#setPaymentCollector - should fail to set a new feeCollector, if NOT Fee Manager', async () => {
|
||||||
await datatoken.removeFeeManager(datatokenAddress, nftOwner, user2)
|
await datatoken.removePaymentManager(datatokenAddress, nftOwner, user2)
|
||||||
assert(
|
assert(
|
||||||
(await datatoken.getDTPermissions(datatokenAddress, user2)).feeManager === false
|
(await datatoken.getDTPermissions(datatokenAddress, user2)).paymentManager === false
|
||||||
)
|
)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await datatoken.setFeeCollector(datatokenAddress, user1, user2)
|
await datatoken.setPaymentCollector(datatokenAddress, user1, user2)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
assert(e.message === 'Caller is not Fee Manager')
|
assert(e.message === 'Caller is not Fee Manager')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
it('#setFeeCollector - should set a new feeCollector, if FEE MANAGER', async () => {
|
it('#setPaymentCollector - should set a new feeCollector, if FEE MANAGER', async () => {
|
||||||
assert((await datatoken.getFeeCollector(datatokenAddress)) === user2)
|
assert((await datatoken.getPaymentCollector(datatokenAddress)) === user2)
|
||||||
|
|
||||||
assert(
|
assert(
|
||||||
(await datatoken.getDTPermissions(datatokenAddress, user1)).feeManager === true
|
(await datatoken.getDTPermissions(datatokenAddress, user1)).paymentManager === true
|
||||||
)
|
)
|
||||||
|
|
||||||
await datatoken.setFeeCollector(datatokenAddress, user1, user3)
|
await datatoken.setPaymentCollector(datatokenAddress, user1, user3)
|
||||||
assert((await datatoken.getFeeCollector(datatokenAddress)) === user3)
|
assert((await datatoken.getPaymentCollector(datatokenAddress)) === user3)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('#startOrder- user2 should create an order for DT ', async () => {
|
it('#startOrder- user2 should create an order for DT ', async () => {
|
||||||
@ -270,7 +270,7 @@ describe('Datatoken', () => {
|
|||||||
assert(
|
assert(
|
||||||
(await datatoken.balance(
|
(await datatoken.balance(
|
||||||
datatokenAddress,
|
datatokenAddress,
|
||||||
await datatoken.getFeeCollector(datatokenAddress)
|
await datatoken.getPaymentCollector(datatokenAddress)
|
||||||
)) === '1',
|
)) === '1',
|
||||||
'Invalid publisher reward, we should have 1 DT'
|
'Invalid publisher reward, we should have 1 DT'
|
||||||
)
|
)
|
||||||
@ -317,22 +317,22 @@ describe('Datatoken', () => {
|
|||||||
it('#cleanPermissions - should clean permissions at ERC20 level', async () => {
|
it('#cleanPermissions - should clean permissions at ERC20 level', async () => {
|
||||||
assert((await datatoken.getDTPermissions(datatokenAddress, nftOwner)).minter === true)
|
assert((await datatoken.getDTPermissions(datatokenAddress, nftOwner)).minter === true)
|
||||||
|
|
||||||
assert((await datatoken.getFeeCollector(datatokenAddress)) === user3)
|
assert((await datatoken.getPaymentCollector(datatokenAddress)) === user3)
|
||||||
|
|
||||||
assert(
|
assert(
|
||||||
(await datatoken.getDTPermissions(datatokenAddress, user1)).feeManager === true
|
(await datatoken.getDTPermissions(datatokenAddress, user1)).paymentManager === true
|
||||||
)
|
)
|
||||||
|
|
||||||
await datatoken.cleanPermissions(datatokenAddress, nftOwner)
|
await datatoken.cleanPermissions(datatokenAddress, nftOwner)
|
||||||
|
|
||||||
assert((await datatoken.getFeeCollector(datatokenAddress)) === nftOwner)
|
assert((await datatoken.getPaymentCollector(datatokenAddress)) === nftOwner)
|
||||||
|
|
||||||
assert(
|
assert(
|
||||||
(await datatoken.getDTPermissions(datatokenAddress, nftOwner)).minter === false
|
(await datatoken.getDTPermissions(datatokenAddress, nftOwner)).minter === false
|
||||||
)
|
)
|
||||||
|
|
||||||
assert(
|
assert(
|
||||||
(await datatoken.getDTPermissions(datatokenAddress, user1)).feeManager === false
|
(await datatoken.getDTPermissions(datatokenAddress, user1)).paymentManager === false
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user