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

Emissions cleanup #183

Merged
merged 2 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backstop/src/backstop/deposit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub fn execute_deposit(e: &Env, from: &Address, pool_address: &Address, amount:
require_is_from_pool_factory(e, pool_address, pool_balance.shares);
let mut user_balance = storage::get_user_balance(e, pool_address, from);

emissions::update_emissions(e, pool_address, &pool_balance, from, &user_balance, false);
emissions::update_emissions(e, pool_address, &pool_balance, from, &user_balance);

let backstop_token_client = TokenClient::new(e, &storage::get_backstop_token(e));
backstop_token_client.transfer(from, &e.current_contract_address(), &amount);
Expand Down
4 changes: 2 additions & 2 deletions backstop/src/backstop/withdrawal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub fn execute_queue_withdrawal(
let mut user_balance = storage::get_user_balance(e, pool_address, from);

// update emissions
emissions::update_emissions(e, pool_address, &pool_balance, from, &user_balance, false);
emissions::update_emissions(e, pool_address, &pool_balance, from, &user_balance);

user_balance.queue_shares_for_withdrawal(e, amount);
pool_balance.queue_for_withdraw(amount);
Expand All @@ -36,7 +36,7 @@ pub fn execute_dequeue_withdrawal(e: &Env, from: &Address, pool_address: &Addres
let mut user_balance = storage::get_user_balance(e, pool_address, from);

// update emissions
emissions::update_emissions(e, pool_address, &pool_balance, from, &user_balance, false);
emissions::update_emissions(e, pool_address, &pool_balance, from, &user_balance);

user_balance.dequeue_shares_for_withdrawal(e, amount, false);
user_balance.add_shares(amount);
Expand Down
4 changes: 2 additions & 2 deletions backstop/src/emissions/claim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use soroban_sdk::{
panic_with_error, vec, Address, Env, IntoVal, Map, Symbol, Val, Vec,
};

use super::update_emissions;
use super::distributor::claim_emissions;

/// Perform a claim for backstop deposit emissions by a user from the backstop module
pub fn execute_claim(e: &Env, from: &Address, pool_addresses: &Vec<Address>, to: &Address) -> i128 {
Expand All @@ -18,7 +18,7 @@ pub fn execute_claim(e: &Env, from: &Address, pool_addresses: &Vec<Address>, to:
for pool_id in pool_addresses.iter() {
let pool_balance = storage::get_pool_balance(e, &pool_id);
let user_balance = storage::get_user_balance(e, &pool_id, from);
let claim_amt = update_emissions(e, &pool_id, &pool_balance, from, &user_balance, true);
let claim_amt = claim_emissions(e, &pool_id, &pool_balance, from, &user_balance);

claimed += claim_amt;
claims.set(pool_id, claim_amt);
Expand Down
Loading