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

New arch #3

Merged
merged 46 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
870f850
rename limiter to delegator
1kresh Jun 19, 2024
ee30850
fix slashing logic
1kresh Jun 19, 2024
d1c42a4
add burner feat
1kresh Jun 19, 2024
d83c704
transfer admin fee
1kresh Jun 19, 2024
f090909
change factory creation
1kresh Jun 19, 2024
129fa0f
add slashers factory
1kresh Jun 19, 2024
43cbdbb
add delegator factory
1kresh Jun 19, 2024
a57ce22
fix creations
1kresh Jun 20, 2024
b2348dd
fix arch
1kresh Jun 20, 2024
b32d854
add slasher without resolving
1kresh Jun 20, 2024
7c4e8ab
remove firstDepositAt
1kresh Jun 20, 2024
20b5eca
rewardsDistributor -> stakeRewardsDistributor
1kresh Jun 20, 2024
5e75854
linter
1kresh Jun 20, 2024
ad71bbd
add changing of delegator and slasher modules
1kresh Jun 20, 2024
347ceb1
fix resolvable slasher
1kresh Jun 21, 2024
334e5af
fix rounding
1kresh Jun 21, 2024
96aea8c
minor
1kresh Jun 21, 2024
3d365ca
create v1 slashers folder
1kresh Jun 21, 2024
31faeab
minor
1kresh Jun 21, 2024
00b9411
add operator rewards distributor
1kresh Jun 21, 2024
6b6906f
rename slashers
1kresh Jun 21, 2024
4a18d8d
fix veto slasher
1kresh Jun 22, 2024
78a54a2
remove delegator updating
1kresh Jun 22, 2024
ae9562a
remove networkOptInService
1kresh Jun 22, 2024
da41982
fix vetoSlasher
1kresh Jun 22, 2024
9f2921c
fix vetoSlasher
1kresh Jun 22, 2024
f088141
fix delegator/slasher links to vault
1kresh Jun 23, 2024
ea24ad4
remove next<> funcs from public
1kresh Jun 23, 2024
079ccd2
fix internal getters namings
1kresh Jun 23, 2024
2837b26
redundant internals -> private
1kresh Jun 23, 2024
32fcc7e
add networkRestakingDelegator
1kresh Jun 23, 2024
0fd7186
fix networkRestakingDelegator
1kresh Jun 23, 2024
b85d732
add fullRestakingDelegator
1kresh Jun 23, 2024
6354a5d
fixes
1kresh Jun 24, 2024
b89f543
change EnumerableSet to array
1kresh Jun 24, 2024
95792d5
check for unique resolvers
1kresh Jun 24, 2024
551300c
fix network stake for FullRestakingDelegator
1kresh Jun 24, 2024
7ca78ff
return 0 on minstakeduring if not opted in
1kresh Jun 24, 2024
15c2e34
renamings
1kresh Jun 24, 2024
9ea91b4
remove permit2lib
1kresh Jun 24, 2024
44baa74
minor
1kresh Jun 24, 2024
2c44c95
minor fix
1kresh Jun 26, 2024
16b4980
fix veto slasher
1kresh Jun 26, 2024
a5407f2
renamings
1kresh Jun 26, 2024
74847c7
change slashers' logic
1kresh Jun 26, 2024
7c6e35d
remove rewards distributors
1kresh Jun 26, 2024
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
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "lib/permit2"]
path = lib/permit2
url = https://github.com/Uniswap/permit2
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
Expand Down
1 change: 0 additions & 1 deletion lib/permit2
Submodule permit2 deleted from cc56ad
1 change: 0 additions & 1 deletion remappings.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
forge-std/=lib/forge-std/src/
permit2/=lib/permit2/
@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/
@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/
21 changes: 10 additions & 11 deletions script/deploy/Core.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@

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

// import {MetadataService} from "src/contracts/MetadataService.sol";
// import {NetworkMiddlewareService} from "src/contracts/NetworkMiddlewareService.sol";
// import {NetworkOptInService} from "src/contracts/NetworkOptInService.sol";
// import {MetadataService} from "src/contracts/service/MetadataService.sol";
// import {NetworkMiddlewareService} from "src/contracts/service/NetworkMiddlewareService.sol";
// import {NetworkRegistry} from "src/contracts/NetworkRegistry.sol";
// import {OperatorOptInService} from "src/contracts/OperatorOptInService.sol";
// import {OptInService} from "src/contracts/service/OptInService.sol";
// import {OperatorRegistry} from "src/contracts/OperatorRegistry.sol";
// import {VaultFactory} from "src/contracts/VaultFactory.sol";
// import {Vault} from "src/contracts/vault/v1/Vault.sol";
// import {Vault} from "src/contracts/vault/Vault.sol";

