2.0.0 • Published 4 months ago

@veive-io/mod-execution-as v2.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

Mod Execution

Overview

mod-execution-as is a core library in the Veive protocol, dedicated to supporting the creation and integration of execution modules. These modules are responsible for carrying out specific operations within the smart accounts on the Koinos blockchain. The library provides essential tools and interfaces to build robust execution logic, ensuring that operations such as token transfers, smart contract calls, or other blockchain actions are executed correctly.

Components and Functional Description

The mod-execution-as library includes key components that facilitate the development and integration of execution modules:

1. ModExecution Class

  • Description: The ModExecution class serves as the foundational class for all execution modules. Developers extend this class to implement the logic necessary for executing specific operations within the Veive protocol.
  • Key Methods:

    • execute: This method is central to the execution module's functionality. It is called to perform a specified operation, such as a smart contract call or other blockchain-related actions. Developers override this method to define the exact logic for executing the operation.
    • on_install and on_uninstall: These methods manage the setup and teardown of the execution module. During installation, on_install initializes any necessary resources or storage. Conversely, on_uninstall handles cleanup tasks, ensuring that the module is properly removed without leaving residual data.
    • is_type: This method verifies whether the module matches a specific type, using the type ID defined in the module's manifest. It ensures compatibility and proper integration within the smart account framework.
  • Use Case: When creating a new execution module, developers extend the ModExecution class and implement the execute method to define how specific operations are carried out. This could include actions like executing smart contract methods, transferring assets, or interacting with other on-chain entities.

2. modexecution Proto

  • Description: The modexecution protocol buffer (proto) defines the data structures necessary for describing and transmitting data related to execution modules.
  • Purpose: This proto standardizes the format and structure of data passed between the smart account and execution modules, ensuring consistent and reliable communication.
  • Components:
    • Data Structures: Includes types and structures used to describe execution commands, module metadata, and operational parameters.

Usage and Integration

Integration in the Veive Protocol

The mod-execution-as library is integral to the Veive protocol's modular design. It interacts closely with the account-as module, allowing smart accounts to utilize execution modules to perform various blockchain operations.

Flow Integration:

  • The ModExecution class and its associated methods are invoked whenever an operation needs to be executed. The execution module takes the operation details and performs the necessary actions, ensuring that the operation adheres to the rules and protocols defined by the account and the blockchain.

Development and Customization:

  • Developers can customize the ModExecution class to create execution modules tailored to specific needs, such as custom asset transfers, complex multi-step transactions, or specialized contract interactions.

Scripts

Build

To compile the package, run:

yarn build

Contributing

Contributions are welcome! Please open an issue or submit a pull request on the GitHub repository.

License

This project is licensed under the MIT License. See the LICENSE file for details.