-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from celo-org/update-hardhat-to-new-version
update hardhat to a new version
- Loading branch information
Showing
16 changed files
with
246 additions
and
14,533 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 |
---|---|---|
|
@@ -39,3 +39,8 @@ nb-configuration.xml | |
*.swp | ||
|
||
PROPOSAL.md | ||
|
||
# Ignore lock files | ||
*.lock | ||
packages/*/*.lock | ||
|
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 |
---|---|---|
|
@@ -12,3 +12,7 @@ node_modules | |
# solidity-coverage files | ||
/coverage | ||
/coverage.json | ||
|
||
|
||
# Ignore lock files | ||
*.lock |
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,57 @@ | ||
# Sample Hardhat Project | ||
# Celo Composer - MiniPay Template | Hardhat | ||
|
||
This project demonstrates a basic Hardhat use case. It comes with a sample contract, a test for that contract, and a script that deploys that contract. | ||
## How to use | ||
|
||
Try running some of the following tasks: | ||
1. Create a copy of `.env.example` and rename it to `.env`. | ||
|
||
```shell | ||
npx hardhat help | ||
npx hardhat test | ||
REPORT_GAS=true npx hardhat test | ||
npx hardhat node | ||
npx hardhat run scripts/deploy.ts | ||
1. For the **smart contract deployment** you will need the `PRIVATE_KEY` set in `.env`. **Never** use a wallet with real funds for development. Always have a separate wallet for testing. | ||
2. For the **smart contract verification** you will need a [Celoscan API Key](https://celoscan.io/myapikey) `CELOSCAN_API_KEY` set in `.env`. | ||
|
||
2. Compile the contract | ||
|
||
```bash | ||
npx hardhat compile | ||
``` | ||
|
||
3. Deploy the contract | ||
|
||
Make sure your wallet is funded when deploying to testnet or mainnet. You can get test tokens for deploying it on Alfajores from the [Celo Faucet](https://faucet.celo.org/alfajores). | ||
|
||
```bash | ||
npx hardhat ignition deploy ./ignition/modules/MiniPay.ts --network <network-name> | ||
``` | ||
|
||
On Alfajores | ||
|
||
```bash | ||
npx hardhat ignition deploy ./ignition/modules/MiniPay.ts --network alfajores | ||
``` | ||
|
||
|
||
On Celo Mainnet | ||
|
||
```bash | ||
npx hardhat ignition deploy ./ignition/modules/MiniPay.ts --network celo | ||
``` | ||
|
||
4. Verify the contract | ||
|
||
For Alfajores (Testnet) Verification | ||
|
||
```bash | ||
npx hardhat verify <CONTRACT_ADDRESS> <CONSTRUCTOR_ARGS> --network alfajores | ||
``` | ||
|
||
For the Lock.sol contract that could look like this: | ||
|
||
```bash | ||
npx hardhat verify 0xF9316Ce3E661D704000bCDDA925766Bf7F09fF5B 0x1724707c52de2fa65ad9c586b5d38507f52D3c06 --network alfajores | ||
``` | ||
|
||
For Celo Mainnet Verification | ||
|
||
```bash | ||
npx hardhat verify <CONTRACT_ADDRESS> <CONSTRUCTOR_ARGS> --network celo | ||
``` | ||
|
||
Check the file `hardhat.config.js` for Celo specific hardhat configuration. |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
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,23 +1,49 @@ | ||
import "@nomicfoundation/hardhat-toolbox"; | ||
import dotenv from "dotenv"; | ||
import { HardhatUserConfig } from "hardhat/config"; | ||
import '@nomicfoundation/hardhat-toolbox'; | ||
import '@nomicfoundation/hardhat-verify'; | ||
import { config as dotEnvConfig } from 'dotenv'; | ||
import { HardhatUserConfig } from 'hardhat/config'; | ||
|
||
dotenv.config(); | ||
|
||
const PRIVATE_KEY = process.env.PRIVATE_KEY as string; | ||
|
||
if (!PRIVATE_KEY) { | ||
throw new Error("PRIVATE_KEY is not set"); | ||
} | ||
dotEnvConfig(); | ||
|
||
const config: HardhatUserConfig = { | ||
solidity: "0.8.20", | ||
networks: { | ||
alfajores: { | ||
url: "https://alfajores-forno.celo-testnet.org", | ||
accounts: [PRIVATE_KEY], | ||
accounts: [process.env.PRIVATE_KEY ?? '0x0'], | ||
url: 'https://alfajores-forno.celo-testnet.org', | ||
}, | ||
celo: { | ||
accounts: [process.env.PRIVATE_KEY ?? '0x0'], | ||
url: 'https://forno.celo.org', | ||
}, | ||
}, | ||
etherscan: { | ||
apiKey: { | ||
alfajores: process.env.CELOSCAN_API_KEY ?? '', | ||
celo: process.env.CELOSCAN_API_KEY ?? '', | ||
}, | ||
customChains: [ | ||
{ | ||
chainId: 44_787, | ||
network: 'alfajores', | ||
urls: { | ||
apiURL: 'https://api-alfajores.celoscan.io/api', | ||
browserURL: 'https://alfajores.celoscan.io', | ||
}, | ||
}, | ||
{ | ||
chainId: 42_220, | ||
network: 'celo', | ||
urls: { | ||
apiURL: 'https://api.celoscan.io/api', | ||
browserURL: 'https://celoscan.io/', | ||
}, | ||
}, | ||
], | ||
}, | ||
sourcify: { | ||
enabled: false, | ||
}, | ||
solidity: '0.8.24', | ||
}; | ||
|
||
export default config; |
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,17 @@ | ||
import { buildModule } from "@nomicfoundation/hardhat-ignition/modules"; | ||
|
||
const MiniPayModule = buildModule("MiniPayModule", (m) => { | ||
// Set up parameters if you want to make the contract address configurable | ||
const initialOwner = m.getParameter( | ||
"initialOwner", | ||
"0x1724707c52de2fa65ad9c586b5d38507f52D3c06" | ||
); | ||
|
||
// Deploy the MiniPay contract with the specified parameters | ||
const miniPayNFT = m.contract("MiniPay", [initialOwner]); | ||
|
||
return { miniPayNFT }; | ||
}); | ||
|
||
export default MiniPayModule; | ||
|
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,26 +1,40 @@ | ||
{ | ||
"name": "hardhat-project", | ||
"license": "MIT", | ||
"version": "1.0.0", | ||
"devDependencies": { | ||
"@nomicfoundation/hardhat-chai-matchers": "^2.0.0", | ||
"@nomicfoundation/hardhat-network-helpers": "^1.0.0", | ||
"@nomicfoundation/hardhat-toolbox": "^4.0.0", | ||
"@nomicfoundation/hardhat-verify": "^2.0.0", | ||
"@nomicfoundation/hardhat-ethers": "^3.0.0", | ||
"@nomicfoundation/hardhat-ignition": "^0.15.7", | ||
"@nomicfoundation/hardhat-ignition-ethers": "^0.15.0", | ||
"@nomicfoundation/hardhat-network-helpers": "^1.0.11", | ||
"@nomicfoundation/hardhat-toolbox": "^5.0.0", | ||
"@nomicfoundation/hardhat-verify": "^2.0.11", | ||
"@nomicfoundation/ignition-core": "^0.15.5", | ||
"@nomiclabs/hardhat-ethers": "^2.2.3", | ||
"@openzeppelin/contracts": "^5.1.0", | ||
"@typechain/ethers-v6": "^0.5.0", | ||
"@typechain/hardhat": "^9.0.0", | ||
"@types/chai": "^4.2.0", | ||
"@types/mocha": ">=9.1.0", | ||
"@typechain/hardhat": "^9.1.0", | ||
"@types/chai": "^4.3.16", | ||
"@types/mocha": "^10.0.7", | ||
"chai": "^4.2.0", | ||
"hardhat": "^2.19.5", | ||
"hardhat": "^2.22.15", | ||
"hardhat-gas-reporter": "^1.0.8", | ||
"solidity-coverage": "^0.8.1", | ||
"ts-node": "^10.9.2", | ||
"typechain": "^8.3.0" | ||
"typechain": "^8.3.2", | ||
"typescript": "^5.5.3" | ||
}, | ||
"dependencies": { | ||
"@nomicfoundation/hardhat-ethers": "^3.0.5", | ||
"@openzeppelin/contracts": "^5.0.1", | ||
"dotenv": "^16.4.3", | ||
"ethers": "^6.11.0" | ||
"dotenv": "^16.4.5" | ||
}, | ||
"scripts": { | ||
"compile": "hardhat compile", | ||
"tsc": "npx tsc -p . && cp typechain/*.d.ts dist/typechain/", | ||
"build": "yarn compile && yarn tsc", | ||
"clean": "hardhat clean", | ||
"run:node": "hardhat node", | ||
"test": "hardhat test", | ||
"prettier": "prettier --write 'contracts/**/*.sol' '**/*.ts'" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.