Skip to content

Commit

Permalink
script: Removes deployment via greenhouse
Browse files Browse the repository at this point in the history
  • Loading branch information
pmerkleplant committed Jul 1, 2024
1 parent 7db7ed9 commit 27ed4f7
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 187 deletions.
2 changes: 0 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ export ETHERSCAN_API_URL=
export ETHERSCAN_API_KEY=

# Deployment Configurations
export GREENHOUSE=
export SALT=
export INITIAL_AUTHED=

# Management Configurations
Expand Down
4 changes: 0 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,3 @@
path = lib/chronicle-std
url = https://github.com/chronicleprotocol/chronicle-std
branch = v2
[submodule "lib/greenhouse"]
path = lib/greenhouse
url = https://github.com/chronicleprotocol/greenhouse
branch = v1
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,3 @@ For more info, see [docs/Management.md](./docs/Management.md).

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

Deployment via:

- [chronicleprotocol/greenhouse@v1](https://github.com/chronicleprotocol/greenhouse/tree/v1)
11 changes: 3 additions & 8 deletions docs/Deployment.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Deployment

This document describes how to deploy `Scribe` and `ScribeOptimistic` instance via _Chronicle Protocol_'s [`Greenhouse`](https://github.com/chronicleprotocol/greenhouse) contract factory.
This document describes how to deploy `SelfKisser` instances.

## Environment Variables

Expand All @@ -14,19 +14,14 @@ The following environment variables must be set:
- Note that the API endpoint varies per Etherscan chain instance
- Note to point to actual API endpoint (e.g. `/api`) and not just host
- `ETHERSCAN_API_KEY`: The Etherscan API key for the Etherscan's chain instance
- `GREENHOUSE`: The `Greenhouse` instance to use for deployment
- `SALT`: The salt to deploy the `SelfKisser` instance to
- Note to use the salt's string representation
- Note that the salt must not exceed 32 bytes in length
- Note that the salt should match the name of the contract deployed!
- `INITIAL_AUTHED`: The address being auth'ed on the newly deployed `Scribe` instance

Note that an `.env.example` file is provided in the project root. To set all environment variables at once, create a copy of the file and rename the copy to `.env`, adjust the variables' values, and run `source .env`.

To easily check the environment variables, run:

```bash
$ env | grep -e "RPC_URL" -e "KEYSTORE" -e "KEYSTORE_PASSWORD" -e "ETHERSCAN_API_URL" -e "ETHERSCAN_API_KEY" -e "GREENHOUSE" -e "SALT" -e "INITIAL_AUTHED"
$ env | grep -e "RPC_URL" -e "KEYSTORE" -e "KEYSTORE_PASSWORD" -e "ETHERSCAN_API_URL" -e "ETHERSCAN_API_KEY" -e "INITIAL_AUTHED"
```

## Code Adjustments
Expand All @@ -49,7 +44,7 @@ $ SALT_BYTES32=$(cast format-bytes32-string $SALT) && \
--password "$KEYSTORE_PASSWORD" \
--broadcast \
--rpc-url "$RPC_URL" \
--sig "$(cast calldata "deploy(address,bytes32,address)" "$GREENHOUSE" "$SALT_BYTES32" "$INITIAL_AUTHED")" \
--sig "$(cast calldata "deploy(address)" "$INITIAL_AUTHED")" \
-vvv \
script/SelfKisser.s.sol:SelfKisserScript
```
Expand Down
1 change: 0 additions & 1 deletion lib/greenhouse
Submodule greenhouse deleted from dccba2
2 changes: 0 additions & 2 deletions remappings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,3 @@ chronicle-std/=lib/chronicle-std/src/
lib/chronicle-std:src/=lib/chronicle-std/src/
lib/chronicle-std:ds-test/=lib/chronicle-std/lib/forge-std/lib/ds-test/src/
lib/chronicle-std:forge-std/=lib/chronicle-std/lib/forge-std/src/

greenhouse/=lib/greenhouse/src/
23 changes: 4 additions & 19 deletions script/SelfKisser.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,16 @@ import {console2} from "forge-std/console2.sol";

import {IAuth} from "chronicle-std/auth/IAuth.sol";

import {IGreenhouse} from "greenhouse/IGreenhouse.sol";

import {ISelfKisser} from "src/ISelfKisser.sol";
import {SelfKisser_COUNTER as SelfKisser} from "src/SelfKisser.sol";
// @todo ^^^^^^^ Adjust name of SelfKisser instance.

contract SelfKisserScript is Script {
/// @dev Deploys a new SelfKisser instance via Greenhouse instance `greenhouse`
/// and salt `salt` with `initialAuthed` being the address initially
/// auth'ed.
function deploy(address greenhouse, bytes32 salt, address initialAuthed)
public
{
// Create creation code with constructor arguments.
bytes memory creationCode = abi.encodePacked(
type(SelfKisser).creationCode, abi.encode(initialAuthed)
);

// Ensure salt not yet used.
address deployed = IGreenhouse(greenhouse).addressOf(salt);
require(deployed.code.length == 0, "Salt already used");

// Plant creation code via greenhouse.
/// @dev Deploys a new SelfKisser instance with `initialAuthed` being the
/// address initially auth'ed.
function deploy(address initialAuthed) public {
vm.startBroadcast();
IGreenhouse(greenhouse).plant(salt, creationCode);
address deployed = address(new SelfKisser(initialAuthed));
vm.stopBroadcast();

console2.log("Deployed at", deployed);
Expand Down
148 changes: 0 additions & 148 deletions script/chaincheck/ISelfKisserChaincheck.sol

This file was deleted.

0 comments on commit 27ed4f7

Please sign in to comment.