// contract CoreScript is Script {
// function run(address owner) public {
Expand All @@ -23,12 +22,12 @@
// MetadataService operatorMetadataService = new MetadataService(address(operatorRegistry));
// MetadataService networkMetadataService = new MetadataService(address(networkRegistry));
// NetworkMiddlewareService networkMiddlewareService = new NetworkMiddlewareService(address(networkRegistry));
// NetworkOptInService networkVaultOptInService =
// new NetworkOptInService(address(networkRegistry), address(vaultFactory));
// OperatorOptInService operatorVaultOptInService =
// new OperatorOptInService(address(operatorRegistry), address(vaultFactory));
// OperatorOptInService operatorNetworkOptInService =
// new OperatorOptInService(address(operatorRegistry), address(networkRegistry));
// OptInService networkVaultOptInService =
// new OptInService(address(networkRegistry), address(vaultFactory));
// OptInService operatorVaultOptInService =
// new OptInService(address(operatorRegistry), address(vaultFactory));
// OptInService operatorNetworkOptInService =
// new OptInService(address(operatorRegistry), address(networkRegistry));

// vaultFactory.whitelist(
// address(
Expand Down
2 changes: 1 addition & 1 deletion script/deploy/MetadataService.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity 0.8.25;

import "forge-std/Script.sol";

import {MetadataService} from "src/contracts/MetadataService.sol";
import {MetadataService} from "src/contracts/service/MetadataService.sol";

