Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose order context #7

Open
0xdapper opened this issue Jul 14, 2023 · 1 comment
Open

Expose order context #7

0xdapper opened this issue Jul 14, 2023 · 1 comment

Comments

@0xdapper
Copy link

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.

@mfw78
Copy link
Contributor

mfw78 commented Jul 14, 2023

With the upcoming EIP-1153, this becomes much cheaper, and therefore potentially feasible to implement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants