Skip to content

Commit

Permalink
feat:vessel_manager
Browse files Browse the repository at this point in the history
  • Loading branch information
0xTitan committed Jan 5, 2024
1 parent ea46408 commit e4fdfb6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 77 deletions.
58 changes: 0 additions & 58 deletions src/components/shisui_base.cairo

This file was deleted.

27 changes: 9 additions & 18 deletions src/core/vessel_manager.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ trait IVesselManager<TContractState> {

#[starknet::contract]
mod VesselManager {
use shisui::core::vessel_manager::IVesselManager;
use core::traits::Into;
use openzeppelin::security::reentrancyguard::ReentrancyGuardComponent::InternalTrait;
use starknet::{
Expand All @@ -216,9 +215,8 @@ mod VesselManager {
use shisui::core::admin_contract::{IAdminContractDispatcher, IAdminContractDispatcherTrait,};
use shisui::core::debt_token::{IDebtTokenDispatcher, IDebtTokenDispatcherTrait,};
use shisui::core::fee_collector::{IFeeCollectorDispatcher, IFeeCollectorDispatcherTrait,};
use shisui::utils::shisui_math;
use shisui::components::shisui_base::ShisuiBaseComponent;
use shisui::utils::constants::DECIMAL_PRECISION;
use shisui::core::vessel_manager::IVesselManager;
use shisui::utils::{shisui_math, shisui_base, constants::DECIMAL_PRECISION};
use super::{RewardSnapshot, Vessel, Status, VesselManagerOperation};
use openzeppelin::security::reentrancyguard::ReentrancyGuardComponent;
use alexandria_storage::list::{List, ListTrait};
Expand All @@ -233,9 +231,6 @@ mod VesselManager {
);
impl ReentrancyGuardInternalImpl = ReentrancyGuardComponent::InternalImpl<ContractState>;

component!(path: ShisuiBaseComponent, storage: shisui_base, event: ShisuiBaseEvent);
impl ShisuiBaseInternalImpl = ShisuiBaseComponent::InternalImpl<ContractState>;

// *************************************************************************
// CONSTANTS
// *************************************************************************
Expand Down Expand Up @@ -276,8 +271,6 @@ mod VesselManager {
struct Storage {
#[substorage(v0)]
reentrancy_guard: ReentrancyGuardComponent::Storage,
#[substorage(v0)]
shisui_base: ShisuiBaseComponent::Storage,
base_rate: LegacyMap::<ContractAddress, u256>,
// The timestamp of the latest fee operation (redemption or new debt token issuance)
last_fee_operation_time: LegacyMap::<ContractAddress, u256>,
Expand Down Expand Up @@ -318,8 +311,6 @@ mod VesselManager {
enum Event {
#[flat]
ReentrancyGuardEvent: ReentrancyGuardComponent::Event,
#[flat]
ShisuiBaseEvent: ShisuiBaseComponent::Event,
VesselIndexUpdated: VesselIndexUpdated,
VesselUpdated: VesselUpdated,
BaseRateUpdated: BaseRateUpdated,
Expand Down Expand Up @@ -499,11 +490,11 @@ mod VesselManager {
}

fn get_tcr(self: @ContractState, asset: ContractAddress, price: u256) -> u256 {
self.shisui_base.get_TCR(asset, price)
shisui_base::get_TCR(self.address_provider.read(), asset, price)
}

fn check_recovery_mode(self: @ContractState, asset: ContractAddress, price: u256) -> bool {
self.shisui_base.check_recovery_mode(asset, price)
shisui_base::check_recovery_mode(self.address_provider.read(), asset, price)
}

fn get_borrowing_rate(self: @ContractState, asset: ContractAddress) -> u256 {
Expand Down Expand Up @@ -799,7 +790,7 @@ mod VesselManager {
}


// TODO implement IActivePool
// TODO implement IActivePool and call return_from_pool when ready
fn send_gas_compensation(
ref self: ContractState,
asset: ContractAddress,
Expand All @@ -814,10 +805,10 @@ mod VesselManager {
.address_provider
.read()
.get_address(AddressesKey::gas_pool);
self
.debt_token
.read()
.return_from_pool(gas_pool_address, liquidator, debt_token_amount);
// self
// .debt_token
// .read()
// .return_from_pool(gas_pool_address, liquidator, debt_token_amount);
}

if asset_amount != 0 { //IActivePool(activePool).sendAsset(_asset, _liquidator, _assetAmount);
Expand Down
1 change: 0 additions & 1 deletion src/lib.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ mod core {
mod price_feed;
mod fee_collector;
mod admin_contract;
mod debt_token;
mod vessel_manager;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

0 comments on commit e4fdfb6

Please sign in to comment.