@consensys-software/permissioning-smart-contracts
Version:
Smart contracts and dapp implementing EEA spec onchain permissioning
17 lines (12 loc) • 634 B
text/typescript
import { Contract } from 'ethers';
import NodeRulesAbi from '../abis/NodeRules.json';
import { NodeIngress } from '../@types/NodeIngress';
import { NodeRules } from '../@types/NodeRules';
let instance: NodeRules | null = null;
export const nodeRulesFactory = async (ingressInstance: NodeIngress) => {
if (instance) return instance;
const ruleContractName = await ingressInstance.functions.RULES_CONTRACT();
const nodeRulesAddress = await ingressInstance.functions.getContractAddress(ruleContractName);
instance = new Contract(nodeRulesAddress, NodeRulesAbi.abi, ingressInstance.signer) as NodeRules;
return instance;
};