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

Pool Gulp #31

Merged
merged 4 commits into from
Jan 20, 2025
Merged

Pool Gulp #31

merged 4 commits into from
Jan 20, 2025

Conversation

Ryang-21
Copy link
Contributor

  • Implements gulping on the pool to update the reserves b rate to the pools token balance
    Implements Add "gulp" function #27

@Ryang-21 Ryang-21 requested a review from mootz12 January 13, 2025 20:28
Copy link
Contributor

@mootz12 mootz12 left a comment

Choose a reason for hiding this comment

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

Functionality looks good, comments mostly about docs / variable names

@@ -145,7 +145,7 @@ fn claim_emissions(
///
/// ### Panics
/// If the reserve update failed
pub(super) fn update_emission_data(
pub fn update_emission_data(
Copy link
Contributor

Choose a reason for hiding this comment

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

This can remain pub(super)


#[cfg(test)]
mod tests {
use std::println;
Copy link
Contributor

Choose a reason for hiding this comment

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

unused import

Comment on lines 198 to 199
/// Updates the reserve's B token supply to match the pool's asset balance
///
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add a bit more color to this comment?

/// Update the reserve's bToken rate based on the pool's balance. This is useful for tokens where
///  a holder's balance can increase outside of a direct transfer.

@@ -274,6 +274,20 @@ impl PoolEvents {
e.events().publish(topics, (tokens_in, d_tokens_burnt));
}

/// Emitted when a reserve updates its supply to its token balance
Copy link
Contributor

Choose a reason for hiding this comment

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

updates its bToken rate.

@@ -128,6 +113,26 @@ impl Reserve {
storage::set_res_data(e, &self.asset, &reserve_data);
}

/// Update the reserve's b_rate and the pool's backstop rate based on the difference in the pools token balance and the reserves stored balance.
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a bit confusing, how about:

Accrue tokens to the reserve supply. This issues any `backstop_credit` required and updates the reserve's bRate to account for the additional tokens.

### Arguments
* bstop_rate - The backstop take rate for the pool
* accrued - The amount of additional underlying tokens

@mootz12 mootz12 linked an issue Jan 15, 2025 that may be closed by this pull request
@mootz12 mootz12 merged commit 9c9f9d7 into main Jan 20, 2025
3 checks passed
@mootz12 mootz12 deleted the pool-gulp branch January 20, 2025 13:41
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.

Add "gulp" function
2 participants