Contracts
Virtual contracts
These are contracts that are not directly deployed, but used as building blocks for higher-level contracts:
-
Registry- allows storage of all the added/created addresses to be able to fetch them later -
Entity(inheritsInitializable) - an initializable contract (assumed to be used with a proxy mechanic) having immutableFACTORYand immutableTYPEvariables -
Factory(inheritsRegistryandOwnable) - allows the creation of entities with implementations (a.k.a., types) proposed byOwner -
MigratableEntity(inheritsOwnableandInitializable) - an initializable contract (assumed to be used as with a proxy mechanic) having immutableFACTORYand versioning via migration mechanic -
MigratableEntityProxy- a simple, pretty cheapERC1967proxy -
MigratablesFactory(inheritsRegistryandOwnable) - allows the creation of entities with implementations (a.k.a., versions) proposed byOwnerand migration of existing entities to newer versions (byMigratableEntity:Owner) -
StaticDelegateCallable- allows the creation of any helper contracts to access the whole storage of the inheriting contract on-chain
Visible contracts
These are contracts that are deployed and can be used for on-chain and off-chain integrations:
-
Vault(inheritsMigratableEntityandStaticDelegateCallable) - the most crucial part of the Vault responsible for deposits accounting and migration control -
NetworkRestakeDelegator/FullRestakeDelegator/OperatorSpecificDelegator/OperatorNetworkSpecificDelegator(inheritsEntityandStaticDelegateCallable) - a part of the Vault responsible for a stake delegation mechanismNetworkRestakeDelegator- allows a restaking across Sub-networksFullRestakeDelegator- allows a restaking across Sub-networks and across Operators inside the Sub-networks (e.g., can be used to create an insurance mechanic)OperatorSpecificDelegator- allows a restaking across Sub-networks with the funds allocations only to a certain OperatorOperatorNetworkSpecificDelegator- allows the funds allocation to a certain Operator across Sub-networks of a certain Network
-
Slasher/VetoSlasher(inheritsEntityandStaticDelegateCallable) - a part of the Vault responsible for a stake slashingSlasher- slashing requests are processed instantlyVetoSlasher- slashing requests can be vetoed (if a resolver is set by a slashing Sub-network) or executed after a veto period
-
VaultFactory(inheritsMigratablesFactory) - pureVaults’ creator with the functionality of their migrations -
DelegatorFactory(inheritsFactory) - pure Delegators’ creator -
SlasherFactory(inheritsFactory) - pure Slashers’ creator -
NetworkRegistry(inheritsRegistry) - Networks’ managing addresses (e.g., DAO, multi-sig, etc.) registrator -
NetworkMiddlewareService- Networks’ middleware addresses setter -
OperatorRegistry(inheritsRegistry) - Operators’ managing addresses (e.g., DAO, multi-sig, etc.) registrator -
OptInService(inheritsStaticDelegateCallable) - a contract for "who"s opt-ins to "where"s providing services like:OperatorVaultOptInService- allows Operators to opt into VaultsOperatorNetworkOptInService- allows Operators to opt into Networks
-
VaultConfigurator- ready-to-work Vaults’ creator -
DefaultStakerRewards- allows Network Middlewares to distribute rewards, and Stakers to claim them -
DefaultStakerRewardsFactory(inheritsRegistry) -DefaultStakerRewardscreator -
DefaultOperatorRewards- allows Network Middlewares to distribute rewards, and Operators to claim them -
DefaultOperatorRewardsFactory(inheritsRegistry) -DefaultOperatorRewardscreator
Contracts Assumptions
These are purely technical assumptions the contracts have on each other, and that will break the standard flow if not followed:
-
MigratablesFactory- assumes a whitelisted implementation:- to have an
owner() returning 20 bytesfunction - to process versioning only through
MigratableEntityProxy.migrate(), and to return a correct version throughMigratableEntity.version() - to have
initialize(uint64,address,bytes)andmigrate(uint64,bytes)functions
- to have an
-
MigratableEntityProxy- assumes an implementation:- to not contain a function with a selector -
4f1ef286(from functionupgradeToAndCall(address,bytes))
- to not contain a function with a selector -
-
Factory- assumes a whitelisted implementation:- to have
initialize(bytes)function
- to have
-
Slasher/VetoSlasher- assumesSlasher.vault()/VetoSlasher.vault():- to have
slasher() returning 20 bytesfunction - to have
activeStake() returning 32 bytesandactiveStakeAt(uint48,bytes) returning 32 bytesfunctions
- to have
-
Slasher/VetoSlasher- assumesVault.delegator():- to have
stakeAt(bytes32,address,uint48,bytes) returning 32 bytesfunction which considers Operator opt-ins - to have
onSlash(bytes32,address,uint256,uint48,bytes)function
- to have
-
VetoSlasher- assumesVault.resolverSetEpochsDelay():- to be meaningfully less than
2 ** 48 - 1
- to be meaningfully less than
-
NetworkRestakeDelegator/FullRestakeDelegator/OperatorSpecificDelegator/OperatorNetworkSpecificDelegator- assumesNetworkRestakeDelegator.vault()/FullRestakeDelegator.vault()/OperatorSpecificDelegator.vault()/OperatorNetworkSpecificDelegator.vault():- to have
delegator() returning 20 bytesfunction - to have
epochDuration() returning 6 bytesfunction
- to have
-
NetworkRestakeDelegator/FullRestakeDelegator/OperatorSpecificDelegator/OperatorNetworkSpecificDelegator- assumesVault.slasher():- to call
onSlash(subnetwork, operator, slashedAmount, captureTimestamp, data)withslashedAmountless or equal tostakeAt(subnetwork, operator, captureTimestamp, new bytes(0))
- to call
-
Vault- assumesVault.collateral():- to be
ERC20contract
- to be
-
Vault- assumesVault.epochDuration():- to be meaningfully less than
2 ** 48 - 1
- to be meaningfully less than
Invalid/Deprecative Contracts’ States
These are states when the contracts become useless (e.g., nobody is able to deposit new funds) or meaningless (e.g., admin fees are accumulated but not claimable):
-
For
Vault:- There is no
Vault:DEFAULT_ADMIN_ROLEholders, and:-
- deposit whitelist is enabled
- no whitelisted depositors
- no
Vault:DEPOSIT_WHITELIST_SET_ROLEholders - no
Vault:DEPOSITOR_WHITELIST_ROLEholders
-
- deposit limit is enabled
- deposit limit is zero
- no
Vault:IS_DEPOSIT_LIMIT_SET_ROLEholders - no
Vault:DEPOSIT_LIMIT_SET_ROLEholders
-
- There is no
-
For
NetworkRestakeDelegator:- There is no
NetworkRestakeDelegator:DEFAULT_ADMIN_ROLEholders, and:- networks limits / operator-network shares are zero
- no
NetworkRestakeDelegator:NETWORK_LIMIT_SET_ROLEholders - no
NetworkRestakeDelegator:OPERATOR_NETWORK_SHARES_SET_ROLEholders
- There is no
-
For
FullRestakeDelegator:- There is no
FullRestakeDelegator:DEFAULT_ADMIN_ROLEholders, and:- networks limits / operator-network limits are zero
- no
FullRestakeDelegator:NETWORK_LIMIT_SET_ROLEholders - no
FullRestakeDelegator:OPERATOR_NETWORK_LIMIT_SET_ROLEholders
- There is no
-
For
OperatorSpecificDelegator:- There is no
OperatorSpecificDelegator:DEFAULT_ADMIN_ROLEholders, and:- networks limits are zero
- no
OperatorSpecificDelegator:NETWORK_LIMIT_SET_ROLEholders
- There is no
-
For
DefaultStakerRewards:- There is no
DefaultStakerRewards:DEFAULT_ADMIN_ROLEholders, and:- admin fee is not zero
- no
DefaultStakerRewards:ADMIN_FEE_CLAIM_ROLEholders - no
DefaultStakerRewards:ADMIN_FEE_SET_ROLEholders
- There is no