Conversation
WalkthroughThis PR introduces a new AMM configuration update script and its integration test, enabling users to modify existing AMM settings on the target network through CLI arguments, resolving parameters from artifacts and current state, then executing the transaction and validating results. Changes
Sequence DiagramsequenceDiagram
participant CLI as User/CLI
participant Script as AMM Update Script
participant SUI as Sui Network
participant Artifacts as Config Artifacts
CLI->>Script: Invoke with update parameters
Script->>Artifacts: Resolve package & config IDs
Script->>Artifacts: Resolve admin cap ID
Script->>SUI: Fetch current AMM config overview
Script->>SUI: Fetch mutable shared object
Script->>Script: Merge CLI args with current defaults
Script->>Script: Compute new Pyth price feed ID
Script->>SUI: Build & execute update transaction
SUI-->>Script: Transaction result
Script->>SUI: Fetch updated AMM config overview
Script->>CLI: Output results (JSON or summary)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/dapp/src/scripts/owner/test-integration/amm-update.test.ts (1)
51-139: LGTM!Comprehensive integration test that exercises the full update flow: publish → create initial config → update config → verify output. Good use of
waitForFinalityafter state-changing operations, andnormalizeHexfor robust hex comparison.Consider adding additional test cases in the future for:
- Partial updates (updating only some fields while others retain defaults)
- Edge cases (e.g., updating with same values as current config)
- Error scenarios (invalid admin cap, invalid config ID)
These can be deferred to a follow-up PR.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/dapp/src/scripts/owner/test-integration/amm-update.test.ts` around lines 51 - 139, No code changes required—the integration test "owner amm-update integration" correctly publishes, creates, updates, and verifies the AMM config and uses waitForFinality and normalizeHex properly; keep as-is (no edits to createSuiScriptRunner, parseJsonFromScriptOutput, AmmUpdateOutput handling, or normalizeHex usage). If you choose to expand coverage later, add follow-up tests that call the "amm-update" script runner to exercise partial updates, same-value updates, and error scenarios (invalid adminCapId/ammConfigId) by asserting expected transaction failures or unchanged fields.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/dapp/src/scripts/owner/test-integration/amm-update.test.ts`:
- Around line 51-139: No code changes required—the integration test "owner
amm-update integration" correctly publishes, creates, updates, and verifies the
AMM config and uses waitForFinality and normalizeHex properly; keep as-is (no
edits to createSuiScriptRunner, parseJsonFromScriptOutput, AmmUpdateOutput
handling, or normalizeHex usage). If you choose to expand coverage later, add
follow-up tests that call the "amm-update" script runner to exercise partial
updates, same-value updates, and error scenarios (invalid
adminCapId/ammConfigId) by asserting expected transaction failures or unchanged
fields.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 0538423d-3487-4c46-924d-42ac2d376757
📒 Files selected for processing (2)
packages/dapp/src/scripts/owner/amm-update.tspackages/dapp/src/scripts/owner/test-integration/amm-update.test.ts
Parts of #26
Summary
Adds the AdminCap-managed AMM update script flow.
Scope
amm-updatescriptNotes
Admin capability resolution primitives are already available from the AMM domain layer in the prior stack PR.
Summary by CodeRabbit
New Features
Tests