-
Notifications
You must be signed in to change notification settings - Fork 408
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
Conversation
"compile": "npx hardhat compile", | ||
``` | ||
|
||
Run `yarn compile` to make sure your project compiles. |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
build/tutorials/smart-contracts/smart-contracts-using-hardhat.md
Outdated
Show resolved
Hide resolved
"deploy-fuji": "npx hardhat run scripts/deploy.js --network fuji", | ||
``` | ||
|
||
Deploy your contract to the Hardhat network with `yarn test-deploy`. |
There was a problem hiding this comment.
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]. |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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). |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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). |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added explanation.
Apparently, some Ubuntu installations don't come with 'curl' preinstalled, added check and install if missing.
- added to stop the script on errors - modified tutorial so fetch command updates the script if it's run again
* Fix `us` -> `is` typo * Remove ERC20 steps
We want to discourage RasPi-s going forward, they are becoming underpowered for the C-chain activity
It was moved in this PR: OpenZeppelin/openzeppelin-contracts#2503
Integrated from another PR. |
No description provided.