-
Notifications
You must be signed in to change notification settings - Fork 465
asset-swapper: DFB support + refactors #2536
asset-swapper: DFB support + refactors #2536
Conversation
4b98f93
to
e0e8546
Compare
@@ -127,7 +127,7 @@ export interface OptimizedMarketOrder extends SignedOrderWithFillableAmounts { | |||
/** | |||
* The optimized fills that generated this order. | |||
*/ | |||
fill: CollapsedFill; | |||
fills: CollapsedFill[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So now orders have an array of collapsed fills instead of a single one. Fun.
df69b02
to
c4dd4d8
Compare
2905768
to
ff75918
Compare
makerAssetAmount: fr.totalMakerAssetAmount, | ||
takerAssetAmount: fr.takerAssetAmount, | ||
totalTakerAssetAmount: fr.totalTakerAssetAmount, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A consequence of this new approach is that both the maker (in buys) and taker (in sells) asset amounts can theoretically deviate from the input amount slightly when fees are involved. In practice they're probably almost always the same though. So if we want to reference a fixed buy or sell amount in the API, we should be using the quote.makerAssetAmount
or quote.takerAssetFillAmount
, not the best or worst case values. Just something to note.
e38f768
to
c6379ca
Compare
`@0x/contract-addresses`: Redeploy `DexForwarderBridge` on Mainnet with Gas Token freeing `@0x/contract-addresses`: Revert to older Curve Bridge (without Gas Tokens)
Description
This adds DexForwarderBridge support AS. When creating the orders, we batch contiguous bridge paths into a single DFB order, so it only pays a single protocol fee. This functionality can be disabled with the
shouldBatchBridgeOrders
SwapQuoter option.I've also massively refactored
swap_quote_calculator.ts
. I created some new functions inquote_simulation.ts
whose responsibility is to simulate filling the quote. These first transform the quote orders into a side-agnostic format to remove the need for all the nasty branching logic. So instead of filling a straight maker -> taker asset order, it ends up filling input -> output orders.We also now have best-case gas estimation and best-case source composition (i.e., what sources were actually used). So now
bestCaseQuoteInfo.gas <= worstCaseQuoteInfo.gas
, where they were previously equivalent. AlsosourceBreakdown
now only includes the sources consumed in the best case, so no fallback orders.Testing instructions
Types of changes
Checklist:
[WIP]
if necessary.