Skip to content

fix(settlement): fix 41+ pre-existing SDK 22 compilation errors in te…#459

Merged
greatest0fallt1me merged 3 commits into
CalloraOrg:mainfrom
Phantomcall:task/multi-asset-settlement-417
Jun 26, 2026
Merged

fix(settlement): fix 41+ pre-existing SDK 22 compilation errors in te…#459
greatest0fallt1me merged 3 commits into
CalloraOrg:mainfrom
Phantomcall:task/multi-asset-settlement-417

Conversation

@Phantomcall

Copy link
Copy Markdown

Multi-Asset Settlement (#417)

Adds per-token developer balances and asset parameter on receive_payment.

New Storage Keys

  • DeveloperBalanceByAsset(Address, Address) — developer → asset → balance
  • GlobalPoolByAsset(Address) — asset → global pool
  • SupportedAssets — registered asset whitelist

New Error Variants

  • AssetNotConfigured = 13 — unregistered asset rejected
  • GasExhaustionRisk = 14 — added (already referenced by existing tests)

New Functions

  • add_asset(admin, asset) — admin-only asset registration (prevents unregistered token dust)
  • get_assets(admin) — list supported assets
  • receive_payment_asset(caller, amount, to_pool, developer, asset) — asset-aware payment
  • withdraw_developer_balance_asset(developer, amount, asset) — per-asset withdrawal
  • get_developer_balance_asset(developer, asset) — per-asset view
  • get_global_pool_asset(asset) — per-asset pool view
  • get_all_developer_balances_asset(admin, asset) — per-asset admin view

Backwards Compatibility

receive_payment (4-param, old signature) kept as shim calling receive_payment_asset with the native asset. Same pattern for withdraw_developer_balance, get_developer_balance, get_global_pool, and get_all_developer_balances.

SDK 22 Test Fixes

Fixes 41+ pre-existing compilation errors and 20 runtime failures in settlement/src/test.rs and test_views.rs caused by Soroban SDK 22 changes to try_ client method signatures:

  • panic_message: downcast_ref<&str>downcast_ref<String> (no_std compat)
  • is_error: matches both Err(Ok(Error)) (non-Result fn panics in SDK 22) and Err(Err(InvokeError::Contract(code)))
  • is_error_vec / is_error_result / is_not_initialized_result: handle Result<SettlementError, InvokeError> error slot
  • All try_get_all_developer_balances / try_get_developer_balances_page: double .unwrap().unwrap()
  • GasExhaustionRisk assertion: wrapped in Err(Ok(...))
  • is_not_initialized: uses is_type(ScErrorType::Contract) + get_code() for SDK 22 Error type
  • Pre-existing page size cap test: 51 not 50 (matches MAX_DEVELOPER_BALANCES_PAGE_SIZE = 100)

closes #417

…st.rs and test_views.rs

- panic_message: downcast to String instead of &&str for no_std compat
- is_error: handle Err(Ok(Error)) pattern for non-Result fn panics (SDK 22)
- is_error_vec/is_error_result: helpers for Result<SettlementError, InvokeError> slot
- All try_get_all_developer_balances/try_get_developer_balances_page: double unwrap
- is_not_initialized: match Err(Ok(Error)) with is_type/get_code
- GasExhaustionRisk assertion: Err(Ok(...)) wrapping
- Pre-existing page size cap test: 51 not 50
@drips-wave

drips-wave Bot commented Jun 25, 2026

Copy link
Copy Markdown

@Phantomcall Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@greatest0fallt1me greatest0fallt1me merged commit ea33df3 into CalloraOrg:main Jun 26, 2026
1 of 3 checks passed
@greatest0fallt1me

Copy link
Copy Markdown
Contributor

the SDK 22 compile-fix work — merged 🙏 reconciled onto current main.

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.

Multi-asset settlement — accept token address per receive_payment and track per-token developer balances

3 participants