Update lending and obligation models

This commit is contained in:
Justin Starry 2021-01-15 16:25:04 +08:00
parent 7c0401a1fd
commit 5dfad004ab
2 changed files with 2 additions and 4 deletions

View File

@ -5,11 +5,12 @@ import * as Layout from "./../../utils/layout";
export const LendingMarketLayout: typeof BufferLayout.Structure = BufferLayout.struct( export const LendingMarketLayout: typeof BufferLayout.Structure = BufferLayout.struct(
[ [
BufferLayout.u8('version'), BufferLayout.u8('version'),
BufferLayout.u8('bumpSeed'),
Layout.publicKey("quoteMint"), Layout.publicKey("quoteMint"),
Layout.publicKey("tokenProgramId"), Layout.publicKey("tokenProgramId"),
// extra space for future contract changes // extra space for future contract changes
BufferLayout.blob(63, "padding"), BufferLayout.blob(62, "padding"),
], ],
); );

View File

@ -6,8 +6,6 @@ import * as Layout from "./../../utils/layout";
export const LendingObligationLayout: typeof BufferLayout.Structure = BufferLayout.struct( export const LendingObligationLayout: typeof BufferLayout.Structure = BufferLayout.struct(
[ [
BufferLayout.u8('version'), BufferLayout.u8('version'),
/// Slot when obligation was updated. Used for calculating interest.
Layout.uint64("lastUpdateSlot"),
/// Amount of collateral tokens deposited for this obligation /// Amount of collateral tokens deposited for this obligation
Layout.uint64("depositedCollateral"), Layout.uint64("depositedCollateral"),
/// Reserve which collateral tokens were deposited into /// Reserve which collateral tokens were deposited into
@ -33,7 +31,6 @@ export const isLendingObligation = (info: AccountInfo<Buffer>) => {
export interface LendingObligation { export interface LendingObligation {
version: number; version: number;
lastUpdateSlot: BN;
depositedCollateral: BN; depositedCollateral: BN;
collateralReserve: PublicKey; collateralReserve: PublicKey;
cumulativeBorrowRateWad: BN; // decimals cumulativeBorrowRateWad: BN; // decimals