Configure BorgAuth roles
Grant and revoke BorgAuth authority levels on a cyberCORP suite
Authority on a cyberCORP is held in its BorgAuth ACL. Roles are numeric levels in a hierarchy — see Access control.
The levels you'll use
99 (OWNER_ROLE)
Owner. Can grant/revoke roles. Held by the suite's manager contracts.
98 (ADMIN_ROLE)
Admin. Gates operational functions (e.g. scrip compliance actions, hook updates). Any level ≥ 98 passes.
200
Company officer. Set for an officer's address; 200 ≥ 99, so officers also pass onlyOwner.
0
No authority.
Grant an officer
The simplest path is CyberCorp.addOfficer, which records the officer and grants their address level 200:
import {CompanyOfficer} from "src/CyberCorpConstants.sol";
CyberCorp(cyberCorp).addOfficer(CompanyOfficer({
eoa: newOfficer,
name: "Sam Officer",
contact: "sam@acme.example",
title: "Chief Financial Officer"
}));Adding an address already listed as an officer reverts (DuplicateOfficer), and an address already holding a level above 200 keeps it — the grant never downgrades a custom role.
Update an officer
updateOfficer replaces the record at an index — new title, contact, or a new address. When the address changes, the old one's level-200 grant is revoked and the new one is granted under the same rules as addOfficer:
One caveat for corps whose legacy state lists the same address at more than one index: the old address keeps its role while any other entry still lists it — only removing or updating away its last entry revokes it.
Remove an officer
Either removes the officer record and revokes the level-200 grant:
Removal only zeroes a level that is exactly 200 — a custom level granted directly on the BorgAuth survives the officer's removal — and only when the address isn't still listed at another index (legacy state may hold duplicates).
Grant or revoke a role directly
To set any level directly, call updateRole on the BorgAuth contract. The caller must hold OWNER_ROLE.
Transfer ownership
Two-step, on the BorgAuth contract:
Renounce
auth.zeroOwner() sets the caller's level to 0, permanently removing its admin control.
Related
Last updated
Was this helpful?
