Skip to content

feat(opencode): add VerifiedFiatCalculator for supply-consistent exchange#645

Merged
bmc08gt merged 5 commits intocode/cashfrom
refacor/localfiat-verifiable-calculations
Apr 24, 2026
Merged

feat(opencode): add VerifiedFiatCalculator for supply-consistent exchange#645
bmc08gt merged 5 commits intocode/cashfrom
refacor/localfiat-verifiable-calculations

Conversation

@bmc08gt
Copy link
Copy Markdown
Collaborator

@bmc08gt bmc08gt commented Apr 24, 2026

No description provided.

@bmc08gt bmc08gt self-assigned this Apr 24, 2026
bmc08gt added 2 commits April 24, 2026 09:45
Enable AGP Kotlin testFixtures support and expose CurveTestInitializer
and FileTableLoader so other modules can initialize the DiscreteBondingCurve
in unit tests without an Android Context.

Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
…ange

Introduce VerifiedFiatCalculator that computes LocalFiat using the
verified supply from VerifiedProtoManager, ensuring underlyingTokenAmount,
nativeAmount, and fx are all consistent with the VerifiedState sent to
the server.

- Move valueExchangeIn logic from LocalFiat into RealVerifiedFiatCalculator
- Add supplyOverride parameter to Fiat.tokenBalance
- Bind via Hilt in OpenCodeModule
- Remove unused imports from TransactionController

Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
@bmc08gt bmc08gt force-pushed the refacor/localfiat-verifiable-calculations branch from cdf31f5 to 2ede53f Compare April 24, 2026 13:46
bmc08gt and others added 3 commits April 24, 2026 11:28
…bmission

Thread VerifiedFiat (LocalFiat + VerifiedState) atomically from
VerifiedFiatCalculator.compute() through ViewModels to TransactionController,
eliminating TOCTOU race where bonding curve supply could diverge between
amount computation and intent submission.

- Add VerifiedFiat wrapper type pairing LocalFiat with pinned VerifiedState
- Update TransactionOperations buy/sell/withdraw to accept VerifiedFiat
- Thread VerifiedFiat through SwapViewModel, WithdrawalViewModel,
  OnRampViewModel, CashScreenViewModel, CurrencyCreatorViewModel
- Thread through ExternalWalletOnRampState and CoinbaseOnRampState pipelines
- Add LocalFiat.rounded() and fix totalBalance penny rounding discrepancy

Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
Thread the pinned VerifiedState from Bill.Cash through the entire gift card
funding chain: shareGiftCard → initiateGiftCardFunding → BillController →
BillTransactionManager → SendGiftCardTransactor → TransactionController.remoteSend.

This eliminates the cache lookup in remoteSend that could return stale exchange
data, making it consistent with the give-bill and swap paths that already
receive a pinned VerifiedState from compute().

Remove VerifiedProtoManager dependency from TransactionController since
remoteSend was its only consumer.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
@bmc08gt bmc08gt merged commit fe987d5 into code/cash Apr 24, 2026
1 check failed
@bmc08gt bmc08gt deleted the refacor/localfiat-verifiable-calculations branch April 24, 2026 19:19
bmc08gt added a commit that referenced this pull request Apr 24, 2026
…le-calculations

feat(opencode): add VerifiedFiatCalculator for supply-consistent exchange
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant