Skip to content

Expose order context #7

@0xdapper

Description

@0xdapper

Right now hooks are arbitrary calls with no contexts. If I want to write something permissioned for the hook callback there is no way to do it reliably right now because there is no information about the order, order's owner, etc. Exposing the context in general would allow the hooks consumers to use it and open more possibilities of what can be done. I suggest something like:

Order public order;

modifier withOrder(Order memory _order) {
  order = _order;
  _;
  order = EMPTY_ORDER;
}

function execute(Order calldata order, Hook[] calldata hooks) external onlySettlement withOrder(order) {
  ...
}

This will set the order variable transiently for the call stack and context of each hook and clear it at the end. The hook contract can then query the same from trampoline contract if they want to.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions