mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
Checking if the caller is Publishing Market Fee Address before calling the smart contract
This commit is contained in:
parent
cd8f892d38
commit
4b9f6c9c00
@ -1362,6 +1362,12 @@ export class Datatoken {
|
||||
const dtContract = new this.web3.eth.Contract(this.datatokensAbi, datatokenAddress, {
|
||||
from: address
|
||||
})
|
||||
const publishingMarketFeeAddress = (
|
||||
await dtContract.methods.getPublishingMarketFee().call()
|
||||
)[0]
|
||||
if (publishingMarketFeeAddress !== address) {
|
||||
throw new Error(`Caller is not the Publishing Market Fee Address`)
|
||||
}
|
||||
const estGas = await this.estGasSetPublishingMarketFee(
|
||||
datatokenAddress,
|
||||
publishMarketFeeAddress,
|
||||
|
@ -611,10 +611,7 @@ describe('Datatoken', () => {
|
||||
)
|
||||
} catch (e) {
|
||||
console.log('Message:', e.message)
|
||||
assert(
|
||||
e.message ===
|
||||
'Returned error: VM Exception while processing transaction: revert ERC20Template: not publishMarketFeeAddress'
|
||||
)
|
||||
assert(e.message === 'Caller is not the Publishing Market Fee Address')
|
||||
}
|
||||
const newPublishingMarketFee = await datatoken.getPublishingMarketFee(
|
||||
datatokenAddress,
|
||||
|
Loading…
x
Reference in New Issue
Block a user