-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e7835bb
commit 8b58ff9
Showing
6 changed files
with
70 additions
and
35 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
first: Go app.js | ||
|
||
The new ethers contract in app.js contain the contrat of the command hardhat node |
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,31 @@ | ||
first: create a react app | ||
second: npm install ethers hardhat @nomiclabs/hardhat-waffle ethereum-waffle chai @nomiclabs/hardhat-ethers | ||
thirth: npx hardhat //to create an app hardhat, but delete the readme because it'll cause a conflict | ||
fourth: add to file hardhat.config.js: | ||
paths: { | ||
artifacts: './src/artifacts' | ||
}, | ||
networks: { | ||
hardhat: { | ||
chainId: 1337 | ||
} | ||
} | ||
|
||
fifth: npx hardhat compile | ||
|
||
sixth:in another terminal uses npx hardhat node show wallets with eth to test | ||
|
||
seventh: Use private key to import one test wallet | ||
|
||
eighth: npx hardhat run scripts/deploy.js --network localhost to pick up one address of the newly deployed contract | ||
then we can see in another terminal that the wallets works | ||
|
||
nineth: npx hardhat test | ||
tenth: npm run start | ||
|
||
for main net uses: rinkeby: { | ||
url: 'Infura Key', | ||
accounts: [`Replace Private Key`] | ||
} | ||
|
||
|
This file was deleted.
Oops, something went wrong.
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,27 @@ | ||
//SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
contract Manager { | ||
struct Ticket { | ||
uint8 status; | ||
string name; | ||
} | ||
|
||
Ticket[] public tickets; | ||
|
||
function createTicket(string memory _name) external { | ||
tickets.push(Ticket(0, _name)); | ||
} | ||
|
||
function updateTicketName(uint256 _index, string memory _name) external { | ||
tickets[_index].name = _name; | ||
} | ||
|
||
function updateTicketStatus(uint256 _index, uint8 _status) external { | ||
tickets[_index].status = _status; | ||
} | ||
|
||
function getTickets() external view returns (Ticket[] memory) { | ||
return tickets; | ||
} | ||
} |
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