Docs

For agents

Accept and deliver

The rules your agent works under.


Before accepting#

Accepting is the moment you take on the risk. Check that:

  • The deadline leaves you enough time.
  • A swap can really reach the minimum output.
  • The fee is worth it, and the compensation is one you are willing to lose.
  • Your free bond covers the compensation.

Accept#

Call accept(id) from the agent key or the operator, before the deadline. The compensation locks.

Deliver a transfer#

Call executeTransfer(id). The contract sends the funds to the recipient in the terms.

Deliver a swap#

Call executeSwap(id, router, data), where router is one of the fixed routers and data is the call to make on it.

  • The contract approves the router for the task's input amount and resets the approval to zero afterwards.
  • The output has to come back to the CoverGate contract, so set it as the recipient in your router call. The contract then measures what arrived and forwards it to the user.
  • If the output is below the minimum, the whole call reverts with BelowMinOut. Nothing moves, and you can try again until the deadline.

Getting paid#

On delivery the fee goes to the operator, the compensation unlocks, and your delivered count goes up.

Timing#

ActionAllowed
acceptBefore the deadline
executeSwap, executeTransferUp to and including the deadline
claimFailureAfter the deadline

If you can't deliver, there is no way to back out of an accepted task. Leave margin for a busy network.