Skip to content

Commit

Permalink
update return types for contracts (#130)
Browse files Browse the repository at this point in the history
* update return types for contracts

- update tests
- update facades
- slight gas optimizing

* Compiled both types files into 1

* fix imports

* fixed comments and imports

* re-org repo

* Delete library.cairo

* Fixed imports from merge commits
  • Loading branch information
0xDegenDeveloper authored Jul 18, 2024
1 parent bbdce1b commit 201acc9
Show file tree
Hide file tree
Showing 37 changed files with 870 additions and 1,051 deletions.
8 changes: 5 additions & 3 deletions src/contracts/lp_token.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ use traits::{Into, TryInto};
use openzeppelin::token::erc20::interface::ERC20ABIDispatcher;
use openzeppelin::utils::serde::SerializedAppend;

use pitch_lake_starknet::contracts::option_round::types::{OptionRoundState};
use pitch_lake_starknet::contracts::market_aggregator::{
IMarketAggregator, IMarketAggregatorDispatcher, IMarketAggregatorDispatcherTrait
use pitch_lake_starknet::{
contracts::market_aggregator::{
IMarketAggregator, IMarketAggregatorDispatcher, IMarketAggregatorDispatcherTrait
},
types::{OptionRoundState}
};

// @note Events for tokeninzing/positionizing in this contract or vault?
Expand Down
32 changes: 5 additions & 27 deletions src/contracts/pitch_lake.cairo
Original file line number Diff line number Diff line change
@@ -1,23 +1,4 @@
// https://www.sciencedirect.com/book/9780123745071/auction-theory
// https://papers.ssrn.com/sol3/papers.cfm?abstract_id=4123018

// TODO:
// underlying
// setting expiry
// setting strike price
// collateralization
// settlement
// premium
// batch auction
// historical volatility
// liquidity provision
// option minting
// liquidity roll-over
// reserve price (this will be difficult?)
// liquidity cap
// fossil
use pitch_lake_starknet::contracts::vault::interface::{IVaultDispatcher};

use pitch_lake_starknet::vault::interface::{IVaultDispatcher};

#[starknet::interface]
trait IPitchLake<TContractState> {
Expand All @@ -28,13 +9,10 @@ trait IPitchLake<TContractState> {

#[starknet::contract]
mod PitchLake {
use starknet::{ContractAddress};
use starknet::contract_address::ContractAddressZeroable;
use pitch_lake_starknet::contracts::vault::{
contract::Vault, interface::{IVault, IVaultDispatcher}
};
use pitch_lake_starknet::contracts::market_aggregator::{
IMarketAggregator, IMarketAggregatorDispatcher
use starknet::{ContractAddress, contract_address::ContractAddressZeroable};
use pitch_lake_starknet::{
vault::{interface::{IVault, IVaultDispatcher}},
contracts::market_aggregator::{IMarketAggregator, IMarketAggregatorDispatcher}
};

#[storage]
Expand Down
30 changes: 0 additions & 30 deletions src/contracts/vault/types.cairo

This file was deleted.

44 changes: 23 additions & 21 deletions src/lib.cairo
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
mod contracts {
mod utils {
mod utils;
}
mod components {
mod eth;
mod red_black_tree;
}
mod pitch_lake;
mod vault {
mod contract;
mod interface;
mod types;
}
mod option_round {
mod contract;
mod interface;
mod types;
}
mod vault {
mod contract;
mod interface;
}

mod market_aggregator;
mod lp_token;
mod option_round {
mod contract;
mod interface;
}

mod library {
mod eth;
mod red_black_tree;
mod utils;
}

mod types;

#[cfg(test)]
mod tests;


// @note Refactor these into their own modules
mod contracts {
mod pitch_lake;
mod market_aggregator;
mod lp_token;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
mod Eth {
use openzeppelin::token::erc20::ERC20Component;
use starknet::ContractAddress;

component!(path: ERC20Component, storage: erc20, event: ERC20Event);
#[storage]
struct Storage {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
use pitch_lake_starknet::contracts::{components::red_black_tree, option_round::types::{Bid}};
use pitch_lake_starknet::{library::red_black_tree, types::{Bid}};
use starknet::ContractAddress;
const BLACK: bool = false;
const RED: bool = true;

#[starknet::component]
pub mod RBTreeComponent {
use super::{BLACK, RED, Bid, ContractAddress};
use super::{Bid, ContractAddress};
use core::{array::ArrayTrait, option::OptionTrait, traits::{IndexView, TryInto}};

const BLACK: bool = false;
const RED: bool = true;

#[storage]
struct Storage {
root: felt252,
Expand Down
File renamed without changes.
Loading

0 comments on commit 201acc9

Please sign in to comment.