Triggers

What can you trigger with HAL?

HAL currently supports 3 types of trigger:

  • Watch contracts - State changes of specific smart contracts’ variables (exposed via getter functions) or any kind of value returned by a view Solidity/Vyper function. You can use this to track what happens in any contract you care about.

  • Watch transactions - Triggers based on Ethereum transactions. You can use basic filters (from, to, gas, gas price, value, nonce) or, in the case of a transaction to a smart contract, advanced multi-filters based on any parameter (arrays’ specific indexes included). It works even if that smart contract doesn't handle events/the events you would like to trigger.

  • Watch events - Triggers based on Ethereum Events. You can apply filters to both indexed and not-indexed parameters of the selected event.

Trigger is a general purpose interface:

interface Trigger {
  UUID: UUID!
  name: String!
  type: TriggerType!
  createdAt: Timestamp!
  updatedAt: Timestamp
  isActive: Boolean!
  matchesCount: Int
  # Actions
  actions: [Action!]!
}

TriggerType can be:

enum TriggerType {
  ContractsTrigger
  EventsTrigger
  TransactionsTrigger
}

and is implemented adding a statement describing the conditions of that specific TriggerType.

For example, for Watch transactions:

type TransactionsTrigger implements Trigger {
  UUID: UUID!
  name: String!
  type: TriggerType!
  createdAt: Timestamp!
  updatedAt: Timestamp
  isActive: Boolean!
  matchesCount: Int!
  # Actions
  actions: [Action!]!
  # Custom TransactionsTrigger fields
  statement: TransactionsTriggerStatement!
}

Last updated