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

Add 0712 1412 options #30

Closed
wants to merge 4 commits into from
Closed
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
2 changes: 1 addition & 1 deletion src/constants.cairo
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const NEW_PROPOSAL_QUORUM: u128 =
200; // 1/200 of totalSupply required to propose an upgrade. Quorums don't take into account investors. at all, they don't count into total eligible voters, but do vote
const PROPOSAL_VOTING_TIME_BLOCKS: u64 = 2000;
const PROPOSAL_VOTING_TIME_BLOCKS: u64 = 2500;
const QUORUM: u128 = 10; // 1/10 of totalSupply required to participate to pass
const MINUS_ONE: felt252 = 0x800000000000011000000000000000000000000000000000000000000000000;
const TEAM_TOKEN_BALANCE: u128 = 1000000000000000000;
Expand Down
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_0712_1412_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_0712_1412_options(ref self: ContractState) {
Options::run_add_0712_1412_options()
}
}
}
104 changes: 56 additions & 48 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_0712_1412_options() {
let mut state = Governance::unsafe_new_contract_state();
assert(
!proposal_initializer_run::InternalContractStateTrait::read(
@state.proposal_initializer_run, 36
@state.proposal_initializer_run, 41
),
'prop36 initializer called again'
'prop41 initializer called again'
);
proposal_initializer_run::InternalContractStateTrait::write(
ref state.proposal_initializer_run, 36, true
ref state.proposal_initializer_run, 41, true
);

add_0911_options();
add_1611_options();
add_1412_options();
add_0712_options();
}

fn add_0911_options() {
let MATURITY: felt252 = 1699574399;
fn add_1412_options() {
let MATURITY: felt252 = 1702598399;

let eth_lpt_addr: ContractAddress =
0x7aba50fdb4e024c1ba63e2c60565d0fd32566ff4b18aa5818fc80c30e749024
Expand All @@ -243,70 +251,70 @@ mod Options {
to_add
.append(
FutureOption {
name_long: 'ETHUSDC-09NOV23-1800-LONG-CALL',
name_short: 'ETHUSDC-09NOV23-1800-SHORT-CALL',
name_long: 'ETHUSDC-14DEC23-2100-LONG-CALL',
name_short: 'ETHUSDC-14DEC23-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_46
}
);
to_add
.append(
FutureOption {
name_long: 'ETHUSDC-09NOV23-1900-LONG-CALL',
name_short: 'ETHUSDC-09NOV23-1900-SHORT-CALL',
name_long: 'ETHUSDC-14DEC23-2200-LONG-CALL',
name_short: 'ETHUSDC-14DEC23-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_48
}
);
to_add
.append(
FutureOption {
name_long: 'ETHUSDC-09NOV23-2000-LONG-CALL',
name_short: 'ETHUSDC-09NOV23-2000-SHORT-CALL',
name_long: 'ETHUSDC-14DEC23-2300-LONG-CALL',
name_short: 'ETHUSDC-14DEC23-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_51
}
);
to_add
.append(
FutureOption {
name_long: 'ETHUSDC-09NOV23-1700-LONG-PUT',
name_short: 'ETHUSDC-09NOV23-1700-SHORT-PUT',
name_long: 'ETHUSDC-14DEC23-2000-LONG-PUT',
name_short: 'ETHUSDC-14DEC23-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_45
}
);
to_add
.append(
FutureOption {
name_long: 'ETHUSDC-09NOV23-1600-LONG-PUT',
name_short: 'ETHUSDC-09NOV23-1600-SHORT-PUT',
name_long: 'ETHUSDC-14DEC23-1900-LONG-PUT',
name_short: 'ETHUSDC-14DEC23-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_47
}
);

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


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

let eth_lpt_addr: ContractAddress =
0x7aba50fdb4e024c1ba63e2c60565d0fd32566ff4b18aa5818fc80c30e749024
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_45
}
);
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_50
}
);
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_45
}
);
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())
}
}