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

Added Hardhat quickstart, reworked smart contracts section #78

Closed
wants to merge 50 commits into from

Conversation

jpop32
Copy link
Contributor

@jpop32 jpop32 commented Jan 29, 2021

No description provided.

"compile": "npx hardhat compile",
```

Run `yarn compile` to make sure your project compiles.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I do this I get:

dan@compy:~/Desktop/smart-contract-quickstart$ yarn compile
yarn run v1.22.10
$ rimraf ./build/
$ npx hardhat compile
✔ Help us improve Hardhat with anonymous crash reports & basic usage data? (Y/n) · true
Downloading compiler 0.6.4
Compiling 1 file with 0.6.4
contracts/MockContract.sol:84:1: Warning: This contract has a payable fallback function, but no receive ether function. Consider adding a receive ether function.
contract MockContract is MockInterface {
^ (Relevant source part starts here and spans across multiple lines).
contracts/MockContract.sol:334:2: The payable fallback function is defined here.
	fallback () payable external {
 ^ (Relevant source part starts here and spans across multiple lines).

Downloading compiler 0.7.0
Compiling 5 files with 0.7.0
@openzeppelin/contracts/token/ERC20/ERC20.sol:55:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor (string memory name_, string memory symbol_) public {
    ^ (Relevant source part starts here and spans across multiple lines).

Compilation finished successfully
Done in 7.01s.


## Prepare to Deploy

Edit the deployment script in `scripts/deploy.js`. You can add other contract deployments there.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How are they supposed to edit it?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does one add a contract deployment?

"deploy-fuji": "npx hardhat run scripts/deploy.js --network fuji",
```

Deploy your contract to the Hardhat network with `yarn test-deploy`.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain what it means to deploy something to the Hardhat network?
People will get confused about what the "Hardhat" network (as opposed to Avalanche) is


## Deploy to Fuji or Mainnet

You need to add your private key to the accounts field in [hardhat.config.js].
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please provide more details here? Perhaps an example?

People will ask, "what private key? How should this file look when I've done it right?"


You need to add your private key to the accounts field in [hardhat.config.js].

Then run `yarn deploy` for mainnet or `yarn deploy-fuji` for fuji.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain what this will do, exactly?


## Hardhat Tasks

You can define custom Hardhat tasks in [hardhat.config.js]. There are two tasks included as examples—`accounts` and `balances` both of which have scripts in [package.json](https://github.com/ava-labs/avalanche-smart-contract-quickstart/blob/master/package.json).
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain what a Hardhat task is?

"balances": "npx hardhat balances"
```

`yarn accounts` will print the list of accounts. `yarn balances` prints the list of AVAX account balances.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What list of accounts will it print?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adressed with an example


## Sending AVAX

[package.json](https://github.com/ava-labs/avalanche-smart-contract-quickstart/blob/master/package.json) has a `send-avax` script which is found in [scripts/sendAvax.js](https://github.com/ava-labs/avalanche-smart-contract-quickstart/blob/master/scripts/sendAvax.js).
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need the link to Github here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find it useful to quickly jump into the script to check it out. but could be removed.

"send-avax": "npx hardhat run scripts/sendAvax.js",
```

Run it with `yarn send-avax`.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this do?

Copy link
Contributor Author

@jpop32 jpop32 Mar 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added explanation.

@jpop32
Copy link
Contributor Author

jpop32 commented Aug 31, 2021

Integrated from another PR.

@jpop32 jpop32 closed this Aug 31, 2021
@jpop32 jpop32 deleted the hardhat-quickstart branch August 31, 2021 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants