Skip to content

Comments

Multiple Collateral Types & Cross-Asset Operations Testing#165

Open
UlyanaAndrukhiv wants to merge 14 commits intomainfrom
UlianaAndrukhiv/148-multiple-collateral-testing
Open

Multiple Collateral Types & Cross-Asset Operations Testing#165
UlyanaAndrukhiv wants to merge 14 commits intomainfrom
UlianaAndrukhiv/148-multiple-collateral-testing

Conversation

@UlyanaAndrukhiv
Copy link
Contributor

@UlyanaAndrukhiv UlyanaAndrukhiv commented Feb 17, 2026

Closes: #148

Description

Adds comprehensive test coverage for positions using multiple collateral types and cross-asset borrowing.

Tests added (fork_multi_collateral_position_test.cdc)

  • test_multi_collateral_positionFLOW + USDF + WETH collateral; weighted health calculation and max borrow capacity
  • test_cross_asset_flow_to_usdf_borrowing — deposit FLOW, borrow USDF
  • test_cross_asset_flow_usdf_weth_borrowingFLOWUSDFWETH chain; netting when borrowing same token held as collateral
  • test_cross_asset_chain — four-asset path FLOWUSDFWETHWBTC, intermediate assets net to zero
  • test_multi_asset_uncorrelated_price_movementsFLOWprice +10%, USDF price -5%, WETH price +20% simultaneously
  • test_multi_asset_partial_withdrawal — partial withdrawal from multi-asset position; verifies remaining balances
  • test_cross_collateral_borrowing_capacity — borrowing same token as collateral caps at credit amount; different token uses health-based formula
  • test_multi_asset_liquidation_collateral_selection — 3 collateral types + 2 debt types; liquidator selects which collateral to seize
  • test_multi_asset_complex_workflow — full lifecycle with price change and auto-rebalance; verifies exact MOET pushed to drawDownSink and health restored to target health

Refactoring

  • Added manualLiquidation, setupGenericVault, transferFungibleTokens and updated createPosition, borrowFromPosition test helpers
  • Moved create_and_store_pool.cdc to tests/transactions/ folder cause pool setup depends on both mocks

@UlyanaAndrukhiv UlyanaAndrukhiv requested a review from a team as a code owner February 17, 2026 15:36
@UlyanaAndrukhiv UlyanaAndrukhiv self-assigned this Feb 17, 2026
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.

Multiple Collateral Types & Cross-Asset Operations Testing

1 participant