• Ask to schedule the execution of a function at a given address in the future.

    Remarks

    The goal of sendMessage functionality is to send a message in the future, that will be executed as soon as possible after the start period but not after the end period.

    You might want to use the sendMessage functionality:

    • Having a smart contract called periodically, without a centralized bot;
    • Having a smart contract that will trigger on the change of value (for example a change in price), of an other one;
    • Having an object that evolves on the blockchain itself.

    This message allows you to make executions in the future and they are executed deterministically on all nodes. The execution is made "as soon as possible" because there is a priority on messages and a limit of messages possibly executed on each slot. More precisely, if you send a low amount of rawFee then your message could possibly not executed directly at the first slot of the slot period. If all of the slots of the specified period have a large load of messages, with more fees than you specified, then it's highly likely that your message will never be executed.

    Additionally, there is an optional filter on a message that adds a new condition on the trigger instead of: "as soon as possible in this range", it becomes "as soon as possible, after this field has been updated, in the state, in this range".

    As a parameter, you can pass the filterAddress, and also an optional datastore filterKey.

    If you pass only an address, then the message will be executed only after: "we are in the range, and a change has happened during this range on the filterAddress" (possibly balance etc). If you provide a filterKey, the condition of the execution of the message is: "we are in the range, and a change has happened during this range on the filterAddress at that datastore filterKey"

    Note: serialization is to be handled at the caller and the callee level.

    Parameters

    • at: Address

      Address of the contract

    • functionName: string

      name of the function in that contract

    • validityStartPeriod: number

      Period of the validity start slot

    • validityStartThread: number

      Thread of the validity start slot

    • validityEndPeriod: number

      Period of the validity end slot

    • validityEndThread: number

      Thread of the validity end slot

    • maxGas: number

      Maximum gas for the message execution

    • rawFee: number

      Fee to be paid for message execution

    • coins: number

      Coins of the sender

    • functionParams: StaticArray<number>

      function parameters serialized in bytes

    • filterAddress: Address = ...

      If you want your message to be trigger only if a modification is made on a specific address precise it here

    • filterKey: StaticArray<number> = ...

      If you want your message to be trigger only if a modification is made on a specific storage key of the filterAddress precise it here

    Returns void

Generated using TypeDoc