mirror of
https://github.com/luxfi/dex.git
synced 2026-09-24 00:26:31 +00:00
The swap looked for the venue that had priced the trade in the per-chain set alone, while the quote falls back to the single set a one-chain deployment is handed. Configured the second way, this surface priced a pair and then reported the venue that had just priced it as unregistered. Both go through Server.arms now, and Server.arm is that set looked up by the name a venue calls itself. The swap also rebuilt the quote request by hand beside convertQuoteRequest, which does the same thing for the quote path — six of seven fields, twice, free to drift about what slippage or isExactIn mean. swapRequest embeds quoteRequest; encoding/json flattens it, so the wire shape is unchanged and there is one conversion. Co-authored-by: Hanzo Dev <[email protected]>
24 lines
880 B
Go
24 lines
880 B
Go
package gateway
|
|
|
|
// The shapes POST /v1/trade/swap speaks.
|
|
//
|
|
// What used to live here — a calldata builder aimed at the PoolManager
|
|
// precompile at 0x9010, whichever venue had actually priced the trade — is
|
|
// gone. Each venue builds its own transaction now (venue_swap.go), because the
|
|
// venue that read the price is the only thing that knows what executes it.
|
|
|
|
// A swap is a quote plus where the proceeds go, so it is that request plus two
|
|
// fields rather than a second copy of the same six. Embedding flattens in JSON,
|
|
// so the shape on the wire is unchanged — and the two cannot drift about what
|
|
// slippage or isExactIn mean.
|
|
type swapRequest struct {
|
|
quoteRequest
|
|
Recipient string `json:"recipient"`
|
|
Deadline int64 `json:"deadline,omitempty"`
|
|
}
|
|
|
|
type swapResponse struct {
|
|
Swap UnsignedTxResponse `json:"swap"`
|
|
Quote SwapQuote `json:"quote"`
|
|
}
|