Skip to main content

x/act

Overview

The IAct precompile allows calling the x/act module from EVM smart contracts.

In this article, you'll find a full list of available methods and events. You can use them for querying and managing the following components:

Precompile address

To reference the IAct precompile in your code, use the following precompile address:

0x0000000000000000000000000000000000000901

Rules

Query Rules

  • Method: templates()
  • Description: Returns a list of all Rules (templates). See the TemplatesResponse struct.
  • Parameters :
    @param pagination The pagination details
    @param creator The template creator
  • Output:
    @return response The paged templates

Query a Rule by ID

  • Method: templateById()
  • Description: Returns a Rule (template) by ID. See the TemplateByIdResponse struct.
  • Parameters :
    @param templateId The id of the template
  • Output:
    @return response The template

Create a new Rule

  • Method: newTemplate()
  • Description: Creates a new Rule (template). Emits the CreateTemplate event.
  • Parameters :
    @param name The template name
    @param definition The template definition
  • Output:
    @return template id

Update a Rule

  • Method: updateTemplate()
  • Description: Updates a Rule (template). Emits the UpdateTemplate event.
  • Parameters :
    @param templateId The id of the template
    @param name The template name
    @param definition The template definition
  • Output:
    @return true If execution was successful

Actions

Query Actions

  • Method: actions()
  • Description: Returns a list of all Actions. See the ActionsResponse struct.
  • Parameters :
    @param pagination The pagination details
  • Output:
    @return response The paged actions

Query Actions by address

  • Method: actionsByAddress()
  • Description: Returns a list of Actions by participant address – ActionsByAddressResponse. You can filter the output by ActionStatus.
  • Parameters :
    @param pagination The pagination details
    @param addr The participant address
    @param status The action status
  • Output:
    @return response The paged actions

Query an Action by ID

  • Method: actionById()
  • Description: Returns an Action by ID. See the ActionByIdResponse struct.
  • Parameters :
    @param actionId The id of the action
  • Output:
    @return response The action

Query the Action status by ID

  • Method: checkAction()
  • Description: Returns the status of an Action with a given ID. See the ActionStatus enum.
  • Parameters :
    @param actionId The action id
  • Output:
    @return action status

Vote for an Action

  • Method: voteForAction()
  • Description: Votes for an Action. Emits the ActionVoted event, returns ActionStatus.
  • Parameters :
    @param actionId The id of the action
    @param voteType The type of the vote
  • Output:
    @return action status

Revoke an Action

  • Method: revokeAction()
  • Description: Revokes an Action.
  • Parameters :
    @param actionId The id of the action
  • Output:
    return true If execution was successful

Structs

Template

  • Description: A struct representing a Rule (template).
struct Template {
uint64 id;
address creator;
string name;
string expression;
}

TemplatesResponse

struct TemplatesResponse {
Types.PageResponse pagination;
Template[] templates;
}

TemplateByIdResponse

struct TemplateByIdResponse {
Template template;
}

Action

  • Description: A struct representing an Action. Includes the ActionStatus enum.
struct Action {
uint64 id;
ActionStatus status;
Types.AnyType msg;
Types.AnyType result;
address creator;
uint64 timeoutHeight;
Types.Timestamp createdAt;
Types.Timestamp updatedAt;
string approveExpression;
string rejectExpression;
address[] mentions;
ActionVote[] votes;
}

ActionsResponse

struct ActionsResponse {
Types.PageResponse pagination;
Action[] actions;
}

ActionsByAddressResponse


struct ActionsByAddressResponse {
Types.PageResponse pagination;
Action[] actions;
}

ActionByIdResponse

struct ActionByIdResponse {
Action action;
}

Enums

ActionStatus

  • Description: The status of an Action.
enum ActionStatus { Unspecified, Pending, Completed, Revoked, Timeout }

VoteType

  • Description: The vote type.
enum VoteType { None, Approve, Reject }

Events

CreateTemplate

  • Description: An event emitted when a Rule is created.
  • Parameters:
    @param name The template name
    @param definition The template definition

UpdateTemplate

  • Description: An event emitted when a Rule is updated.
  • Parameters:
    @param creator The address of the creator
    @param templateId The template id

CreateAction

  • Description: An event emitted when an Action is created.
  • Parameters:
    @param author The address of the author
    @param templateId The template id

ActionStateChange

  • Description: An event emitted when the status of an Action is changed.
  • Parameters:
    @param author The address of the author
    @param actionId The action Id
    @param previousStatus The previous status of the action
    @param newStatus The new status of the action

ActionVoted

  • Description: An event emitted when an Action is voted on. Includes the VoteType enum.
  • Parameters:
    @param participant The address of the participant
    @param actionId The action Id
    @param voteType The type of the vote