Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NES-266] [Fix:] [N6] add overrides for deposit related functions #112

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 54 additions & 1 deletion nest/src/AggregateToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,66 @@ contract AggregateToken is ComponentToken, IAggregateToken, ERC1155Holder {
uint256 assets,
address receiver,
address controller
) public override(ComponentToken, IComponentToken) returns (uint256 shares) {
) public override(ComponentToken, IComponentToken, ERC4626Upgradeable) returns (uint256 shares) {
if (_getAggregateTokenStorage().paused) {
revert DepositPaused();
}
return super.deposit(assets, receiver, controller);
}

/**
* @inheritdoc ERC4626Upgradeable
* @dev Overridden to add pause check before deposit
* @param assets Amount of assets to deposit
* @param receiver Address that will receive the shares
* @return shares Amount of shares minted
*/
function deposit(
uint256 assets,
address receiver
) public virtual override(ERC4626Upgradeable) returns (uint256 shares) {
if (_getAggregateTokenStorage().paused) {
revert DepositPaused();
}
return super.deposit(assets, receiver);
}

/**
* @inheritdoc ComponentToken
* @dev Overridden to add pause check before minting
* @param shares Amount of shares to mint
* @param receiver Address that will receive the shares
* @param controller Address that controls the minting
* @return assets Amount of assets deposited
*/
function mint(
uint256 shares,
address receiver,
address controller
) public virtual override(ComponentToken) returns (uint256 assets) {
if (_getAggregateTokenStorage().paused) {
revert DepositPaused();
}
return super.mint(shares, receiver, controller);
}

/**
* @inheritdoc ERC4626Upgradeable
* @dev Overridden to add pause check before minting
* @param shares Amount of shares to mint
* @param receiver Address that will receive the shares
* @return assets Amount of assets deposited
*/
function mint(
uint256 shares,
address receiver
) public virtual override(ERC4626Upgradeable) returns (uint256 assets) {
if (_getAggregateTokenStorage().paused) {
revert DepositPaused();
}
return super.mint(shares, receiver);
}

/// @inheritdoc IComponentToken
function redeem(
uint256 shares,
Expand Down
Loading