Skip to content

Commit

Permalink
fix: decimals info
Browse files Browse the repository at this point in the history
  • Loading branch information
Vid201 committed Aug 9, 2024
1 parent 1b2a261 commit 2f204c4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions abis/market_abi/src/structs.sw
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ pub struct MarketConfiguration {
pub borrow_per_second_interest_rate_slope_high: u256, // decimals: 18
pub borrow_per_second_interest_rate_base: u256, // decimals: 18
pub store_front_price_factor: u256, // decimals: 18
pub base_tracking_index_scale: u256, // decimals: 18
pub base_tracking_supply_speed: u256, // decimals: 18
pub base_tracking_borrow_speed: u256, // decimals: 18
pub base_tracking_index_scale: u256, // decimals: 15
pub base_tracking_supply_speed: u256, // decimals: 15
pub base_tracking_borrow_speed: u256, // decimals: 15
pub base_min_for_rewards: u256, // decimals: base_token_decimals
pub base_borrow_min: u256, // decimals: base_token_decimals
pub target_reserves: u256, // decimals: base_token_decimals
Expand Down Expand Up @@ -88,7 +88,7 @@ impl PauseConfiguration {

pub struct UserBasic {
pub principal: I256, // decimals: base_asset_decimal
pub base_tracking_index: u256, // decimals: 18
pub base_tracking_index: u256, // decimals: 15
pub base_tracking_accrued: u256, // decimals: base_accrual_scale
}

Expand All @@ -105,8 +105,8 @@ impl UserBasic {
pub struct MarketBasics {
pub base_supply_index: u256, // decimals: 15
pub base_borrow_index: u256, // decimals: 15
pub tracking_supply_index: u256, // decimals: 18
pub tracking_borrow_index: u256, // decimals: 18
pub tracking_supply_index: u256, // decimals: 15
pub tracking_borrow_index: u256, // decimals: 15
pub total_supply_base: u256, // decimals: base_asset_decimal
pub total_borrow_base: u256, // decimals: base_asset_decimal
pub last_accrual_time: u256,
Expand Down
4 changes: 2 additions & 2 deletions contracts/market/src/main.sw
Original file line number Diff line number Diff line change
Expand Up @@ -1174,10 +1174,10 @@ fn accrue_internal() {

// Calculate rewards and update tracking indices
if market_basic.total_supply_base >= storage.market_configuration.read().base_min_for_rewards {
market_basic.tracking_supply_index += storage.market_configuration.read().base_tracking_supply_speed * time_elapsed * base_scale / market_basic.total_supply_base; // decimals: 18
market_basic.tracking_supply_index += storage.market_configuration.read().base_tracking_supply_speed * time_elapsed * base_scale / market_basic.total_supply_base; // decimals: 15
}
if market_basic.total_borrow_base >= storage.market_configuration.read().base_min_for_rewards {
market_basic.tracking_borrow_index += storage.market_configuration.read().base_tracking_borrow_speed * time_elapsed * base_scale / market_basic.total_borrow_base; // decimals: 18
market_basic.tracking_borrow_index += storage.market_configuration.read().base_tracking_borrow_speed * time_elapsed * base_scale / market_basic.total_borrow_base; // decimals: 15
}

// Update last_accrual_time
Expand Down

0 comments on commit 2f204c4

Please sign in to comment.