diff --git a/.solhint.json b/.solhint.json index b27480f..587e70f 100644 --- a/.solhint.json +++ b/.solhint.json @@ -9,6 +9,7 @@ "named-parameters-mapping": "warn", "no-console": "off", "not-rely-on-time": "off", - "one-contract-per-file": "off" + "one-contract-per-file": "off", + "custom-errors": "off" } } diff --git a/Makefile b/Makefile index ee66a87..3e1bab2 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,11 @@ VERSION = `git rev-parse --short HEAD` PROGRAM=gin bar -all: fmt test +all: all test @echo Run all scripts ... -fmt: - yarn prettier:write && yarn lint && yarn lint:sol +lint: + yarn lint test: forge test \ No newline at end of file diff --git a/contracts/Ethernaut/01_Fallback.sol b/contracts/Ethernaut/01_Fallback.sol index 67e8035..6d6822a 100644 --- a/contracts/Ethernaut/01_Fallback.sol +++ b/contracts/Ethernaut/01_Fallback.sol @@ -7,7 +7,7 @@ import { Level } from "./00_Ethernaut.sol"; contract Fallback { using Math for uint256; - mapping(address => uint256) public contributions; + mapping(address account => uint256 balance) public contributions; address payable public owner; constructor() payable { @@ -38,10 +38,8 @@ contract Fallback { function _fallback() private { // naming has switched to fallback - require( - msg.value > 0 && contributions[msg.sender] > 0, - "tx must have value and msg.send must have made a contribution" - ); // Add message with require + require(msg.value > 0 && contributions[msg.sender] > 0, "Not have made a contribution"); // Add message with + // require owner = payable(msg.sender); // Type issues must be payable address } diff --git a/package.json b/package.json index 4f74013..c3e274a 100644 --- a/package.json +++ b/package.json @@ -22,11 +22,9 @@ "private": true, "scripts": { "clean": "rm -rf cache out broadcast", - "build": "forge build", - "lint": "yarn lint:sol && yarn prettier:check", - "lint:sol": "forge fmt --check && yarn solhint foundry/{script,src,test}/**/*.sol", - "prettier:check": "prettier --check **/*.{json,md,yml} --ignore-path=.prettierignore", - "prettier:write": "prettier --write **/*.{json,md,yml} --ignore-path=.prettierignore", + "lint": "yarn lint:sol && yarn lint:prettier", + "lint:sol": "forge fmt && yarn solhint foundry/test/**/*.sol contracts/**/*.sol --fix", + "lint:prettier": "prettier --write **/*.{json,md,yml} --ignore-path=.prettierignore", "test": "forge test", "test:coverage": "forge coverage", "test:coverage:report": "forge coverage --report lcov && genhtml lcov.info --branch-coverage --output-dir foundry/coverage"