Skip to content

Commit 88d3ef6

Browse files
committed
Finalize to v1
1 parent 6948754 commit 88d3ef6

9 files changed

+145
-123
lines changed

Diff for: .gitmodules

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
[submodule "lib/chronicle-std"]
66
path = lib/chronicle-std
77
url = https://github.com/chronicleprotocol/chronicle-std
8-
branch = v1
8+
branch = v2

Diff for: CHANGELOG.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Common Changelog](https://common-changelog.org/).
6+
7+
[1.0.0]: https://github.com/chronicleprotocol/greenhouse/releases/tag/v1.0.0
8+
9+
## [1.0.0] - 2023-08-01
10+
11+
### Added
12+
13+
- Initial release

Diff for: README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The contract uses [`chronicle-std/Auth`](https://github.com/chronicleprotocol/ch
1010

1111
Install module via Foundry:
1212
```bash
13-
$ forge install chronicleprotocol/greenhouse
13+
$ forge install chronicleprotocol/greenhouse@v1
1414
```
1515

1616
## Contributing
@@ -43,4 +43,4 @@ $ forge snapshot [--check]
4343

4444
## Dependencies
4545

46-
- [chronicleprotocol/chronicle-std@v1](https://github.com/chronicleprotocol/chronicle-std/tree/v1)
46+
- [chronicleprotocol/chronicle-std@v2](https://github.com/chronicleprotocol/chronicle-std/tree/v2)

Diff for: script/Greenhouse.s.sol

+4-99
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,11 @@ import {Greenhouse} from "src/Greenhouse.sol";
1414
* @title Greenhouse Management Script
1515
*/
1616
contract GreenhouseScript is Script {
17-
/// @dev Deploys a new Greenhouse instance.
18-
///
19-
/// @dev Usage:
20-
///
21-
/// Set the following environment variables:
22-
/// - RPC_URL : The RPC URL
23-
/// - PRIVATE_KEY : The deployer's private key
24-
/// - ETHERSCAN_API_KEY : An Etherscan API key
25-
///
26-
/// Deployment command:
27-
///
28-
/// ```bash
29-
/// forge script \
30-
/// --broadcast \
31-
/// --rpc-url $RPC_URL \
32-
/// --private-key $PRIVATE_KEY \
33-
/// --etherscan-api-key $ETHERSCAN_API_KEY \
34-
/// --verify
35-
/// --sig "deploy()"
36-
/// script/Greenhouse.s.sol:GreenhouseScript
37-
/// ```
38-
function deploy() public {
17+
/// @dev Deploys a new Greenhouse instance with address `initialAuthed`
18+
/// being auth'ed.
19+
function deploy(address initialAuthed) public {
3920
vm.startBroadcast();
40-
IGreenhouse greenhouse = new Greenhouse();
21+
IGreenhouse greenhouse = new Greenhouse(initialAuthed);
4122
vm.stopBroadcast();
4223

4324
console2.log("Deployed at", address(greenhouse));
@@ -46,25 +27,6 @@ contract GreenhouseScript is Script {
4627
// -- IAuth Functions --
4728

4829
/// @dev Grants auth to address `who`.
49-
///
50-
/// @dev Usage:
51-
///
52-
/// Set the following environment variables:
53-
/// - RPC_URL : The RPC URL
54-
/// - PRIVATE_KEY : The deployer's private key
55-
/// - GREENHOUSE : The Greenhouse instance's address
56-
/// - WHO : The address to grant auth to
57-
///
58-
/// Rely command:
59-
///
60-
/// ```bash
61-
/// forge script \
62-
/// --broadcast \
63-
/// --rpc-url $RPC_URL \
64-
/// --private-key $PRIVATE_KEY \
65-
/// --sig $(cast calldata "rely(address,address)" $GREENHOUSE $WHO)
66-
/// script/Greenhouse.s.sol:GreenhouseScript
67-
/// ```
6830
function rely(address self, address who) public {
6931
vm.startBroadcast();
7032
IAuth(self).rely(who);
@@ -74,25 +36,6 @@ contract GreenhouseScript is Script {
7436
}
7537

7638
/// @dev Renounces auth from address `who`.
77-
///
78-
/// @dev Usage:
79-
///
80-
/// Set the following environment variables:
81-
/// - RPC_URL : The RPC URL
82-
/// - PRIVATE_KEY : The deployer's private key
83-
/// - GREENHOUSE : The Greenhouse instance's address
84-
/// - WHO : The address to renounce auth from
85-
///
86-
/// Deny command:
87-
///
88-
/// ```bash
89-
/// forge script \
90-
/// --broadcast \
91-
/// --rpc-url $RPC_URL \
92-
/// --private-key $PRIVATE_KEY \
93-
/// --sig $(cast calldata "deny(address,address)" $GREENHOUSE $WHO)
94-
/// script/Greenhouse.s.sol:GreenhouseScript
95-
/// ```
9639
function deny(address self, address who) public {
9740
vm.startBroadcast();
9841
IAuth(self).deny(who);
@@ -104,25 +47,6 @@ contract GreenhouseScript is Script {
10447
// -- IToll Functions --
10548

10649
/// @dev Grants toll to address `who`.
107-
///
108-
/// @dev Usage:
109-
///
110-
/// Set the following environment variables:
111-
/// - RPC_URL : The RPC URL
112-
/// - PRIVATE_KEY : The deployer's private key
113-
/// - GREENHOUSE : The Greenhouse instance's address
114-
/// - WHO : The address to grant toll to
115-
///
116-
/// Kiss command:
117-
///
118-
/// ```bash
119-
/// forge script \
120-
/// --broadcast \
121-
/// --rpc-url $RPC_URL \
122-
/// --private-key $PRIVATE_KEY \
123-
/// --sig $(cast calldata "kiss(address,address)" $GREENHOUSE $WHO)
124-
/// script/Greenhouse.s.sol:GreenhouseScript
125-
/// ```
12650
function kiss(address self, address who) public {
12751
vm.startBroadcast();
12852
IToll(self).kiss(who);
@@ -132,25 +56,6 @@ contract GreenhouseScript is Script {
13256
}
13357

13458
/// @dev Renounces toll from address `who`.
135-
///
136-
/// @dev Usage:
137-
///
138-
/// Set the following environment variables:
139-
/// - RPC_URL : The RPC URL
140-
/// - PRIVATE_KEY : The deployer's private key
141-
/// - GREENHOUSE : The Greenhouse instance's address
142-
/// - WHO : The address to renounce toll from
143-
///
144-
/// Diss command:
145-
///
146-
/// ```bash
147-
/// forge script \
148-
/// --broadcast \
149-
/// --rpc-url $RPC_URL \
150-
/// --private-key $PRIVATE_KEY \
151-
/// --sig $(cast calldata "diss(address,address)" $GREENHOUSE $WHO)
152-
/// script/Greenhouse.s.sol:GreenhouseScript
153-
/// ```
15459
function diss(address self, address who) public {
15560
vm.startBroadcast();
15661
IToll(self).diss(who);

Diff for: script/GreenhouseScript.md

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# Greenhouse Script
2+
3+
This document describes how to deploy and manage `Greenhouse` instances via the `Greenhouse.s.sol`'s `GreenhouseScript`.
4+
5+
The following environment variables are necessary for all commands:
6+
7+
- `RPC_URL`: The RPC URL of an EVM node
8+
- `PRIVATE_KEY`: The private key to use
9+
10+
Note that foundry offers different wallet options, for more info see `$ forge script -h`.
11+
12+
## Deployment
13+
14+
Set the following environment variables:
15+
- `ETHERSCAN_API_KEY`: The Etherscan API key for the Etherscan's chain instance
16+
- `INITIAL_AUTHED`: The address being auth'ed on the newly deployed `Greenhouse` instance
17+
18+
Run:
19+
```bash
20+
$ forge script \
21+
--private-key $PRIVATE_KEY \
22+
--broadcast \
23+
--rpc-url $RPC_URL \
24+
--etherscan-api-key $ETHERSCAN_API_KEY \
25+
--verify \
26+
--sig $(cast calldata "deploy(address)" $INITIAL_AUTHED) \
27+
-vvv \
28+
script/Greenhouse.s.sol:GreenhouseScript
29+
```
30+
31+
32+
## Management
33+
34+
`Greenhouse` implements `chronicle-std`'s `Auth` and `Toll` modules which can be configured.
35+
36+
Set the following environment variables:
37+
- `GREENHOUSE`: The `Greenhouse` instance's address
38+
39+
### `IAuth::rely`
40+
41+
Set the following environment variables:
42+
- `WHO`: The address to grant auth to
43+
44+
Run:
45+
```bash
46+
$ forge script \
47+
--private-key $PRIVATE_KEY \
48+
--broadcast \
49+
--rpc-url $RPC_URL \
50+
--sig $(cast calldata "rely(address,address)" $GREENHOUSE $WHO) \
51+
-vvv \
52+
script/Greenhouse.s.sol:GreenhouseScript
53+
```
54+
55+
### `IAuth::deny`
56+
57+
Set the following environment variables:
58+
- `WHO`: The address renounce auth from
59+
60+
Run:
61+
```bash
62+
$ forge script \
63+
--private-key $PRIVATE_KEY \
64+
--broadcast \
65+
--rpc-url $RPC_URL \
66+
--sig $(cast calldata "deny(address,address)" $GREENHOUSE $WHO) \
67+
-vvv \
68+
script/Greenhouse.s.sol:GreenhouseScript
69+
```
70+
71+
### `IToll::kiss`
72+
73+
Set the following environment variables:
74+
- `WHO`: The address grant toll to
75+
76+
Run:
77+
```bash
78+
$ forge script \
79+
--private-key $PRIVATE_KEY \
80+
--broadcast \
81+
--rpc-url $RPC_URL \
82+
--sig $(cast calldata "kiss(address,address)" $GREENHOUSE $WHO) \
83+
-vvv \
84+
script/Greenhouse.s.sol:GreenhouseScript
85+
```
86+
87+
### `IToll::diss`
88+
89+
Set the following environment variables:
90+
- `WHO`: The address renounce toll from
91+
92+
Run:
93+
```bash
94+
$ forge script \
95+
--private-key $PRIVATE_KEY \
96+
--broadcast \
97+
--rpc-url $RPC_URL \
98+
--sig $(cast calldata "diss(address,address)" $GREENHOUSE $WHO) \
99+
-vvv \
100+
script/Greenhouse.s.sol:GreenhouseScript
101+
```

Diff for: script/IGreenhouseChaincheck.sol

+19-19
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,25 @@ import {IGreenhouse} from "src/IGreenhouse.sol";
1414
* @notice IGreenhouse's `chaincheck` Integration Test
1515
*
1616
* @dev Config Definition:
17-
* ```json
18-
* {
19-
* "IGreenhouse": { },
20-
* "IAuth": {
21-
* "legacy": bool,
22-
* "authed": [
23-
* "<Ethereum address>",
24-
* ...
25-
* ]
26-
* },
27-
* "IToll": {
28-
* "legacy": bool,
29-
* "tolled": [
30-
* "<Ethereum address>",
31-
* ...
32-
* ]
33-
* }
34-
* }
35-
* ```
17+
* ```json
18+
* {
19+
* "IGreenhouse": { },
20+
* "IAuth": {
21+
* "legacy": bool,
22+
* "authed": [
23+
* "<Ethereum address>",
24+
* ...
25+
* ]
26+
* },
27+
* "IToll": {
28+
* "legacy": bool,
29+
* "tolled": [
30+
* "<Ethereum address>",
31+
* ...
32+
* ]
33+
* }
34+
* }
35+
* ```
3636
*/
3737
contract IGreenhouseChaincheck is Chaincheck {
3838
using stdJson for string;

Diff for: src/Greenhouse.sol

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {LibCREATE3} from "./libs/LibCREATE3.sol";
1010

1111
/**
1212
* @title Greenhouse
13+
* @custom:version 1.0.0
1314
*
1415
* @notice A greenhouse to plant contracts using CREATE3
1516
*
@@ -24,6 +25,8 @@ import {LibCREATE3} from "./libs/LibCREATE3.sol";
2425
* contracts.
2526
*/
2627
contract Greenhouse is IGreenhouse, Auth, Toll {
28+
constructor(address initialAuthed) Auth(initialAuthed) {}
29+
2730
/// @inheritdoc IGreenhouse
2831
///
2932
/// @custom:invariant Planted contract's address is deterministic and solely

Diff for: test/Greenhouse.t.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ import {IGreenhouseTest} from "./IGreenhouseTest.sol";
77

88
contract GreenhouseTest is IGreenhouseTest {
99
function setUp() public {
10-
setUp(address(new Greenhouse()));
10+
setUp(address(new Greenhouse(address(this))));
1111
}
1212
}

0 commit comments

Comments
 (0)