From b428af86f19e33e08394fab4508dc2f4fd431679 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sojka?= Date: Tue, 10 Oct 2023 14:10:23 +0000 Subject: [PATCH] Add 1910 2912 options --- src/contract.cairo | 6 +-- src/options.cairo | 118 ++++++++++++++++++++++++++++++++++++--------- 2 files changed, 97 insertions(+), 27 deletions(-) diff --git a/src/contract.cairo b/src/contract.cairo index 766edc6d..85d2f104 100644 --- a/src/contract.cairo +++ b/src/contract.cairo @@ -30,7 +30,7 @@ trait IGovernance { // OPTIONS - fn add_2411_options(ref self: TContractState); + fn add_1910_2912_options(ref self: TContractState); } @@ -153,8 +153,8 @@ mod Governance { Airdrop::claim(address, amount, proof) } - fn add_2411_options(ref self: ContractState) { - Options::run_add_2411_options() + fn add_1910_2912_options(ref self: ContractState) { + Options::run_add_1910_2912_options() } } } diff --git a/src/options.cairo b/src/options.cairo index d5062386..34ed01b8 100644 --- a/src/options.cairo +++ b/src/options.cairo @@ -34,6 +34,7 @@ mod Options { const VOLATILITY_31_5: Math64x61_ = 72634054790231359488; const VOLATILITY_32: Math64x61_ = consteval_int!(32 * 2305843009213693952); const VOLATILITY_32_5: Math64x61_ = 74939897799445053440; + const VOLATILITY_33: Math64x61_ = consteval_int!(33 * 2305843009213693952); const VOLATILITY_34: Math64x61_ = consteval_int!(34 * 2305843009213693952); const VOLATILITY_35: Math64x61_ = consteval_int!(35 * 2305843009213693952); const VOLATILITY_35_5: Math64x61_ = 81857426827086135296; @@ -52,9 +53,11 @@ mod Options { const VOLATILITY_46: Math64x61_ = 106068778423829921792; const VOLATILITY_46_5: Math64x61_ = 107221699928436768768; const VOLATILITY_48_5: Math64x61_ = 111833385946864156672; + const VOLATILITY_52: Math64x61_ = consteval_int!(52 * 2305843009213693952); const VOLATILITY_55: Math64x61_ = 126821365506753167360; const VOLATILITY_60: Math64x61_ = 138350580552821637120; + const STRIKE_PRICE_1400: Math64x61_ = consteval_int!(1400 * 2305843009213693952); const STRIKE_PRICE_1500: Math64x61_ = consteval_int!(1500 * 2305843009213693952); const STRIKE_PRICE_1600: Math64x61_ = consteval_int!(1600 * 2305843009213693952); const STRIKE_PRICE_1700: Math64x61_ = consteval_int!(1700 * 2305843009213693952); @@ -203,23 +206,24 @@ mod Options { res } - fn run_add_2411_options() { + fn run_add_1910_2912_options() { let mut state = Governance::unsafe_new_contract_state(); assert( !proposal_initializer_run::InternalContractStateTrait::read( - @state.proposal_initializer_run, 34 + @state.proposal_initializer_run, 35 ), - 'prop34 initializer called again' + 'prop35 initializer called again' ); proposal_initializer_run::InternalContractStateTrait::write( - ref state.proposal_initializer_run, 34, true + ref state.proposal_initializer_run, 35, true ); - add_2411_options(); + add_1910_options(); + add_2912_options(); } - fn add_2411_options() { - let MATURITY: felt252 = 1700783999; + fn add_1910_opions() { + let MATURITY: felt252 = 1697759999; let eth_lpt_addr: ContractAddress = 0x7aba50fdb4e024c1ba63e2c60565d0fd32566ff4b18aa5818fc80c30e749024 @@ -234,61 +238,127 @@ mod Options { to_add .append( FutureOption { - name_long: 'ETHUSDC-23NOV23-1700-LONG-CALL', - name_short: 'ETHUSDC-23NOV23-1700-SHORT-CALL', + name_long: 'ETHUSDC-19OCT23-1600-LONG-CALL', + name_short: 'ETHUSDC-19OCT23-1600-SHORT-CALL', + maturity: MATURITY, + strike_price: STRIKE_PRICE_1600, + option_type: OPTION_CALL, + lptoken_address: eth_lpt_addr, + initial_volatility: VOLATILITY_30 + } + ); + to_add + .append( + FutureOption { + name_long: 'ETHUSDC-19OCT23-1700-LONG-CALL', + name_short: 'ETHUSDC-19OCT23-1700-SHORT-CALL', maturity: MATURITY, strike_price: STRIKE_PRICE_1700, option_type: OPTION_CALL, lptoken_address: eth_lpt_addr, - initial_volatility: VOLATILITY_32 + initial_volatility: VOLATILITY_35 } ); to_add .append( FutureOption { - name_long: 'ETHUSDC-23NOV23-1800-LONG-CALL', - name_short: 'ETHUSDC-23NOV23-1800-SHORT-CALL', + name_long: 'ETHUSDC-19OCT23-1800-LONG-CALL', + name_short: 'ETHUSDC-19OCT23-1800-SHORT-CALL', maturity: MATURITY, strike_price: STRIKE_PRICE_1800, option_type: OPTION_CALL, lptoken_address: eth_lpt_addr, - initial_volatility: VOLATILITY_34 + initial_volatility: VOLATILITY_46 + } + ); + to_add + .append( + FutureOption { + name_long: 'ETHUSDC-19OCT23-1500-LONG-PUT', + name_short: 'ETHUSDC-19OCT23-1500-SHORT-PUT', + maturity: MATURITY, + strike_price: STRIKE_PRICE_1500, + option_type: OPTION_PUT, + lptoken_address: usdc_lpt_addr, + initial_volatility: VOLATILITY_38 + } + ); + to_add + .append( + FutureOption { + name_long: 'ETHUSDC-19OCT23-1400-LONG-PUT', + name_short: 'ETHUSDC-19OCT23-1400-SHORT-PUT', + maturity: MATURITY, + strike_price: STRIKE_PRICE_1400, + option_type: OPTION_PUT, + lptoken_address: usdc_lpt_addr, + initial_volatility: VOLATILITY_52 + } + ); + + add_options(1910238812, to_add.span()) + } + + + fn add_2912_opions() { + let MATURITY: felt252 = 1703807999; + + let eth_lpt_addr: ContractAddress = + 0x7aba50fdb4e024c1ba63e2c60565d0fd32566ff4b18aa5818fc80c30e749024 + .try_into() + .unwrap(); + let usdc_lpt_addr: ContractAddress = + 0x18a6abca394bd5f822cfa5f88783c01b13e593d1603e7b41b00d31d2ea4827a + .try_into() + .unwrap(); + + let mut to_add = ArrayTrait::::new(); + to_add + .append( + FutureOption { + name_long: 'ETHUSDC-29DEC23-1600-LONG-CALL', + name_short: 'ETHUSDC-29DEC23-1600-SHORT-CALL', + maturity: MATURITY, + strike_price: STRIKE_PRICE_1600, + option_type: OPTION_CALL, + lptoken_address: eth_lpt_addr, + initial_volatility: VOLATILITY_33 } ); to_add .append( FutureOption { - name_long: 'ETHUSDC-23NOV23-1900-LONG-CALL', - name_short: 'ETHUSDC-23NOV23-1900-SHORT-CALL', + name_long: 'ETHUSDC-29DEC23-1700-LONG-CALL', + name_short: 'ETHUSDC-29DEC23-1700-SHORT-CALL', maturity: MATURITY, - strike_price: STRIKE_PRICE_1900, + strike_price: STRIKE_PRICE_1700, option_type: OPTION_CALL, lptoken_address: eth_lpt_addr, - initial_volatility: VOLATILITY_37 + initial_volatility: VOLATILITY_35 } ); to_add .append( FutureOption { - name_long: 'ETHUSDC-23NOV23-1500-LONG-PUT', - name_short: 'ETHUSDC-23NOV23-1500-SHORT-PUT', + name_long: 'ETHUSDC-29DEC23-1500-LONG-PUT', + name_short: 'ETHUSDC-29DEC23-1500-SHORT-PUT', maturity: MATURITY, strike_price: STRIKE_PRICE_1500, option_type: OPTION_PUT, lptoken_address: usdc_lpt_addr, - initial_volatility: VOLATILITY_37 + initial_volatility: VOLATILITY_35 } ); to_add .append( FutureOption { - name_long: 'ETHUSDC-23NOV23-1600-LONG-PUT', - name_short: 'ETHUSDC-23NOV23-1600-SHORT-PUT', + name_long: 'ETHUSDC-29DEC23-1400-LONG-PUT', + name_short: 'ETHUSDC-29DEC23-1400-SHORT-PUT', maturity: MATURITY, - strike_price: STRIKE_PRICE_1600, + strike_price: STRIKE_PRICE_1400, option_type: OPTION_PUT, lptoken_address: usdc_lpt_addr, - initial_volatility: VOLATILITY_34 + initial_volatility: VOLATILITY_40 } );