-
Notifications
You must be signed in to change notification settings - Fork 71
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
Merge WithdrawObligationCollateral and RedeemReserveCollateral #14
Conversation
clock, | ||
token_program_id, | ||
)?; | ||
|
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.
So we don't have to refresh anything here because _withdraw_obligation_collateral requires the reserve to be refreshed, and does not mark it as stale (only reads from it as far as I can tell)
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.
oh hm maybe my flow chart is wrong then
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.
Its not strictly wrong, since it does require a refreshed reserve.
If someone were to do these in separate transactions, you might need to re-refresh it.
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 guess it makes sense since removing the collateral doesn't change anything about the deposited liquidity so no interest calculations need to happen
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 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.
Thats just the obligation thats getting marked stale right?
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.
ye
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.
Did the frontend PR, works like a charm! https://github.com/solendprotocol/web/pull/114
RedeemReserveCollateral
let obligation_info = next_account_info(account_info_iter)?; | ||
let lending_market_info = next_account_info(account_info_iter)?; | ||
let lending_market_authority_info = next_account_info(account_info_iter)?; | ||
let user_liquidity_info = next_account_info(account_info_iter)?; |
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 call it destination_liquidity_info
to be consistent with how _redeem_reserve_collateral
refers to it.
Also for whatever reason, a user may not want to withdraw to themselves. We see this with proxy wallets and gassless txs in Ethereum. Basically the naive way to implement in Solidity is to withdraw to the caller (msg.sender
), but for gasless txs the user signs a message that the smart contract verifies, and a relayer submits the tx (so they're the msg.sender
). The result is an improved UX where the user signs something but doesn't have to spend the gas, and maybe doesn't even need a web3 wallet like Metamask at all.
Anyway just some Ethereum history.
Combines WithdrawObligationCollateral and RedeemReserveCollateral
into a single function