Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CrabNetting goerli deploy script #893

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/crab-netting/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FORK_URL=https://mainnet.infura.io/v3/abcd
MAINNET_RPC_URL=https://mainnet.infura.io/v3/abcd
GOERLI_RPC_URL=https://mainnet.infura.io/v3/abcd
ETHERSCAN_API_KEY=abcd
DEPLOYER_PK=abcs
65 changes: 65 additions & 0 deletions packages/crab-netting/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# CRAB NETTING


## Local Development

To install dependencies and compile contracts:

```bash
git clone https://github.com/opynfinance/squeeth-monorepo && cd packages/crab-netting
```

To install Foundry (assuming a Linux or macOS system):

```bash
curl -L https://foundry.paradigm.xyz | bash
```

This will download foundryup. To start Foundry, run:

```bash
foundryup
```

To install dependencies:

```
forge install
```

<!-- There are three Foundry profiles for running the test suites, which bypass the IR pipeline to speed up compilation. To run tests, run any of the following: -->

```bash
FOUNDRY_PROFILE=test forge test # run only test functions
FOUNDRY_PROFILE=fuzz forge test # run only fuz testing (function with name that include "Fuzzing")
FOUNDRY_PROFILE=coverage forge coverage # coverage report
```

To run tests, you need to create `.env` file with the variables included in `.env.example`.

You may wish to include a `.env` file that `export`s a specific profile when developing locally.

The following modifiers are also available:

- Level 2 (-vv): Logs emitted during tests are also displayed.
- Level 3 (-vvv): Stack traces for failing tests are also displayed.
- Level 4 (-vvvv): Stack traces for all tests are displayed, and setup traces for failing tests are displayed.
- Level 5 (-vvvvv): Stack traces and setup traces are always displayed.

```bash
FOUNDRY_PROFILE=test forge test forge test -vvvv
```

For more information on foundry testing and use, see [Foundry Book installation instructions](https://book.getfoundry.sh/getting-started/installation.html).

## How To Deploy

Before running the deployment script, make sure to copy `.env.example` in a `.env` file and set the environment variables.

The deployment script for [Goerli](/packages/crab-netting/script/GoerliDeploy.s.sol) can be executed using the below command:
```shell
$ source .env
$ forge script script/GoerliDeploy.s.sol:GoerliDeploy --rpc-url $GOERLI_RPC_URL --broadcast --verify -vvvv
```

## SCRIPTS

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

113 changes: 113 additions & 0 deletions packages/crab-netting/broadcast/GoerliDeploy.s.sol/5/run-latest.json

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions packages/crab-netting/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,10 @@ src = 'src'
out = 'out'
libs = ['lib']

[rpc_endpoints]
goerli = "${GOERLI_RPC_URL}"

[etherscan]
goerli = { key = "${ETHERSCAN_API_KEY}" }

# See more config options https://github.com/foundry-rs/foundry/tree/master/config
35 changes: 35 additions & 0 deletions packages/crab-netting/script/Deploy.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

import "forge-std/Script.sol";

import { CrabNetting } from "../src/CrabNetting.sol";

contract DeployScript is Script {

address private crabAddress;
address private swapRouterAddress;

CrabNetting crabNetting;

function run() external {
uint256 deployerKey = vm.envUint("DEPLOYER_PK");
address deployerAddress = vm.rememberKey(deployerKey);

vm.startBroadcast(deployerAddress);

crabNetting =
new CrabNetting(crabAddress, swapRouterAddress);

vm.stopBroadcast();
}

function setAddressParamsAtConstructor(
address _crabAddress,
address _swapRouterAddress
) internal {
crabAddress = _crabAddress;
swapRouterAddress = _swapRouterAddress;

}
}
20 changes: 20 additions & 0 deletions packages/crab-netting/script/GoerliDeploy.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

import { DeployScript } from "./Deploy.s.sol";

contract GoerliDeploy is DeployScript {

address public constant crabAddress = 0x3fF39f6BF8156bdA997D93E3EFF6904c2bc4481f;
address public constant swapRouterAddress = 0x833A158dA5ceBc44901211427E9Df936023EC0d3;

constructor() {
setAddressParamsAtConstructor(
crabAddress,
swapRouterAddress
);


}

}