Skip to content

Commit 0fe3531

Browse files
committed
add new lp event for devnet event subscriber
1 parent 4aa47ed commit 0fe3531

File tree

4 files changed

+124
-4
lines changed

4 files changed

+124
-4
lines changed

programs/drift/src/state/events.rs

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,8 @@ pub struct LPSettleRecord {
789789
pub lp_aum: u128,
790790
// current mint price of lp
791791
pub lp_price: u128,
792+
// lp pool pubkey
793+
pub lp_pool: Pubkey,
792794
}
793795

794796
#[event]
@@ -830,10 +832,12 @@ pub struct LPSwapRecord {
830832
pub out_market_target_weight: i64,
831833
pub in_swap_id: u64,
832834
pub out_swap_id: u64,
835+
// lp pool pubkey
836+
pub lp_pool: Pubkey,
833837
}
834838

835839
impl Size for LPSwapRecord {
836-
const SIZE: usize = 376;
840+
const SIZE: usize = 408;
837841
}
838842

839843
#[event]
@@ -868,8 +872,29 @@ pub struct LPMintRedeemRecord {
868872
/// PERCENTAGE_PRECISION
869873
pub in_market_current_weight: i64,
870874
pub in_market_target_weight: i64,
875+
// lp pool pubkey
876+
pub lp_pool: Pubkey,
871877
}
872878

873879
impl Size for LPMintRedeemRecord {
874-
const SIZE: usize = 328;
880+
const SIZE: usize = 360;
881+
}
882+
883+
#[event]
884+
#[derive(Default)]
885+
pub struct LPBorrowLendDepositRecord {
886+
pub ts: i64,
887+
pub slot: u64,
888+
pub spot_market_index: u16,
889+
pub constituent_index: u16,
890+
pub direction: DepositDirection,
891+
pub token_balance: i64,
892+
pub last_token_balance: i64,
893+
pub interest_accrued_token_amount: i64,
894+
pub amount_deposit_withdraw: u64,
895+
pub lp_pool: Pubkey,
896+
}
897+
898+
impl Size for LPBorrowLendDepositRecord {
899+
const SIZE: usize = 104;
875900
}

sdk/src/events/types.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {
2424
LPMintRedeemRecord,
2525
LPSettleRecord,
2626
LPSwapRecord,
27+
LPBorrowLendDepositRecord,
2728
} from '../types';
2829
import { EventEmitter } from 'events';
2930

@@ -116,8 +117,8 @@ export type EventMap = {
116117
FuelSeasonRecord: Event<FuelSeasonRecord>;
117118
InsuranceFundSwapRecord: Event<InsuranceFundSwapRecord>;
118119
TransferProtocolIfSharesToRevenuePoolRecord: Event<TransferProtocolIfSharesToRevenuePoolRecord>;
119-
LPMintRedeemRecord: Event<LPMintRedeemRecord>;
120120
LPSettleRecord: Event<LPSettleRecord>;
121+
LPMintRedeemRecord: Event<LPMintRedeemRecord>;
121122
LPSwapRecord: Event<LPSwapRecord>;
122123
};
123124

@@ -146,8 +147,9 @@ export type DriftEvent =
146147
| Event<InsuranceFundSwapRecord>
147148
| Event<TransferProtocolIfSharesToRevenuePoolRecord>
148149
| Event<LPSettleRecord>
150+
| Event<LPMintRedeemRecord>
149151
| Event<LPSwapRecord>
150-
| Event<LPMintRedeemRecord>;
152+
| Event<LPBorrowLendDepositRecord>;
151153

