Skip to content

Commit

Permalink
Merge pull request #36 from devlancer412/feat/readme
Browse files Browse the repository at this point in the history
Feat/readme
  • Loading branch information
chimera-defi authored Jun 26, 2024
2 parents 3ca0fbb + 574b475 commit 6d1365a
Show file tree
Hide file tree
Showing 11 changed files with 2,672 additions and 19 deletions.
70 changes: 59 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Contracts powering https://sharedstake.org / https://sharedstake.finance

Ethereum liquid staking derivatives.
Ethereum liquid staking derivatives.
Docs: https://docs.sharedstake.finance/

V2 core auditable contracts and guidance/README in `contracts/v2/core`.
Expand Down Expand Up @@ -44,8 +44,8 @@ export ALCHEMY_GOERLI_KEY='xx'
# Errors

A note on errors
To reduce bytecode size and gas costs, error strings are shortened following UNIv3 as an example.
The template is: {origin contract}:reason
To reduce bytecode size and gas costs, error strings are shortened following UNIv3 as an example.
The template is: {origin contract}:reason
Common reasons:

```
Expand Down Expand Up @@ -85,24 +85,24 @@ Spec:

# Gas profiling

Gas profiling on goerli with different optimizations.
Transfer costs:
Gas profiling on goerli with different optimizations.
Transfer costs:
Optimizations | Cost
5000000 | 51481
200 | 51553

This represents a 0.13% improvement in the cost of a transfer, arguably the most frequent interaction.
Deploy costs:
Optimizations | Cost
5000000 | 27645256739592190
This represents a 0.13% improvement in the cost of a transfer, arguably the most frequent interaction.
Deploy costs:
Optimizations | Cost
5000000 | 27645256739592190
200 | 22124896691748864

This represents a 24% increase in deployment costs with 5000000 optimizer runs vs 200.

This was carried out on Goerli using a gas price avg of 4.5 Gwei.
This was carried out on Goerli using a gas price avg of 4.5 Gwei.
Based on this a 200 run base is chosen.

Gas costs of large lists in args:
Gas costs of large lists in args:
With around ~100 addresses in a constructor arg gas price of the entire deploy stack increased by around 10%.

Added gas observations - may '23
Expand Down Expand Up @@ -166,3 +166,51 @@ Ownership transferred for TokenMigrator at 0x9615460582Efa2a9b1d8D21e7E02afE43A4
Ownership transferred for Blocklist at <redacted> to 0xeBc37F4c20C7F8336E81fB3aDf82f6372BEf777E
Ownership transferred for Allowlist at <redacted> to 0xeBc37F4c20C7F8336E81fB3aDf82f6372BEf777E
```

Here's the corrected README section:

---

## Using Development Kit

### Deploy Contracts

You can run the deploy script by specifying tags for the deploy script:

```bash
yarn deploy:sepolia --tags minter
```

The tag should exist in the deploy scripts:

```typescript
import {DeployFunction} from "hardhat-deploy/types";

const func: DeployFunction = async function (hre) {
// deployment code
};

export default func;
func.tags = ["minter"];
func.dependencies = ["sgEth", "wsgEth"];
```

When deploying contracts, the dependency scripts will run first.

### Verify Contracts

You can verify contracts by specifying the name of the contract:

```bash
yarn verify:sepolia SharedDepositMinterV2
```

Ensure you provide the correct contract name.

---

### Explanation

- **Deploying Contracts**: The `yarn deploy:sepolia --tags minter` command runs the deploy script with the specified tag (`minter`). The tag must be defined in the deploy script. Dependencies specified in `func.dependencies` will run before the tagged script.

- **Verifying Contracts**: The `yarn verify:sepolia SharedDepositMinterV2` command verifies the contract on the `sepolia` network by its name (`SharedDepositMinterV2`). Ensure the contract name is accurate to avoid verification errors.
4 changes: 3 additions & 1 deletion deploy/03_paymentSplitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ const func: DeployFunction = async hre => {

const wsgEth = (await connect(WSGETH__factory)) as WSGETH;

const splitterAddresses = [accounts.deployer.address, accounts.multiSig.address, wsgEth.target];
const multiSig = hre.network.tags.hardhat ? accounts.multiSig.address : "0x610c92c70eb55dfeafe8970513d13771da79f2e0";

const splitterAddresses = [accounts.deployer.address, multiSig, wsgEth.target];
const splitterValues = [6, 3, 31];

await deploy(PaymentSplitter__factory, {
Expand Down
4 changes: 3 additions & 1 deletion deploy/04_minter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ const func: DeployFunction = async hre => {
const numValidators = 1000;
const adminFee = 0;

const multiSig = hre.network.tags.hardhat ? accounts.multiSig.address : "0x610c92c70eb55dfeafe8970513d13771da79f2e0";

// const FeeCalc = await ethers.getContractFactory("FeeCalc");
// const feeCalc = await FeeCalc.deploy(parseEther("0"), parseEther("0"));
// await feeCalc.deployed();
Expand All @@ -21,7 +23,7 @@ const func: DeployFunction = async hre => {
//feeCalc.address, // fee splitter
sgEth.target, // sgETH address
wsgEth.target, // wsgETH address
accounts.multiSig.address, // government address
multiSig, // government address
ZeroAddress, // deposit contract address - can't find deposit contract - using dummy address
];

Expand Down
5 changes: 1 addition & 4 deletions deploy/05_withdrawalQueue.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
import {DeployFunction} from "hardhat-deploy/types";
import Ship from "../utils/ship";
import {
SgETH,
SgETH__factory,
SharedDepositMinterV2,
SharedDepositMinterV2__factory,
WSGETH,
WSGETH__factory,
WithdrawalQueue__factory,
} from "../types";
import {ZeroAddress} from "ethers";

const func: DeployFunction = async hre => {
const {deploy, connect, accounts} = await Ship.init(hre);
const {deploy, connect} = await Ship.init(hre);

const wsgEth = (await connect(WSGETH__factory)) as WSGETH;
const minter = (await connect(SharedDepositMinterV2__factory)) as SharedDepositMinterV2;
Expand Down
1 change: 1 addition & 0 deletions deployments/sepolia/.chainId
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
11155111
Loading

0 comments on commit 6d1365a

Please sign in to comment.