Skip to content

Commit

Permalink
Goodbye Hardhat (+ Foundry Deployment Scripts)
Browse files Browse the repository at this point in the history
  • Loading branch information
akshatmittal committed Apr 25, 2024
1 parent 46e48ad commit 58fa91d
Show file tree
Hide file tree
Showing 10 changed files with 704 additions and 6,297 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ node_modules
/coverage
/coverage.json
/lcov.info

# secrets
.seed
5 changes: 1 addition & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{
"typescript.tsdk": "node_modules\\typescript\\lib",
"solidity.compileUsingRemoteVersion": "v0.8.24+commit.e11b9ed9",
"evenBetterToml.formatter.indentEntries": true,
"solidity.defaultCompiler": "localFile"
"evenBetterToml.formatter.indentEntries": true
}
4 changes: 4 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
src = "contracts"
test = "test"
script = "script"
fs_permissions = [{ access = "read", path = "./" }]

[profile.ci]
fuzz = { runs = 10_000 }

[rpc_endpoints]
mainnet = "https://mainnet.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161"
71 changes: 0 additions & 71 deletions hardhat.config.ts

This file was deleted.

22 changes: 0 additions & 22 deletions ignition/modules/GenericStakedAppreciatingVault.ts

This file was deleted.

28 changes: 5 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
"size": "forge build --sizes --force",
"clean": "rm -rf ./cache ./out ./artifacts ./cache ./lcov.info",
"format": "prettier --write \"./**/*.{js,ts,json,md,sol,yaml,yml}\"",
"anvil": "anvil --fork-url https://mainnet.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161 --chain-id 31337 --balance 1000"
"anvil": "anvil --fork-url https://mainnet.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161 --chain-id 31337 --balance 1000",
"deploy:rewards-vault": "forge script scripts/deploy/GenericMultiRewardsVault.s.sol:GenericMultiRewardsVaultDeployer --broadcast --rpc-url http://127.0.0.1:8545",
"deploy:staking-vault": "forge script scripts/deploy/GenericStakedAppreciatingVault.s.sol:GenericStakedAppreciatingVaultDeployer --broadcast --rpc-url http://127.0.0.1:8545"
},
"repository": {
"type": "git",
Expand All @@ -22,33 +24,13 @@
},
"dependencies": {
"@openzeppelin/contracts": "^5.0.2",
"forge-std": "github:foundry-rs/forge-std#v1.8.1",
"hardhat": "^2.22.2"
"forge-std": "github:foundry-rs/forge-std#v1.8.1"
},
"devDependencies": {
"@nomicfoundation/hardhat-ignition": "^0.15.1",
"@nomicfoundation/hardhat-ignition-viem": "^0.15.1",
"@nomicfoundation/hardhat-network-helpers": "^1.0.10",
"@nomicfoundation/hardhat-toolbox-viem": "^3.0.0",
"@nomicfoundation/hardhat-verify": "^2.0.5",
"@nomicfoundation/hardhat-viem": "^2.0.0",
"@nomicfoundation/ignition-core": "^0.15.1",
"@types/chai": "^4.3.14",
"@types/chai-as-promised": "^7.1.8",
"@types/mocha": "^10.0.6",
"@types/node": "^20.12.7",
"chai": "^4.4.1",
"hardhat-contract-sizer": "^2.10.0",
"hardhat-gas-reporter": "^1.0.10",
"prettier": "^3.2.5",
"prettier-plugin-solidity": "^1.3.1",
"solhint": "^4.5.4",
"solhint-plugin-prettier": "^0.1.0",
"solidity-coverage": "^0.8.12",
"ts-node": "^10.9.2",
"tsconfig-paths": "^4.2.0",
"typescript": "~5.3.3",
"viem": "^2.9.17"
"solhint-plugin-prettier": "^0.1.0"
},
"author": "Akshat Mittal <[email protected]>"
}
28 changes: 28 additions & 0 deletions scripts/deploy/GenericMultiRewardsVault.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;

import { Script } from "forge-std/Script.sol";
import { GenericMultiRewardsVault, IERC20, IERC20Metadata } from "@src/rewards/GenericMultiRewardsVault.sol";

contract GenericMultiRewardsVaultDeployer is Script {
function setUp() public {}

function run() public {
string memory seedPhrase = vm.readFile(".seed");
uint256 privateKey = vm.deriveKey(seedPhrase, 0);
address walletAddress = vm.rememberKey(privateKey);

vm.startBroadcast(privateKey);

IERC20Metadata asset = IERC20Metadata(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48); // TODO: REPLACE THIS!!!!

GenericMultiRewardsVault vault = new GenericMultiRewardsVault(
string(abi.encodePacked("Rewardable ", asset.name())),
string(abi.encodePacked("r", asset.symbol())),
IERC20(address(asset)),
walletAddress
);

vm.stopBroadcast();
}
}
29 changes: 29 additions & 0 deletions scripts/deploy/GenericStakedAppreciatingVault.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;

import { Script } from "forge-std/Script.sol";
import { IERC20Metadata } from "@src/rewards/GenericMultiRewardsVault.sol";
import { GenericStakedAppreciatingVault, IERC20 } from "@src/staking/GenericStakedAppreciatingVault.sol";

contract GenericStakedAppreciatingVaultDeployer is Script {
function setUp() public {}

function run() public {
string memory seedPhrase = vm.readFile(".seed");
uint256 privateKey = vm.deriveKey(seedPhrase, 0);
address walletAddress = vm.rememberKey(privateKey);

vm.startBroadcast(privateKey);

IERC20Metadata asset = IERC20Metadata(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48); // TODO: REPLACE THIS!!!!

GenericStakedAppreciatingVault vault = new GenericStakedAppreciatingVault(
string(abi.encodePacked("Staked ", asset.name())),
string(abi.encodePacked("s", asset.symbol())),
IERC20(address(asset)),
14 days
);

vm.stopBroadcast();
}
}
17 changes: 0 additions & 17 deletions tsconfig.json

This file was deleted.

Loading

0 comments on commit 58fa91d

Please sign in to comment.