Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust option size in get_all_non_expr_options_with_premia #143

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions contracts/core_amm/views_from_outside/view.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ func save_all_non_expired_options_with_premia_to_array{syscall_ptr: felt*, peder
// If option is non_expired append it, else keep going
let (current_block_time) = get_block_timestamp();
if (is_le(current_block_time, option.maturity) == TRUE) {
let one = Math64x61.fromFelt(1);
let one_tenth = 230584300921369395; // 0.1 ** 2**61
let (current_volatility) = get_pool_volatility_auto(lptoken_address, option.maturity, option.strike_price);
let (pool_volatility_adjustment_speed) = get_pool_volatility_adjustment_speed(lptoken_address);
with_attr error_message(
"Failed getting premium in save_all_non_expired_options_with_premia_to_array, cpb_uint256.low {current_pool_balance_uint256_low}"
){
let (premia) = _get_premia_with_fees(
option=option,
position_size=one,
position_size=one_tenth,
option_type=option.option_type,
current_volatility=current_volatility,
pool_volatility_adjustment_speed=pool_volatility_adjustment_speed
Expand Down
8 changes: 4 additions & 4 deletions tests/itest_specs/view_functions/liquidity_pool_basic.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ namespace LPBasicViewFunctions {
let option_call_strike_0 = get_array_element(2, option_call_len, option_call_array);
let option_call_premia_0 = get_array_element(6, option_call_len, option_call_array);

assert option_call_premia_0 = 1857344407991927;
assert option_call_premia_0 = 116904024424443;

let (call_option_token_address_0) = IAMM.get_option_token_address(
contract_address=amm_addr,
Expand All @@ -354,7 +354,7 @@ namespace LPBasicViewFunctions {
let option_call_strike_1 = get_array_element(9, option_call_len, option_call_array);
let option_call_premia_1 = get_array_element(13, option_call_len, option_call_array);

assert option_call_premia_1 = 539159896455322;
assert option_call_premia_1 = 98028062292272;


let (call_option_token_address_1) = IAMM.get_option_token_address(
Expand All @@ -372,7 +372,7 @@ namespace LPBasicViewFunctions {
let option_put_strike_0 = get_array_element(2, option_put_len, option_put_array);
let option_put_premia_0 = get_array_element(6, option_put_len, option_put_array);

assert option_put_premia_0 = 240748633495885851168;
assert option_put_premia_0 = 23918528951461624519;

let (put_option_token_address_0) = IAMM.get_option_token_address(
contract_address=amm_addr,
Expand All @@ -388,7 +388,7 @@ namespace LPBasicViewFunctions {
let option_put_strike_1 = get_array_element(9, option_put_len, option_put_array);
let option_put_premia_1 = get_array_element(13, option_put_len, option_put_array);

assert option_put_premia_1 = 224173826281861372371;
assert option_put_premia_1 = 22499877150927774264;

let (put_option_token_address_1) = IAMM.get_option_token_address(
contract_address=amm_addr,
Expand Down