152154
export interface EventSubscriberEvents {
153155
newEvent: (event: WrappedEvent<EventType>) => void;

sdk/src/idl/drift.json

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14875,6 +14875,11 @@
1487514875
"name": "lpPrice",
1487614876
"type": "u128",
1487714877
"index": false
14878+
},
14879+
{
14880+
"name": "lpPool",
14881+
"type": "publicKey",
14882+
"index": false
1487814883
}
1487914884
]
1488014885
},
@@ -14985,6 +14990,11 @@
1498514990
"name": "outSwapId",
1498614991
"type": "u64",
1498714992
"index": false
14993+
},
14994+
{
14995+
"name": "lpPool",
14996+
"type": "publicKey",
14997+
"index": false
1498814998
}
1498914999
]
1499015000
},
@@ -15080,6 +15090,68 @@
1508015090
"name": "inMarketTargetWeight",
1508115091
"type": "i64",
1508215092
"index": false
15093+
},
15094+
{
15095+
"name": "lpPool",
15096+
"type": "publicKey",
15097+
"index": false
15098+
}
15099+
]
15100+
},
15101+
{
15102+
"name": "LPBorrowLendDepositRecord",
15103+
"fields": [
15104+
{
15105+
"name": "ts",
15106+
"type": "i64",
15107+
"index": false
15108+
},
15109+
{
15110+
"name": "slot",
15111+
"type": "u64",
15112+
"index": false
15113+
},
15114+
{
15115+
"name": "spotMarketIndex",
15116+
"type": "u16",
15117+
"index": false
15118+
},
15119+
{
15120+
"name": "constituentIndex",
15121+
"type": "u16",
15122+
"index": false
15123+
},
15124+
{
15125+
"name": "direction",
15126+
"type": {
15127+
"defined": "DepositDirection"
15128+
},
15129+
"index": false
15130+
},
15131+
{
15132+
"name": "tokenBalance",
15133+
"type": "i64",
15134+
"index": false
15135+
},
15136+
{
15137+
"name": "lastTokenBalance",
15138+
"type": "i64",
15139+
"index": false
15140+
},
15141+
{
15142+
"name": "interestAccruedTokenAmount",
15143+
"type": "i64",
15144+
"index": false
15145+
},
15146+
{
15147+
"name": "amountDepositWithdraw",
15148+
"type": "u64",
15149+
"index": false
15150+
},
15151+
{
15152+
"name": "lpPool",
15153+
"type": "publicKey",
15154+
"index": false
1508315155
}
1508415156
]
1508515157
}

sdk/src/types.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,7 @@ export type LPSwapRecord = {
767767
outMarketTargetWeight: BN;
768768
inSwapId: BN;
769769
outSwapId: BN;
770+
lpPool: PublicKey;
770771
};
771772

772773
export type LPMintRedeemRecord = {
@@ -789,6 +790,7 @@ export type LPMintRedeemRecord = {
789790
lastAumSlot: BN;
790791
inMarketCurrentWeight: BN;
791792
inMarketTargetWeight: BN;
793+
lpPool: PublicKey;
792794
};
793795

794796
export type LPSettleRecord = {
@@ -803,6 +805,20 @@ export type LPSettleRecord = {
803805
perpAmmExFeeDelta: BN;
804806
lpAum: BN;
805807
lpPrice: BN;
808+
lpPool: PublicKey;
809+
};
810+
811+
export type LPBorrowLendDepositRecord = {
812+
ts: BN;
813+
slot: BN;
814+
spotMarketIndex: number;
815+
constituentIndex: number;
816+
direction: DepositDirection;
817+
tokenBalance: BN;
818+
lastTokenBalance: BN;
819+
interestAccruedTokenAmount: BN;
820+
amountDepositWithdraw: BN;
821+
lpPool: PublicKey;
806822
};
807823

808824
export type StateAccount = {
@@ -878,6 +894,11 @@ export type PerpMarketAccount = {
878894
protectedMakerLimitPriceDivisor: number;
879895
protectedMakerDynamicDivisor: number;
880896
lastFillPrice: BN;
897+
898+
lpFeeTransferScalar: number;
899+
lpExchangeFeeExcluscionScalar: number;
900+
lpStatus: number;
901+
lpPausedOperations: number;
881902
};
882903

883904
export type HistoricalOracleData = {

0 commit comments

Comments
 (0)