-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor deploy scripts using foundry best practices
- Loading branch information
1 parent
f2fad7f
commit 79f955c
Showing
9 changed files
with
132 additions
and
895 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
//SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.24; | ||
|
||
import { ScaffoldETHDeploy, console } from "./ScaffoldETHDeploy.s.sol"; | ||
import { MockToken1 } from "../contracts/MockToken1.sol"; | ||
import { MockToken2 } from "../contracts/MockToken2.sol"; | ||
|
||
/** | ||
* @title Deploy Mock Tokens | ||
* @dev run this script with `yarn deploy:tokens` | ||
*/ | ||
contract DeployMockTokens is ScaffoldETHDeploy { | ||
function run() external virtual { | ||
uint256 deployerPrivateKey = vm.envUint("DEPLOYER_PRIVATE_KEY"); | ||
if (deployerPrivateKey == 0) { | ||
revert InvalidPrivateKey( | ||
"You don't have a deployer account. Make sure you have set DEPLOYER_PRIVATE_KEY in .env or use `yarn generate` to generate a new random account" | ||
); | ||
} | ||
|
||
vm.startBroadcast(deployerPrivateKey); | ||
MockToken1 scUSD = new MockToken1("Scaffold USD", "scUSD"); | ||
MockToken2 scDAI = new MockToken2("Scaffold DAI", "scDAI"); | ||
console.log("Deployed MockToken1 Address: %s", address(scUSD)); | ||
console.log("Deployed MockToken2 Address: %s", address(scDAI)); | ||
vm.stopBroadcast(); | ||
|
||
// TODO: figure out how to carry contract info from foundry to nextjs for more than a single deploy script | ||
// /** | ||
// * This function generates the file containing the contracts Abi definitions. | ||
// * These definitions are used to derive the types needed in the custom scaffold-eth hooks, for example. | ||
// * This function should be called last. | ||
// */ | ||
// exportDeployments(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
//SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.24; | ||
|
||
import { ScaffoldETHDeploy, console } from "./ScaffoldETHDeploy.s.sol"; | ||
import { CustomPoolFactory } from "../contracts/CustomPoolFactory.sol"; | ||
import { HelperConfig } from "../utils/HelperConfig.sol"; | ||
|
||
/** | ||
* @title Deploy Factory | ||
* @dev Set the factory pauseWindowDuration in `HelperConfig.sol` | ||
* @dev Run this script with `yarn deploy:factory` | ||
*/ | ||
contract DeployFactory is HelperConfig, ScaffoldETHDeploy { | ||
function run() external virtual { | ||
uint256 deployerPrivateKey = vm.envUint("DEPLOYER_PRIVATE_KEY"); | ||
if (deployerPrivateKey == 0) { | ||
revert InvalidPrivateKey( | ||
"You don't have a deployer account. Make sure you have set DEPLOYER_PRIVATE_KEY in .env or use `yarn generate` to generate a new random account" | ||
); | ||
} | ||
|
||
HelperConfig helperConfig = new HelperConfig(); | ||
uint32 pauseWindowDuration = helperConfig.getFactoryConfig(); | ||
vm.startBroadcast(deployerPrivateKey); | ||
CustomPoolFactory factory = new CustomPoolFactory(vault, pauseWindowDuration); | ||
console.log("Deployed Factory Address: %s", address(factory)); | ||
vm.stopBroadcast(); | ||
|
||
/** | ||
* This function generates the file containing the contracts Abi definitions. | ||
* These definitions are used to derive the types needed in the custom scaffold-eth hooks, for example. | ||
* This function should be called last. | ||
*/ | ||
exportDeployments(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.