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

[Fix] Nest: Add solmate, fix compilation issues #99

Merged
merged 3 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 0 additions & 4 deletions nest/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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/",
]
1 change: 1 addition & 0 deletions nest/lib/solmate
Submodule solmate added at c93f77
3 changes: 3 additions & 0 deletions nest/remappings.txt
Original file line number Diff line number Diff line change
@@ -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/
4 changes: 3 additions & 1 deletion nest/script/DeployNestContracts.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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 { }

Expand All @@ -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
Expand Down
7 changes: 6 additions & 1 deletion nest/src/token/pUSD.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -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);

}

Expand All @@ -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;

Expand Down