From 2516a1647f37013bbb7f8b7dc6b6dae5bde98e20 Mon Sep 17 00:00:00 2001 From: ungaro Date: Tue, 19 Nov 2024 21:04:30 -0500 Subject: [PATCH 1/3] forge install: solmate --- .gitmodules | 3 +++ nest/lib/solmate | 1 + 2 files changed, 4 insertions(+) create mode 160000 nest/lib/solmate diff --git a/.gitmodules b/.gitmodules index 449864e..24ec20a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -34,3 +34,6 @@ [submodule "staking/lib/openzeppelin-contracts-upgradeable"] path = staking/lib/openzeppelin-contracts-upgradeable url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable +[submodule "nest/lib/solmate"] + path = nest/lib/solmate + url = https://github.com/transmissions11/solmate diff --git a/nest/lib/solmate b/nest/lib/solmate new file mode 160000 index 0000000..c93f771 --- /dev/null +++ b/nest/lib/solmate @@ -0,0 +1 @@ +Subproject commit c93f7716c9909175d45f6ef80a34a650e2d24e56 From 31613f4eef02d9e527646a8ad60abe57ce386621 Mon Sep 17 00:00:00 2001 From: ungaro Date: Tue, 19 Nov 2024 21:36:22 -0500 Subject: [PATCH 2/3] fix compilation issues, add solmate --- nest/foundry.toml | 4 ---- nest/remappings.txt | 3 +++ nest/script/DeployNestContracts.s.sol | 4 +++- nest/src/token/pUSD.sol | 4 +++- 4 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 nest/remappings.txt diff --git a/nest/foundry.toml b/nest/foundry.toml index 7a2f702..20e167a 100644 --- a/nest/foundry.toml +++ b/nest/foundry.toml @@ -22,7 +22,3 @@ quote_style = "double" number_underscore = "thousands" wrap_comments = true -remappings = [ - "@openzeppelin/contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/", - "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/", -] diff --git a/nest/remappings.txt b/nest/remappings.txt new file mode 100644 index 0000000..1e9aa67 --- /dev/null +++ b/nest/remappings.txt @@ -0,0 +1,3 @@ +@openzeppelin/contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/ +@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/ +@solmate/=lib/solmate/src/ \ No newline at end of file diff --git a/nest/script/DeployNestContracts.s.sol b/nest/script/DeployNestContracts.s.sol index 2159664..56a5ad4 100644 --- a/nest/script/DeployNestContracts.s.sol +++ b/nest/script/DeployNestContracts.s.sol @@ -36,6 +36,7 @@ contract ConcreteComponentToken is ComponentToken { contract DeployNestContracts is Script, Test { address private constant NEST_ADMIN_ADDRESS = 0xb015762405De8fD24d29A6e0799c12e0Ea81c1Ff; + address private constant VAULT_ADDRESS = 0x52805adf7b3d25c013eDa66eF32b53d1696f809C; function test() public { } @@ -44,8 +45,9 @@ contract DeployNestContracts is Script, Test { // Deploy pUSD pUSD pUSDToken = new pUSD(); + ERC1967Proxy pUSDProxy = - new ERC1967Proxy(address(pUSDToken), abi.encodeCall(pUSD.initialize, (NEST_ADMIN_ADDRESS))); +new ERC1967Proxy(address(pUSDToken), abi.encodeCall(pUSD.initialize, (VAULT_ADDRESS, NEST_ADMIN_ADDRESS))); console2.log("pUSDProxy deployed to:", address(pUSDProxy)); // Deploy ConcreteComponentToken diff --git a/nest/src/token/pUSD.sol b/nest/src/token/pUSD.sol index f1c693f..72b86ca 100644 --- a/nest/src/token/pUSD.sol +++ b/nest/src/token/pUSD.sol @@ -4,6 +4,7 @@ pragma solidity ^0.8.25; import { AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import { UUPSUpgradeable } from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; +import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import { ERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; import { SafeTransferLib } from "@solmate/utils/SafeTransferLib.sol"; @@ -14,6 +15,7 @@ interface IVault { function exit(address to, address asset, uint256 assetAmount, address from, uint256 shareAmount) external; function transferFrom(address from, address to, uint256 amount) external returns (bool); function approve(address spender, uint256 amount) external returns (bool); + function balanceOf(address account) external view returns (uint256); } @@ -22,7 +24,7 @@ interface IVault { * @author Eugene Y. Q. Shen, Alp Guneysel * @notice Unified Plume USD stablecoin */ -contract PUSD is Initializable, ERC20Upgradeable, AccessControlUpgradeable, UUPSUpgradeable { +contract pUSD is Initializable, ERC20Upgradeable, AccessControlUpgradeable, UUPSUpgradeable { using SafeTransferLib for ERC20; From d5ae3bef53b2455092d5f4e993925cd56554d7bf Mon Sep 17 00:00:00 2001 From: ungaro Date: Tue, 19 Nov 2024 21:44:41 -0500 Subject: [PATCH 3/3] forge fmt --- nest/script/DeployNestContracts.s.sol | 2 +- nest/src/token/pUSD.sol | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/nest/script/DeployNestContracts.s.sol b/nest/script/DeployNestContracts.s.sol index 56a5ad4..3bad931 100644 --- a/nest/script/DeployNestContracts.s.sol +++ b/nest/script/DeployNestContracts.s.sol @@ -47,7 +47,7 @@ contract DeployNestContracts is Script, Test { pUSD pUSDToken = new pUSD(); ERC1967Proxy pUSDProxy = -new ERC1967Proxy(address(pUSDToken), abi.encodeCall(pUSD.initialize, (VAULT_ADDRESS, NEST_ADMIN_ADDRESS))); + new ERC1967Proxy(address(pUSDToken), abi.encodeCall(pUSD.initialize, (VAULT_ADDRESS, NEST_ADMIN_ADDRESS))); console2.log("pUSDProxy deployed to:", address(pUSDProxy)); // Deploy ConcreteComponentToken diff --git a/nest/src/token/pUSD.sol b/nest/src/token/pUSD.sol index 72b86ca..a7c6626 100644 --- a/nest/src/token/pUSD.sol +++ b/nest/src/token/pUSD.sol @@ -4,8 +4,9 @@ pragma solidity ^0.8.25; import { AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import { UUPSUpgradeable } from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; -import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; + import { ERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; +import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import { SafeTransferLib } from "@solmate/utils/SafeTransferLib.sol"; @@ -15,7 +16,9 @@ interface IVault { function exit(address to, address asset, uint256 assetAmount, address from, uint256 shareAmount) external; function transferFrom(address from, address to, uint256 amount) external returns (bool); function approve(address spender, uint256 amount) external returns (bool); - function balanceOf(address account) external view returns (uint256); + function balanceOf( + address account + ) external view returns (uint256); }