This file contains hidden or 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
/// @notice Storage variable documentation example. | |
uint256 public storagevar; | |
/// @notice Mints desired amount of tokens for the recepient | |
/// @param _receiver Receiver of the tokens. | |
/// @param _amount Amount (in wei - smallest decimals) | |
function mintFor(address _receiver, uint256 _amount) external { | |
} |
This file contains hidden or 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
#!/bin/sh | |
. "$(dirname "$0")/_/husky.sh" | |
npx commitlint --edit $1 |
This file contains hidden or 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
#!/bin/sh | |
. "$(dirname "$0")/_/husky.sh" | |
npm run prettier:fix | |
npm run prettier:check | |
This file contains hidden or 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
"dev:prettier": "npx prettier --write .", | |
"dev:prettier-check": "npx prettier --check .", | |
"dev:lint": "npx eslint . && npx solhint contracts/**/*.sol", | |
"dev:coverage": "npx truffle run coverage --network coverage --solcoverjs ./.solcover.js", | |
"dev:contract-size": "npx truffle run contract-size", | |
"dev:docgen": "npx solidity-docgen -i ./contracts -o ./docs -t docgen --solc-module solc -H docgen/helpers.js", | |
"dev:slither": "slither . --config-file slither-config.json", | |
"prettier:fix": "npx prettier --write \"contracts/**/*.sol\"", | |
"prettier:check": "npx prettier --check \"contracts/**/*.sol\"", |
This file contains hidden or 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
"postinstall": "npm run compile && npm run generate-abi", | |
"prepare": "husky install" |
This file contains hidden or 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
"compile": "npx truffle compile --all", | |
"ganache": "npx ganache-cli --gasLimit 6721975 --gasPrice 20000000000 -e 10000000 -p 8545 -a 20", | |
"test": "npx truffle test", | |
"generate-abi": "npx truffle-abi -o ./abi", |
This file contains hidden or 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
module.exports = { | |
// networks and other stuff | |
plugins: ["solidity-coverage", "truffle-contract-size"], | |
// Set default mocha options here, use special reporters etc. | |
mocha: { | |
timeout: 25000, | |
reporter: 'eth-gas-reporter' | |
}, |
This file contains hidden or 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
require("dotenv").config(); | |
const HDWalletProvider = require("@truffle/hdwallet-provider"); | |
module.exports = { | |
networks: { | |
main: { | |
provider: () => | |
new HDWalletProvider( | |
process.env.MAINNET_PRIVATE_KEY, | |
`https://mainnet.infura.io/v3/${process.env.INFURA_API_KEY}` |
This file contains hidden or 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
// CODE FROM web3-eth-accounts/lib/index.js | |
// NATIVE WEB3 LIBRARY CODE | |
Accounts.prototype.hashMessage = function hashMessage(data) { | |
var messageHex = utils.isHexStrict(data) ? data : utils.utf8ToHex(data); | |
var messageBytes = utils.hexToBytes(messageHex); | |
var messageBuffer = Buffer.from(messageBytes); | |
// MANDATORY HASHING | |
var preamble = '\x19Ethereum Signed Message:\n' + messageBytes.length; | |
var preambleBuffer = Buffer.from(preamble); | |
var ethMessage = Buffer.concat([preambleBuffer, messageBuffer]); |
This file contains hidden or 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
//Create new account | |
refUser = await web3.eth.accounts.create(); | |
let mesGenerated = ... //from previous gist | |
let mesSigned = refUser.sign(mesGenerated) |
NewerOlder