Skip to content
This repository has been archived by the owner on Jun 5, 2024. It is now read-only.

Commit

Permalink
update readme, clean contract of hardhat dep (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
andyrdt authored Oct 7, 2022
1 parent f0eb749 commit 39e9865
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# 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.
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 a specified amount of time.

## Deploy with Hardhat

1. Run `yarn install` to install dependency.
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.
1. If you haven't already, install [nodejs](https://nodejs.org/en/download/) and [yarn](https://classic.yarnpkg.com/lang/en/docs/install).
2. Run `yarn install` to install dependencies.
3. 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`.
4. Run `yarn compile` to compile the contract.
5. Run `yarn deploy:scrollTestnet` to deploy the contract on the Scroll Pre-Alpha Testnet.

## Deploy with Foundry

Expand All @@ -29,3 +29,5 @@ This project demonstrates how to use hardhat or foundry to deploy a contract in
--legacy \
contracts/Lock.sol:Lock
```
- `<lock_amount>` is the amount of `TSETH` to be locked in the contract. Try setting this to some small amount, like `0.0000001ether`.
- `<unlock_time>` is the Unix timestamp after which the funds locked in the contract will become available for withdrawal. Try setting this to some Unix timestamp in the future, like `1696118400` (this Unix timestamp corresponds to October 1, 2023).
6 changes: 0 additions & 6 deletions contracts/Lock.sol
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;

// Import this file to use console.log
import "hardhat/console.sol";

contract Lock {
uint public unlockTime;
address payable public owner;
Expand All @@ -21,9 +18,6 @@ contract Lock {
}

function withdraw() public {
// Uncomment this line to print a log in your terminal
// console.log("Unlock time is %o and block timestamp is %o", unlockTime, block.timestamp);

require(block.timestamp >= unlockTime, "You can't withdraw yet");
require(msg.sender == owner, "You aren't the owner");

Expand Down

0 comments on commit 39e9865

Please sign in to comment.