Skip to content

Commit

Permalink
fix: use "constructor" instead of "setUp" in "BaseScript"
Browse files Browse the repository at this point in the history
chore: prettier ignore ".github/workflows"
ci: polish deploy workflow
refactor: remove nested dirs in "script"
  • Loading branch information
PaulRBerg committed Jun 21, 2023
1 parent 01996b6 commit 29c6828
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 24 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/deploy-test-token.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
inputs:
chain:
default: "goerli"
description: 'Chain name. Defaults to "goerli" if unspecified'
description: "Chain name as defined in the Foundry config."
required: false

jobs:
Expand All @@ -27,7 +27,11 @@ jobs:

- name: "Deploy a test ERC-20 token contract"
run: >-
forge script script/deploy/DeployTestToken.s.sol --broadcast --rpc-url "${{ github.event.inputs.chain }}"
forge script script/DeployTestToken.s.sol \
--broadcast \
--rpc-url \
--verify \
"${{github.event.inputs.chain }}" \
-vvvv
- name: "Add summary"
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# directories
.github/workflows
broadcast
cache
lib
Expand Down
29 changes: 29 additions & 0 deletions script/Base.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.19 <0.9.0;

import { Script } from "forge-std/Script.sol";

abstract contract BaseScript is Script {
/// @dev Included to enable compilation of the script without a $MNEMONIC environment variable.
string internal constant TEST_MNEMONIC = "test test test test test test test test test test test junk";

/// @dev Needed for the deterministic deployments.
bytes32 internal constant ZERO_SALT = bytes32(0);

/// @dev The address of the contract deployer.
address internal deployer;

/// @dev Used to derive the deployer's address.
string internal mnemonic;

constructor() {
mnemonic = vm.envOr("MNEMONIC", TEST_MNEMONIC);
(deployer,) = deriveRememberKey({ mnemonic: mnemonic, index: 0 });
}

modifier broadcaster() {
vm.startBroadcast(deployer);
_;
vm.stopBroadcast();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Script } from "forge-std/Script.sol";

import { ERC20GodMode } from "../../src/token/erc20/ERC20GodMode.sol";

import { BaseScript } from "../shared/Base.s.sol";
import { BaseScript } from "./Base.s.sol";

/// @notice Deploys a test ERC-20 token with infinite minting and burning capabilities.
contract DeployTestToken is Script, BaseScript {
Expand Down
21 changes: 0 additions & 21 deletions script/shared/Base.s.sol

This file was deleted.

0 comments on commit 29c6828

Please sign in to comment.