Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CurrentAssetInvestmentAllocation Refactor #272

Merged
merged 23 commits into from
Dec 4, 2024

Conversation

esteblock
Copy link
Member

This refactor includes:

pub struct CurrentAssetInvestmentAllocation {
    pub asset: Address,
    pub total_amount: i128,
    pub idle_amount: i128,
    pub invested_amount: i128,
    pub strategy_investments: Vec<StrategyInvestment>,
}

Which allows the contract to fetch all this data at the beggining of every function, and then just use that information.
Using this object will avoid to repeat some cross-contract calls and re do calculations

Copy link

vercel bot commented Dec 4, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
defindex-dapp ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 4, 2024 7:57pm
defindex-landing ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 4, 2024 7:57pm
defindex-rust-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 4, 2024 7:57pm

@esteblock esteblock requested a review from chopan123 December 4, 2024 16:27
@@ -99,13 +108,35 @@ pub fn fetch_current_invested_funds(e: &Env) -> Map<Address, i128> {
///
/// # Returns
/// * A map where each entry represents an asset's address and its total managed balance.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update docs, remove unnecessary comments (like pasting from models)

@@ -0,0 +1,172 @@
use soroban_sdk::{vec as sorobanvec, String, Vec, Map};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is not being run by make test.
Also, it should be on vault folder


// test fees are correctly calculated and harvested (todo)
#[test]
fn test_fees() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be on vault folder


// check total manage funds

// fn fetch_total_managed_funds(e: &Env) -> Map<Address, CurrentAssetInvestmentAllocation> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove unnecesary comments

@chopan123
Copy link
Member

  • follow file structure /test/

@esteblock
Copy link
Member Author

Fixed @chopan123

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.

5 Refactor Current Asset Invesment Allocations
2 participants