Skip to content

Commit

Permalink
add docgen
Browse files Browse the repository at this point in the history
  • Loading branch information
crapthings committed Apr 28, 2022
1 parent a07e3ad commit c363e4a
Show file tree
Hide file tree
Showing 7 changed files with 2,060 additions and 931 deletions.
18 changes: 11 additions & 7 deletions dapp-contract/contracts/Dapp.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,22 @@ pragma solidity ^0.8.9;
import "hardhat/console.sol";

contract Dapp {
string private str = 'Hardhat Parcel Dapp Starter';
string private _str = 'Hardhat Parcel Dapp Starter';

event changeStr(string str);

/// @notice use this function to view your string
/// @return str
function getStr () public view returns (string memory) {
console.log("log: str is equal to", str);
return str;
console.log("log: str is equal to", _str);
return _str;
}

function setStr (string memory _str) public {
console.log("log: set str to", _str);
str = _str;
emit changeStr(str);
/// @notice set string to your input
/// @param str set string to any thing that fit your need
function setStr (string memory str) public {
console.log("log: set str to", str);
_str = str;
emit changeStr(_str);
}
}
1 change: 1 addition & 0 deletions dapp-contract/docs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"><title>Hardhat Docgen</title><link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet"><script defer="defer" src="main.js"></script></head><body><div id="app"></div></body></html>
2 changes: 2 additions & 0 deletions dapp-contract/docs/main.js

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions dapp-contract/docs/main.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/*!
* Vue.js v2.6.14
* (c) 2014-2021 Evan You
* Released under the MIT License.
*/
6 changes: 6 additions & 0 deletions hardhat.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require('@nomiclabs/hardhat-waffle')
require('solidity-coverage')
require('hardhat-gas-reporter')
require('hardhat-docgen')

module.exports = {
solidity: '0.8.9',
Expand All @@ -14,5 +15,10 @@ module.exports = {
hardhat: {
chainId: 1337
},
},
docgen: {
path: './docs',
clear: true,
runOnCompile: true,
}
}
Loading

0 comments on commit c363e4a

Please sign in to comment.