Skip to content

Commit 171d8d3

Browse files
committed
chore: bump to v1.1.5 — AMA refit, oversized-deal splitter, doc sync
Two post-v1.1.4 changes packaged as a minor release plus a doc-sync pass that closes stale references left behind when the splitter landed. ## Feat: AMA refit Files: `modules/constants.ts`, `analysis/ama_fitting/optimizer_high_resolution.ts` - Refit on 3yr pool 133 1h data (2023-07 → 2026-07) with per-AMA λ weights (0.0031/0.0025/0.00185/0.0013) and SMA-warmup-aligned optimizer. - Slow periods: AMA1 73.3→62.1, AMA2 80.6→71.7, AMA3 88.7→82.7, AMA4 102.4→95.5. Default slow range narrowed 40-160→35-140. - New `--fixEr` / `--fixFast` CLI flags fix ER=781 / Fast=5.2 and search Slow only. Stale references in market_adapter/README.md, TradingView README, and two test fixtures updated. ## Feat: maxBorrowAmountPerOperation + oversized-deal splitter Files: `modules/types.ts`, `modules/bot_settings.ts`, `modules/credit_runtime.ts`, `modules/cr_planner.ts`, `tests/test_credit_runtime.ts` - New per-op borrow cap on `LendingEntryBase`; rejected at `buildCreditOfferAcceptOperation` and clamped in the MPA planner. - `_splitOversizedCreditDeals` runs as Phase 0 of credit maintenance: splits deals whose debt exceeds the cap into equal pieces via atomic repay+reborrow with 6s spacing, capped at `TIMING.CREDIT_DEAL_SPLIT_MAX_PIECES=48` per cycle. `_splitInFlight` concurrency guard prevents runMaintenance / runCreditWatchdog overlap. - 6 new tests cover per-op rejection, offer-selection capping, correct split arithmetic, within-limit skip, no-limit skip, error-pattern match. ## Fix: Split settle-delay resolves from TIMING constant File: `modules/credit_runtime.ts` - `_doSplitOversizedCreditDeals` now reads `BLOCKCHAIN_SETTLE_DELAY_MS` from the imported `TIMING` constant, consistent with `dexbot_maintenance_runtime.ts`. Per-bot `bots.json` overrides for this field are no longer honoured for split pacing. ## Docs: Stale MPA/credit references closed Files: `docs/MPA_CREDIT_USAGE.md`, `docs/developer_guide.md` - Added `maxBorrowAmountPerOperation` to the Field Reference, the Amount Cap Semantics table, and the "Which section do I need?" quick-ref table. - New "Oversized Credit Deal Splitter" subsection documents Phase 0 behavior, `CREDIT_DEAL_SPLIT_MAX_PIECES`, `_splitInFlight`, the `min_deal_amount` guard, and shutdown abort. - Runtime Timing now lists `CREDIT_DEAL_SPLIT_MAX_PIECES` and `BLOCKCHAIN_SETTLE_DELAY_MS`. Related Files adds `cr_planner.ts` and `types.ts` (`LendingEntryBase`). - developer_guide.md Key Rules extended to mention the per-op cap with splitter. ## Version sync Files: `package.json`, `package-lock.json`, `claw/package.json`, `claw/runtimes/openclaw-plugin/package.json`, `claw/runtimes/openclaw-plugin/openclaw.plugin.json`, `analysis/ama_fitting/package.json`, `claw/tests/test_claw_mcp_transport.ts` - Version bumped 1.1.4 → 1.1.5 across all 7 manifests. `version:check` clean. ## Testing Notes - `npm run version:check` — all manifests in sync
1 parent 05df6e7 commit 171d8d3

14 files changed

Lines changed: 60 additions & 29 deletions