contract MetadataServiceScript is Script {
function run(address registry) public {
Expand Down
2 changes: 1 addition & 1 deletion script/deploy/NetworkMiddlewareService.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity 0.8.25;

import "forge-std/Script.sol";

import {NetworkMiddlewareService} from "src/contracts/NetworkMiddlewareService.sol";
import {NetworkMiddlewareService} from "src/contracts/service/NetworkMiddlewareService.sol";

contract NetworkMiddlewareServiceScript is Script {
function run(address networkRegistry) public {
Expand Down
16 changes: 0 additions & 16 deletions script/deploy/NetworkOptInService.s.sol

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ pragma solidity 0.8.25;

import "forge-std/Script.sol";

import {OperatorOptInService} from "src/contracts/OperatorOptInService.sol";
import {OptInService} from "src/contracts/service/OptInService.sol";

contract OperatorOptInServiceScript is Script {
function run(address operatorRegistry, address whereRegistry) public {
vm.startBroadcast();

new OperatorOptInService(operatorRegistry, whereRegistry);
new OptInService(operatorRegistry, whereRegistry);

vm.stopBroadcast();
}
Expand Down
6 changes: 3 additions & 3 deletions script/deploy/Vault.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// import "forge-std/Script.sol";

// import {IMigratablesFactory} from "src/interfaces/base/IMigratablesFactory.sol";
// import {IVault} from "src/interfaces/vault/v1/IVault.sol";
// import {IVault} from "src/interfaces/vault/IVault.sol";

// contract VaultScript is Script {
// function run(
Expand All @@ -14,7 +14,7 @@
// uint48 epochDuration,
// uint48 vetoDuration,
// uint48 executeDuration,
// address rewardsDistributor,
// address stakerRewardsDistributor,
// uint256 adminFee,
// bool depositWhitelist
// ) public {
Expand All @@ -29,7 +29,7 @@
// epochDuration: epochDuration,
// vetoDuration: vetoDuration,
// executeDuration: executeDuration,
// rewardsDistributor: rewardsDistributor,
// stakerRewardsDistributor: stakerRewardsDistributor,
// adminFee: adminFee,
// depositWhitelist: depositWhitelist
// })
Expand Down

This file was deleted.

This file was deleted.

4 changes: 2 additions & 2 deletions specs/Network.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ forge script script/deploy/NetworkMiddlewareService.s.sol:NetworkMiddlewareServi

#### Deploy opt-in service

Deployment script: [click](../script/deploy/NetworkOptInService.s.sol)
Deployment script: [click](../script/deploy/OptInService.s.sol)

```shell
forge script script/deploy/NetworkOptInService.s.sol:NetworkOptInServiceScript 0x0000000000000000000000000000000000000000 0x0000000000000000000000000000000000000000 --sig "run(address,address)" --broadcast --rpc-url=$ETH_RPC_URL
forge script script/deploy/OptInService.s.sol:OptInServiceScript 0x0000000000000000000000000000000000000000 0x0000000000000000000000000000000000000000 --sig "run(address,address)" --broadcast --rpc-url=$ETH_RPC_URL
```
4 changes: 2 additions & 2 deletions specs/Operator.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ forge script script/deploy/MetadataService.s.sol:MetadataServiceScript 0x0000000

#### Deploy opt-in service

Deployment script: [click](../script/deploy/OperatorOptInService.s.sol)
Deployment script: [click](../script/deploy/OptInService.s.sol)

```shell
forge script script/deploy/OperatorOptInService.s.sol:OperatorOptInServiceScript 0x0000000000000000000000000000000000000000 0x0000000000000000000000000000000000000000 --sig "run(address,address)" --broadcast --rpc-url=$ETH_RPC_URL
forge script script/deploy/OptInService.s.sol:OperatorOptInServiceScript 0x0000000000000000000000000000000000000000 0x0000000000000000000000000000000000000000 --sig "run(address,address)" --broadcast --rpc-url=$ETH_RPC_URL
```
16 changes: 8 additions & 8 deletions specs/Rewards.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ For staker rewards calculation, the vault provides the following data:

Reward processing is not integrated into the vault's functionality. Instead, external reward contracts should manage this using the provided data.

However, we created the first version of the `IRewardsDistributor` interface to facilitate more generic reward distribution across networks.
However, we created the first version of the `IStakerRewardsDistributor` interface to facilitate more generic reward distribution across networks.

- `IRewardsDistributor.version()` - provides a version of the interface that a particular rewards distributor uses
- `IRewardsDistributor.distributeReward(network, token, amount, timestamp)` - call to distribute `amount` of `token` on behalf of `network` using `timestamp` as a time point for calculations
- `IStakerRewardsDistributor.version()` - provides a version of the interface that a particular rewards distributor uses
- `IStakerRewardsDistributor.distributeReward(network, token, amount, timestamp)` - call to distribute `amount` of `token` on behalf of `network` using `timestamp` as a time point for calculations

The vault's rewards distributor's address can be obtained via the `rewardsDistributor()` method, which can be set by the `REWARDS_DISTRIBUTOR_SET_ROLE` holder.
The vault's rewards distributor's address can be obtained via the `stakerRewardsDistributor()` method, which can be set by the `STAKER_REWARDS_DISTRIBUTOR_SET_ROLE` holder.

### Deploy

Expand All @@ -23,16 +23,16 @@ source .env

#### Deploy factory

Deployment script: [click](../script/deploy/defaultRewardsDistributor/DefaultRewardsDistributorFactory.s.sol)
Deployment script: [click](../script/deploy/defaultStakerRewardsDistributor/DefaultStakerRewardsDistributorFactory.s.sol)

```shell
forge script script/deploy/defaultRewardsDistributor/DefaultRewardsDistributorFactory.s.sol:DefaultRewardsDistributorFactoryScript 0x0000000000000000000000000000000000000000 0x0000000000000000000000000000000000000000 0x0000000000000000000000000000000000000000 --sig "run(address,address,address)" --broadcast --rpc-url=$ETH_RPC_URL
forge script script/deploy/defaultStakerRewardsDistributor/DefaultStakerRewardsDistributorFactory.s.sol:DefaultStakerRewardsDistributorFactoryScript 0x0000000000000000000000000000000000000000 0x0000000000000000000000000000000000000000 0x0000000000000000000000000000000000000000 --sig "run(address,address,address)" --broadcast --rpc-url=$ETH_RPC_URL
```

#### Deploy entity

Deployment script: [click](../script/deploy/defaultRewardsDistributor/DefaultRewardsDistributor.s.sol)
Deployment script: [click](../script/deploy/defaultStakerRewardsDistributor/DefaultStakerRewardsDistributor.s.sol)

```shell
forge script script/deploy/defaultRewardsDistributor/DefaultRewardsDistributor.s.sol:DefaultRewardsDistributorScript 0x0000000000000000000000000000000000000000 0x0000000000000000000000000000000000000000 --sig "run(address,address)" --broadcast --rpc-url=$ETH_RPC_URL
forge script script/deploy/defaultStakerRewardsDistributor/DefaultStakerRewardsDistributor.s.sol:DefaultStakerRewardsDistributorScript 0x0000000000000000000000000000000000000000 0x0000000000000000000000000000000000000000 --sig "run(address,address)" --broadcast --rpc-url=$ETH_RPC_URL
```
10 changes: 10 additions & 0 deletions src/contracts/DelegatorFactory.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

import {NonMigratablesFactory} from "src/contracts/common/NonMigratablesFactory.sol";

import {IDelegatorFactory} from "src/interfaces/IDelegatorFactory.sol";

contract DelegatorFactory is NonMigratablesFactory, IDelegatorFactory {
constructor(address owner_) NonMigratablesFactory(owner_) {}
}
82 changes: 0 additions & 82 deletions src/contracts/NetworkOptInService.sol

This file was deleted.

2 changes: 1 addition & 1 deletion src/contracts/NetworkRegistry.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

import {Registry} from "./base/Registry.sol";
import {Registry} from "./common/Registry.sol";

import {INetworkRegistry} from "src/interfaces/INetworkRegistry.sol";

Expand Down
Loading
Loading