Skip to content

Implement ToB order execution #8

@jubeira

Description

@jubeira

In the Uni-Angstrom implementation, the sender is the node, but the funds don't come from / to the node.

This is a departure from the usual pattern we follow for routers where msg.sender is the account that wants to swap with the pools.

In Angstrom's case, we have:

  • The node is msg.sender, and can unlock the system by calling the angstrom router directly.
  • Swappers that participate in the auction and send tokens in to the vault / receive tokens out

The Uni implementation supports many swappers per transaction, and the batch swap is separated from what each user actually receives. For this to work the swappers pre-approve the router for the tokens to be used, and then they have to sign a message that indicates that they effectively want to trade.

I'd suggest doing this in stages. First, let's just separate msg.sender from the swapper. This will require:

  • Adding extra inputs to the entrypoints
  • Validating the signature
  • Sending tokens from / to the swapper

After all of this is done, we can think about supporting many swappers in a later stage. Regarding the signatures: we shall support ECDSA and ERC-1271.

In the Uni implementation, swaps are completely separated from settlement, meaning that one batch swap can then be used to settle with many swappers. We can either adopt that pattern, or have one batch swap per user (TBD).

See reference implementation.

Metadata

Metadata

Assignees

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