Emit share_amount on lending events (closes #577)#583
Open
shubhamessier wants to merge 1 commit into
Open
Conversation
Author
|
Hello @jgur-psyops, can you kindly have a look at these changes once, thanks! implementation per your guidance in #577: Decisions you flagged:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Append
share_amount: WrappedI80F48toLendingAccountDepositEvent,LendingAccountWithdrawEvent,LendingAccountBorrowEvent, andLendingAccountRepayEvent. Indexers can now reconstruct share-basedbalances from event history without re-deriving cumulative share price
or polling on-chain state.
Implementation:
serialization compat for existing consumers per maintainer guidance in
the issue thread.
bank_account.balance.{asset,liability}_sharesbefore and after thedeposit / withdraw / borrow / repaycall. Because each public wrapperuses a single-direction
Balance{Increase,Decrease}Type, the orthogonalshare field is invariant across the call, so the snapshot is equivalent
to the delta computed internally — no
*_balance_internalsignaturechange required.
WrappedI80F48(notu64orf64) per maintainer comment:shares are fractional, f64 cast is CU-expensive, raw I80F48 preserves
full precision.
deposit/borrow, burned for withdraw/repay).
*_allpaths produce thefull pre-balance amount since post-close balance is zero.
Touched all event construction sites (12 total): the 4 in
instructions/marginfi_account/, plusjuplend / drift / kamino / solenddeposit and withdraw, since they construct the same event types.
Verification:
cargo check -p marginfi --no-default-features --features custom-heappasses clean.
basic-testsnot run in dev environment(toolchain unavailable); CI should validate