@@ -41,9 +41,7 @@ export interface ObligationFields {
4141 /** The dangerous borrow value at the weighted average liquidation threshold (scaled fraction) */
4242 unhealthyBorrowValueSf : BN
4343 /** The asset tier of the deposits */
44- depositsAssetTiers : Array < number >
45- /** The asset tier of the borrows */
46- borrowsAssetTiers : Array < number >
44+ paddingDeprecatedAssetTiers : Array < number >
4745 /** The elevation group id the obligation opted into. */
4846 elevationGroup : number
4947 /** The number of obsolete reserves the obligation has a deposit in */
@@ -71,10 +69,15 @@ export interface ObligationFields {
7169 */
7270 autodeleverageMarginCallStartedTimestamp : BN
7371 /**
74- * Owner-defined, liquidator -executed orders applicable to this obligation .
72+ * Owner-defined, permissionlessly -executed repay orders .
7573 * Typical use-cases would be a stop-loss and a take-profit (possibly co-existing).
7674 */
77- orders : Array < types . ObligationOrderFields >
75+ obligationOrders : Array < types . ObligationOrderFields >
76+ /**
77+ * Owner-defined, permissionlessly-executed borrow order applicable to this obligation.
78+ * Non-zeroed only on a newly-initialized fixed-rate, fixed-term obligation.
79+ */
80+ borrowOrder : types . BorrowOrderFields
7881 padding3 : Array < BN >
7982}
8083
@@ -104,9 +107,7 @@ export interface ObligationJSON {
104107 /** The dangerous borrow value at the weighted average liquidation threshold (scaled fraction) */
105108 unhealthyBorrowValueSf : string
106109 /** The asset tier of the deposits */
107- depositsAssetTiers : Array < number >
108- /** The asset tier of the borrows */
109- borrowsAssetTiers : Array < number >
110+ paddingDeprecatedAssetTiers : Array < number >
110111 /** The elevation group id the obligation opted into. */
111112 elevationGroup : number
112113 /** The number of obsolete reserves the obligation has a deposit in */
@@ -134,10 +135,15 @@ export interface ObligationJSON {
134135 */
135136 autodeleverageMarginCallStartedTimestamp : string
136137 /**
137- * Owner-defined, liquidator -executed orders applicable to this obligation .
138+ * Owner-defined, permissionlessly -executed repay orders .
138139 * Typical use-cases would be a stop-loss and a take-profit (possibly co-existing).
139140 */
140- orders : Array < types . ObligationOrderJSON >
141+ obligationOrders : Array < types . ObligationOrderJSON >
142+ /**
143+ * Owner-defined, permissionlessly-executed borrow order applicable to this obligation.
144+ * Non-zeroed only on a newly-initialized fixed-rate, fixed-term obligation.
145+ */
146+ borrowOrder : types . BorrowOrderJSON
141147 padding3 : Array < string >
142148}
143149
@@ -168,9 +174,7 @@ export class Obligation {
168174 /** The dangerous borrow value at the weighted average liquidation threshold (scaled fraction) */
169175 readonly unhealthyBorrowValueSf : BN
170176 /** The asset tier of the deposits */
171- readonly depositsAssetTiers : Array < number >
172- /** The asset tier of the borrows */
173- readonly borrowsAssetTiers : Array < number >
177+ readonly paddingDeprecatedAssetTiers : Array < number >
174178 /** The elevation group id the obligation opted into. */
175179 readonly elevationGroup : number
176180 /** The number of obsolete reserves the obligation has a deposit in */
@@ -198,10 +202,15 @@ export class Obligation {
198202 */
199203 readonly autodeleverageMarginCallStartedTimestamp : BN
200204 /**
201- * Owner-defined, liquidator -executed orders applicable to this obligation .
205+ * Owner-defined, permissionlessly -executed repay orders .
202206 * Typical use-cases would be a stop-loss and a take-profit (possibly co-existing).
203207 */
204- readonly orders : Array < types . ObligationOrder >
208+ readonly obligationOrders : Array < types . ObligationOrder >
209+ /**
210+ * Owner-defined, permissionlessly-executed borrow order applicable to this obligation.
211+ * Non-zeroed only on a newly-initialized fixed-rate, fixed-term obligation.
212+ */
213+ readonly borrowOrder : types . BorrowOrder
205214 readonly padding3 : Array < BN >
206215
207216 static readonly discriminator = Buffer . from ( [
@@ -221,8 +230,7 @@ export class Obligation {
221230 borsh . u128 ( "borrowedAssetsMarketValueSf" ) ,
222231 borsh . u128 ( "allowedBorrowValueSf" ) ,
223232 borsh . u128 ( "unhealthyBorrowValueSf" ) ,
224- borsh . array ( borsh . u8 ( ) , 8 , "depositsAssetTiers" ) ,
225- borsh . array ( borsh . u8 ( ) , 5 , "borrowsAssetTiers" ) ,
233+ borsh . array ( borsh . u8 ( ) , 13 , "paddingDeprecatedAssetTiers" ) ,
226234 borsh . u8 ( "elevationGroup" ) ,
227235 borsh . u8 ( "numOfObsoleteDepositReserves" ) ,
228236 borsh . u8 ( "hasDebt" ) ,
@@ -234,8 +242,9 @@ export class Obligation {
234242 borsh . array ( borsh . u8 ( ) , 4 , "reserved" ) ,
235243 borsh . u64 ( "highestBorrowFactorPct" ) ,
236244 borsh . u64 ( "autodeleverageMarginCallStartedTimestamp" ) ,
237- borsh . array ( types . ObligationOrder . layout ( ) , 2 , "orders" ) ,
238- borsh . array ( borsh . u64 ( ) , 93 , "padding3" ) ,
245+ borsh . array ( types . ObligationOrder . layout ( ) , 2 , "obligationOrders" ) ,
246+ types . BorrowOrder . layout ( "borrowOrder" ) ,
247+ borsh . array ( borsh . u64 ( ) , 73 , "padding3" ) ,
239248 ] )
240249
241250 constructor ( fields : ObligationFields ) {
@@ -257,8 +266,7 @@ export class Obligation {
257266 this . borrowedAssetsMarketValueSf = fields . borrowedAssetsMarketValueSf
258267 this . allowedBorrowValueSf = fields . allowedBorrowValueSf
259268 this . unhealthyBorrowValueSf = fields . unhealthyBorrowValueSf
260- this . depositsAssetTiers = fields . depositsAssetTiers
261- this . borrowsAssetTiers = fields . borrowsAssetTiers
269+ this . paddingDeprecatedAssetTiers = fields . paddingDeprecatedAssetTiers
262270 this . elevationGroup = fields . elevationGroup
263271 this . numOfObsoleteDepositReserves = fields . numOfObsoleteDepositReserves
264272 this . hasDebt = fields . hasDebt
@@ -271,9 +279,10 @@ export class Obligation {
271279 this . highestBorrowFactorPct = fields . highestBorrowFactorPct
272280 this . autodeleverageMarginCallStartedTimestamp =
273281 fields . autodeleverageMarginCallStartedTimestamp
274- this . orders = fields . orders . map (
282+ this . obligationOrders = fields . obligationOrders . map (
275283 ( item ) => new types . ObligationOrder ( { ...item } )
276284 )
285+ this . borrowOrder = new types . BorrowOrder ( { ...fields . borrowOrder } )
277286 this . padding3 = fields . padding3
278287 }
279288
@@ -346,8 +355,7 @@ export class Obligation {
346355 borrowedAssetsMarketValueSf : dec . borrowedAssetsMarketValueSf ,
347356 allowedBorrowValueSf : dec . allowedBorrowValueSf ,
348357 unhealthyBorrowValueSf : dec . unhealthyBorrowValueSf ,
349- depositsAssetTiers : dec . depositsAssetTiers ,
350- borrowsAssetTiers : dec . borrowsAssetTiers ,
358+ paddingDeprecatedAssetTiers : dec . paddingDeprecatedAssetTiers ,
351359 elevationGroup : dec . elevationGroup ,
352360 numOfObsoleteDepositReserves : dec . numOfObsoleteDepositReserves ,
353361 hasDebt : dec . hasDebt ,
@@ -360,11 +368,12 @@ export class Obligation {
360368 highestBorrowFactorPct : dec . highestBorrowFactorPct ,
361369 autodeleverageMarginCallStartedTimestamp :
362370 dec . autodeleverageMarginCallStartedTimestamp ,
363- orders : dec . orders . map (
371+ obligationOrders : dec . obligationOrders . map (
364372 (
365373 item : any /* eslint-disable-line @typescript-eslint/no-explicit-any */
366374 ) => types . ObligationOrder . fromDecoded ( item )
367375 ) ,
376+ borrowOrder : types . BorrowOrder . fromDecoded ( dec . borrowOrder ) ,
368377 padding3 : dec . padding3 ,
369378 } )
370379 }
@@ -385,8 +394,7 @@ export class Obligation {
385394 borrowedAssetsMarketValueSf : this . borrowedAssetsMarketValueSf . toString ( ) ,
386395 allowedBorrowValueSf : this . allowedBorrowValueSf . toString ( ) ,
387396 unhealthyBorrowValueSf : this . unhealthyBorrowValueSf . toString ( ) ,
388- depositsAssetTiers : this . depositsAssetTiers ,
389- borrowsAssetTiers : this . borrowsAssetTiers ,
397+ paddingDeprecatedAssetTiers : this . paddingDeprecatedAssetTiers ,
390398 elevationGroup : this . elevationGroup ,
391399 numOfObsoleteDepositReserves : this . numOfObsoleteDepositReserves ,
392400 hasDebt : this . hasDebt ,
@@ -399,7 +407,8 @@ export class Obligation {
399407 highestBorrowFactorPct : this . highestBorrowFactorPct . toString ( ) ,
400408 autodeleverageMarginCallStartedTimestamp :
401409 this . autodeleverageMarginCallStartedTimestamp . toString ( ) ,
402- orders : this . orders . map ( ( item ) => item . toJSON ( ) ) ,
410+ obligationOrders : this . obligationOrders . map ( ( item ) => item . toJSON ( ) ) ,
411+ borrowOrder : this . borrowOrder . toJSON ( ) ,
403412 padding3 : this . padding3 . map ( ( item ) => item . toString ( ) ) ,
404413 }
405414 }
@@ -426,8 +435,7 @@ export class Obligation {
426435 borrowedAssetsMarketValueSf : new BN ( obj . borrowedAssetsMarketValueSf ) ,
427436 allowedBorrowValueSf : new BN ( obj . allowedBorrowValueSf ) ,
428437 unhealthyBorrowValueSf : new BN ( obj . unhealthyBorrowValueSf ) ,
429- depositsAssetTiers : obj . depositsAssetTiers ,
430- borrowsAssetTiers : obj . borrowsAssetTiers ,
438+ paddingDeprecatedAssetTiers : obj . paddingDeprecatedAssetTiers ,
431439 elevationGroup : obj . elevationGroup ,
432440 numOfObsoleteDepositReserves : obj . numOfObsoleteDepositReserves ,
433441 hasDebt : obj . hasDebt ,
@@ -441,7 +449,10 @@ export class Obligation {
441449 autodeleverageMarginCallStartedTimestamp : new BN (
442450 obj . autodeleverageMarginCallStartedTimestamp
443451 ) ,
444- orders : obj . orders . map ( ( item ) => types . ObligationOrder . fromJSON ( item ) ) ,
452+ obligationOrders : obj . obligationOrders . map ( ( item ) =>
453+ types . ObligationOrder . fromJSON ( item )
454+ ) ,
455+ borrowOrder : types . BorrowOrder . fromJSON ( obj . borrowOrder ) ,
445456 padding3 : obj . padding3 . map ( ( item ) => new BN ( item ) ) ,
446457 } )
447458 }
0 commit comments