-
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
Issue 141 claim to backstop #142
Conversation
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.
Approving - but we should hold off merging for #143
backstop/src/emissions/claim.rs
Outdated
TokenClient::new(e, &blnd_id).approve( | ||
&e.current_contract_address(), | ||
&lp_id, | ||
&claimed, | ||
&(e.ledger().sequence() + 10), | ||
); |
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.
we can omit this approval after the merge of the Comet update
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.
This being said, this PR should probably follow the Comet one.
let mut pool_balance = storage::get_pool_balance(e, &pool_id); | ||
let mut user_balance = storage::get_user_balance(e, &pool_id, to); | ||
|
||
// Deposit LP tokens into pool backstop | ||
let to_mint = pool_balance.convert_to_shares(deposit_amount); | ||
pool_balance.deposit(deposit_amount, to_mint); | ||
user_balance.add_shares(to_mint); | ||
|
||
storage::set_pool_balance(e, &pool_id, &pool_balance); | ||
storage::set_user_balance(e, &pool_id, to, &user_balance); | ||
e.events().publish( | ||
(Symbol::new(&e, "deposit"), pool_id, to), | ||
(deposit_amount, to_mint), | ||
); |
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.
not a massive fan of this logic being duplicated, but there doesn't seem to be that easy of a way around it without a bunch of refactoring to make things consistent
backstop/src/storage.rs
Outdated
pub pool: Address, | ||
pub user: Address, |
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.
not sure I see why these needed to be public?
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.
I needed them public for tests and forgot to remove whoops
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.
LG2M
User claims now are deposited directly into whatever backstop module they previously deposited in