Cron triggers

Trigger actions to check contract state at specific intervals

Cron triggers define the time intervals through a cron object with two fields:

  • timezone: the + or - hours in relation to UCT

  • rule: a temporal definition using the standard unix cron job syntax

Rule definition

In each field you can define time conditions by using those operators:

Examples

Create a cron trigger

mutation {
  createCronTrigger(input: {
  name: "HELLO CRON",
  type: CronTrigger,
  statement: {
    cron: {
      rule: "*/2 * * * *"
      timezone: "-0000"
    }
    contract: {
      address: "0xeead394A017b8428E2D5a976a054F303F78f3c0C",
      abi: [
        {
          inputs: [
            {
              internalType: "contract IConverterAnchor",
              name: "_poolAnchor",
              type: "address"
            }
          ],
          name: "poolAvailableSpace",
          outputs: [
            {
              internalType: "uint256",
              name: "poolAvailableSpace-0",
              type: "uint256"
            },
            {
              internalType: "uint256",
              name: "poolAvailableSpace-1",
              type: "uint256"
            }
          ],
          stateMutability: "view",
          type: "function"
        }
      ]
    },
    inputs: [
      {
        type: "address",
        name: "_poolAnchor",
        value: "0x8b3082e273E4B923830c637a203c1C1D963cA307"
      },
    ],
    method: {
      name: "poolAvailableSpace"
    }
  },
  actions: [
    {
      type: Webhook,
      attributes: {
        uri: "http://www.dasa"
      }
    }
  ]
}) {
    UUID
  }
}

Last updated