Skip to content

Commit

Permalink
fix fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-fleming committed Dec 24, 2024
1 parent 379f874 commit 3e8f237
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
4 changes: 2 additions & 2 deletions packages/test_common/src/mocks/erc4626.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ pub mod ERC4626LimitsMock {
}

/// The mock contract charges fees in terms of assets, not shares.
/// This means that the fees are calculated based on the amount of assets that are being deposited or withdrawn,
/// and not based on the amount of shares that are being minted or redeemed.
/// This means that the fees are calculated based on the amount of assets that are being deposited
/// or withdrawn, and not based on the amount of shares that are being minted or redeemed.
/// This is an opinionated design decision for the purpose of testing.
/// DO NOT USE IN PRODUCTION
#[starknet::contract]
Expand Down
28 changes: 16 additions & 12 deletions packages/token/src/erc20/extensions/erc4626/erc4626.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,11 @@ pub mod ERC4626Component {
/// current block, given current on-chain conditions.
///
/// The default deposit preview value is the full amount of shares.
/// This can be changed to account for fees, for example, in the implementing contract by defining
/// custom logic in `FeeConfigTrait::adjust_deposit`.
/// This can be changed to account for fees, for example, in the implementing contract by
/// defining custom logic in `FeeConfigTrait::adjust_deposit`.
///
/// NOTE: `preview_deposit` must be inclusive of entry fees to be compliant with the IERC4626 spec.
/// NOTE: `preview_deposit` must be inclusive of entry fees to be compliant with the
/// IERC4626 spec.
fn preview_deposit(self: @ComponentState<TContractState>, assets: u256) -> u256 {
let adjusted_assets = Fee::adjust_deposit(self, assets);
self._convert_to_shares(adjusted_assets, Rounding::Floor)
Expand Down Expand Up @@ -313,10 +314,11 @@ pub mod ERC4626Component {
/// current block, given current on-chain conditions.
///
/// The default mint preview value is the full amount of assets.
/// This can be changed to account for fees, for example, in the implementing contract by defining
/// custom logic in `FeeConfigTrait::adjust_mint`.
/// This can be changed to account for fees, for example, in the implementing contract by
/// defining custom logic in `FeeConfigTrait::adjust_mint`.
///
/// NOTE: `preview_mint` must be inclusive of entry fees to be compliant with the IERC4626 spec.
/// NOTE: `preview_mint` must be inclusive of entry fees to be compliant with the IERC4626
/// spec.
fn preview_mint(self: @ComponentState<TContractState>, shares: u256) -> u256 {
let full_assets = self._convert_to_assets(shares, Rounding::Ceil);
Fee::adjust_mint(self, full_assets)
Expand Down Expand Up @@ -365,10 +367,11 @@ pub mod ERC4626Component {
/// current block, given current on-chain conditions.
///
/// The default withdraw preview value is the full amount of shares.
/// This can be changed to account for fees, for example, in the implementing contract by defining
/// custom logic in `FeeConfigTrait::adjust_withdraw`.
/// This can be changed to account for fees, for example, in the implementing contract by
/// defining custom logic in `FeeConfigTrait::adjust_withdraw`.
///
/// NOTE: `preview_withdraw` must be inclusive of exit fees to be compliant with the IERC4626 spec.
/// NOTE: `preview_withdraw` must be inclusive of exit fees to be compliant with the
/// IERC4626 spec.
fn preview_withdraw(self: @ComponentState<TContractState>, assets: u256) -> u256 {
let adjusted_assets = Fee::adjust_withdraw(self, assets);
self._convert_to_shares(adjusted_assets, Rounding::Ceil)
Expand Down Expand Up @@ -417,10 +420,11 @@ pub mod ERC4626Component {
/// current block, given current on-chain conditions.
///
/// The default redeem preview value is the full amount of assets.
/// This can be changed to account for fees, for example, in the implementing contract by defining
/// custom logic in `FeeConfigTrait::adjust_redeem`.
/// This can be changed to account for fees, for example, in the implementing contract by
/// defining custom logic in `FeeConfigTrait::adjust_redeem`.
///
/// NOTE: `preview_redeem` must be inclusive of exit fees to be compliant with the IERC4626 spec.
/// NOTE: `preview_redeem` must be inclusive of exit fees to be compliant with the IERC4626
/// spec.
fn preview_redeem(self: @ComponentState<TContractState>, shares: u256) -> u256 {
let full_assets = self._convert_to_assets(shares, Rounding::Floor);
Fee::adjust_redeem(self, full_assets)
Expand Down

0 comments on commit 3e8f237

Please sign in to comment.