forked from scaffold-eth/scaffold-eth-2
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dacb14b
commit 311f7ce
Showing
9 changed files
with
514 additions
and
279 deletions.
There are no files selected for viewing
31 changes: 24 additions & 7 deletions
31
templates/example-contracts/foundry/packages/foundry/script/DeployYourContract.s.sol
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 |
---|---|---|
@@ -1,13 +1,30 @@ | ||
//SPDX-License-Identifier: MIT | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.19; | ||
|
||
import "../contracts/YourContract.sol"; | ||
import "./DeployHelpers.s.sol"; | ||
import "../contracts/YourContract.sol"; | ||
|
||
/** | ||
* @notice Deploy script for YourContract contract | ||
* @dev Inherits ScaffoldETHDeploy which: | ||
* - Includes forge-std/Script.sol for deployment | ||
* - Includes ScaffoldEthDeployerRunner modifier | ||
* - Provides `deployer` variable | ||
* Example: | ||
* yarn deploy --file DeployYourContract.s.sol # local anvil chain | ||
* yarn deploy --file DeployYourContract.s.sol --network optimism # live network (requires keystore) | ||
*/ | ||
contract DeployYourContract is ScaffoldETHDeploy { | ||
// use `deployer` from `ScaffoldETHDeploy` | ||
function run() external ScaffoldEthDeployerRunner { | ||
YourContract yourContract = new YourContract(deployer); | ||
console.logString(string.concat("YourContract deployed at: ", vm.toString(address(yourContract)))); | ||
} | ||
/** | ||
* @dev Deployer setup based on `ETH_KEYSTORE_ACCOUNT` in `.env`: | ||
* - "scaffold-eth-default": Uses Anvil's account #9 (0xa0Ee7A142d267C1f36714E4a8F75612F20a79720), no password prompt | ||
* - "scaffold-eth-custom": requires password used while creating keystore | ||
* | ||
* Note: Must use ScaffoldEthDeployerRunner modifier to: | ||
* - Setup correct `deployer` account and fund it | ||
* - Export contract addresses & ABIs to `nextjs` packages | ||
*/ | ||
function run() external ScaffoldEthDeployerRunner { | ||
new YourContract(deployer); | ||
} | ||
} |
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
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
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.