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 immutableFACTORY
and immutableTYPE
variables -
Factory
(inheritsRegistry
andOwnable
) - allows the creation of entities with implementations (a.k.a., types) proposed byOwner
-
MigratableEntity
(inheritsOwnable
andInitializable
) - an initializable contract (assumed to be used as with a proxy mechanic) having immutableFACTORY
and versioning via migration mechanic -
MigratableEntityProxy
- a simple, pretty cheapERC1967
proxy -
MigratablesFactory
(inheritsRegistry
andOwnable
) - allows the creation of entities with implementations (a.k.a., versions) proposed byOwner
and 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
(inheritsMigratableEntity
andStaticDelegateCallable
) - the most crucial part of the Vault responsible for deposits accounting and migration control -
NetworkRestakeDelegator
/FullRestakeDelegator
(inheritsEntity
andStaticDelegateCallable
) - 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)
-
Slasher
/VetoSlasher
(inheritsEntity
andStaticDelegateCallable
) - 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
) - pureVault
s’ 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 -
MetadataService
- metadata setter for "who"NetworkMetadataService
- Networks’ metadata setterOperatorMetadataService
- Operators’ metadata setter
-
OptInService
(inheritsStaticDelegateCallable
) - a contract for "who"s opt-ins to "where"s providing services like:VaultOptInService
- allows Operators to opt into VaultsNetworkOptInService
- allows Operators to opt into Networks
-
VaultConfigurator
- ready-to-work Vaults’ creator -
DefaultStakerRewards
- allows Network Middlewares to ditribute rewards, and Stakers to claim them -
DefaultStakerRewardsFactory
(inheritsRegistry
) -DefaultStakerRewards
creator -
DefaultOperatorRewards
- allows Network Middlewares to ditribute rewards, and Operators to claim them -
DefaultOperatorRewardsFactory
(inheritsRegistry
) -DefaultOperatorRewards
creator
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 bytes
function - 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 bytes
function - to have
activeStake() returning 32 bytes
andactiveStakeAt(uint48,bytes) returning 32 bytes
functions
- to have
-
Slasher
/VetoSlasher
- assumesVault.delegator()
:- to have
stakeAt(bytes32,address,uint48,bytes) returning 32 bytes
function 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
- assumesNetworkRestakeDelegator.vault()
/FullRestakeDelegator.vault()
:- to have
delegator() returning 20 bytes
function - to have
epochDuration() returning 6 bytes
function
- to have
-
NetworkRestakeDelegator
/FullRestakeDelegator
- assumesVault.slasher()
:- to call
onSlash(subnetwork, operator, slashedAmount, captureTimestamp, data)
withslashedAmount
less or equal tostakeAt(subnetwork, operator, captureTimestamp, new bytes(0))
- to call
-
Vault
- assumesVault.collateral()
:- to be
ERC20
contract
- 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_ROLE
holders, and:-
- deposit whitelist is enabled
- no whitelisted depositors
- no
Vault:DEPOSIT_WHITELIST_SET_ROLE
holders - no
Vault:DEPOSITOR_WHITELIST_ROLE
holders
-
- deposit limit is enabled
- deposit limit is zero
- no
Vault:IS_DEPOSIT_LIMIT_SET_ROLE
holders - no
Vault:DEPOSIT_LIMIT_SET_ROLE
holders
-
- There is no
-
For
NetworkRestakeDelegator
:- There is no
NetworkRestakeDelegator:DEFAULT_ADMIN_ROLE
holders, and:- networks limits / operator-network shares are zero
- no
NetworkRestakeDelegator:NETWORK_LIMIT_SET_ROLE
holders - no
NetworkRestakeDelegator:OPERATOR_NETWORK_SHARES_SET_ROLE
holders
- There is no
-
For
FullRestakeDelegator
:- There is no
FullRestakeDelegator:DEFAULT_ADMIN_ROLE
holders, and:- networks limits / operator-network limits are zero
- no
FullRestakeDelegator:NETWORK_LIMIT_SET_ROLE
holders - no
FullRestakeDelegator:OPERATOR_NETWORK_LIMIT_SET_ROLE
holders
- There is no
-
For
DefaultStakerRewards
:- There is no
DefaultStakerRewards:DEFAULT_ADMIN_ROLE
holders, and:- admin fee is not zero
- no
DefaultStakerRewards:ADMIN_FEE_CLAIM_ROLE
holders - no
DefaultStakerRewards:ADMIN_FEE_SET_ROLE
holders
- There is no