Skip to content

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.

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:

  1. Verifies the successful execution of a parent action.
  2. Retrieves the return data (an address) from that parent action.
  3. Assigns a configured Role ID to that address.

When adopting a PowersFactory_AssignRole instance, the following parameters are required:

  1. factoryMandateId (uint16): The ID of the parent mandate that generates the target address.
  2. roleIdNewOrg (uint256): The Role ID that will be assigned to the address.
  3. inputParams (string[]): The description of input parameters required by the parent mandate (used to compute the parent’s Action ID).

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.

  1. Parent Validation

    • Computes the parentActionId using the provided calldata.
    • Verifies that the parent action state is Fulfilled.
    • Retrieves the return data from the parent action.
  2. Address Extraction

    • Decodes the return data to obtain the decodedAddress.
  3. Role Assignment

    • Generates a call to IPowers.assignRole.
    • Assigns roleIdNewOrg to decodedAddress.
function initializeMandate(...) public override
  • Initializes the mandate configuration.
  • Sets the input parameter descriptions to match those provided in the configuration.
function handleRequest(...) public view override returns (...)
  • Validates parent action fulfillment.
  • Decodes the target address.
  • Constructs the role assignment call.
Chain IDChain NameAddress