Skip to content

Commit

Permalink
Merge branch 'leon/add-solhint' into 'master'
Browse files Browse the repository at this point in the history
add Solidity linter

See merge request wildland/hexagon!5
  • Loading branch information
leoni-q committed Sep 26, 2022
2 parents 8285acb + cb685b8 commit 5add0de
Show file tree
Hide file tree
Showing 5 changed files with 503 additions and 25 deletions.
6 changes: 6 additions & 0 deletions .solhint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "solhint:default",
"rules": {
"mark-callable-contracts": "off"
}
}
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,20 @@ ensure that `.env` file is present. See `.env.template`


## Test
```
```bash
yarn test
```

## Format and lint
```bash
yarn format
yarn lint
```

## Deployment

### Goerli testnet
```
```bash
hardhat --network goerli deploy
hardhat --network goerli etherscan-verify --license UNLICENSED
```
Expand Down
11 changes: 6 additions & 5 deletions contracts/Proposals.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@ import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract Proposals is Ownable {

struct Proposal {
uint8 id;
string uri;
}

string baseURI;
uint8 proposalsCount;
string public baseURI;
uint8 public proposalsCount;

constructor(string memory _initBaseURI, uint8 _proposalsCount) {
constructor(string memory _initBaseURI, uint8 _proposalsCount) public {
setBaseURI(_initBaseURI);
setProposalsCount(_proposalsCount);
}
Expand All @@ -31,7 +30,9 @@ contract Proposals is Ownable {
function getProposals() external view returns (Proposal[] memory) {
Proposal[] memory proposals = new Proposal[](proposalsCount);
for (uint8 i = 0; i < proposalsCount; i++) {
string memory uri = string(abi.encodePacked(baseURI, Strings.toString(i)));
string memory uri = string(
abi.encodePacked(baseURI, Strings.toString(i))
);
proposals[i] = Proposal(i, uri);
}
return proposals;
Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"main": "index.js",
"scripts": {
"test": "TS_NODE_TRANSPILE_ONLY=1 npx hardhat test",
"format": "npx prettier --write 'contracts/**/*.sol'"
"format": "npx prettier --write 'contracts/**/*.sol'",
"lint": "npx solhint 'contracts/**/*.sol'"
},
"repository": {
"type": "git",
Expand All @@ -24,17 +25,18 @@
"devDependencies": {
"@ethersproject/abi": "^5.4.7",
"@ethersproject/providers": "^5.4.7",
"@nomiclabs/hardhat-solhint": "^2.0.1",
"@openzeppelin/contracts": "^4.7.3",
"@typechain/ethers-v5": "^10.1.0",
"@typechain/hardhat": "^6.1.2",
"@types/chai": "^4.2.0",
"@types/mocha": "^9.1.0",
"@types/node": ">=12.0.0",
"@openzeppelin/contracts": "^4.7.3",
"chai": "^4.2.0",
"chai-bignumber": "^3.0.0",
"dotenv": "^10.0.0",
"ethers": "^5.4.7",
"ethereum-waffle": "^3.4.4",
"ethers": "^5.4.7",
"hardhat": "^2.11.2",
"hardhat-deploy": "^0.11.15",
"hardhat-deploy-ethers": "^0.3.0-beta.13",
Expand Down
Loading

0 comments on commit 5add0de

Please sign in to comment.