-
Notifications
You must be signed in to change notification settings - Fork 0
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 ekubo pools #8
Merged
Merged
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2de5746
Update AMM interface, add Pool struct
Chepelau 4915b71
Update AMM class hash
Chepelau 7cabdc6
Add arbitrary proposal for ekubo pools
Chepelau 8b97feb
Add test for ekubo pools proposal
Chepelau c7ce4bc
Run scarb fmt
Chepelau 0f21903
Comment out test for custom proposal
Chepelau 078c646
Update voladjspd for ekubo put pool
Chepelau 7074ab6
Fetch AMM owner address when testing ekubo pools
Chepelau File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
use starknet::ClassHash; | ||
|
||
use starknet::ContractAddress; | ||
|
||
#[starknet::interface] | ||
trait IArbitraryProposalAddOptions<TContractState> { | ||
fn execute_arbitrary_proposal(ref self: TContractState); | ||
} | ||
|
||
|
||
#[starknet::contract] | ||
pub mod ArbitraryProposalAddEkuboPools { | ||
use amm_governance::constants::{LP_TOKEN_CLASS_HASH, AMM_CLASS_HASH, OPTION_CALL, OPTION_PUT}; | ||
use amm_governance::traits::{ | ||
IAMMDispatcher, IAMMDispatcherTrait, IOptionTokenDispatcher, IOptionTokenDispatcherTrait | ||
}; | ||
|
||
use core::integer::BoundedInt; | ||
use core::traits::{Into, TryInto}; | ||
|
||
use cubit::f128::types::{Fixed, FixedTrait}; | ||
use starknet::ClassHash; | ||
use starknet::ContractAddress; | ||
use starknet::SyscallResult; | ||
use starknet::SyscallResultTrait; | ||
use starknet::syscalls::deploy_syscall; | ||
|
||
|
||
#[storage] | ||
struct Storage {} | ||
|
||
#[derive(starknet::Event, Drop)] | ||
#[event] | ||
enum Event {} | ||
|
||
#[constructor] | ||
fn constructor(ref self: ContractState) {} | ||
|
||
|
||
#[abi(embed_v0)] | ||
impl ArbitraryProposalAddOptions of super::IArbitraryProposalAddOptions<ContractState> { | ||
fn execute_arbitrary_proposal(ref self: ContractState) { | ||
let AMM_ADDRESS: ContractAddress = | ||
0x047472e6755afc57ada9550b6a3ac93129cc4b5f98f51c73e0644d129fd208d9 | ||
.try_into() | ||
.unwrap(); | ||
|
||
let USDC_TOKEN: ContractAddress = | ||
0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8 | ||
.try_into() | ||
.unwrap(); | ||
|
||
let EKUBO_TOKEN: ContractAddress = | ||
0x075afe6402ad5a5c20dd25e10ec3b3986acaa647b77e4ae24b0cbc9a54a27a87 | ||
.try_into() | ||
.unwrap(); | ||
|
||
// Create amm dispatcher | ||
let amm = IAMMDispatcher { contract_address: AMM_ADDRESS }; | ||
|
||
// Upgrade AMM to newest class hash | ||
amm.upgrade(AMM_CLASS_HASH.try_into().unwrap()); | ||
|
||
// Deploy new lp tokens | ||
let lptoken_class = LP_TOKEN_CLASS_HASH.try_into().unwrap(); | ||
|
||
// Ekubo Call Calldata | ||
let mut ekubo_call_lpt_calldata = array![]; | ||
ekubo_call_lpt_calldata.append('Carmine EKUBO/USDC call pool'); // Name | ||
ekubo_call_lpt_calldata.append('C-EKUBOUSDC-C'); // Symbol | ||
ekubo_call_lpt_calldata.append(AMM_ADDRESS.into()); // Owner | ||
|
||
// Ekubo Put Calldata | ||
let mut ekubo_put_lpt_calldata = array![]; | ||
ekubo_put_lpt_calldata.append('Carmine EKUBO/USDC put pool'); // Name | ||
ekubo_put_lpt_calldata.append('C-EKUBOUSDC-P'); // Symbol | ||
ekubo_put_lpt_calldata.append(AMM_ADDRESS.into()); // Owner | ||
|
||
// Call deploy | ||
let call_deploy_retval = deploy_syscall( | ||
lptoken_class, 'ekubousdc call', ekubo_call_lpt_calldata.span(), false | ||
); | ||
let (call_lpt_address, _) = call_deploy_retval.unwrap_syscall(); | ||
// Put deploy | ||
let put_deploy_retval = deploy_syscall( | ||
lptoken_class, 'ekubousdc put', ekubo_put_lpt_calldata.span(), false | ||
); | ||
let (put_lpt_address, _) = put_deploy_retval.unwrap_syscall(); | ||
|
||
// Add the lptokens to the AMM | ||
let call_voladjspd = FixedTrait::new_unscaled(10_000, false); | ||
let put_voladjspd = FixedTrait::new_unscaled(50_000, false); | ||
|
||
// Call | ||
amm | ||
.add_lptoken( | ||
USDC_TOKEN, | ||
EKUBO_TOKEN, | ||
OPTION_CALL, | ||
call_lpt_address, | ||
call_voladjspd, | ||
BoundedInt::<u256>::max() | ||
); | ||
|
||
// Put | ||
amm | ||
.add_lptoken( | ||
USDC_TOKEN, | ||
EKUBO_TOKEN, | ||
OPTION_PUT, | ||
put_lpt_address, | ||
put_voladjspd, | ||
BoundedInt::<u256>::max() | ||
); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
mod arbitrary_proposal_add_ekubo_pools; | ||
mod arbitrary_proposal_add_options; | ||
pub mod carm; | ||
pub mod constants; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is too high, DMd