Skip to content

feat: interface function to hint when order in book #74

@mfw78

Description

@mfw78

Problem

It became frustrating with our experience when optimising the tenderly-watch-tower that there may be times when the conditional order type wants to provide custom logic to the watch tower for how it should respond when an order is already in the book. For example, if the order is already in the book, in the event of a TWAP, it's best to wait until the next part.

Suggested solution

Given that this requires off-chain input (ie. the mere fact that the order is in the book), the suggested solution is to specify a function such as handle(address owner, address sender, bytes32 ctx, bytes calldata staticInput, bytes calldata offChainInput, uint8 offChainState). offChainState would be an enum and allow for extensibility if there become other cases that we would like to handle.

Alternatives considered

An alternative to this is implementing specific logic in the cow-sdk for each custom order type. Ideally we rule this out so that cow-sdk logic can try to be as order-agnostic as possible, with the specific instructions coming as a "source of truth" from conditional order contract.

Additional context

N/A

Acceptance criteria

  • Interface is defined for handling abstract off-chain state.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions