-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #300 from lidofinance/develop
Release 2.1.0
- Loading branch information
Showing
120 changed files
with
2,539 additions
and
1,329 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,3 +47,6 @@ lerna-debug.log* | |
|
||
# benchmarks | ||
/benchmarks/output.json | ||
|
||
|
||
artifacts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const fs = require('fs'); | ||
|
||
const getCSMArtifact = () => { | ||
const artifact = JSON.parse(fs.readFileSync('./artifacts/CSModule.json', 'utf-8')); | ||
return artifact; | ||
}; | ||
|
||
const PARTS = [ | ||
'getNodeOperatorIsActive', | ||
'getNodeOperator', | ||
'getSigningKey', | ||
'getNonce', | ||
'getNodeOperatorsCount', | ||
'getSigningKeysWithSignatures', | ||
'addNodeOperatorETH', | ||
'activatePublicRelease', | ||
'grantRole', | ||
'MODULE_MANAGER_ROLE', | ||
'decreaseVettedSigningKeysCount', | ||
'STAKING_ROUTER_ROLE', | ||
'NodeOperatorAdded', | ||
'RESUME_ROLE', | ||
'resume', | ||
'NodeOperatorRewardAddressChanged', | ||
]; | ||
|
||
const getCSMAbi = () => { | ||
const { abi } = getCSMArtifact(); | ||
|
||
return abi.filter((node) => PARTS.includes(node.name) || node.type === 'error'); | ||
}; | ||
|
||
fs.writeFileSync( | ||
'./src/staking-router-modules/contracts/abi/csm.json', | ||
JSON.stringify(getCSMAbi(), null, '\t'), | ||
'utf-8', | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
export interface RegistryKey { | ||
index: number; | ||
operatorIndex: number; | ||
depositSignature: string; | ||
key: string; | ||
used: boolean; | ||
moduleAddress: string; | ||
vetted: boolean; | ||
} | ||
|
||
export type KeyBatchRecord = [string, string] & { | ||
keys: string; | ||
signatures: string; | ||
}; |
20 changes: 20 additions & 0 deletions
20
src/common/registry-csm/fetch/interfaces/module.interface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
import { ModuleMetadata } from '@nestjs/common'; | ||
import { Signer } from 'ethers'; | ||
import { Provider } from '@ethersproject/providers'; | ||
|
||
export const REGISTRY_FETCH_OPTIONS_TOKEN = Symbol('registryFetchOptionsToken'); | ||
|
||
export interface RegistryFetchOptions { | ||
registryAddress?: string; | ||
lidoAddress?: string; | ||
provider?: Provider | Signer; | ||
keysBatchSize?: number; | ||
} | ||
|
||
export interface RegistryFetchModuleSyncOptions extends Pick<ModuleMetadata, 'imports'>, RegistryFetchOptions {} | ||
|
||
export interface RegistryFetchModuleAsyncOptions extends Pick<ModuleMetadata, 'imports'> { | ||
useFactory: (...args: any[]) => Promise<RegistryFetchOptions>; | ||
inject?: any[]; | ||
} |
12 changes: 12 additions & 0 deletions
12
src/common/registry-csm/fetch/interfaces/operator.interface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export interface RegistryOperator { | ||
index: number; | ||
active: boolean; | ||
name: string; | ||
rewardAddress: string; | ||
stakingLimit: number; | ||
stoppedValidators: number; | ||
totalSigningKeys: number; | ||
usedSigningKeys: number; | ||
moduleAddress: string; | ||
finalizedUsedSigningKeys: number; | ||
} |
11 changes: 11 additions & 0 deletions
11
src/common/registry-csm/fetch/interfaces/overrides.interface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { CallOverrides as CallOverridesSource } from '@ethersproject/contracts'; | ||
|
||
export type BlockTagWith1898 = | ||
| string | ||
| number | ||
| { blockNumber: string } | ||
| { blockHash: string; requireCanonical?: boolean }; | ||
|
||
export interface CallOverrides extends Omit<CallOverridesSource, 'blockTag'> { | ||
blockTag?: BlockTagWith1898; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* keys 96 = 48byte | ||
* signatures 192 = 96byte | ||
* https://github.com/lidofinance/lido-dao/blob/539a0faf33807d04444047d0905dce2b45260dfa/contracts/0.4.24/lib/SigningKeys.sol#L213-L238 | ||
*/ | ||
export const KEYS_LENGTH = 96; | ||
export const SIGNATURE_LENGTH = 192; | ||
export const KEYS_BATCH_SIZE = 1100; |
Oops, something went wrong.