Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing deployment scripts and doc improvements #2

Merged
merged 7 commits into from
Mar 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .env.template
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
.env.templateETHERSCAN_API_KEY=ABC123ABC123ABC123ABC123ABC123ABC1
ETHERSCAN_API_KEY=ABC123ABC123ABC123ABC123ABC123ABC1
ROPSTEN_URL=https://eth-ropsten.alchemyapi.io/v2/<YOUR ALCHEMY KEY>
PRIVATE_KEY=0xabc123abc123abc123abc123abc123abc123abc123abc123abc123abc123abc1

BCT_ERC20_ADDRESS=
KLIMA_ERC20_ADDRESS=
SKLIMA_ERC20_ADDRESS=

KLIMA_TREASURY_ADDRESS=
56 changes: 24 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,34 @@
# Advanced Sample Hardhat Project
# KlimaDAO contracts

This project demonstrates an advanced Hardhat use case, integrating other tools commonly used alongside Hardhat in the ecosystem.
## Build

The project comes with a sample contract, a test for that contract, a sample script that deploys that contract, and an example of a task implementation, which simply lists the available accounts. It also comes with a variety of other tools, preconfigured to work with the project code.

Try running some of the following tasks:

```shell
npx hardhat accounts
Note that the `AlphaKlimaRedeemUpgradeable` will fail to get built by default.
You will need to manually update the `@openzeppelin/contracts-upgradeable`
contracts that are downloaded in your `node_modules` by changing `_trustedForwarder`
in `metatx/ERC2771ContextUpgradeable.sol` from a private to a public address.
```
npm i
npx hardhat compile
npx hardhat clean
npx hardhat test
npx hardhat node
npx hardhat help
REPORT_GAS=true npx hardhat test
npx hardhat coverage
npx hardhat run scripts/deploy.js
node scripts/deploy.js
npx eslint '**/*.js'
npx eslint '**/*.js' --fix
npx prettier '**/*.{json,sol,md}' --check
npx prettier '**/*.{json,sol,md}' --write
npx solhint 'contracts/**/*.sol'
npx solhint 'contracts/**/*.sol' --fix
```

# Etherscan verification

To try out Etherscan verification, you first need to deploy a contract to an Ethereum network that's supported by Etherscan, such as Ropsten.

In this project, copy the .env.template file to a file named .env, and then edit it to fill in the details. Enter your Etherscan API key, your Ropsten node URL (eg from Alchemy), and the private key of the account which will send the deployment transaction. With a valid .env file in place, first deploy your contract:
## Deploy

```shell
hardhat run --network ropsten scripts/deploy.js
Deploy the Klima tokens (KLIMA, sKLIMA, wsKLIMA).
```
npx hardhat run --network <network_name> ./scripts/deploy_KLIMA_Tokens.js
```

Then, copy the deployment address and paste it in to replace `DEPLOYED_CONTRACT_ADDRESS` in this command:
Update `.env` with the KLIMA address from the previous step and with the BCT
address and deploy the Klima treasury.
```
npx hardhat run --network <network_name> ./scripts/deploy_KLIMA_treasury.js
```
Note that sKLIMA is not set at the treasury contract and needs to be a separate
transaction to add it as it stands.

```shell
npx hardhat verify --network ropsten DEPLOYED_CONTRACT_ADDRESS "Hello, Hardhat!"
Update `.env` with the sKLIMA address from the first step and the treasury
address from the previous step. Also, configure the desired parameters for
the first epoch number, block, and epoch length in the deploy script below.
```
npx hardhat run --network <network_name> ./scripts/deploy_KLIMA_staking.js
```
Loading