Summary
DorkFiMCP's deposit_txn (and related deposit flows) should detect when a deposit would exceed the market deposit cap and fail early with a clear error, instead of building/signing and potentially failing on-chain or giving a confusing result.
Problem
When a user calls deposit_txn with an amount that would push total supplied (e.g. existing supply + new deposit) over the market's deposit cap:
- The MCP may build transactions that will fail on-chain or behave unexpectedly
- Users get a poor experience (e.g. signing then failure, or unclear reason for failure)
- No upfront validation against the cap in the MCP layer
Expected behavior
- Before building
deposit_txn, DorkFiMCP should:
- Resolve the market's deposit cap (if any) and current total supplied / user supply
- Compute whether
current supply + deposit amount would exceed the cap
- If over cap: return a clear error (e.g. "Deposit would exceed market cap: current X, cap Y, requested Z") and do not return transaction bytes
- If there is no cap or cap is not applicable, proceed as today
Suggested implementation
- In the code path that handles
deposit_txn (and any wrapper that uses it):
- Fetch market info (e.g. via
get_market or equivalent) including deposit cap and current supplied amounts
- Optionally fetch user's current supply in that market
- Validate
(user_current_supply + deposit_amount) and/or (total_supplied + deposit_amount) against cap
- If over cap, return a structured error and no
txn payload
- Add or extend MCP/unit tests for: at-cap, over-cap, and no-cap scenarios
Context
Improves UX and reliability for DorkFi MCP callers; aligns with deposit cap behavior in the app (see e.g. DorkFi/dorkfi-app#246).
Summary
DorkFiMCP's
deposit_txn(and related deposit flows) should detect when a deposit would exceed the market deposit cap and fail early with a clear error, instead of building/signing and potentially failing on-chain or giving a confusing result.Problem
When a user calls
deposit_txnwith an amount that would push total supplied (e.g. existing supply + new deposit) over the market's deposit cap:Expected behavior
deposit_txn, DorkFiMCP should:current supply + deposit amountwould exceed the capSuggested implementation
deposit_txn(and any wrapper that uses it):get_marketor equivalent) including deposit cap and current supplied amounts(user_current_supply + deposit_amount)and/or(total_supplied + deposit_amount)against captxnpayloadContext
Improves UX and reliability for DorkFi MCP callers; aligns with deposit cap behavior in the app (see e.g. DorkFi/dorkfi-app#246).