Skip to content

Commit

Permalink
[NES-265] [N5] [Critical] ERC4626 preview function override is incorr…
Browse files Browse the repository at this point in the history
…ect (#114)

* use convertToAssets and convertToShares for previewMint and previewWithdraw functions

* use convertToAssets and convertToShares functions for previewMint and previewWithdraw
  • Loading branch information
ungaro committed Dec 12, 2024
1 parent 5439b51 commit 2905c91
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions nest/src/ComponentToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ abstract contract ComponentToken is
bytes32 public constant UPGRADER_ROLE = keccak256("UPGRADER_ROLE");
/// @notice Base that is used to divide all price inputs in order to represent e.g. 1.000001 as 1000001e12
uint256 internal constant _BASE = 1e18;

// Events

/**
Expand Down Expand Up @@ -527,7 +527,7 @@ abstract contract ComponentToken is
if (_getComponentTokenStorage().asyncDeposit) {
revert Unimplemented();
}
assets = super.previewDeposit(shares);
assets = convertToAssets(shares);
}

/**
Expand All @@ -554,7 +554,7 @@ abstract contract ComponentToken is
if (_getComponentTokenStorage().asyncRedeem) {
revert Unimplemented();
}
shares = super.previewWithdraw(assets);
shares = convertToShares(assets);
}

/// @inheritdoc IERC7540
Expand Down

0 comments on commit 2905c91

Please sign in to comment.