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

Add deploy scripts #16

Merged
merged 7 commits into from
Jan 31, 2024
Merged
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 .env.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PRIVATE_KEY=
ETHERSCAN_API_KEY=
DEFAULT_FEE=2800
GOERLI_RPC_URL=https://ethereum-goerli.publicnode.com
HOLESKY_RPC_URL=https://ethereum-holesky.publicnode.com
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,27 @@ the ownership on the transfer must confirm it with a transaction.
- **defaultFeeNumerator**: Set upon deployment and modifiable by the contract owner.
- **Eth Withdrawal**: Only the owner can withdraw Eth from the contract.

## Deploying

Copy and populate `.env.dist` to `.env` in the root directory
To deploy to Goerli, run:

```
forge script ./script/FeeRewardsManager.s.sol --verify --broadcast --rpc-url goerli --private-key ${PRIVATE_KEY}
```

Switch to `--rpc-url mainnet` making sure the `mainnet` RPC endpoint exists in the `foundry.toml` file.
enriquefynn marked this conversation as resolved.
Show resolved Hide resolved
If deploying with a ledger, instead of `--private-key ${PRIVATE_KEY}`, use `--ledger`.

## Deployments

This contract is currently deployed on:

| Network | FeeRewardsManager | CalculateAndSendRewards |
|--------------|-----------------------|-------------------------|
| Goerli | [0xaf0f0d6c4eeb740f62dfe2b10fd9e9b9c90ad3c3](https://goerli.etherscan.io/address/0xaf0f0d6c4eeb740f62dfe2b10fd9e9b9c90ad3c3) | [0xa2f0982aa895c3abbfebb858f0ec011e27d8210b](https://goerli.etherscan.io/address/0xa2f0982aa895c3abbfebb858f0ec011e27d8210b) |
| Holesky | [0x84aC4E25d621D9c73EF75E2FB4DBf491ae396B8a](https://holesky.etherscan.io/address/0x84aC4E25d621D9c73EF75E2FB4DBf491ae396B8a) | [0x49302ddf4d8651c14c2572a5d1d68d98d6090ded](https://holesky.etherscan.io/address/0x49302ddf4d8651c14c2572a5d1d68d98d6090ded) |

## Walkthrough a normal execution

Deploy `FeeRewardsManager` as `manager`, then we call
Expand All @@ -41,7 +62,7 @@ withdrawal credentials, this will create the `collector` contract where the `col
note that the contract state will already have 10 Ether.
By default, the `manager` contract gets `collector.balance * x` and the
`withdrawal_credential` contract gets the rest of the Ether (`collector.balance - collector.balance * x`).
the `manager` contract has a default tax, it gets _copied_ to the `collector` contract during contract creation,
the `manager` contract has a default tax, it gets *copied* to the `collector` contract during contract creation,
these tax can be modified by the owner of the `manager` contract.

Let's assume the tax `x` is 28% and
Expand Down
7 changes: 7 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,10 @@ out = "out"
libs = ["lib"]

# See more config options https://github.com/foundry-rs/foundry/tree/master/config

[rpc_endpoints]
goerli = "${GOERLI_RPC_URL}"
holesky = "${HOLESKY_RPC_URL}"

[etherscan]
all_chains = { key = "${ETHERSCAN_API_KEY}" }
13 changes: 13 additions & 0 deletions script/FeeRewardsManager.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// SPDX-License-Identifier: Apache License 2.0
pragma solidity ^0.8.13;

import "forge-std/Script.sol";
import "../src/FeeRewardsManager.sol";

contract Deployer is Script {
function run() external {
vm.startBroadcast();
new FeeRewardsManager(uint32(vm.envUint("DEFAULT_FEE")));
vm.stopBroadcast();
}
}
2 changes: 1 addition & 1 deletion src/FeeRewardsManager.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: BSD-3-Clause
// SPDX-License-Identifier: Apache License 2.0
pragma solidity ^0.8.13;
jenpaff marked this conversation as resolved.
Show resolved Hide resolved

import "@openzeppelin/contracts/access/Ownable2Step.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/FeeRewardsManager.t.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: Apache License 2.0
pragma solidity ^0.8.13;

import "forge-std/Test.sol";
Expand Down
Loading