Skip to content

Commit 1d705ae

Browse files
committed
weow it compiels
1 parent dba7a19 commit 1d705ae

File tree

41 files changed

+2833
-2818
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+2833
-2818
lines changed

programs/drift/src/controller/amm/tests.rs

Lines changed: 163 additions & 163 deletions
Large diffs are not rendered by default.

programs/drift/src/controller/insurance/tests.rs

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ pub fn basic_stake_if_test() {
2525
};
2626
let amount = QUOTE_PRECISION as u64; // $1
2727
let mut spot_market = SpotMarket {
28-
deposit_balance: 0,
29-
cumulative_deposit_interest: 1111 * SPOT_CUMULATIVE_INTEREST_PRECISION / 1000,
28+
deposit_balance: 0.into(),
29+
cumulative_deposit_interest: (1111 * SPOT_CUMULATIVE_INTEREST_PRECISION / 1000).into(),
3030
insurance_fund: InsuranceFund {
3131
unstaking_period: 0,
3232
..InsuranceFund::default()
@@ -124,8 +124,8 @@ pub fn basic_seeded_stake_if_test() {
124124
};
125125
let amount = QUOTE_PRECISION as u64; // $1
126126
let mut spot_market = SpotMarket {
127-
deposit_balance: 0,
128-
cumulative_deposit_interest: 1111 * SPOT_CUMULATIVE_INTEREST_PRECISION / 1000,
127+
deposit_balance: 0.into(),
128+
cumulative_deposit_interest: (1111 * SPOT_CUMULATIVE_INTEREST_PRECISION / 1000).into(),
129129
insurance_fund: InsuranceFund {
130130
unstaking_period: 0,
131131
..InsuranceFund::default()
@@ -224,16 +224,16 @@ pub fn large_num_seeded_stake_if_test() {
224224

225225
// all funds in revenue pool
226226
let mut spot_market = SpotMarket {
227-
deposit_balance: 100 * SPOT_BALANCE_PRECISION,
228-
cumulative_deposit_interest: 1111 * SPOT_CUMULATIVE_INTEREST_PRECISION / 1000,
227+
deposit_balance: (100 * SPOT_BALANCE_PRECISION).into(),
228+
cumulative_deposit_interest: (1111 * SPOT_CUMULATIVE_INTEREST_PRECISION / 1000).into(),
229229
insurance_fund: InsuranceFund {
230230
unstaking_period: 0,
231231
revenue_settle_period: 1,
232232
..InsuranceFund::default()
233233
},
234234
revenue_pool: PoolBalance {
235235
market_index: 0,
236-
scaled_balance: 100 * SPOT_BALANCE_PRECISION,
236+
scaled_balance: (100 * SPOT_BALANCE_PRECISION).into(),
237237
..PoolBalance::default()
238238
},
239239
..SpotMarket::default()
@@ -371,8 +371,8 @@ pub fn gains_stake_if_test() {
371371
};
372372
let amount = QUOTE_PRECISION as u64; // $1
373373
let mut spot_market = SpotMarket {
374-
deposit_balance: 0,
375-
cumulative_deposit_interest: 1111 * SPOT_CUMULATIVE_INTEREST_PRECISION / 1000,
374+
deposit_balance: 0.into(),
375+
cumulative_deposit_interest: (1111 * SPOT_CUMULATIVE_INTEREST_PRECISION / 1000).into(),
376376
insurance_fund: InsuranceFund {
377377
unstaking_period: 0,
378378
..InsuranceFund::default()
@@ -496,8 +496,8 @@ pub fn losses_stake_if_test() {
496496
};
497497
let amount = QUOTE_PRECISION as u64; // $1
498498
let mut spot_market = SpotMarket {
499-
deposit_balance: 0,
500-
cumulative_deposit_interest: 1111 * SPOT_CUMULATIVE_INTEREST_PRECISION / 1000,
499+
deposit_balance: 0.into(),
500+
cumulative_deposit_interest: (1111 * SPOT_CUMULATIVE_INTEREST_PRECISION / 1000).into(),
501501
insurance_fund: InsuranceFund {
502502
unstaking_period: 0,
503503
..InsuranceFund::default()
@@ -624,8 +624,8 @@ pub fn escrow_losses_stake_if_test() {
624624
};
625625
let amount = (QUOTE_PRECISION * 100_000) as u64; // $100k
626626
let mut spot_market = SpotMarket {
627-
deposit_balance: 0,
628-
cumulative_deposit_interest: 1111 * SPOT_CUMULATIVE_INTEREST_PRECISION / 1000,
627+
deposit_balance: 0.into(),
628+
cumulative_deposit_interest: (1111 * SPOT_CUMULATIVE_INTEREST_PRECISION / 1000).into(),
629629
insurance_fund: InsuranceFund {
630630
unstaking_period: 60 * 60 * 24 * 7, // 7 weeks
631631
..InsuranceFund::default()
@@ -721,12 +721,12 @@ pub fn escrow_gains_stake_if_test() {
721721
};
722722
let amount = 100_000_384_939_u64; // $100k + change
723723
let mut spot_market = SpotMarket {
724-
deposit_balance: 0,
725-
cumulative_deposit_interest: 1111 * SPOT_CUMULATIVE_INTEREST_PRECISION / 1000,
724+
deposit_balance: 0.into(),
725+
cumulative_deposit_interest: (1111 * SPOT_CUMULATIVE_INTEREST_PRECISION / 1000).into(),
726726
insurance_fund: InsuranceFund {
727727
unstaking_period: 60 * 60 * 24 * 7, // 7 weeks
728-
total_shares: 1,
729-
user_shares: 0,
728+
total_shares: 1.into(),
729+
user_shares: 0.into(),
730730
..InsuranceFund::default()
731731
},
732732
..SpotMarket::default()
@@ -841,12 +841,12 @@ pub fn drained_stake_if_test_rebase_on_new_add() {
841841
let amount = 100_000_384_939_u64; // $100k + change
842842

843843
let mut spot_market = SpotMarket {
844-
deposit_balance: 0,
845-
cumulative_deposit_interest: 1111 * SPOT_CUMULATIVE_INTEREST_PRECISION / 1000,
844+
deposit_balance: 0.into(),
845+
cumulative_deposit_interest: (1111 * SPOT_CUMULATIVE_INTEREST_PRECISION / 1000).into(),
846846
insurance_fund: InsuranceFund {
847847
unstaking_period: 60 * 60 * 24 * 7, // 7 weeks
848-
total_shares: 100_000 * QUOTE_PRECISION,
849-
user_shares: 80_000 * QUOTE_PRECISION,
848+
total_shares: (100_000 * QUOTE_PRECISION).into(),
849+
user_shares: (80_000 * QUOTE_PRECISION).into(),
850850
..InsuranceFund::default()
851851
},
852852
..SpotMarket::default()
@@ -950,12 +950,12 @@ pub fn drained_stake_if_test_rebase_on_old_remove_all() {
950950
let mut if_balance = 0;
951951

952952
let mut spot_market = SpotMarket {
953-
deposit_balance: 0,
954-
cumulative_deposit_interest: 1111 * SPOT_CUMULATIVE_INTEREST_PRECISION / 1000,
953+
deposit_balance: 0.into(),
954+
cumulative_deposit_interest: (1111 * SPOT_CUMULATIVE_INTEREST_PRECISION / 1000).into(),
955955
insurance_fund: InsuranceFund {
956956
unstaking_period: 0,
957-
total_shares: 100_000 * QUOTE_PRECISION,
958-
user_shares: 80_000 * QUOTE_PRECISION,
957+
total_shares: (100_000 * QUOTE_PRECISION).into(),
958+
user_shares: (80_000 * QUOTE_PRECISION).into(),
959959
..InsuranceFund::default()
960960
},
961961
..SpotMarket::default()
@@ -1044,12 +1044,12 @@ pub fn drained_stake_if_test_rebase_on_old_remove_all_2() {
10441044
let mut if_balance = 0;
10451045

10461046
let mut spot_market = SpotMarket {
1047-
deposit_balance: 0,
1048-
cumulative_deposit_interest: 1111 * SPOT_CUMULATIVE_INTEREST_PRECISION / 1000,
1047+
deposit_balance: 0.into(),
1048+
cumulative_deposit_interest: (1111 * SPOT_CUMULATIVE_INTEREST_PRECISION / 1000).into(),
10491049
insurance_fund: InsuranceFund {
10501050
unstaking_period: 0,
1051-
total_shares: 100_930_021_053,
1052-
user_shares: 83_021 * QUOTE_PRECISION + 135723,
1051+
total_shares: 100_930_021_053.into(),
1052+
user_shares: (83_021 * QUOTE_PRECISION + 135723).into(),
10531053
..InsuranceFund::default()
10541054
},
10551055
..SpotMarket::default()
@@ -1258,8 +1258,8 @@ pub fn multiple_if_stakes_and_rebase() {
12581258

12591259
let amount = (QUOTE_PRECISION * 100_000) as u64; // $100k
12601260
let mut spot_market = SpotMarket {
1261-
deposit_balance: 0,
1262-
cumulative_deposit_interest: 1111 * SPOT_CUMULATIVE_INTEREST_PRECISION / 1000,
1261+
deposit_balance: 0.into(),
1262+
cumulative_deposit_interest: (1111 * SPOT_CUMULATIVE_INTEREST_PRECISION / 1000).into(),
12631263
insurance_fund: InsuranceFund {
12641264
unstaking_period: 0,
12651265
..InsuranceFund::default()
@@ -1377,8 +1377,8 @@ pub fn multiple_if_stakes_and_rebase_and_admin_remove() {
13771377

13781378
let amount = (QUOTE_PRECISION * 100_000) as u64; // $100k
13791379
let mut spot_market = SpotMarket {
1380-
deposit_balance: 0,
1381-
cumulative_deposit_interest: 1111 * SPOT_CUMULATIVE_INTEREST_PRECISION / 1000,
1380+
deposit_balance: 0.into(),
1381+
cumulative_deposit_interest: (1111 * SPOT_CUMULATIVE_INTEREST_PRECISION / 1000).into(),
13821382
insurance_fund: InsuranceFund {
13831383
unstaking_period: 0,
13841384
..InsuranceFund::default()
@@ -1539,8 +1539,8 @@ fn test_transfer_protocol_owned_stake() {
15391539
};
15401540

15411541
let mut spot_market = SpotMarket {
1542-
deposit_balance: 0,
1543-
cumulative_deposit_interest: 1111 * SPOT_CUMULATIVE_INTEREST_PRECISION / 1000,
1542+
deposit_balance: 0.into(),
1543+
cumulative_deposit_interest: (1111 * SPOT_CUMULATIVE_INTEREST_PRECISION / 1000).into(),
15441544
insurance_fund: InsuranceFund {
15451545
unstaking_period: 0,
15461546
..InsuranceFund::default()

programs/drift/src/controller/liquidation.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -672,10 +672,10 @@ pub fn liquidate_perp(
672672
maker_order_cumulative_quote_asset_amount_filled: Some(base_asset_value),
673673
oracle_price,
674674
bit_flags: 0,
675-
taker_existing_quote_entry_amount: taker_existing_quote_entry_amount,
676-
taker_existing_base_asset_amount: taker_existing_base_asset_amount,
677-
maker_existing_quote_entry_amount: maker_existing_quote_entry_amount,
678-
maker_existing_base_asset_amount: maker_existing_base_asset_amount,
675+
taker_existing_quote_entry_amount,
676+
taker_existing_base_asset_amount,
677+
maker_existing_quote_entry_amount,
678+
maker_existing_base_asset_amount,
679679
trigger_price: None,
680680
builder_idx: None,
681681
builder_fee: None,

0 commit comments

Comments
 (0)