-
Notifications
You must be signed in to change notification settings - Fork 72
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 #2612 from keep-network/new-project-structure
Setting up hardhat for beacon v2 Adding dependency libs and basic configuration for hardhat.
- Loading branch information
Showing
12 changed files
with
8,543 additions
and
1 deletion.
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,25 @@ | ||
// This is a template file. The file should be renamed to `networks.ts` and updated | ||
// with valid data. The properties will overwrite the ones defined in hardhat | ||
// project config file if hardhat.config.ts file contains `localNetworksConfig` property | ||
// pointing to this file. | ||
|
||
import { LocalNetworksConfig } from "@keep-network/hardhat-local-networks-config" | ||
|
||
const config: LocalNetworksConfig = { | ||
networks: { | ||
ropsten: { | ||
url: "url not set", | ||
from: "address not set", | ||
accounts: ["private key not set"], | ||
tags: ["tenderly"], | ||
}, | ||
mainnet: { | ||
url: "url not set", | ||
from: "address not set", | ||
accounts: ["private key not set"], | ||
tags: ["tenderly"], | ||
}, | ||
}, | ||
} | ||
|
||
module.exports = 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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 keep.network | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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 @@ | ||
= Keep Random Beacon |
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,9 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity 0.8.5; | ||
|
||
// Stub contract used for initial project setup. | ||
// Should be removed once we have actual contracts. | ||
contract TestToken { | ||
string public name = "Test Token"; | ||
} |
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,25 @@ | ||
import { HardhatRuntimeEnvironment } from "hardhat/types" | ||
import { DeployFunction } from "hardhat-deploy/types" | ||
|
||
// This is an example of deployment script. | ||
// Should be removed once we have actual contracts to deploy. | ||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
const { getNamedAccounts, deployments } = hre | ||
const { deployer } = await getNamedAccounts() | ||
|
||
const testToken = await deployments.deploy("TestToken", { | ||
from: deployer, | ||
log: true, | ||
}) | ||
|
||
if (hre.network.tags.tenderly) { | ||
await hre.tenderly.verify({ | ||
name: "TestToken", | ||
address: testToken.address, | ||
}) | ||
} | ||
} | ||
|
||
export default func | ||
|
||
func.tags = ["TestToken"] |
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,56 @@ | ||
import { HardhatUserConfig } from "hardhat/config" | ||
|
||
import "@keep-network/hardhat-local-networks-config" | ||
import "hardhat-deploy" | ||
import "@tenderly/hardhat-tenderly" | ||
import "@nomiclabs/hardhat-waffle" | ||
import "hardhat-gas-reporter" | ||
|
||
const config: HardhatUserConfig = { | ||
solidity: { | ||
compilers: [ | ||
{ | ||
version: "0.8.5", | ||
}, | ||
], | ||
}, | ||
paths: { | ||
artifacts: "./build", | ||
}, | ||
networks: { | ||
hardhat: { | ||
forking: { | ||
// forking is enabled only if FORKING_URL env is provided | ||
enabled: !!process.env.FORKING_URL, | ||
// URL should point to a node with archival data (Alchemy recommended) | ||
url: process.env.FORKING_URL || "", | ||
// latest block is taken if FORKING_BLOCK env is not provided | ||
blockNumber: process.env.FORKING_BLOCK | ||
? parseInt(process.env.FORKING_BLOCK) | ||
: undefined, | ||
}, | ||
tags: ["local"], | ||
}, | ||
ropsten: { | ||
url: process.env.CHAIN_API_URL || "", | ||
chainId: 3, | ||
accounts: process.env.CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY | ||
? [process.env.CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY] | ||
: undefined, | ||
tags: ["tenderly"], | ||
}, | ||
}, | ||
// // Define local networks configuration file path to load networks from the file. | ||
// localNetworksConfig: "./.hardhat/networks.ts", | ||
tenderly: { | ||
username: "thesis", | ||
project: "", | ||
}, | ||
namedAccounts: { | ||
deployer: { | ||
default: 0, // take the first account as deployer | ||
}, | ||
}, | ||
} | ||
|
||
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,30 @@ | ||
{ | ||
"name": "@keep-network/random-beacon", | ||
"version": "2.0.0-dev", | ||
"description": "Keep Random Beacon", | ||
"scripts": { | ||
"build": "hardhat compile", | ||
"test": "hardhat test", | ||
"deploy": "hardhat deploy --export export.json" | ||
}, | ||
"devDependencies": { | ||
"@keep-network/hardhat-local-networks-config": "^0.1.0-pre.0", | ||
"@nomiclabs/hardhat-ethers": "^2.0.2", | ||
"@nomiclabs/hardhat-waffle": "^2.0.1", | ||
"@types/chai": "^4.2.22", | ||
"@types/mocha": "^9.0.0", | ||
"@types/node": "^16.9.6", | ||
"@tenderly/hardhat-tenderly": "^1.0.12", | ||
"chai": "^4.3.4", | ||
"ethereum-waffle": "^3.4.0", | ||
"ethers": "^5.4.7", | ||
"hardhat": "^2.6.4", | ||
"hardhat-deploy": "^0.9.1", | ||
"hardhat-gas-reporter": "^1.0.4", | ||
"ts-node": "^10.2.1", | ||
"typescript": "^4.4.3" | ||
}, | ||
"engines": { | ||
"node": ">= 14.0.0" | ||
} | ||
} |
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,18 @@ | ||
import { ethers } from "hardhat"; | ||
import { expect } from "chai"; | ||
|
||
// This is an example of Typescript test. | ||
// Should be removed once we have actual tests. | ||
describe("Token", function () { | ||
let testToken | ||
|
||
beforeEach(async function () { | ||
const TestToken = await ethers.getContractFactory("TestToken") | ||
testToken = await TestToken.deploy() | ||
await testToken.deployed() | ||
}); | ||
|
||
it("should test token name", async function () { | ||
expect(await testToken.name()).to.equal("Test Token") | ||
}); | ||
}); |
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,7 @@ | ||
{ | ||
"files": [ | ||
"./hardhat.config.ts", | ||
"node_modules/@keep-network/hardhat-local-networks-config/src/type-extensions.d.ts" | ||
], | ||
"include": ["./deploy", "./test"] | ||
} |
Oops, something went wrong.