Skip to content

Commit

Permalink
feat: add some important local settings (#14)
Browse files Browse the repository at this point in the history
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Added Solidity language settings for VSCode across multiple projects.

- **Refactor**
- Updated `runs-on` configuration to `namespace-profile-btp-scs` in
GitHub workflows for multiple projects.
- Removed `timeout` property from Hardhat configuration files across
various projects.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
roderik authored Jun 29, 2024
1 parent 9c1869d commit d7f258c
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 32 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/pr-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ permissions:

jobs:
labels:
runs-on: ubuntu-latest
#runs-on: ubuntu-latest
runs-on: namespace-profile-btp-scs
steps:
- uses: fuxingloh/multi-labeler@v4
10 changes: 0 additions & 10 deletions .github/workflows/solidity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,6 @@ jobs:
apk update
apk add --no-cache cairo-dev jpeg-dev pango-dev giflib-dev build-base g++ pkgconfig
- name: Fetch semgrep rules
uses: actions/checkout@v4
with:
repository: decurity/semgrep-smart-contracts
path: rules

- run: semgrep ci --sarif --output=semgrep.sarif || true
env:
SEMGREP_RULES: rules/solidity/security rules/solidity/performance

- uses: crytic/[email protected]
id: slither
with:
Expand Down
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"[solidity]": {
"editor.defaultFormatter": "NomicFoundation.hardhat-solidity"
},
"solidity.formatter": "forge",
"solidity.telemetry": false,
"taskManager.exclude": "lib|install|tsc|hardhat"
}
19 changes: 3 additions & 16 deletions contracts/GenericERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,12 @@ import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol";
/// @title A generic ERC20 Token
/// @dev Extends ERC20 with burnable, pausable, and permit functionalities.
/// @custom:security-contact [email protected]
contract GenericERC20 is
ERC20,
ERC20Burnable,
ERC20Pausable,
Ownable,
ERC20Permit
{
contract GenericERC20 is ERC20, ERC20Burnable, ERC20Pausable, Ownable, ERC20Permit {
/// @dev Initializes the contract by setting a `name` and a `symbol` to the token and mints initial tokens to the
/// deploying address.
/// @param name The name of the token.
/// @param symbol The symbol of the token.
constructor(
string memory name,
string memory symbol
) ERC20(name, symbol) Ownable(msg.sender) ERC20Permit(name) {
constructor(string memory name, string memory symbol) ERC20(name, symbol) Ownable(msg.sender) ERC20Permit(name) {
// Mint 100,000 tokens to the deploying address, adjusting for the token's decimals.
_mint(msg.sender, 100_000 * 10 ** decimals());
}
Expand Down Expand Up @@ -53,11 +44,7 @@ contract GenericERC20 is
/// @param from The address from which tokens are transferred.
/// @param to The address to which tokens are transferred.
/// @param value The amount of tokens to be transferred.
function _update(
address from,
address to,
uint256 value
) internal override(ERC20, ERC20Pausable) {
function _update(address from, address to, uint256 value) internal override(ERC20, ERC20Pausable) {
super._update(from, to, value);
}
}
3 changes: 2 additions & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@
gas_reports = ["*"]
fuzz = { runs = 1_000 }
auto_detect_solc = false
extra_output_files = [ "metadata" ]
extra_output_files = [ "metadata" ]
viaIR = true
2 changes: 1 addition & 1 deletion hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const config: HardhatUserConfig = {
solidity: {
version: "0.8.24",
settings: {
viaIR: true,
optimizer: {
enabled: true,
runs: 10_000,
Expand All @@ -18,7 +19,6 @@ const config: HardhatUserConfig = {
btp: {
url: process.env.BTP_RPC_URL || "",
gasPrice: process.env.BTP_GAS_PRICE ? parseInt(process.env.BTP_GAS_PRICE) : "auto",
timeout: 100_000,
},
},
etherscan: {
Expand Down
5 changes: 2 additions & 3 deletions test/GenericERC20.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ contract GenericERC20Test is Test {
token.mint(owner, mintAmount); // This should fail
}

function testBurn() public {
function testBurn() public {
uint256 burnAmount = 1000 * 10 ** token.decimals();
token.burn(burnAmount);
uint256 newOwnerBalance = token.balanceOf(owner);
Expand All @@ -53,5 +53,4 @@ contract GenericERC20Test is Test {
vm.expectRevert("ERC20: burn amount exceeds balance");
token.burn(burnAmount); // This should fail
}

}
}

0 comments on commit d7f258c

Please sign in to comment.