Skip to content

refactor: AssetType oracle routing for RWA lending pools#8

Merged
aguilar1x merged 11 commits into
devfrom
refactor/rwa-lending-contract
Feb 21, 2026
Merged

refactor: AssetType oracle routing for RWA lending pools#8
aguilar1x merged 11 commits into
devfrom
refactor/rwa-lending-contract

Conversation

@aguilar1x

@aguilar1x aguilar1x commented Feb 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds AssetType (Crypto | Rwa) so any asset can participate as a lending asset or collateral regardless of type. RWA tokens (e.g. CETES, USDY) can be deposited as lending assets and the protocol routes prices to the correct oracle per asset type.

Changes

Contract

  • types.rs: New AssetType enum (Crypto | Rwa).
  • storage.rs: New storage keys asset_types, collateral_asset_types, collateral_symbols in PoolStorage.
  • admin/mod.rs: set_token_contract and set_collateral_factor now accept an AssetType parameter.
  • operations/oracles.rs: New routing helpers get_price_for_lending_asset and get_price_for_collateral that call the appropriate oracle (Blend/crypto vs RWA) by asset type.
  • contract.rs: Wiring updated for new admin signatures and oracle usage.
  • borrowing.rs, collateral.rs, liquidations.rs: Replaced 9 hardcoded oracle calls with the new routing functions.
  • test/mod.rs: Tests updated for new admin signatures and behavior.

Docs

  • README.md: Description and features updated for RWA lending; new “AssetType” section under Core Concepts; admin function examples with new signatures; Oracle Integration routing table; two usage examples (USDC pool, CETES pool).

Backward compatibility

  • Existing crypto lending assets default to AssetType::Crypto.
  • Existing RWA collateral defaults to AssetType::Rwa.
  • No breaking change for already-deployed pools that keep current config.

@aguilar1x aguilar1x self-assigned this Feb 21, 2026
Add AssetType enum (Crypto | Rwa) so any asset can participate as a
lending asset or collateral regardless of type.

- Add AssetType to types.rs
- Add asset_types, collateral_asset_types, collateral_symbols to PoolStorage
- Update set_token_contract and set_collateral_factor to accept AssetType
- Add get_price_for_lending_asset and get_price_for_collateral routing functions
- Replace 9 hardcoded oracle calls across borrowing, collateral, liquidations
- Backward compat: existing crypto assets default to Crypto, existing RWA collateral defaults to Rwa

Enables RWA tokens (CETES, USDY) to be deposited as lending assets.
- Update description and features to mention RWA tokens as lending assets
- Add AssetType section to Core Concepts
- Update admin function examples with new signatures
- Add Oracle Integration routing table
- Add two usage examples: USDC pool and CETES pool
- Update Related Contracts to include rwa-yield-aggregator
@aguilar1x aguilar1x force-pushed the refactor/rwa-lending-contract branch from 6849fbd to ea8dd3c Compare February 21, 2026 20:50
…, use stellar contract build

- Add wasm32v1-none-unknown target and install Stellar CLI
- Build rwa-oracle WASM before workspace build so rwa-token/rwa-lending imports resolve
- Copy oracle WASM to target/wasm32v1-none/release for contractimport! path
- Use stellar contract build for final Soroban build; cache ~/.cargo/bin
wasm32v1-none-unknown is no longer available on Rust stable; use
wasm32-unknown-unknown and copy oracle WASM to target/wasm32v1-none/release
for contractimport! path.
Avoids libdbus-sys build failure on GitHub Actions; contract build does not
need keyring/ledger features.
Add apt step so cargo install stellar-cli succeeds on GitHub Actions;
revert to full stellar-cli (no --no-default-features).
Required by hidapi (ledger support) when compiling stellar-cli on Ubuntu.
Restore from ~/.cache/stellar-cli when present; install and save on cache miss.
Key stellar-cli-25.1.0 so cache persists across workflow runs.
Download stellar-cli-25.1.0-x86_64-unknown-linux-gnu.tar.gz instead of
cargo install (~11 min). Remove libdbus/libudev system deps. Cache binary
unchanged for subsequent runs.
Tarball layout may vary; find stellar or stellar-cli and copy to
~/.cargo/bin and cache instead of hardcoding path.
@aguilar1x aguilar1x merged commit ce79848 into dev Feb 21, 2026
0 of 2 checks passed
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.

refactor: routing in rwa-lending for the change of collateral between crypto assets or rwa assets

1 participant