@@ -737,3 +737,112 @@ pub fn emit_buffers<T: AnchorSerialize + Discriminator>(
737737
738738 Ok ( ( ) )
739739}
740+
741+ #[ event]
742+ #[ derive( Default ) ]
743+ pub struct LPSettleRecord {
744+ pub record_id : u64 ,
745+ // previous settle unix timestamp
746+ pub last_ts : i64 ,
747+ // previous settle slot
748+ pub last_slot : u64 ,
749+ // current settle unix timestamp
750+ pub ts : i64 ,
751+ // current slot
752+ pub slot : u64 ,
753+ // amm perp market index
754+ pub perp_market_index : u16 ,
755+ // token amount to settle to lp (positive is from amm to lp, negative lp to amm)
756+ pub settle_to_lp_amount : i64 ,
757+ // quote pnl of amm since last settle
758+ pub perp_amm_pnl_delta : i64 ,
759+ // exchange fees earned by market/amm since last settle
760+ pub perp_amm_ex_fee_delta : i64 ,
761+ // current aum of lp
762+ pub lp_aum : u128 ,
763+ // current mint price of lp
764+ pub lp_price : u128 ,
765+ }
766+
767+ #[ event]
768+ #[ derive( Default ) ]
769+ pub struct LPSwapRecord {
770+ pub ts : i64 ,
771+ pub slot : u64 ,
772+ pub authority : Pubkey ,
773+ /// precision: out market mint precision, gross fees
774+ pub out_amount : u128 ,
775+ /// precision: in market mint precision, gross fees
776+ pub in_amount : u128 ,
777+ /// precision: fee on amount_out, in market mint precision
778+ pub out_fee : i128 ,
779+ /// precision: fee on amount_in, out market mint precision
780+ pub in_fee : i128 ,
781+ // out spot market index
782+ pub out_spot_market_index : u16 ,
783+ // in spot market index
784+ pub in_spot_market_index : u16 ,
785+ // out constituent index
786+ pub out_constituent_index : u16 ,
787+ // in constituent index
788+ pub in_constituent_index : u16 ,
789+ /// precision: PRICE_PRECISION
790+ pub out_oracle_price : i64 ,
791+ /// precision: PRICE_PRECISION
792+ pub in_oracle_price : i64 ,
793+ /// LPPool last_aum, QUOTE_PRECISION
794+ pub last_aum : u128 ,
795+ pub last_aum_slot : u64 ,
796+ /// PERCENTAGE_PRECISION
797+ pub in_market_current_weight : i64 ,
798+ /// PERCENTAGE_PRECISION
799+ pub out_market_current_weight : i64 ,
800+ /// PERCENTAGE_PRECISION
801+ pub in_market_target_weight : i64 ,
802+ /// PERCENTAGE_PRECISION
803+ pub out_market_target_weight : i64 ,
804+ pub in_swap_id : u64 ,
805+ pub out_swap_id : u64 ,
806+ }
807+
808+ impl Size for LPSwapRecord {
809+ const SIZE : usize = 376 ;
810+ }
811+
812+ #[ event]
813+ #[ derive( Default ) ]
814+ pub struct LPMintRedeemRecord {
815+ pub ts : i64 ,
816+ pub slot : u64 ,
817+ pub authority : Pubkey ,
818+ pub description : u8 ,
819+ /// precision: continutent mint precision, gross fees
820+ pub amount : u128 ,
821+ /// precision: fee on amount, constituent market mint precision
822+ pub fee : i128 ,
823+ // spot market index
824+ pub spot_market_index : u16 ,
825+ // constituent index
826+ pub constituent_index : u16 ,
827+ /// precision: PRICE_PRECISION
828+ pub oracle_price : i64 ,
829+ /// token mint
830+ pub mint : Pubkey ,
831+ /// lp amount, lp mint precision
832+ pub lp_amount : u64 ,
833+ /// lp fee, lp mint precision
834+ pub lp_fee : i64 ,
835+ /// the fair price of the lp token, PRICE_PRECISION
836+ pub lp_price : u128 ,
837+ pub mint_redeem_id : u64 ,
838+ /// LPPool last_aum
839+ pub last_aum : u128 ,
840+ pub last_aum_slot : u64 ,
841+ /// PERCENTAGE_PRECISION
842+ pub in_market_current_weight : i64 ,
843+ pub in_market_target_weight : i64 ,
844+ }
845+
846+ impl Size for LPMintRedeemRecord {
847+ const SIZE : usize = 328 ;
848+ }
0 commit comments