feat: vault redemption preview, OpenAPI examples, audit log filters, negative yield simulator support - #1455
Merged
github-actions[bot] merged 5 commits intoOct 2, 2026
Conversation
Server - GET /api/admin/audit-logs and its CSV export accept `wallet`, `action` (one, comma-separated, or repeated) and `startDate`/`endDate`, validated once in utils/auditFilters.ts. - Invalid filters answer 400 with a stable code (INVALID_WALLET, INVALID_ACTION, INVALID_DATE, INVALID_DATE_RANGE, INVALID_FILTER) instead of an empty page: an unparseable date used to become NaN, which made every comparison false and silently returned nothing. - A wallet matches the acting identity, the target resource, or a wallet recorded under a wallet-like key of `changes`. A date-only endDate covers the whole UTC day, and dates without a zone are rejected because they parse as local time. - The list response echoes the normalised filters. The export now returns up to 10,000 matching rows instead of silently stopping at the default page of 100, and sets X-Audit-Export-Truncated when it hits the cap. Client - New /admin/audit-logs page with wallet, action and date-range filters, client-side validation that mirrors the server, cursor paging, CSV export, and loading, empty, forbidden and unavailable states that never show raw server output. Closes edehvictor#1406
…lators The rebalance preview and backtest rejected any APY below zero, so users could not model a depeg, a slashing event or a strategy that costs more than it earns. Server - Accept a negative `apy` down to -100 (a total loss over a year) and negative `dailyApy` entries down to -36500, where the daily compounding factor reaches zero. `dailyApy` was not validated at all before; it now rejects NaN, Infinity, non-numbers, non-arrays and oversized series, naming the offending index. - The engine floors the daily factor at zero, skips rebalancing when nothing is left, and no longer produces NaN weights or blended APY for a wiped-out portfolio. - The backtest result adds negativeYieldDays, maxDrawdownPct and passiveMaxDrawdownPct. New structured warnings: NEGATIVE_YIELD_PERIOD (per allocation, and per leg in the preview) and CAPITAL_LOSS. - The vault contract already charges its performance fee only on positive yield, so no contract change is needed; the simulator models turnover fees only. Client - The APY field keeps the raw text, so a lone "-" can be typed on the way to "-5" (the old number input with a `|| 0` fallback swallowed it, and had min=0). Values are parsed and bounds-checked on submit with a message that names the allocation. - Show max drawdown and negative-yield days, and surface the server's 400 `details` instead of only "Invalid backtest parameters". Closes edehvictor#1407
Before signing a partial withdrawal the user now sees how many shares are burned, what they receive, the share price, and what is left. Shared - shared/types/vaultRedemption.ts holds the math once, in BigInt so amounts beyond 2^53 stay exact. Rounding favours the vault (ERC-4626): redeeming shares rounds the assets down, withdrawing an exact asset amount rounds the shares up, and the burned shares' surplus is reported as rounding dust. Server - POST /api/vaults/:vaultId/redemption-preview accepts shares, assets, or a percentage of the position, plus an optional exit fee and dust threshold. Amounts travel as integers or digit strings and come back as strings. - Typed errors (INVALID_VAULT_STATE, INVALID_REQUEST, INVALID_AMOUNT, INVALID_PERCENT, INSUFFICIENT_SHARES with the maximum, REDEMPTION_TOO_SMALL, VAULT_EMPTY) instead of raw provider output; DUST_REMAINDER and REMAINDER_WORTHLESS warnings. Client - The withdraw panel gains 25/50/75/100% presets and a preview that updates as the amount changes, using the same math against the vault's on-chain totals. If the totals cannot be read it says so and does not block the withdrawal. Closes edehvictor#1404
…saction intent endpoints
Add OpenAPI request/response examples for all transaction intent endpoints:
- /api/onramp/quote (step 1: get fiat-to-USDC conversion quote)
- /api/onramp/intent (step 2: confirm quote and create pending transaction)
- /api/onramp/status/{txId} (step 3: poll for transaction completion)
- /api/onramp/cancel (cancel pending transaction)
- /api/offramp/* endpoints (withdrawal flow)
Examples cover normal paths and meaningful edge cases (invalid amounts,
missing currencies, quote expiration). Improves API documentation clarity
for integrators. Updated OpenAPI schema snapshot.
Closes edehvictor#1405
|
Someone is attempting to deploy a commit to the Edeh Victor's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@Emeka-12 this PR currently has merge conflicts. Please resolve the conflicts before it can be merged automatically. |
…it-filters-negative-yield
|
Good job. |
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.
Summary
Test plan
npm run testinserver/; snapshot diff should show only the new examples.Closes #1404
Closes #1405
Closes #1406
Closes #1407