-
Notifications
You must be signed in to change notification settings - Fork 13
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
Emission cycle fix #153
Emission cycle fix #153
Conversation
mootz12
commented
Dec 1, 2023
•
edited
Loading
edited
- Add queue/timelock for emissions swaps
- Can cancel at any point during the timelock
- Update emitter to track distributions on a backstop basis to ensure no missed emissions during a swap
- Remove emission cycle logic and distribute exact amounts instead
- Update backstop to stop calculating EPS when distributing emissions to pools, causing emissions to get missed
- Update pool to consume emissions from backstop, and distribute them to reserves
- Fix integration tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good - spent some time on it and I agree this eliminates like all the edge cases I could think of and feels more robust
Left a few comments just about code documentation and leftover commented out lines - feel free to fix now or we could fix as part of a wider codebase cleanup
backstop/src/storage.rs
Outdated
@@ -217,6 +244,16 @@ pub fn set_user_balance(e: &Env, pool: &Address, user: &Address, balance: &UserB | |||
/// * `pool` - The pool the deposit is associated with | |||
pub fn get_pool_balance(e: &Env, pool: &Address) -> PoolBalance { | |||
let key = BackstopDataKey::PoolBalance(pool.clone()); | |||
// if let Some(result) = e.storage().persistent().get::<BackstopDataKey, PoolBalance>(&key) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should probably remove this commented out section as it could be confusing
backstop/src/storage.rs
Outdated
pub fn get_pool_eps(e: &Env, pool: &Address) -> i128 { | ||
let key = BackstopDataKey::PoolEPS(pool.clone()); | ||
pub fn get_pool_emissions(e: &Env, pool: &Address) -> i128 { | ||
let key = BackstopDataKey::PoolEmis(pool.clone()); | ||
get_persistent_default(e, &key, 0i128, LEDGER_THRESHOLD_SHARED, LEDGER_BUMP_SHARED) | ||
} | ||
|
||
/// Set the current emissions EPS the backstop is distributing to the pool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a lot of references to EPS in the backstop that are confusing now as we don't store eps in the backstop anymore