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, {
|
const dtContract = new this.web3.eth.Contract(this.datatokensAbi, datatokenAddress, {
|
||||||
from: address
|
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(
|
const estGas = await this.estGasSetPublishingMarketFee(
|
||||||
datatokenAddress,
|
datatokenAddress,
|
||||||
publishMarketFeeAddress,
|
publishMarketFeeAddress,
|
||||||
|
@ -611,10 +611,7 @@ describe('Datatoken', () => {
|
|||||||
)
|
)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('Message:', e.message)
|
console.log('Message:', e.message)
|
||||||
assert(
|
assert(e.message === 'Caller is not the Publishing Market Fee Address')
|
||||||
e.message ===
|
|
||||||
'Returned error: VM Exception while processing transaction: revert ERC20Template: not publishMarketFeeAddress'
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
const newPublishingMarketFee = await datatoken.getPublishingMarketFee(
|
const newPublishingMarketFee = await datatoken.getPublishingMarketFee(
|
||||||
datatokenAddress,
|
datatokenAddress,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user