PowersFactory_AssignRole
PowersFactory_AssignRole is a factory integration mandate that assigns a specific role in the Powers organization to an address returned by a parent action.
Overview
Section titled “Overview”This mandate connects a “Factory” mandate (which produces a result, such as a newly deployed contract or a selected address) with the Powers role system. It automates the granting of permissions by assigning a role to the entity created or selected by a previous action.
Specifically, it:
- Verifies the successful execution of a parent action.
- Retrieves the return data (an address) from that parent action.
- Assigns a configured Role ID to that address.
Configuration
Section titled “Configuration”When adopting a PowersFactory_AssignRole instance, the following parameters are required:
factoryMandateId(uint16): The ID of the parent mandate that generates the target address.roleIdNewOrg(uint256): The Role ID that will be assigned to the address.inputParams(string[]): The description of input parameters required by the parent mandate (used to compute the parent’s Action ID).
Proposing an Action
Section titled “Proposing an Action”When calling the mandate, the inputs provided must match the inputs expected by the parent factoryMandateId. These inputs are used to re-compute the parent’s Action ID to look up its result.
Execution Flow
Section titled “Execution Flow”-
Parent Validation
- Computes the
parentActionIdusing the provided calldata. - Verifies that the parent action state is
Fulfilled. - Retrieves the return data from the parent action.
- Computes the
-
Address Extraction
- Decodes the return data to obtain the
decodedAddress.
- Decodes the return data to obtain the
-
Role Assignment
- Generates a call to
IPowers.assignRole. - Assigns
roleIdNewOrgtodecodedAddress.
- Generates a call to
Technical Specifications
Section titled “Technical Specifications”Functions
Section titled “Functions”initializeMandate
Section titled “initializeMandate”function initializeMandate(...) public override- Initializes the mandate configuration.
- Sets the input parameter descriptions to match those provided in the configuration.
handleRequest
Section titled “handleRequest”function handleRequest(...) public view override returns (...)- Validates parent action fulfillment.
- Decodes the target address.
- Constructs the role assignment call.
Current Deployments
Section titled “Current Deployments”| Chain ID | Chain Name | Address |
|---|---|---|