;; Dungeon Crawler Contract
;;
;; This contract serves as the primary interface for user interactions within the Charisma protocol.
;; It acts as a central hub for executing actions across various interaction contracts, enabling
;; users to engage with multiple protocol components in a single transaction.
;;
;; Key Responsibilities:
;; 1. Action Execution: Coordinates the execution of actions on interaction contracts.
;; 2. Multi-Interaction Support: Allows users to execute up to eight different interactions in one transaction.
;; 3. Error Handling: Implements a "best-effort" approach, attempting all interactions even if some fail.
;;
;; Core Components:
;; - Interaction Execution: Provides functions to execute single or multiple interactions.
;; - Error Clobbering: Continues execution of subsequent interactions even if earlier ones fail.
;;
;; Integration with Charisma Ecosystem:
;; - Interaction Contracts: Executes actions on various protocol components through standardized interfaces.
;; - Dungeon Keeper: Relies on for interaction verification and privileged operations (indirectly through interactions).
;; - Token Contracts: Interacts with Experience, Energy, DMG, and Charisma token contracts indirectly through verified interactions.
;;
;; Key Functions:
;; - interact: Executes a single interaction with the specified action.
;; - explore: Executes up to eight different interactions in a single transaction.
;;
;; Security Features:
;; - Interaction Isolation: Each interaction is executed independently, preventing cascading failures.
;; - Non-Privileged Execution: The Dungeon Crawler itself does not perform sensitive operations, relying on properly verified interaction contracts.
;;
;; Error Handling Philosophy:
;; The Dungeon Crawler implements a "best-effort" approach to interaction execution:
;; - In single interactions, errors are propagated to the caller for handling.
;; - In multi-interaction calls, the contract attempts to execute all provided interactions, regardless of individual failures.
;; - This approach ensures maximum utility from each transaction while isolating failures.
;;
;; This contract is crucial for enabling flexible and robust user engagement with the Charisma protocol.
;; It provides a streamlined interface for executing complex sequences of interactions while maintaining
;; system integrity. The architecture supports the protocol's innovative approach to multi-faceted
;; blockchain interactions, allowing for complex operations to be performed in a single transaction.
(use-trait interaction-trait .dao-traits-v6.interaction-trait)
(define-public (interact (interaction <interaction-trait>) (action (string-ascii 32)))
(contract-call? interaction execute action))
(define-public (explore
(interaction-1 <interaction-trait>) (action-1 (string-ascii 32))
(interaction-2 <interaction-trait>) (action-2 (string-ascii 32))
(interaction-3 <interaction-trait>) (action-3 (string-ascii 32))
(interaction-4 <interaction-trait>) (action-4 (string-ascii 32))
(interaction-5 <interaction-trait>) (action-5 (string-ascii 32))
(interaction-6 <interaction-trait>) (action-6 (string-ascii 32))
(interaction-7 <interaction-trait>) (action-7 (string-ascii 32))
(interaction-8 <interaction-trait>) (action-8 (string-ascii 32)))
(begin
(match (interact interaction-1 action-1) success true error false)
(match (interact interaction-2 action-2) success true error false)
(match (interact interaction-3 action-3) success true error false)
(match (interact interaction-4 action-4) success true error false)
(match (interact interaction-5 action-5) success true error false)
(match (interact interaction-6 action-6) success true error false)
(match (interact interaction-7 action-7) success true error false)
(match (interact interaction-8 action-8) success true error false)
(ok true)))