feat(ramps): poll neo-bank deposits and emit status notifications - #10108
Closed
saustrie-consensys wants to merge 2 commits into
Closed
feat(ramps): poll neo-bank deposits and emit status notifications#10108saustrie-consensys wants to merge 2 commits into
saustrie-consensys wants to merge 2 commits into
Conversation
Add emit-only Money Account deposit polling to RampsController for the MM
Neobank onramp flow (TRAM-3898, "poll for deposit and notifications"). A
sibling poll loop fetches each pollable autoramp's deposit/transaction records
from the neo-bank proxy, keeps a persisted state.deposits clone, and publishes
RampsController:depositStatusChanged on status transitions so the app can show
a toast or refresh the account screen. The poller takes no on-chain action;
vault sweeping stays with the backend.
- Add NeoBankService.getAutorampTransactions and the matching messenger action,
mapping proxy transactions (bare array or a { transactions } envelope) via the
exported mapNeoBankTransactionToRemoteSnapshot. Rejects items missing id/status.
- Add the moneyAccountDeposit model: MoneyAccountDeposit, MoneyAccountDepositStatus,
the pure applyDepositRemoteStatus diff, and helpers, mirroring autorampAccount.
- Add startDepositPolling / stopDepositPolling / refreshDeposits, plus
markDepositAsNotified (notify dedupe) and removeDeposit (prune persisted state),
a persisted state.deposits array, and the depositStatusChanged event, reusing
the order poller's 30s interval and error backoff.
- Poll only Approved autoramps, or ones with an in-flight local deposit, so an
in-flight deposit keeps being tracked even if its route later goes terminal.
4 tasks
Contributor
Author
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.
Explanation
Part of the MM Neobank MVP0 (Brazil 🇧🇷) onramp flow. When a user funds a Money Account via Pix, the partner (Iron) pays out mUSD on Monad, and Core needs to notice those deposits so the app can react.
This adds emit-only deposit polling to
RampsController(TRAM-3898, "poll for deposit and notifications"). The vault "sweep" (the original step 3) was removed from the ticket, so this PR only detects and reports: it takes no on-chain action, and vault sweeping stays with the backend.How it works, reusing the existing autoramp/order patterns already in this package:
NeoBankService.getAutorampTransactions(autorampId)fetches a partner's deposit/transaction records, mapped via the exportedmapNeoBankTransactionToRemoteSnapshot(accepts a bare array or a{ transactions }envelope; rejects items missingid/status).moneyAccountDeposit.tsis a thin local clone model mirroringautorampAccount.ts: a status enum plus a pureapplyDepositRemoteStatusdiff returningstatusChanged/shouldNotify.startDepositPolling/stopDepositPolling, plusrefreshDepositsfor app-load catch-up) reuses the order poller's 30s interval and error backoff. Each cycle upserts a persistedstate.depositsarray and publishesRampsController:depositStatusChangedon status transitions. OnlyApprovedautoramps (or ones with an in-flight local deposit) are polled, so an in-flight deposit keeps being tracked even if its route later goes terminal.markDepositAsNotifieddedupes repeat notifications for the same status;removeDepositlets consumers prune the persisted list.Note: the proxy route (
GET /neobank/autoramps/{id}/transactions) and the payout-hash field are assumed pending the proxy contract (onramp-api #1124 / #1125); they are mocked in the unit tests here.Hosts must delegate
NeoBankService:getAutorampTransactions(added toRAMPS_CONTROLLER_REQUIRED_SERVICE_ACTIONS), orstartDepositPolling/refreshDepositsreject with a messenger "handler has not been delegated" error.Base / stacking
Stacked on
saustrie/neobank-pix-service-methods(#9851), which providesNeoBankServiceand the autoramp model. Review the top commit only; retarget tomainonce #9851 lands. Lint/coverage red on shared files is pre-existing #9851 draft debt on unchanged code, not from this PR.References
Checklist