Skip to content

Commit

Permalink
Merge pull request #43 from lidofinance/develop
Browse files Browse the repository at this point in the history
Weekly PR to master #35
  • Loading branch information
mymphe authored Mar 7, 2024
2 parents 39a411e + 8ca3b2f commit c48051c
Show file tree
Hide file tree
Showing 47 changed files with 3,411 additions and 1,026 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# top-most EditorConfig file
root = true

[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 4

[*.{js,yml,json,cjs,ts}]
indent_size = 2
19 changes: 10 additions & 9 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"parser": "@typescript-eslint/parser",
"extends": ["plugin:@typescript-eslint/recommended", "prettier"],
"parserOptions": { "ecmaVersion": 2022, "sourceType": "module" },
"parserOptions": { "ecmaVersion": 2022, "sourceType": "module", "project": ["./tsconfig.json"] },
"plugins": ["no-only-tests", "simple-import-sort"],
"rules": {
"@typescript-eslint/no-explicit-any": ["warn"],
"@typescript-eslint/no-unused-vars": ["warn"],
"@typescript-eslint/no-floating-promises": ["warn"],
// prevents committing `describe.only` and `it.only` tests
"no-only-tests/no-only-tests": "warn",
"simple-import-sort/imports": [
Expand All @@ -21,17 +22,17 @@
["^test"],
["^../"],
["^./"],
["^"]
]
}
]
["^"],
],
},
],
},
"overrides": [
{
"files": ["./scripts/{**/,}*.js", "./test/{**/,}*.js"],
"env": {
"mocha": true
}
}
]
"mocha": true,
},
},
],
}
13 changes: 5 additions & 8 deletions .github/workflows/analyse.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Code Analysis

on:
push:
branches: [master, develop]
pull_request:
branches: [master, develop]

Expand Down Expand Up @@ -63,9 +61,8 @@ jobs:
echo 'value=present' >> $GITHUB_OUTPUT ||
echo 'value=not' >> $GITHUB_OUTPUT
# # https://github.com/lidofinance/core/issues/1
# - name: Upload results.sarif file
# uses: github/codeql-action/upload-sarif@main
# if: ${{ always() && steps.results.outputs.value == 'present' }}
# with:
# sarif_file: results.sarif
- name: Upload results.sarif file
uses: github/codeql-action/upload-sarif@v3
if: ${{ always() && steps.results.outputs.value == 'present' }}
with:
sarif_file: results.sarif
38 changes: 38 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Tests

on:
pull_request:
branches: [master, develop]

jobs:
coverage:
name: Solidity coverage
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- run: corepack enable

- uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"

- name: Install dependencies
run: pnpm install

- name: Run Solidity coverage
run: pnpm test:coverage

- name: Produce the coverage report
uses: insightsengineering/coverage-action@v2
with:
path: ./coverage/cobertura-coverage.xml
publish: true
diff: true
diff-branch: master
diff-storage: _core_coverage_reports
coverage-summary-title: "Code Coverage Summary"
38 changes: 1 addition & 37 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: Tests

on:
push:
branches: [master, develop]
pull_request:
branches: [master, develop]
on: [push]

jobs:
test:
Expand All @@ -28,35 +24,3 @@ jobs:

- name: Run Hardhat Solidity tests
run: pnpm test

coverage:
name: Solidity coverage
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- run: corepack enable

- uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"

- name: Install dependencies
run: pnpm install

- name: Run Solidity coverage
run: pnpm test:coverage

- name: Produce the coverage report
uses: insightsengineering/coverage-action@v2
with:
path: ./coverage/cobertura-coverage.xml
publish: true
diff: true
diff-branch: master
diff-storage: _core_coverage_reports
coverage-summary-title: "Code Coverage Summary"
81 changes: 53 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,65 @@
# Lido Core
<div style="display: flex; flex-direction: column; align-items: center; justify-content: center;">
<img alt="Lido on Ethereum Logo" src="./docs/assets/lido.png" width="500"/>
</div>

## Develop
**Lido on Ethereum** is a liquid-staking protocol allowing anyone to earn staking rewards without locking ether or maintaining infrastructure.

```sh
# install deps
pnpm install
Key features:

# run tests
pnpm test
- No minimum deposit amount,
- Instant rewards within 24 hours of deposit,
- stETH, an LST with the deepest liquidity in DeFi,
- In-protocol automated withdrawals,
- Governed by Lido DAO.

Learn more:

- [Lido DAO](https://docs.lido.fi/lido-dao)
- [Contracts](https://docs.lido.fi/contracts/lido)
- [Addresses](https://docs.lido.fi/deployed-contracts/)
- [Protocol levers](https://docs.lido.fi/guides/protocol-levers/)

## Development

**NB:** Please read [Documentation](https://docs.lido.fi/) before getting started.

### Requirements

- Shell - bash or zsh
- [Node.js v20](https://nodejs.org/en)
- [Pnpm](https://pnpm.io/)
- [Foundry](https://book.getfoundry.sh/)

### Setup

> Installation is local and doesn't require root privileges.
Install dependencies

```bash
pnpm install
```

## Setup
### Test

- node.js v20
- pnpm
- hardhat
- ethers v6
- typechain
- commitlint
- lint-staged
- eslint
- prettier
- solhint
- slither
Run tests

## Todos
```bash
pnpm test
```

- anvil
- readme
# License

## Conventions
2023 Lido <[email protected]>

- use the `batch` helper to resolve multiple promises in parallel
- use `Snapshot` helper to restore the state at the end of suite
- use `expect` statements instead of `assert`
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License, or any later version.

### Pending
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

- test optional ERC-20 methods
You should have received a copy of the [GNU General Public License](LICENSE)
along with this program. If not, see <https://www.gnu.org/licenses/>.
Binary file added docs/assets/lido.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ export const ERC165_INTERFACE_ID = "0x01ffc9a7";
export const ERC721_INTERFACE_ID = "0x80ac58cd";
export const ERC721METADATA_INTERFACE_ID = "0x5b5e139f";

// 0x49064906 is magic number ERC4906 interfaceId as defined in the standard https://eips.ethereum.org/EIPS/eip-4906
export const ERC4906_INTERFACE_ID = "0x49064906";

// OZ Interfaces
export const OZ_ACCESS_CONTROL_INTERFACE_ID = "0x7965db0b";
export const OZ_ACCESS_CONTROL_ENUMERABLE_INTERFACE_ID = "0x5a05180f";
Expand All @@ -23,4 +26,9 @@ export const BLOCK_TIME = 12n;
export const DEFAULT_ADMIN_ROLE = "0x0000000000000000000000000000000000000000000000000000000000000000";

// Withdrawal Queue related constants
export const WITHDRAWAL_QUEUE_NAME = "Lido: Withdrawal Request NFT";
export const WITHDRAWAL_QUEUE_SYMBOL = "unstETH";
export const WITHDRAWAL_MAX_BATCHES_LENGTH = 36n;

export const WITHDRAWAL_MIN_STETH_WITHDRAWAL_AMOUNT = 100n;
export const WITHDRAWAL_MAX_STETH_WITHDRAWAL_AMOUNT = 10n ** 21n; // 1000 * 1e18
Loading

0 comments on commit c48051c

Please sign in to comment.