CHANGELOG.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,21 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [1.1.5] - 2026-07-14 - AMA Refit, Oversized Credit Deal Splitter & Per-op Borrow Cap
6+
7+
### 2026-07-14
8+
9+
- **Feat**: AMA refit on 3yr pool 133 1h data (2023-07 → 2026-07) with per-AMA λ weights (0.0031/0.0025/0.00185/0.0013) and SMA-warmup-aligned optimizer. Slow periods updated AMA1 73.3→62.1, AMA2 80.6→71.7, AMA3 88.7→82.7, AMA4 102.4→95.5. Default slow range narrowed 40-160→35-140. New `--fixEr` / `--fixFast` CLI flags fix ER=781 / Fast=5.2 and search Slow only. CLI validation adds `--ama1Cap``--ama4Weight` properties, removing 8 `(out as any)` casts. Stale references updated in market_adapter/README.md, TradingView README, and two test fixtures (`analysis/ama_fitting/optimizer_high_resolution.ts`, `modules/constants.ts`, `market_adapter/README.md`, `analysis/tradingview/README.md`, `tests/test_market_adapter_log_format.ts`, `tests/test_market_adapter_logic.ts`).
10+
- **Feat**: add `maxBorrowAmountPerOperation` config field and `_splitOversizedCreditDeals` — when a credit deal exceeds `maxBorrowAmountPerOperation`, maintenance splits it into equal pieces via repay+reborrow cycles with 6s spacing. Planner clamps debtDelta by per-op cap on top of the total `maxBorrowAmount` ceiling. `min_deal_amount` guard skips deals where any piece would be below the offer's minimum deal size. `MAX_PIECES_PER_CYCLE=48` (new `TIMING.CREDIT_DEAL_SPLIT_MAX_PIECES`) prevents unbounded cycles. `_splitInFlight` concurrency guard prevents `runMaintenance` / `runCreditWatchdog` collisions. 6 new tests cover per-op rejection, offer-selection capping, correct split arithmetic, within-limit skip, no-limit skip, and error-pattern match (`modules/types.ts`, `modules/bot_settings.ts`, `modules/credit_runtime.ts`, `modules/cr_planner.ts`, `tests/test_credit_runtime.ts`).
11+
- **Fix**: settle-delay resolution for credit splits now reads from the `TIMING` constant instead of `bot.config.TIMING.BLOCKCHAIN_SETTLE_DELAY_MS` — consistent with `dexbot_maintenance_runtime.ts`. Any per-bot `TIMING.BLOCKCHAIN_SETTLE_DELAY_MS` override in `bots.json` is no longer honoured for split pacing (`modules/credit_runtime.ts`).
12+
513
## [1.1.4] - 2026-07-14 - AMA4 Slow Correction, Optimizer Range Tighten, Post-tag Doc Sync
614

715
### 2026-07-14
816

917
- **Fix**: correct AMA4 slowPeriod from 107.4 to 102.4 — aligns AMA4 with the same λ=0.0025 refit applied to AMA1-3 in v1.1.3. Fixes stale slowPeriod references in market_adapter/README.md, test fixtures, and TradingView chart generator (`modules/constants.ts`, `market_adapter/README.md`, `tests/test_market_adapter_log_format.ts`, `tests/test_market_adapter_logic.ts`, `analysis/tradingview/tradingview_uplot_chart_generator.ts`).
1018
- **Feat**: narrow optimizer slow search range from 50-200 to 40-160 — focuses the geometric grid on the range where fitted winners consistently land, reducing wasted evaluations at uncompetitive extremes (`analysis/ama_fitting/optimizer_high_resolution.ts`).
1119
- **Docs**: sync v1.1.3 release notes with amaS% retune (0.085→0.08), update DYNAMIC_WEIGHT_RESEARCH.md knob table, correct EVOLUTION.md commit count for v1.1.3 (2→4) and summary to include the amaS% retune (`CHANGELOG.md`, `analysis/trend_detection/DYNAMIC_WEIGHT_RESEARCH.md`, `docs/EVOLUTION.md`).
12-
- **Feat**: add `maxBorrowAmountPerOperation` config field and `_splitOversizedCreditDeals` — when a credit deal exceeds `maxBorrowAmountPerOperation`, maintenance splits it into equal pieces via repay+reborrow cycles with 6s spacing (`modules/types.ts`, `modules/bot_settings.ts`, `modules/credit_runtime.ts`, `modules/cr_planner.ts`).
13-
- **Fix**: settle-delay resolution for credit splits now reads from the `TIMING` constant instead of `bot.config.TIMING.BLOCKCHAIN_SETTLE_DELAY_MS` — consistent with `dexbot_maintenance_runtime.ts`. Any per-bot `TIMING.BLOCKCHAIN_SETTLE_DELAY_MS` override in `bots.json` is no longer honoured for split pacing (`modules/credit_runtime.ts`).
1420

1521
## [1.1.3] - 2026-07-13 - AMA Refit λ=0.0025, amaS% Retune, tsx Compatibility, Doc Fixes
1622

