Repository navigation
Report Solana trade fees and return executedFee on /orders - #5302
Open
squadgazzz wants to merge 12 commits into
Open
squadgazzz wants to merge 12 commits into
squadgazzz wants to merge 12 commits into
Conversation
…a quote The fresh quote of a placed order returns a typed error, so placement follows the outcomes of the EVM `get_or_create_quote`: - No driver has a route, or a token has no native price: the order is placed without a quote, like the EVM `PriceEstimationError::NoLiquidity`. - The costs swallow the amount: the order is placed without a quote. The EVM orderbook stores such a quote and classes the order out of market, which an order without a quote is too. - A driver failed, the verification dropped every quote, or the price lookup is rate limited: the order is rejected with the quote's 404 `NoLiquidity`. The quoter reports no liquidity only when every driver answered `QuotingFailed`, and reads that from the body under any status, like the EVM orderbook. The fresh quote asks for a verified one. The native payout check of the quoted amount moves to the quote endpoint, since placement checks the payout of the order's own limit.
… order its own cost
…09-placement-quote
…derbook/be-509-quote-record
|
Reminder: Please consider backward compatibility when modifying the API specification.
Caused by: |
squadgazzz
marked this pull request as ready for review
November 17, 2026 19:41
Contributor
|
Claude finished @squadgazzz's task in 1m 19s —— View job ReviewI found one issue and left it as an inline comment: the I checked the rest and found no problems:
|
|
🤖 Claude reviewed this PR. Any issues are posted as inline comments on the relevant lines.
Won't run when: the PR is a draft, the author is a bot or lacks write access, or the |
…lana-autopilot/be-534-executed-fee # Conflicts: # crates/autopilot-svm/src/infra/order_execution.rs
Base automatically changed from
solana-autopilot/be-497-executed-protocol-fees
to
main
November 20, 2026 14:13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
A Solana order's
executedFeeon/ordersshould be everything taken from its fills, in the sell token, like on EVM. Solana's/ordersdoes not return it.The driver takes three amounts out of each fill before reporting it: the execution cost (rent and a share of the network fee), the solver fee and the protocol fee. They come out of the surplus token (the buy token of a sell order).
/solvereported none of them, and without clearing prices the autopilot cannot recover them.This PR reports their sum per trade on
/solveasfee, and the autopilot stores it with the proposed solution. The sweep task from #5301 converts the winning solution's fee to the sell token, for a sell order at the fill's rate before the fee:Changes
feeonproposed_trade_executions, and the sweep task writesorder_execution.executed_feein the sell token/ordersreturnsexecutedFee,executedFeeTokenandexecutedSellAmountBeforeFees, OpenAPI updatedautopilot/src/domain/settlement/trade/math.rs:126)autopilot/src/domain/settlement/trade/math.rs:104)autopilot/src/domain/settlement/mod.rs:139)/orderslike EVM'sCOALESCE(database/src/orders.rs:706)feeyetexecutedFeeTokendatabase/src/orders.rs:707)executedSellAmountBeforeFeesorderbook/src/database/orders.rs:622)How to test
New unit, DB and API tests.
Related issues
BE-534