this mainly allows us to check if an account has a certain role and thus if the account can call specific contract functions. At some point we might want to extend that to support the check if an account can call the function. For that we would need to have a mapping between function names and roles, which we have not right now.
14 lines
394 B
JavaScript
14 lines
394 B
JavaScript
const Base = require('./base');
|
|
const EthersUtils = require('ethers').utils;
|
|
|
|
class Acl extends Base {
|
|
|
|
hasPermission(fromAddress, contractAddress, roleID, params = null) {
|
|
let roleHash = EthersUtils.keccak256(EthersUtils.toUtf8Bytes(roleID));
|
|
console.log(roleHash)
|
|
return this.functions.hasPermission(fromAddress, contractAddress, roleHash, params);
|
|
}
|
|
}
|
|
|
|
module.exports = Acl;
|