analysis/ama_fitting/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ama_fitting",
3-
"version": "1.1.4",
3+
"version": "1.1.5",
44
"description": "Tools for fitting AMA parameters to market data",
55
"main": "../../dist/analysis/ama_fitting/optimizer_high_resolution.js",
66
"scripts": {

claw/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dexbot2-claw",
3-
"version": "1.1.4",
3+
"version": "1.1.5",
44
"private": true,
55
"description": "Claw bridge and runtime integration layer for BitShares and DEXBot2.",
66
"type": "commonjs",

claw/runtimes/openclaw-plugin/openclaw.plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"id": "bitshares-claw",
33
"name": "BitShares Claw",
44
"description": "Native BitShares and DEXBot2 tools from the DEXBot2 claw integration",
5-
"version": "1.1.4",
5+
"version": "1.1.5",
66
"skills": [
77
"skills"
88
],
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "bitshares-claw-openclaw-plugin",
33
"private": true,
4-
"version": "1.1.4",
4+
"version": "1.1.5",
55
"type": "commonjs",
66
"main": "index.js"
77
}

claw/tests/test_claw_mcp_transport.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ async function testParserAcceptsJsonlAcrossChunksAndSingleBuffer() {
3030
capabilities: {},
3131
clientInfo: {
3232
name: 'claw-mcp-transport-test',
33-
version: '1.1.4'
33+
version: '1.1.5'
3434
},
3535
protocolVersion: '2024-11-05'
3636
}
@@ -181,7 +181,7 @@ async function testMainEntrypointHandlesRealProcessInitialize() {
181181
capabilities: {},
182182
clientInfo: {
183183
name: 'claw-mcp-transport-test',
184-
version: '1.1.4'
184+
version: '1.1.5'
185185
},
186186
protocolVersion: '2024-11-05'
187187
}

docs/DEXBOT_COMPARISON.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# DEXBot vs DEXBot2 — Detailed Comparison Report
22

