Skip to content

Commit

Permalink
set initial borrow attribution limit value to u64::MAX
Browse files Browse the repository at this point in the history
  • Loading branch information
0xripleys committed Nov 23, 2023
1 parent 100ffba commit f32651f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion token-lending/sdk/src/state/reserve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1478,7 +1478,17 @@ impl Pack for Reserve {
protocol_take_rate: u8::from_le_bytes(*config_protocol_take_rate),
added_borrow_weight_bps: u64::from_le_bytes(*config_added_borrow_weight_bps),
reserve_type: ReserveType::from_u8(config_asset_type[0]).unwrap(),
attributed_borrow_limit: u64::from_le_bytes(*config_attributed_borrow_limit),
// this field is added in v2.0.3 and we will never set it to zero. only time it'll
// be zero is when we upgrade from v2.0.2 to v2.0.3. in that case, the correct
// thing to do is set the value to u64::MAX.
attributed_borrow_limit: {
let value = u64::from_le_bytes(*config_attributed_borrow_limit);
if value == 0 {
u64::MAX
} else {
value
}
},
},
rate_limiter: RateLimiter::unpack_from_slice(rate_limiter)?,
attributed_borrow_value: unpack_decimal(attributed_borrow_value),
Expand Down

0 comments on commit f32651f

Please sign in to comment.