refactor: AssetType oracle routing for RWA lending pools#8
Merged
Conversation
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
6849fbd to
ea8dd3c
Compare
…, 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.
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.
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: NewAssetTypeenum (Crypto|Rwa).storage.rs: New storage keysasset_types,collateral_asset_types,collateral_symbolsinPoolStorage.admin/mod.rs:set_token_contractandset_collateral_factornow accept anAssetTypeparameter.operations/oracles.rs: New routing helpersget_price_for_lending_assetandget_price_for_collateralthat 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
AssetType::Crypto.AssetType::Rwa.