Skip to content

Commit

Permalink
Add 3011 0712 options
Browse files Browse the repository at this point in the history
  • Loading branch information
tensojka committed Nov 22, 2023
1 parent 8640104 commit 8cd4d3c
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 50 deletions.
6 changes: 3 additions & 3 deletions src/contract.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ trait IGovernance<TContractState> {

// OPTIONS

fn add_0911_1611_options(ref self: TContractState);
fn add_3011_0712_options(ref self: TContractState);
}


Expand Down Expand Up @@ -153,8 +153,8 @@ mod Governance {
Airdrop::claim(address, amount, proof)
}

fn add_0911_1611_options(ref self: ContractState) {
Options::run_add_0911_1611_options()
fn add_3011_0712_options(ref self: ContractState) {
Options::run_add_3011_0712_options()
}
}
}
102 changes: 55 additions & 47 deletions src/options.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,16 @@ mod Options {
const VOLATILITY_46: Math64x61_ = 106068778423829921792;
const VOLATILITY_46_5: Math64x61_ = 107221699928436768768;
const VOLATILITY_47: Math64x61_ = consteval_int!(47 * 2305843009213693952);
const VOLATILITY_48: Math64x61_ = consteval_int!(48 * 2305843009213693952);
const VOLATILITY_48_5: Math64x61_ = 111833385946864156672;
const VOLATILITY_49: Math64x61_ = consteval_int!(49 * 2305843009213693952);
const VOLATILITY_49_5: Math64x61_ = 114139228956077850624;
const VOLATILITY_50: Math64x61_ = consteval_int!(50 * 2305843009213693952);
const VOLATILITY_51: Math64x61_ = consteval_int!(51 * 2305843009213693952);
const VOLATILITY_52: Math64x61_ = consteval_int!(52 * 2305843009213693952);
const VOLATILITY_53: Math64x61_ = consteval_int!(53 * 2305843009213693952);
const VOLATILITY_55: Math64x61_ = 126821365506753167360;
const VOLATILITY_57: Math64x61_ = consteval_int!(57 * 2305843009213693952);
const VOLATILITY_59: Math64x61_ = consteval_int!(59 * 2305843009213693952);
const VOLATILITY_60: Math64x61_ = 138350580552821637120;

Expand All @@ -68,6 +73,9 @@ mod Options {
const STRIKE_PRICE_1800: Math64x61_ = consteval_int!(1800 * 2305843009213693952);
const STRIKE_PRICE_1900: Math64x61_ = consteval_int!(1900 * 2305843009213693952);
const STRIKE_PRICE_2000: Math64x61_ = consteval_int!(2000 * 2305843009213693952);
const STRIKE_PRICE_2100: Math64x61_ = consteval_int!(2100 * 2305843009213693952);
const STRIKE_PRICE_2200: Math64x61_ = consteval_int!(2200 * 2305843009213693952);
const STRIKE_PRICE_2300: Math64x61_ = consteval_int!(2300 * 2305843009213693952);

fn add_options(salt: felt252, mut options: Span<FutureOption>) {
// TODO use block hash from block_hash syscall as salt // actually doable with the new syscall
Expand Down Expand Up @@ -211,24 +219,24 @@ mod Options {
res
}

fn run_add_0911_1611_options() {
fn run_add_3011_0712_options() {
let mut state = Governance::unsafe_new_contract_state();
assert(
!proposal_initializer_run::InternalContractStateTrait::read(
@state.proposal_initializer_run, 36
@state.proposal_initializer_run, 38
),
'prop36 initializer called again'
'prop38 initializer called again'
);
proposal_initializer_run::InternalContractStateTrait::write(
ref state.proposal_initializer_run, 36, true
ref state.proposal_initializer_run, 38, true
);

add_0911_options();
add_1611_options();
add_3011_options();
add_0712_options();
}

fn add_0911_options() {
let MATURITY: felt252 = 1699574399;
fn add_3011_options() {
let MATURITY: felt252 = 1701388799;

let eth_lpt_addr: ContractAddress =
0x7aba50fdb4e024c1ba63e2c60565d0fd32566ff4b18aa5818fc80c30e749024
Expand All @@ -243,69 +251,69 @@ mod Options {
to_add
.append(
FutureOption {
name_long: 'ETHUSDC-09NOV23-1800-LONG-CALL',
name_short: 'ETHUSDC-09NOV23-1800-SHORT-CALL',
name_long: 'ETHUSDC-30NOV23-2100-LONG-CALL',
name_short: 'ETHUSDC-30NOV23-2100-SHORT-CALL',
maturity: MATURITY,
strike_price: STRIKE_PRICE_1800,
strike_price: STRIKE_PRICE_2100,
option_type: OPTION_CALL,
lptoken_address: eth_lpt_addr,
initial_volatility: VOLATILITY_41
initial_volatility: VOLATILITY_49
}
);
to_add
.append(
FutureOption {
name_long: 'ETHUSDC-09NOV23-1900-LONG-CALL',
name_short: 'ETHUSDC-09NOV23-1900-SHORT-CALL',
name_long: 'ETHUSDC-30NOV23-2200-LONG-CALL',
name_short: 'ETHUSDC-30NOV23-2200-SHORT-CALL',
maturity: MATURITY,
strike_price: STRIKE_PRICE_1900,
strike_price: STRIKE_PRICE_2200,
option_type: OPTION_CALL,
lptoken_address: eth_lpt_addr,
initial_volatility: VOLATILITY_45
initial_volatility: VOLATILITY_52
}
);
to_add
.append(
FutureOption {
name_long: 'ETHUSDC-09NOV23-2000-LONG-CALL',
name_short: 'ETHUSDC-09NOV23-2000-SHORT-CALL',
name_long: 'ETHUSDC-30NOV23-2300-LONG-CALL',
name_short: 'ETHUSDC-30NOV23-2300-SHORT-CALL',
maturity: MATURITY,
strike_price: STRIKE_PRICE_2000,
strike_price: STRIKE_PRICE_2300,
option_type: OPTION_CALL,
lptoken_address: eth_lpt_addr,
initial_volatility: VOLATILITY_53
initial_volatility: VOLATILITY_57
}
);
to_add
.append(
FutureOption {
name_long: 'ETHUSDC-09NOV23-1700-LONG-PUT',
name_short: 'ETHUSDC-09NOV23-1700-SHORT-PUT',
name_long: 'ETHUSDC-30NOV23-2000-LONG-PUT',
name_short: 'ETHUSDC-30NOV23-2000-SHORT-PUT',
maturity: MATURITY,
strike_price: STRIKE_PRICE_1700,
strike_price: STRIKE_PRICE_2000,
option_type: OPTION_PUT,
lptoken_address: usdc_lpt_addr,
initial_volatility: VOLATILITY_42
initial_volatility: VOLATILITY_48
}
);
to_add
.append(
FutureOption {
name_long: 'ETHUSDC-09NOV23-1600-LONG-PUT',
name_short: 'ETHUSDC-09NOV23-1600-SHORT-PUT',
name_long: 'ETHUSDC-30NOV23-1900-LONG-PUT',
name_short: 'ETHUSDC-30NOV23-1900-SHORT-PUT',
maturity: MATURITY,
strike_price: STRIKE_PRICE_1600,
strike_price: STRIKE_PRICE_1900,
option_type: OPTION_PUT,
lptoken_address: usdc_lpt_addr,
initial_volatility: VOLATILITY_52
initial_volatility: VOLATILITY_51
}
);

add_options(1011238812, to_add.span())
add_options(3011238812, to_add.span())
}


fn add_1611_options() {
fn add_0712_options() {
let MATURITY: felt252 = 1700179199;

let eth_lpt_addr: ContractAddress =
Expand All @@ -321,52 +329,52 @@ mod Options {
to_add
.append(
FutureOption {
name_long: 'ETHUSDC-16NOV23-1800-LONG-CALL',
name_short: 'ETHUSDC-16NOV23-1800-SHORT-CALL',
name_long: 'ETHUSDC-07DEC23-2100-LONG-CALL',
name_short: 'ETHUSDC-07DEC23-2100-SHORT-CALL',
maturity: MATURITY,
strike_price: STRIKE_PRICE_1800,
strike_price: STRIKE_PRICE_2100,
option_type: OPTION_CALL,
lptoken_address: eth_lpt_addr,
initial_volatility: VOLATILITY_44
initial_volatility: VOLATILITY_50
}
);
to_add // purposefully only two call strikes to be conservative about future volatility spikes
.append(
FutureOption {
name_long: 'ETHUSDC-16NOV23-1900-LONG-CALL',
name_short: 'ETHUSDC-16NOV23-1900-SHORT-CALL',
name_long: 'ETHUSDC-07DEC23-2200-LONG-CALL',
name_short: 'ETHUSDC-07DEC23-2200-SHORT-CALL',
maturity: MATURITY,
strike_price: STRIKE_PRICE_1900,
strike_price: STRIKE_PRICE_2200,
option_type: OPTION_CALL,
lptoken_address: eth_lpt_addr,
initial_volatility: VOLATILITY_46
initial_volatility: VOLATILITY_52
}
);
to_add
.append(
FutureOption {
name_long: 'ETHUSDC-16NOV23-1700-LONG-PUT',
name_short: 'ETHUSDC-16NOV23-1700-SHORT-PUT',
name_long: 'ETHUSDC-07DEC23-2000-LONG-PUT',
name_short: 'ETHUSDC-07DEC23-2000-SHORT-PUT',
maturity: MATURITY,
strike_price: STRIKE_PRICE_1700,
strike_price: STRIKE_PRICE_2000,
option_type: OPTION_PUT,
lptoken_address: usdc_lpt_addr,
initial_volatility: VOLATILITY_43_5
initial_volatility: VOLATILITY_48_5
}
);
to_add
.append(
FutureOption {
name_long: 'ETHUSDC-16NOV23-1600-LONG-PUT',
name_short: 'ETHUSDC-16NOV23-1600-SHORT-PUT',
name_long: 'ETHUSDC-07DEC23-1900-LONG-PUT',
name_short: 'ETHUSDC-07DEC23-1900-SHORT-PUT',
maturity: MATURITY,
strike_price: STRIKE_PRICE_1600,
strike_price: STRIKE_PRICE_1900,
option_type: OPTION_PUT,
lptoken_address: usdc_lpt_addr,
initial_volatility: VOLATILITY_48_5
initial_volatility: VOLATILITY_49_5
}
);

add_options(16112383681242, to_add.span())
add_options(07122383681242, to_add.span())
}
}

0 comments on commit 8cd4d3c

Please sign in to comment.