The Lulo userAccount has authority over the deposited funds in each integrated protocol. For Mango, Drift, and Kamino, the authority transfers over directly to the respective user accounts at those protocols.
For Solend and MarginFi, you can find the corresponding Lulo obligation accounts by parsing the userAccount using the below IDL:
#[account]pubstructUserAccount {pub bump:u8,pub _padding: [u8; 7],// wallet address that owns this UserAccountpub owner:Pubkey,// the marginFi userAccount which this UserAccount has authoritypub mfi_account:Pubkey,// the solend obligation which this UserAccount has authoritypub solend_obligation:Pubkey,// 2x Points lift metadatapub promotion_seeds: [PromotionSeed; 4],pub _padding2: [u64; 12],}
Points Lift balance
exportasyncfunctionfetchKaminoPointsLiftBalance( program:Program<Flexlend>, owner:PublicKey,// always USDC mintAddress:PublicKey,):Promise<BN|null> {constflexUserPda=getFlexUserPDA(owner,program.programId)constflexUser=awaitprogram.account.userAccount.fetchNullable(flexUserPda)if (flexUser ==null) {returnnull }// default [u8, 19]constisEmpty= (authoritySeed:number[]) => {return (authoritySeed.toString() === [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].toString() ) }// check for any valid `promotionSeeds` on the user, there should be either 0 or 1constvalidAuthoritySeed=flexUser.promotionSeeds.find(s =>!isEmpty(s.authoritySeed))if (!validAuthoritySeed) {returnnull }// map to UTF-8 and find the address for this promotion authority,// which is another PDA that has the authority over the Kamino obligationconstseedValue=Buffer.from(validAuthoritySeed.authoritySeed).toString('utf8')constauthorityAddress=PublicKey.findProgramAddressSync( [Buffer.from('promotion_authority'),Buffer.from(seedValue.toString())],program.programId, )[0]constpromotionAuthority=awaitprogram.account.promotionAuthority.fetchNullable( authorityAddress, )if (promotionAuthority ===null) {thrownewError(`invalid promotion seed ${seedValue} for owner ${owner}`) }// promotion authority tracks user deposits, the obligation on the JLP pool will show 2x the user depositsreturnpromotionAuthority.totalDeposits}