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/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/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 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..3bad931 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..a7c6626 100644 --- a/nest/src/token/pUSD.sol +++ b/nest/src/token/pUSD.sol @@ -4,7 +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 { 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"; @@ -14,6 +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); } @@ -22,7 +27,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;