33
> **Date:** 2026-07-11 *(metrics refreshed against local source trees)*
4-
> **Scope:** Full architectural, functional, and operational comparison between the original [DEXBot](https://github.com/Codaone/DEXBot) (Python, v1.0.0) and DEXBot2 (TypeScript, v1.1.4).
4+
> **Scope:** Full architectural, functional, and operational comparison between the original [DEXBot](https://github.com/Codaone/DEXBot) (Python, v1.0.0) and DEXBot2 (TypeScript, v1.1.5).
55
> **Audience:** Developers, contributors, and operators evaluating or migrating between the two projects.
66
77
---
@@ -36,7 +36,7 @@
3636

3737
| Attribute | DEXBot (original) | DEXBot2 |
3838
|---|---|---|
39-
| **Release Track** | 1.0.0 | v1.1.4 |
39+
| **Release Track** | 1.0.0 | v1.1.5 |
4040
| **Language** | Python 3.6+ | TypeScript 5.x |
4141
| **Status** | Released 1.0.0, unmaintained | Active development |
4242
| **Last Repo Activity** | May 23, 2020 | 2026-07-10 |
@@ -782,7 +782,7 @@ Where:
782782

783783
| Metric | DEXBot | DEXBot2 |
784784
|---|---|---|
785-
| **Release Track** | 1.0.0 | v1.1.4 |
785+
| **Release Track** | 1.0.0 | v1.1.5 |
786786
| **Active Since** | ~2018 | December 2025 |
787787
| **Last Commit** | May 23, 2020 | 2026-07-10 |
788788
| **Total Commits** | 2281 | 1713 at current HEAD |

docs/EVOLUTION.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
## Executive Summary
44

5-
DEXBot2 is a sophisticated decentralized exchange trading bot for the BitShares blockchain. This report documents the complete evolution of the project from its inception in December 2025 through the current 1.1.4 stable release.
5+
DEXBot2 is a sophisticated decentralized exchange trading bot for the BitShares blockchain. This report documents the complete evolution of the project from its inception in December 2025 through the current 1.1.5 stable release.
66

77
### Key Milestones
88
- **Project Inception**: December 2, 2025
9-
- **Growth Phase**: 1,724+ commits over ~7 active months
9+
- **Growth Phase**: 1,738+ commits over ~7 active months
1010
- **Code Maturity**: Evolution from basic utilities to a ~58,000+ LoC intelligent TypeScript system
1111
- **Stability**: Progression from manual testing to a suite of 200+ automated test files
12-
- **Releases**: 52 release entries (v0.1.0 to v1.1.4)
12+
- **Releases**: 53 release entries (v0.1.0 to v1.1.5)
1313

1414
---
1515

@@ -127,12 +127,13 @@ Compact view; per-commit detail lives in [CHANGELOG.md](../CHANGELOG.md).
127127
| v1.1.1 → v1.1.2 | 1 | AMA refit (λ=0.0022/step=0.0002), optimizer chart output, constant tuning, doc sync |
128128
| v1.1.2 → v1.1.3 | 4 | AMA refit (λ=0.0025/step=0.0003), per-AMA distance weights, tsx-CJS export fix, amaS% retune 0.085→0.08, doc sync |
129129
| v1.1.3 → v1.1.4 | 3 | AMA4 slow correction 107.4→102.4, optimizer range 50-200→40-160, post-tag doc sync |
130+
| v1.1.4 → v1.1.5 | 2 | AMA refit (per-AMA λ weights, SMA-warmup optimizer, slow 62.1/71.7/82.7/95.5), `maxBorrowAmountPerOperation` + oversized-deal splitter |
130131

131132
---
132133

133134
## Development Statistics
134135

135-
200+ automated test files (all TypeScript), 51 release entries. See **Version History** for commit breakdown by release.
136+
200+ automated test files (all TypeScript), 52 release entries. See **Version History** for commit breakdown by release.
136137

137138
---
138139

@@ -178,7 +179,7 @@ DEXBot2 has matured from a basic grid bot into a signal-intelligent, production-
178179
---
179180

180181
**Report Originally Generated**: February 19, 2026
181-
**Last Updated**: July 14, 2026 (v1.1.4)
182-
**Total Commits**: 1,735
182+
**Last Updated**: July 14, 2026 (v1.1.5)
183+
**Total Commits**: 1,738
183184
**Date Range**: December 2, 2025 - July 14, 2026 (ongoing)
184185
**Repository**: DEXBot2 (BitShares DEX Trading Bot)

docs/FUND_MOVEMENT_AND_ACCOUNTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,4 +806,4 @@ To prevent "Time-of-Check to Time-of-Use" errors:
806806
3. **Bootstrapping:** Fills arriving during startup (`isBootstrapping=true`) are queued until the grid is fully reconciled.
807807
808808
---
809-
*Technical Reference for DEXBot2 v1.1.4 release*
809+
*Technical Reference for DEXBot2 v1.1.5 release*

docs/MPA_CREDIT_USAGE.md

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ DEXBot2 supports native BitShares debt workflows through the bot-level `debtPoli
2323
| Change how often the credit watchdog runs | [Runtime Timing](#runtime-timing) | `TIMING` in `constants.ts` |
2424
| Know what happens when MPA CR drops below minimum | [MPA Maintenance](#mpa-maintenance) | `minCollateralRatio` |
2525
| Know how credit deals are renewed and repaid | [Credit Offer Maintenance](#credit-offer-maintenance) | `autoReborrow` / `autoRepay` |
26+
| Cap the size of a single borrow, or split oversized deals | [Credit Offer Maintenance](#credit-offer-maintenance) | `maxBorrowAmountPerOperation` |
2627
| Use LP shares as credit-offer collateral | [LP-Backed Credit Collateral](#lp-backed-credit-collateral) | automatic valuation |
2728
| Diagnose pending reborrow or renewal issues | [State Files](#state-files) | `profiles/credit_runtime/<botKey>.json` |
2829
| Safe operating practices | [Operational Notes](#operational-notes) ||
@@ -92,6 +93,7 @@ Add `debtPolicy` to a bot entry in `profiles/bots.json`:
9293
|-------|------|----------|-------------|
9394
| `outputWeight` | `number` | No | Output weight for this asset. Controls the proportion of debt value across lending items (not collateral). Defaults to `1`. See **Collateral Distribution** below. |
9495
| `maxBorrowAmount` | `number` | No | **Fixed** total debt ceiling. Must be a positive number (not a percentage). |
96+
| `maxBorrowAmountPerOperation` | `number` | No | **Per-operation borrow cap**. Any single credit-offer accept operation whose borrow amount exceeds this is rejected. For MPA, the planner clamps each `debtDelta` by this cap on top of `maxBorrowAmount`. When set, oversized credit deals are split into equal pieces via repay+reborrow cycles during maintenance (see [Credit Offer Maintenance](#credit-offer-maintenance)). Must be a positive number. |
9597
| `maxCollateralAmount` | `number \| percentage string` | No | Total collateral ceiling. Use a number for an absolute collateral amount, e.g. `5000`, or a percentage string of total available collateral, e.g. `"80%"`. |
9698
| `minCollateralIncreaseThreshold` | `number \| percentage string` | No | Minimum unused collateral allocation before increasing debt. Use a number for an absolute collateral amount, e.g. `25`, or a percentage string of assigned collateral budget, e.g. `"5%"`. `0` means no minimum. |
9799
| `maxCollateralRatio` | `number` | No\* | Behavior differs by type: MPA — hard CR ceiling above which debt is increased first; creditOffer — maximum effective ratio when accepting offers. **Required** for `creditOffer`. |
@@ -171,13 +173,17 @@ Timing defaults live in `modules/constants.ts`:
171173
{
172174
"TIMING": {
173175
"CREDIT_DEAL_CHECK_INTERVAL_MIN": 60,
174-
"CREDIT_DEAL_EXPIRY_THRESHOLD_HOURS": 12
176+
"CREDIT_DEAL_EXPIRY_THRESHOLD_HOURS": 12,
177+
"CREDIT_DEAL_SPLIT_MAX_PIECES": 48,
178+
"BLOCKCHAIN_SETTLE_DELAY_MS": 6000
175179
}
176180
}
177181
```
178182

179183
- `CREDIT_DEAL_CHECK_INTERVAL_MIN`: how often the credit watchdog runs. Set to `0` or negative to disable.
180184
- `CREDIT_DEAL_EXPIRY_THRESHOLD_HOURS`: how far before `latest_repay_time` the bot proactively repays and reborrows.
185+
- `CREDIT_DEAL_SPLIT_MAX_PIECES`: hard cap on pieces per `_splitOversizedCreditDeals` cycle (default 48; ~4.8min at 6s/piece). Prevents one maintenance run from exceeding the watchdog interval.
186+
- `BLOCKCHAIN_SETTLE_DELAY_MS`: pause between split pieces (default 6000ms). Resolved from the `TIMING` constant — per-bot `bots.json` overrides for this field are **not** honoured for split pacing.
181187

182188
## MPA Maintenance
183189

@@ -196,19 +202,35 @@ For each `type: "mpa"` lending item:
196202

197203
For each `type: "creditOffer"` lending item, the runtime:
198204

205+
- **Phase 0 — Split oversized deals**: if `maxBorrowAmountPerOperation` is set, scans existing credit deals and splits any whose debt exceeds the per-op cap into equal pieces via repay+reborrow cycles (see [Oversized Credit Deal Splitter](#oversized-credit-deal-splitter)). This keeps each individual deal below the per-op cap and makes future renewals easier with less liquidity per operation.
199206
- Discovers active credit deals on-chain.
200207
- Validates deals against the per-item policy (`maxCollateralRatio`, `maxFeeRatePerDay`, `allowedOfferIds`, `disallowedDealIds`, etc.).
201-
- Gates increases on unused assigned collateral. If the collateral shortfall is at least `minCollateralIncreaseThreshold`, it accepts an additional credit deal from the cheapest acceptable offer; the selected offer's price derives the borrow amount, capped by `maxBorrowAmount`. A borrow-cap-capped increase is skipped if the actual collateral used would fall below `minCollateralIncreaseThreshold`.
208+
- Gates increases on unused assigned collateral. If the collateral shortfall is at least `minCollateralIncreaseThreshold`, it accepts an additional credit deal from the cheapest acceptable offer; the selected offer's price derives the borrow amount, capped by `maxBorrowAmount` and, when set, `maxBorrowAmountPerOperation`. A borrow-cap-capped increase is skipped if the actual collateral used would fall below `minCollateralIncreaseThreshold`.
202209
- Proactively repays deals nearing expiration (within `CREDIT_DEAL_EXPIRY_THRESHOLD_HOURS`) and reborrows when `autoReborrow` is enabled.
203210
- Ensures `auto_repay` on-chain matches the policy's `autoRepay` setting, updating local state after each successful broadcast.
204211

212+
### Oversized Credit Deal Splitter
213+
214+
When `maxBorrowAmountPerOperation` is set, each credit-maintenance cycle runs `_splitOversizedCreditDeals` as Phase 0. The splitter:
215+
216+
- Discovers deals whose `debtAmount` exceeds `maxBorrowAmountPerOperation`.
217+
- Splits each oversized deal into `ceil(debt / maxPerOp)` equal pieces via atomic repay+reborrow transactions. Total debt across the new deals is preserved; only deal granularity changes.
218+
- Skips a deal if any piece would fall below the offer's `min_deal_amount` (the offer is cached for the runtime lifetime, so on-chain `min_deal_amount` changes mid-split are not re-read).
219+
- Pauses `BLOCKCHAIN_SETTLE_DELAY_MS` between pieces; aborts on shutdown.
220+
- Stops once `CREDIT_DEAL_SPLIT_MAX_PIECES` pieces have been emitted in the current cycle. Remaining oversized deals are deferred to the next maintenance cycle.
221+
- Uses an in-process `_splitInFlight` guard so `runMaintenance` and `runCreditWatchdog` cannot start overlapping splits.
222+
223+
The split pieces are normal credit deals — they appear in `profiles/credit_runtime/<botKey>.json` alongside other deals and are subject to the usual renewal, `auto_repay`, and collateral-switching flows.
224+
205225
### Amount Cap Semantics
206226

207227
| Policy | Field | Scope |
208228
|--------|-------|-------|
209229
| MPA | `maxBorrowAmount` | **Total debt ceiling** — call order debt cannot exceed this. |
230+
| MPA | `maxBorrowAmountPerOperation` | **Per-op borrow cap** — clamps each `debtDelta` increment during CR-band adjustments. Ignored on debt-reduction moves. |
210231
| MPA | `maxCollateralAmount` | **Total collateral ceiling** — call order collateral cannot exceed this. Withdrawals still allowed. |
211232
| Credit | `maxBorrowAmount` | **Total debt ceiling** — total credit debt for the asset cannot exceed this. |
233+
| Credit | `maxBorrowAmountPerOperation` | **Per-op borrow cap** — rejects any single `credit_offer_accept` whose borrow amount exceeds this. Oversized existing deals are split during maintenance (see [Oversized Credit Deal Splitter](#oversized-credit-deal-splitter)). |
212234
| Credit | `maxCollateralAmount` | **Total collateral ceiling** — total credit collateral for the asset cannot exceed this. |
213235

214236
`maxBorrowAmount` is always a **fixed number** (no percentages). `maxCollateralAmount` may be a fixed number or a percentage.
@@ -281,7 +303,7 @@ The file tracks discovered chain state and pending work, including:
281303
- `positions` — per-position state map keyed as `debtAssetId:collateralAssetId`
282304
- Active MPA call-order state and credit deal IDs per position
283305
- `assignedCollateralBudget` per position
284-
- Pending reborrow requests
306+
- Pending reborrow requests (including deferred split pieces when an oversized-deal cycle hits `CREDIT_DEAL_SPLIT_MAX_PIECES`)
285307
- Last repay timestamp and grid reset request
286308
- Debt snapshot across all assets
287309

@@ -300,12 +322,14 @@ Treat this file as runtime state, not primary configuration. The source of truth
300322

301323
<details><summary>Source files and tests (click to expand)</summary>
302324

303-
- `modules/credit_runtime.ts`: debt workflow executor
325+
- `modules/credit_runtime.ts`: debt workflow executor (Phase 0 oversized-deal splitter lives here)
326+
- `modules/cr_planner.ts`: MPA debt-first planner; clamps `debtDelta` by `maxBorrowAmountPerOperation`
327+
- `modules/types.ts`: `LendingEntryBase` — shared `mpa` / `creditOffer` type including `maxBorrowAmountPerOperation`
304328
- `modules/dexbot_class.ts`: runtime startup and watchdog lifecycle
305329
- `modules/bot_settings.ts`: `debtPolicy` validation
306330
- `market_adapter/README.md`: AMA pricing, grid triggers, and dynamic-weight runtime
307331
- `modules/credential_policy.ts`: signing constraints for credit and call-order operations
308-
- `tests/test_credit_runtime.ts`: credit runtime behavior coverage
332+
- `tests/test_credit_runtime.ts`: credit runtime behavior coverage (including 6 oversized-deal splitter tests)
309333
- `tests/test_multi_asset_distribution.ts`: collateral distribution and multi-asset state coverage
310334

311335
</details>

0 commit comments

Comments
 (0)