Skip to content

Commit

Permalink
Remove unused events, and unused view funciton
Browse files Browse the repository at this point in the history
  • Loading branch information
crispymangoes committed Aug 2, 2023
1 parent 37445c4 commit 6a41154
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 25 deletions.
43 changes: 19 additions & 24 deletions src/base/Cellar.sol
Expand Up @@ -459,13 +459,6 @@ contract Cellar is ERC4626, Owned, ERC721Holder {

// =============================================== FEES CONFIG ===============================================

/**
* @notice Emitted when platform fees is changed.
* @param oldPlatformFee value platform fee was changed from
* @param newPlatformFee value platform fee was changed to
*/
event PlatformFeeChanged(uint64 oldPlatformFee, uint64 newPlatformFee);

/**
* @notice Emitted when strategist platform fee cut is changed.
* @param oldPlatformCut value strategist platform fee cut was changed from
Expand Down Expand Up @@ -709,13 +702,6 @@ contract Cellar is ERC4626, Owned, ERC721Holder {

// =========================================== CORE LOGIC ===========================================

/**
* @notice Emitted when share locking period is changed.
* @param oldPeriod the old locking period
* @param newPeriod the new locking period
*/
event ShareLockingPeriodChanged(uint256 oldPeriod, uint256 newPeriod);

/**
* @notice Attempted an action with zero shares.
*/
Expand Down Expand Up @@ -761,6 +747,9 @@ contract Cellar is ERC4626, Owned, ERC721Holder {
_checkIfPaused();
}

/**
* @notice Called when users enter the cellar via deposit or mint.
*/
function _enter(uint256 assets, uint256 shares, address receiver) internal {
beforeDeposit(assets, shares, receiver);

Expand Down Expand Up @@ -809,6 +798,9 @@ contract Cellar is ERC4626, Owned, ERC721Holder {
_enter(assets, shares, receiver);
}

/**
* @notice Called when users exit the cellar via withdraw or redeem.
*/
function _exit(uint256 assets, uint256 shares, address receiver, address owner) internal {
beforeWithdraw(assets, shares, receiver, owner);

Expand Down Expand Up @@ -1283,6 +1275,9 @@ contract Cellar is ERC4626, Owned, ERC721Holder {
bytes[] callData;
}

/**
* @notice Emitted when adaptor calls are made.
*/
event AdaptorCalled(address adaptor, bytes data);

/**
Expand Down Expand Up @@ -1332,7 +1327,7 @@ contract Cellar is ERC4626, Owned, ERC721Holder {
// Run all adaptor calls.
_makeAdaptorCalls(data);

// After making every external call, check that the totalAssets haas not deviated significantly, and that totalShares is the same.
// After making every external call, check that the totalAssets has not deviated significantly, and that totalShares is the same.
uint256 assets = _calculateTotalAssetsOrTotalAssetsWithdrawable(false);
if (assets < minimumAllowedAssets || assets > maximumAllowedAssets) {
revert Cellar__TotalAssetDeviatedOutsideRange(assets, minimumAllowedAssets, maximumAllowedAssets);
Expand Down Expand Up @@ -1486,15 +1481,15 @@ contract Cellar is ERC4626, Owned, ERC721Holder {
if (registry.getAddress(_registryId) != _expected) revert Cellar__ExpectedAddressDoesNotMatchActual();
}

/**
* @notice Get all the credit positions underlying assets.
*/
function getPositionAssets() external view returns (ERC20[] memory assets) {
assets = new ERC20[](creditPositions.length);
for (uint256 i = 0; i < creditPositions.length; ++i) {
assets[i] = _assetOf(creditPositions[i]);
}
}
// /**
// * @notice Get all the credit positions underlying assets.
// */
// function getPositionAssets() external view returns (ERC20[] memory assets) {
// assets = new ERC20[](creditPositions.length);
// for (uint256 i = 0; i < creditPositions.length; ++i) {
// assets[i] = _assetOf(creditPositions[i]);
// }
// }

/**
* @notice View the amount of assets in each Cellar Position.
Expand Down
3 changes: 2 additions & 1 deletion src/base/permutations/CellarWithOracle.sol
Expand Up @@ -62,7 +62,8 @@ contract CellarWithOracle is Cellar {
*/
function setSharePriceOracle(uint256 _registryId, ERC4626SharePriceOracle _sharePriceOracle) external onlyOwner {
_checkRegistryAddressAgainstExpected(_registryId, address(_sharePriceOracle));
if (_sharePriceOracle.decimals() != ORACLE_DECIMALS) revert Cellar__OracleFailure();
if (_sharePriceOracle.decimals() != ORACLE_DECIMALS || address(_sharePriceOracle.target()) != address(this))
revert Cellar__OracleFailure();
sharePriceOracle = _sharePriceOracle;
emit SharePriceOracleUpdated(address(_sharePriceOracle));
}
Expand Down
7 changes: 7 additions & 0 deletions src/base/permutations/CellarWithShareLockPeriod.sol
Expand Up @@ -32,6 +32,13 @@ contract CellarWithShareLockPeriod is Cellar {
)
{}

/**
* @notice Emitted when share locking period is changed.
* @param oldPeriod the old locking period
* @param newPeriod the new locking period
*/
event ShareLockingPeriodChanged(uint256 oldPeriod, uint256 newPeriod);

/**
* @notice Attempted to set `shareLockPeriod` to an invalid number.
*/
Expand Down

0 comments on commit 6a41154

Please sign in to comment.