feat: add transaction logic for veda depost and withdrawal#28658
Conversation
…to MUSD-593-crypto-deposits
d5fdb3e to
26725b6
Compare
…to MUSD-593-crypto-deposits
|
✅ E2E Fixture Validation — Schema is up to date |
|
@MoMannn Suggested edits to the feature flag name to conform to the one in LD |
Co-authored-by: Shane T <muldots@gmail.com>
Co-authored-by: Shane T <muldots@gmail.com>
Co-authored-by: Shane T <muldots@gmail.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 247c748. Configure here.
AI PR Analysis🚫 Merge safe: false | 🟠 Risk: high
AI analysis did not complete. Manual review recommended. |
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
Why no E2E tags are needed:
No existing E2E test flows are at risk from these changes. Performance Test Selection: |
|




Description
Adds the on-chain transaction layer for Money Account crypto deposits and withdrawals (MUSD-593).
What changed:
buildMoneyAccountDepositBatchandbuildMoneyAccountWithdrawutility functions (moneyAccountTransactions.ts) that encode the approve + deposit / withdraw calldata against the Veda vault contracts (Teller, Accountant, Lens).useMoneyAccountDepositanduseMoneyAccountWithdrawalhooks (useMoneyAccount.ts) that read vault configuration from remote feature flags, derive the provider from the active network client, and submit the transactions viaaddTransactionBatch/addTransaction.selectMoneyAccountVaultConfigselector and themoneyAccountDepositConfigremote feature flag registry entry, which holds chain ID and contract addresses for the vault.MoneyHomeViewtoinitiateDepositwith a hardcoded amount as a dev integration test; this will be replaced once the amount entry UI is built.Deposit flow:
approve(boringVault, amount)+deposit(asset, amount, minimumMint, 0x0)submitted as an atomic batch. A 0.1% slippage tolerance is applied to thepreviewDepositquote.Withdrawal flow:
getRate→ convert asset amount to vault shares →withdraw(asset, shares, minimumAssets, to).Changelog
CHANGELOG entry: null
TODO
Note that the code has 2 todos that should be address seperatly:
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Introduces new transaction-construction and submission code paths that interact with wallet confirmations and remote-configured contract addresses; mistakes could cause failed or incorrect on-chain calls. Risk is reduced by added unit tests and feature-flag gating, but still impacts critical transaction flow.
Overview
Adds the on-chain transaction building/submission layer for Money Account deposits and withdrawals.
Introduces
buildMoneyAccountDepositBatch(approve + deposit batch with preview+slippage) andbuildMoneyAccountWithdraw(rate-based share conversion + slippage) utilities, plususeMoneyAccountDeposit/useMoneyAccountWithdrawalhooks that fetch vault addresses from remote feature flags, resolve provider/network client, navigate to confirmations, and submit viaaddTransactionBatch/addTransactionwith error logging.Adds a new
moneyAccountVaultConfigremote flag (with a dev fallback gated byMM_MONEY_DEPOSIT_CONFIG_DEV_ENABLED) and corresponding selector/tests; updates test babel config to avoid inlining env vars for those selector files. The Money home view only adds an import and TODO scaffolding for wiring deposits later (no behavior change).Reviewed by Cursor Bugbot for commit 46369dc. Bugbot is set up for automated code reviews on this repo. Configure here.