diff --git a/nest/script/UpgradepUSD.s.sol b/nest/script/UpgradepUSD.s.sol index 033b498..ce2a86c 100644 --- a/nest/script/UpgradepUSD.s.sol +++ b/nest/script/UpgradepUSD.s.sol @@ -56,12 +56,12 @@ contract UpgradePUSD is Script, Test { console2.log("Vault:", currentVault); console2.log("Total Supply:", currentTotalSupply); } else { - vm.assume(true); + vm.skip(true); isConnected = false; } } catch { console2.log("No implementation found - skipping"); - vm.assume(true); + vm.skip(true); isConnected = false; } } @@ -69,7 +69,7 @@ contract UpgradePUSD is Script, Test { function testSimulateUpgrade() public { // Deploy new implementation in test environment if (!isConnected) { - vm.assume(true); + vm.skip(true); } else { vm.startPrank(ADMIN_ADDRESS); @@ -85,7 +85,7 @@ contract UpgradePUSD is Script, Test { function run() external { if (!isConnected) { - vm.assume(true); + vm.skip(true); } else { vm.startBroadcast(ADMIN_ADDRESS); diff --git a/nest/src/AggregateToken.sol b/nest/src/AggregateToken.sol index 2ac2144..5d57091 100644 --- a/nest/src/AggregateToken.sol +++ b/nest/src/AggregateToken.sol @@ -44,8 +44,6 @@ contract AggregateToken is ComponentToken, IAggregateToken, ERC1155Holder { // Constants - // Base that is used to divide all price inputs in order to represent e.g. 1.000001 as 1000001e12 - uint256 private constant _BASE = 1e18; /// @notice Role for the price updater of the AggregateToken bytes32 public constant PRICE_UPDATER_ROLE = keccak256("PRICE_UPDATER_ROLE"); diff --git a/nest/src/ComponentToken.sol b/nest/src/ComponentToken.sol index 1b21bbb..cb89485 100644 --- a/nest/src/ComponentToken.sol +++ b/nest/src/ComponentToken.sol @@ -69,14 +69,14 @@ abstract contract ComponentToken is // Constants /// @notice All ComponentToken requests are fungible and all have ID = 0 - uint256 private constant REQUEST_ID = 0; + uint256 internal constant REQUEST_ID = 0; /// @notice Role for the admin of the ComponentToken bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE"); /// @notice Role for the upgrader of the ComponentToken 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 private constant _BASE = 1e18; - + uint256 internal constant _BASE = 1e18; + // Events /** diff --git a/nest/src/interfaces/IBoringVault.sol b/nest/src/interfaces/IBoringVault.sol index 5a3f3cc..7358533 100644 --- a/nest/src/interfaces/IBoringVault.sol +++ b/nest/src/interfaces/IBoringVault.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.25; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { IERC20Metadata } from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; -interface IVault is IERC20, IERC20Metadata { +interface IBoringVault is IERC20, IERC20Metadata { /** * @notice Deposits assets into the vault in exchange for shares diff --git a/nest/src/interfaces/ILens.sol b/nest/src/interfaces/ILens.sol index d95cec9..111613e 100644 --- a/nest/src/interfaces/ILens.sol +++ b/nest/src/interfaces/ILens.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.25; import { IAccountantWithRateProviders } from "./IAccountantWithRateProviders.sol"; -import { IVault } from "./IBoringVault.sol"; +import { IBoringVault } from "./IBoringVault.sol"; import { ITeller } from "./ITeller.sol"; import { IERC20 } from "@openzeppelin/contracts/interfaces/IERC20.sol"; @@ -14,22 +14,22 @@ interface ILens { error InvalidVault(); function totalAssets( - IVault vault, + IBoringVault vault, IAccountantWithRateProviders accountant ) external view returns (IERC20 asset, uint256 assets); function previewDeposit( IERC20 depositAsset, uint256 depositAmount, - IVault vault, + IBoringVault vault, IAccountantWithRateProviders accountant ) external view returns (uint256 shares); - function balanceOf(address account, IVault vault) external view returns (uint256 shares); + function balanceOf(address account, IBoringVault vault) external view returns (uint256 shares); function balanceOfInAssets( address account, - IVault vault, + IBoringVault vault, IAccountantWithRateProviders accountant ) external view returns (uint256 assets); @@ -41,7 +41,7 @@ interface ILens { address account, IERC20 depositAsset, uint256 depositAmount, - IVault vault, + IBoringVault vault, ITeller teller ) external view returns (bool); diff --git a/nest/src/mocks/MockLens.sol b/nest/src/mocks/MockLens.sol index c94f686..8736fdc 100644 --- a/nest/src/mocks/MockLens.sol +++ b/nest/src/mocks/MockLens.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.25; import { IAccountantWithRateProviders } from "../interfaces/IAccountantWithRateProviders.sol"; -import { IVault } from "../interfaces/IBoringVault.sol"; +import { IBoringVault } from "../interfaces/IBoringVault.sol"; import { ILens } from "../interfaces/ILens.sol"; import { ITeller } from "../interfaces/ITeller.sol"; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; @@ -20,7 +20,7 @@ contract MockLens is ILens { mapping(address => mapping(address => uint256)) private vaultBalances; function totalAssets( - IVault vault, + IBoringVault vault, IAccountantWithRateProviders accountant ) external view override returns (IERC20 asset, uint256 assets) { uint256 totalSupply = vault.totalSupply(); @@ -31,7 +31,7 @@ contract MockLens is ILens { function previewDeposit( IERC20 depositAsset, uint256 depositAmount, - IVault vault, + IBoringVault vault, IAccountantWithRateProviders accountant ) external view override returns (uint256 shares) { // Check if we have a preset value @@ -44,12 +44,7 @@ contract MockLens is ILens { try vault.decimals() returns (uint8 shareDecimals) { return depositAmount.mulDivDown(10 ** shareDecimals, rate); } catch { - // Explicitly revert with InvalidVault error - bytes4 selector = bytes4(keccak256("InvalidVault()")); - assembly { - mstore(0, selector) - revert(0, 4) - } + revert InvalidVault(); } } @@ -65,7 +60,7 @@ contract MockLens is ILens { balances[account] = balance; } - function balanceOf(address account, IVault vault) external view override returns (uint256) { + function balanceOf(address account, IBoringVault vault) external view override returns (uint256) { // First check if we have a preset balance if (balances[account] != 0) { return balances[account]; @@ -76,7 +71,7 @@ contract MockLens is ILens { function balanceOfInAssets( address account, - IVault vault, + IBoringVault vault, IAccountantWithRateProviders accountant ) external view override returns (uint256 assets) { uint256 shares = vault.balanceOf(account); @@ -96,7 +91,7 @@ contract MockLens is ILens { address account, IERC20 depositAsset, uint256 depositAmount, - IVault vault, + IBoringVault vault, ITeller teller ) external view override returns (bool) { if (depositAsset.balanceOf(account) < depositAmount) { diff --git a/nest/src/mocks/MockVault.sol b/nest/src/mocks/MockVault.sol index 438c054..367aafa 100644 --- a/nest/src/mocks/MockVault.sol +++ b/nest/src/mocks/MockVault.sol @@ -9,9 +9,9 @@ import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.s import { ERC721Holder } from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol"; import { Auth, Authority } from "@solmate/auth/Auth.sol"; -import { IVault } from "../interfaces/IBoringVault.sol"; +import { IBoringVault } from "../interfaces/IBoringVault.sol"; -contract MockVault is ERC20, Auth, ERC721Holder, ERC1155Holder, IVault { +contract MockVault is ERC20, Auth, ERC721Holder, ERC1155Holder, IBoringVault { using SafeERC20 for IERC20; diff --git a/nest/src/token/BoringVaultAdapter.sol b/nest/src/token/BoringVaultAdapter.sol index bef5797..2407ad4 100644 --- a/nest/src/token/BoringVaultAdapter.sol +++ b/nest/src/token/BoringVaultAdapter.sol @@ -15,7 +15,7 @@ import { FixedPointMathLib } from "@solmate/utils/FixedPointMathLib.sol"; import { IAccountantWithRateProviders } from "../interfaces/IAccountantWithRateProviders.sol"; import { IAtomicQueue } from "../interfaces/IAtomicQueue.sol"; -import { IVault } from "../interfaces/IBoringVault.sol"; +import { IBoringVault } from "../interfaces/IBoringVault.sol"; import { IComponentToken } from "../interfaces/IComponentToken.sol"; import { ILens } from "../interfaces/ILens.sol"; import { ITeller } from "../interfaces/ITeller.sol"; @@ -55,7 +55,7 @@ abstract contract BoringVaultAdapter is struct BoringVault { ITeller teller; - IVault vault; + IBoringVault vault; IAtomicQueue atomicQueue; ILens lens; IAccountantWithRateProviders accountant; @@ -131,7 +131,7 @@ abstract contract BoringVaultAdapter is BoringVaultAdapterStorage storage $ = _getBoringVaultAdapterStorage(); $.boringVault.teller = ITeller(teller_); - $.boringVault.vault = IVault(vault_); + $.boringVault.vault = IBoringVault(vault_); $.boringVault.atomicQueue = IAtomicQueue(atomicQueue_); $.boringVault.lens = ILens(lens_); $.boringVault.accountant = IAccountantWithRateProviders(accountant_); @@ -172,7 +172,7 @@ abstract contract BoringVaultAdapter is // Increment version $.version += 1; $.boringVault.teller = ITeller(teller_); - $.boringVault.vault = IVault(vault_); + $.boringVault.vault = IBoringVault(vault_); $.boringVault.atomicQueue = IAtomicQueue(atomicQueue_); $.boringVault.lens = ILens(lens_); $.boringVault.accountant = IAccountantWithRateProviders(accountant_); @@ -325,7 +325,7 @@ abstract contract BoringVaultAdapter is IAtomicQueue queue = _getBoringVaultAdapterStorage().boringVault.atomicQueue; queue.updateAtomicRequest(IERC20(address(this)), IERC20(asset()), request); - return 0; // ComponentToken's standard REQUEST_ID + return REQUEST_ID; } /**