Skip to content

Commit ed48bf4

Browse files
committed
feat: specify owner and receiver in constructor
1 parent 464da5a commit ed48bf4

File tree

4 files changed

+43
-38
lines changed

4 files changed

+43
-38
lines changed

foundry.toml

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,46 @@
11
# Full reference https://github.com/foundry-rs/foundry/tree/master/crates/config
22

33
[profile.default]
4-
auto_detect_solc = false
5-
block_timestamp = 1_738_368_000 # Feb 1, 2025 at 00:00 GMT
6-
bytecode_hash = "none"
7-
evm_version = "shanghai"
8-
fuzz = { runs = 1_000 }
9-
gas_reports = ["*"]
10-
optimizer = true
11-
optimizer_runs = 10_000
12-
out = "out"
13-
script = "script"
14-
solc = "0.8.29"
15-
src = "src"
16-
test = "tests"
4+
auto_detect_solc = false
5+
block_timestamp = 1_738_368_000 # Feb 1, 2025 at 00:00 GMT
6+
bytecode_hash = "none"
7+
evm_version = "shanghai"
8+
fuzz = { runs = 1_000 }
9+
gas_reports = ["*"]
10+
optimizer = true
11+
optimizer_runs = 10_000
12+
out = "out"
13+
script = "script"
14+
solc = "0.8.29"
15+
src = "src"
16+
test = "tests"
17+
always_use_create_2_factory = true
1718

1819
[profile.ci]
19-
fuzz = { runs = 10_000 }
20-
verbosity = 4
20+
fuzz = { runs = 10_000 }
21+
verbosity = 4
2122

2223
[etherscan]
23-
mainnet = { key = "${API_KEY_ETHERSCAN}" }
24+
mainnet = { key = "${API_KEY_ETHERSCAN}" }
2425

2526
[fmt]
26-
bracket_spacing = true
27-
int_types = "long"
28-
line_length = 120
29-
multiline_func_header = "all"
30-
number_underscore = "thousands"
31-
quote_style = "double"
32-
tab_width = 4
33-
wrap_comments = true
27+
bracket_spacing = true
28+
int_types = "long"
29+
line_length = 120
30+
multiline_func_header = "all"
31+
number_underscore = "thousands"
32+
quote_style = "double"
33+
tab_width = 4
34+
wrap_comments = true
3435

3536
[rpc_endpoints]
36-
arbitrum = "https://arbitrum-one-rpc.publicnode.com"
37-
avalanche = "https://avalanche-c-chain-rpc.publicnode.com"
38-
base = "https://mainnet.base.org"
39-
bnb_smart_chain = "https://bsc-dataseed.binance.org"
40-
gnosis_chain = "https://rpc.gnosischain.com"
41-
localhost = "http://localhost:8545"
42-
mainnet = "https://eth-mainnet.g.alchemy.com/v2/${API_KEY_ALCHEMY}"
43-
optimism = "https://optimism-rpc.publicnode.com"
44-
polygon = "https://polygon-bor-rpc.publicnode.com"
45-
sepolia = "https://ethereum-sepolia-rpc.publicnode.com"
37+
arbitrum = "https://arbitrum-one-rpc.publicnode.com"
38+
avalanche = "https://avalanche-c-chain-rpc.publicnode.com"
39+
base = "https://base-mainnet.public.blastapi.io"
40+
bnb_smart_chain = "https://bsc-dataseed.binance.org"
41+
gnosis_chain = "https://rpc.gnosischain.com"
42+
localhost = "http://localhost:8545"
43+
mainnet = "https://eth-mainnet.g.alchemy.com/v2/${API_KEY_ALCHEMY}"
44+
optimism = "https://optimism-rpc.publicnode.com"
45+
polygon = "https://polygon-bor-rpc.publicnode.com"
46+
sepolia = "https://ethereum-sepolia-rpc.publicnode.com"

script/Deploy.s.sol

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import { BaseScript } from "./Base.s.sol";
88
/// @dev See the Solidity Scripting tutorial: https://book.getfoundry.sh/guides/scripting-with-solidity
99
contract Deploy is BaseScript {
1010
function run() public broadcast returns (CommitBox box) {
11-
box = new CommitBox();
11+
box = new CommitBox{ salt: keccak256("commit.box/0") }(
12+
address(0xC2f3F2c8084d6bc40887B0B867353d280e3D742D), address(0xC2f3F2c8084d6bc40887B0B867353d280e3D742D)
13+
);
1214
}
1315
}

src/CommitBox.sol

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,10 @@ contract CommitBox is Ownable {
7171
}
7272
}
7373

74-
constructor() {
75-
_initializeOwner(msg.sender);
74+
constructor(address _owner, address _receiver) {
75+
_initializeOwner(_owner);
76+
emit ReceiverChange(receiver, _receiver);
77+
receiver = _receiver;
7678
}
7779

7880
function commit(

tests/CommitBox.t.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ contract CommitBoxTest is Test {
1515
/// @dev A function invoked before each test case is run.
1616
function setUp() public virtual {
1717
// Instantiate the contract-under-test.
18-
box = new CommitBox();
18+
box = new CommitBox(address(this), address(0x31313));
1919
token = new MockERC20();
2020
}
2121

0 commit comments

Comments
 (0)