Skip to content

Commit

Permalink
improve FeeConfigTrait NOTE
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-fleming committed Dec 24, 2024
1 parent 3e8f237 commit 02206f0
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/token/src/erc20/extensions/erc4626/erc4626.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,16 @@ pub mod ERC4626Component {

/// Adjustments for fees expected to be defined at the contract level.
/// Defaults to no entry or exit fees.
/// To transfer fees, this trait needs to be coordinated with `ERC4626Component::ERC4626Hooks`.
///
/// See the example:
/// NOTE: The FeeConfigTrait hooks directly into the preview methods of the ERC4626 component.
/// The preview methods must return as close to the exact amount of shares or assets as possible if the
/// actual (previewed) operation occurred in the same transaction (according to IERC4626 spec).
/// All operations use their corresponding preview method as the value of assets or shares being moved.
/// Therefore, adjusting an operation's assets in FeeConfigTrait consequently adjusts the assets
/// (or assets to be converted into shares) in both the preview operation and the actual operation.
///
/// NOTE: To transfer fees, this trait needs to be coordinated with `ERC4626Component::ERC4626Hooks`.
/// See the ERC4626FeesMock example:
/// https://github.com/OpenZeppelin/cairo-contracts/tree/main/packages/test_common/src/mocks/erc4626.cairo
pub trait FeeConfigTrait<TContractState, +HasComponent<TContractState>> {
/// Adjusts deposits within `preview_deposit` to account for entry fees.
Expand Down

0 comments on commit 02206f0

Please sign in to comment.