We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6647b38 commit 598c786Copy full SHA for 598c786
programs/drift/src/math/insurance/tests.rs
@@ -165,4 +165,13 @@ pub fn if_shares_lost_test() {
165
< if_stake.last_withdraw_request_value,
166
true
167
);
168
+
169
+ // removing 100% of shares
170
+ spot_market.insurance_fund.total_shares = 1000 * QUOTE_PRECISION;
171
+ if_stake.update_if_shares(1000 * QUOTE_PRECISION, &spot_market).unwrap();
172
+ if_stake.last_withdraw_request_value = (1000 * QUOTE_PRECISION - 1) as u64;
173
+ if_stake.last_withdraw_request_shares = 1000 * QUOTE_PRECISION;
174
+ let lost_shares = calculate_if_shares_lost(&if_stake, &spot_market, if_balance).unwrap();
175
176
+ assert_eq!(lost_shares, 0);
177
}
0 commit comments