This repository has been archived by the owner on Jun 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 305
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
Showing
1 changed file
with
26 additions
and
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,31 @@ | ||
# Scroll Contract Deploy Demo | ||
# Scroll Contract Deployment Demo | ||
|
||
This project demonstrates how to use hardhat or foundry to deploy a contract in Scroll testnet. This project contains a simple contract which will lock certain amounts of Ether in the deployed contract for 1 year. | ||
|
||
## Deploy with hardhat | ||
## Deploy with Hardhat | ||
|
||
1. Run `yarn install` to install dependency. | ||
2. Create a file `.env` in the directory, or just copy `.env.example` to `.env`. | ||
3. Change `PRIVATE_KEY` and `SCROLL_TESTNET_URL` to the correct one in file `.env`. | ||
4. Run `yarn compile` to compile the contract. | ||
5. Run `yarn deploy:scrollTestnet` to deploy the contract in Scroll testnet. | ||
|
||
## Deploy with foundry | ||
|
||
### Installation | ||
|
||
``` | ||
curl -L https://foundry.paradigm.xyz | bash | ||
``` | ||
|
||
### Build | ||
|
||
``` | ||
forge build | ||
``` | ||
|
||
### Deploy | ||
|
||
``` | ||
forge create --rpc-url <SCROLL_TESTNET_URL> \ | ||
--value <lock_amount> | ||
--constructor-args <unlock_time> \ | ||
--interactive \ | ||
--legacy \ | ||
contracts/Lock.sol:Lock | ||
``` | ||
2. Create a `.env` file following the example `.env.example` in the root directory. Change `PRIVATE_KEY` to your own account private key in the `.env`. | ||
3. Run `yarn compile` to compile the contract. | ||
4. Run `yarn deploy:scrollTestnet` to deploy the contract in Scroll testnet. | ||
|
||
## Deploy with Foundry | ||
|
||
1. Install Foundry. | ||
```shell | ||
curl -L https://foundry.paradigm.xyz | bash | ||
foundryup | ||
``` | ||
2. Build the project. | ||
``` | ||
forge build | ||
``` | ||
3. Deploy the contract. | ||
``` | ||
forge create --rpc-url https://prealpha.scroll.io/l2 \ | ||
--value <lock_amount> \ | ||
--constructor-args <unlock_time> \ | ||
--private-key <your_private_key> \ | ||
--legacy \ | ||
contracts/Lock.sol:Lock | ||
``` |