Action Manger

Functionalities

  1. Enable Action

    • Function: enableAction(string memory actionName_, address actionAddress_, address blueprintAddress_)

    • Purpose: Registers and enables a new action within the protocol.

    • Parameters:

      • actionName_: The name of the action.

      • actionAddress_: The address of the action's smart contract.

      • blueprintAddress_: The address of the blueprint associated with the action.

    • Validation:

      • Ensures that the action address, name, and blueprint address are valid.

      • Checks that the action is not already registered for the given blueprint.

    • Event: Emits ActionEnabled with the action name and address.

  2. Disable Action

    • Function: disableAction(string memory actionName_, address blueprintAddress_)

    • Purpose: Disables a previously enabled action.

    • Parameters:

      • actionName_: The name of the action to be disabled.

      • blueprintAddress_: The address of the blueprint associated with the action.

    • Validation:

      • Ensures that the action name is valid.

      • Checks that the action is currently enabled for the given blueprint.

    • Event: Emits ActionDisabled with the action name.

  3. Execute Action Transaction

    • Function: executeActionTransaction(string memory actionName_, address blueprintAddress_, uint256 value_, bytes memory data_, Enum.Operation operation_)

    • Purpose: Executes arbitrary code on an action.

    • Parameters:

      • actionName_: The name of the action.

      • blueprintAddress_: The address of the blueprint associated with the action.

      • value_: Ether value for the transaction.

      • data_: Encoded data for the function call.

      • operation_: Type of call (e.g., call or delegatecall).

    • Process:

      • Validates that the action is registered for the given blueprint.

      • Checks permissions using a guard contract.

      • Executes the transaction via the Executor contract.

    • Events: Depending on success or failure, emits either ExecuteActionSuccess or ExecuteActionFailure with the action name and transaction hash.

  4. Check Action Status

    • Function: isActionEnabled(string memory actionName_, address blueprintAddress_)

    • Purpose: Checks if a given action is enabled for the specified blueprint.

    • Parameters:

      • actionName_: The name of the action.

      • blueprintAddress_: The address of the blueprint associated with the action.

    • Returns: Boolean value indicating whether the action is enabled.

  5. Get Action Address

    • Function: getActionAddress(string memory actionName_, address blueprintAddress_)

    • Purpose: Retrieves the address of a deployed action.

    • Parameters:

      • actionName_: The name of the action.

      • blueprintAddress_: The address of the blueprint associated with the action.

    • Returns: Address of the action.

Last updated