Skip to content

Commit

Permalink
Run scarb fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Chepelau committed Dec 11, 2023
1 parent 4423775 commit 764957f
Showing 1 changed file with 47 additions and 17 deletions.
64 changes: 47 additions & 17 deletions tests/test_trade_close.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ fn test_trade_close_long_with_pool_position_change() {
99999999999 // Disable this check
);


let stats_1 = StatsTrait::new(ctx, dsps);

assert(stats_1.bal_lpt_c == five_tokens, 'Call lpt bal wrong');
Expand All @@ -278,19 +277,39 @@ fn test_trade_close_long_with_pool_position_change() {
assert(stats_1.lpool_balance_c == 4999260530545281572, 'Call1 lpool bal wrong');
assert(stats_1.lpool_balance_p == 4956655873, 'Put1 lpool bal wrong');

assert(stats_1.bal_eth + stats_1.lpool_balance_c + 500000000000000000 == 2 * five_tokens, 'random eth appeared 1');
assert(stats_1.bal_usdc + stats_1.lpool_balance_p + 750000000 == 2 * five_k_tokens, 'random usdc appeared 1');

assert(stats_1.bal_eth + stats_1.locked_capital_c + stats_1.unlocked_capital_c + 500000000000000000 == 2 * five_tokens, 'random eth appeared 2');
assert(stats_1.bal_usdc + stats_1.locked_capital_p + stats_1.unlocked_capital_p + 750000000 == 2 * five_k_tokens, 'random usdc appeared 2');
assert(
stats_1.bal_eth + stats_1.lpool_balance_c + 500000000000000000 == 2 * five_tokens,
'random eth appeared 1'
);
assert(
stats_1.bal_usdc + stats_1.lpool_balance_p + 750000000 == 2 * five_k_tokens,
'random usdc appeared 1'
);

assert(
stats_1.bal_eth
+ stats_1.locked_capital_c
+ stats_1.unlocked_capital_c
+ 500000000000000000 == 2 * five_tokens,
'random eth appeared 2'
);
assert(
stats_1.bal_usdc
+ stats_1.locked_capital_p
+ stats_1.unlocked_capital_p
+ 750000000 == 2 * five_k_tokens,
'random usdc appeared 2'
);

assert(stats_1.locked_capital_c == 0, 'Call1 locked wrong');
assert(stats_1.locked_capital_p == 0, 'Put1 locked wrong');

assert(stats_1.unlocked_capital_c == 4999260530545281572, 'Call1 unlocked wrong');
assert(stats_1.unlocked_capital_p == 4956655873, 'Put1 unlocked wrong');

assert(stats_1.volatility_c == FixedTrait::from_felt(1660206966633859645500), 'Call1 vol wrong');

assert(
stats_1.volatility_c == FixedTrait::from_felt(1660206966633859645500), 'Call1 vol wrong'
);
assert(stats_1.volatility_p == FixedTrait::from_felt(1567973246265311887400), 'Put1 vol wrong');

assert(stats_1.opt_pos_lc == 500000000000000000, 'lc1 pos wrong');
Expand Down Expand Up @@ -499,7 +518,6 @@ fn test_trade_close_short_with_pool_position_change() {
FixedTrait::from_unscaled_felt(100_000), // Disable this check
99999999999 // Disable this check
);


let short_call_premia = dsps
.amm
Expand Down Expand Up @@ -528,7 +546,7 @@ fn test_trade_close_short_with_pool_position_change() {
FixedTrait::from_unscaled_felt(100_000), // Disable this check
99999999999 // Disable this check
);

let stats_1 = StatsTrait::new(ctx, dsps);

assert(stats_1.bal_lpt_c == five_tokens, 'Call lpt bal wrong');
Expand All @@ -538,26 +556,38 @@ fn test_trade_close_short_with_pool_position_change() {
assert(stats_1.bal_opt_sc == 0, 'Opt1 sc bal wrong');
assert(stats_1.bal_opt_lp == 500000000000000000, 'Opt1 lp bal wrong');
assert(stats_1.bal_opt_sp == 0, 'Opt1 sp bal wrong');

assert(stats_1.bal_eth == 4998433196311350232, 'Eth1 bal wrong');
assert(stats_1.bal_usdc == 4940147218, 'Usdc1 bal wrong');

assert(stats_1.lpool_balance_c == 5001566803688649768, 'Call1 lpool bal wrong');
assert(stats_1.lpool_balance_p == 5059852782, 'Put1 lpool bal wrong');

assert(stats_1.bal_eth + stats_1.lpool_balance_c == 2 * five_tokens, 'random eth appeared 1');
assert(stats_1.bal_usdc + stats_1.lpool_balance_p == 2 * five_k_tokens, 'random usdc appeared 1');

assert(
stats_1.bal_usdc + stats_1.lpool_balance_p == 2 * five_k_tokens, 'random usdc appeared 1'
);

assert(stats_1.locked_capital_c == 500000000000000000, 'Call1 locked wrong');
assert(stats_1.locked_capital_p == 750000000, 'Put1 locked wrong');

assert(stats_1.bal_eth + stats_1.locked_capital_c + stats_1.unlocked_capital_c == 2 * five_tokens, 'random eth appeared 2');
assert(stats_1.bal_usdc + stats_1.locked_capital_p + stats_1.unlocked_capital_p == 2 * five_k_tokens, 'random usdc appeared 2');

assert(
stats_1.bal_eth + stats_1.locked_capital_c + stats_1.unlocked_capital_c == 2 * five_tokens,
'random eth appeared 2'
);
assert(
stats_1.bal_usdc
+ stats_1.locked_capital_p
+ stats_1.unlocked_capital_p == 2 * five_k_tokens,
'random usdc appeared 2'
);

assert(stats_1.unlocked_capital_c == 4501566803688649768, 'Call1 unlocked wrong');
assert(stats_1.unlocked_capital_p == 4309852782, 'Put1 unlocked wrong');

assert(stats_1.volatility_c == FixedTrait::from_felt(2029141848108050677700), 'Call1 vol wrong');
assert(
stats_1.volatility_c == FixedTrait::from_felt(2029141848108050677700), 'Call1 vol wrong'
);
assert(stats_1.volatility_p == FixedTrait::from_felt(2121375568476598435800), 'Put1 vol wrong');

assert(stats_1.opt_pos_lc == 0, 'lc1 pos wrong');
Expand Down

0 comments on commit 764957f

Please sign in to comment.