Skip to main content

BaseMiddlewareReader

Git Source

BaseMiddlewareReader

A helper contract for view functions that combines core manager functionality

This contract serves as a foundation for building custom middleware by providing essential

management capabilities that can be extended with additional functionality.

Methods

getCaptureTimestamp

function getCaptureTimestamp() public view override returns (uint48 timestamp) 

Gets the capture timestamp from the middleware

Returns

NameTypeDescription
timestampuint48timestamp The capture timestamp

stakeToPower

function stakeToPower(address vault, uint256 stake) public view override returns (uint256 power) 

Converts stake amount to voting power using a 1:1 ratio

Parameters

NameTypeDescription
vaultaddressThe vault address (unused in this implementation)
stakeuint256The stake amount

Returns

NameTypeDescription
poweruint256power The calculated voting power (equal to stake)

NETWORK

function NETWORK() external view returns (address) 

Gets the network address

Returns

NameTypeDescription
addressThe network address

SLASHING_WINDOW

function SLASHING_WINDOW() external view returns (uint48) 

Gets the slashing window

Returns

NameTypeDescription
uint48The slashing window

VAULT_REGISTRY

function VAULT_REGISTRY() external view returns (address) 

Gets the vault registry address

Returns

NameTypeDescription
addressThe vault registry address

OPERATOR_REGISTRY

function OPERATOR_REGISTRY() external view returns (address) 

Gets the operator registry address

Returns

NameTypeDescription
addressThe operator registry address

OPERATOR_NET_OPTIN

function OPERATOR_NET_OPTIN() external view returns (address) 

Gets the operator net opt-in address

Returns

NameTypeDescription
addressThe operator net opt-in address

operatorsLength

function operatorsLength() external view returns (uint256) 

Gets the number of operators

Returns

NameTypeDescription
uint256The number of operators

operatorWithTimesAt

function operatorWithTimesAt(
uint256 pos
) external view returns (address, uint48, uint48)

Gets the operator and its times at a specific position

Parameters

NameTypeDescription
posuint256The position

Returns

NameTypeDescription
addressThe operator address, start time, and end time
uint48
uint48

activeOperators

function activeOperators() external view returns (address[] memory) 

Gets the list of active operators

Returns

NameTypeDescription
memoryaddress[]The list of active operators

activeOperatorsAt

function activeOperatorsAt(
uint48 timestamp
) external view returns (address[] memory)

Gets the list of active operators at a specific timestamp

Parameters

NameTypeDescription
timestampuint48The timestamp

Returns

NameTypeDescription
memoryaddress[]The list of active operators at the given timestamp

operatorWasActiveAt

function operatorWasActiveAt(uint48 timestamp, address operator) external view returns (bool) 

Checks if an operator was active at a specific timestamp

Parameters

NameTypeDescription
timestampuint48The timestamp
operatoraddressThe operator address

Returns

NameTypeDescription
boolTrue if the operator was active at the given timestamp, false otherwise

isOperatorRegistered

function isOperatorRegistered(
address operator
) external view returns (bool)

Checks if an operator is registered

Parameters

NameTypeDescription
operatoraddressThe operator address

Returns

NameTypeDescription
boolTrue if the operator is registered, false otherwise

subnetworksLength

function subnetworksLength() external view returns (uint256) 

Gets the number of subnetworks

Returns

NameTypeDescription
uint256The number of subnetworks

subnetworkWithTimesAt

function subnetworkWithTimesAt(
uint256 pos
) external view returns (uint160, uint48, uint48)

Gets the subnetwork and its times at a specific position

Parameters

NameTypeDescription
posuint256The position

Returns

NameTypeDescription
uint160The subnetwork address, start time, and end time
uint48
uint48

activeSubnetworks

function activeSubnetworks() external view returns (uint160[] memory) 

Gets the list of active subnetworks

Returns

NameTypeDescription
memoryuint160[]The list of active subnetworks

activeSubnetworksAt

function activeSubnetworksAt(
uint48 timestamp
) external view returns (uint160[] memory)

Gets the list of active subnetworks at a specific timestamp

Parameters

NameTypeDescription
timestampuint48The timestamp

Returns

NameTypeDescription
memoryuint160[]The list of active subnetworks at the given timestamp

subnetworkWasActiveAt

function subnetworkWasActiveAt(uint48 timestamp, uint96 subnetwork) external view returns (bool) 

Checks if a subnetwork was active at a specific timestamp

Parameters

NameTypeDescription
timestampuint48The timestamp
subnetworkuint96The subnetwork address

Returns

NameTypeDescription
boolTrue if the subnetwork was active at the given timestamp, false otherwise

sharedVaultsLength

function sharedVaultsLength() external view returns (uint256) 

Gets the number of shared vaults

Returns

NameTypeDescription
uint256The number of shared vaults

sharedVaultWithTimesAt

function sharedVaultWithTimesAt(
uint256 pos
) external view returns (address, uint48, uint48)

Gets the shared vault and its times at a specific position

Parameters

NameTypeDescription
posuint256The position

Returns

NameTypeDescription
addressThe shared vault address, start time, and end time
uint48
uint48

activeSharedVaults

function activeSharedVaults() external view returns (address[] memory) 

Gets the list of active shared vaults

Returns

NameTypeDescription
memoryaddress[]The list of active shared vaults

activeSharedVaultsAt

function activeSharedVaultsAt(
uint48 timestamp
) external view returns (address[] memory)

Gets the list of active shared vaults at a specific timestamp

Parameters

NameTypeDescription
timestampuint48The timestamp

Returns

NameTypeDescription
memoryaddress[]The list of active shared vaults at the given timestamp

operatorVaultsLength

function operatorVaultsLength(
address operator
) external view returns (uint256)

Gets the number of vaults for a specific operator

Parameters

NameTypeDescription
operatoraddressThe operator address

Returns

NameTypeDescription
uint256The number of vaults for the given operator

operatorVaultWithTimesAt

function operatorVaultWithTimesAt(address operator, uint256 pos) external view returns (address, uint48, uint48) 

Gets the operator vault and its times at a specific position

Parameters

NameTypeDescription
operatoraddressThe operator address
posuint256The position

Returns

NameTypeDescription
addressThe operator vault address, start time, and end time
uint48
uint48

activeOperatorVaults

function activeOperatorVaults(
address operator
) external view returns (address[] memory)

Gets the list of active vaults for a specific operator

Parameters

NameTypeDescription
operatoraddressThe operator address

Returns

NameTypeDescription
memoryaddress[]The list of active vaults for the given operator

activeOperatorVaultsAt

function activeOperatorVaultsAt(uint48 timestamp, address operator) external view returns (address[] memory) 

Gets the list of active vaults for a specific operator at a specific timestamp

Parameters

NameTypeDescription
timestampuint48The timestamp
operatoraddressThe operator address

Returns

NameTypeDescription
memoryaddress[]The list of active vaults for the given operator at the given timestamp

activeVaults

function activeVaults() external view returns (address[] memory) 

Gets the list of active vaults

Returns

NameTypeDescription
memoryaddress[]The list of active vaults

activeVaultsAt

function activeVaultsAt(
uint48 timestamp
) external view returns (address[] memory)

Gets the list of active vaults at a specific timestamp

Parameters

NameTypeDescription
timestampuint48The timestamp

Returns

NameTypeDescription
memoryaddress[]The list of active vaults at the given timestamp

activeVaults

function activeVaults(
address operator
) external view returns (address[] memory)

Gets the list of active vaults for a specific operator

Parameters

NameTypeDescription
operatoraddressThe operator address

Returns

NameTypeDescription
memoryaddress[]The list of active vaults for the given operator

activeVaultsAt

function activeVaultsAt(uint48 timestamp, address operator) external view returns (address[] memory) 

Gets the list of active vaults for a specific operator at a specific timestamp

Parameters

NameTypeDescription
timestampuint48The timestamp
operatoraddressThe operator address

Returns

NameTypeDescription
memoryaddress[]The list of active vaults for the given operator at the given timestamp

vaultWasActiveAt

function vaultWasActiveAt(uint48 timestamp, address operator, address vault) external view returns (bool) 

Checks if a vault was active at a specific timestamp for a specific operator

Parameters

NameTypeDescription
timestampuint48The timestamp
operatoraddressThe operator address
vaultaddressThe vault address

Returns

NameTypeDescription
boolTrue if the vault was active at the given timestamp for the given operator, false otherwise

sharedVaultWasActiveAt

function sharedVaultWasActiveAt(uint48 timestamp, address vault) external view returns (bool) 

Checks if a shared vault was active at a specific timestamp

Parameters

NameTypeDescription
timestampuint48The timestamp
vaultaddressThe shared vault address

Returns

NameTypeDescription
boolTrue if the shared vault was active at the given timestamp, false otherwise

operatorVaultWasActiveAt

function operatorVaultWasActiveAt(uint48 timestamp, address operator, address vault) external view returns (bool) 

Checks if an operator vault was active at a specific timestamp for a specific operator

Parameters

NameTypeDescription
timestampuint48The timestamp
operatoraddressThe operator address
vaultaddressThe vault address

Returns

NameTypeDescription
boolTrue if the operator vault was active at the given timestamp for the given operator, false otherwise

getOperatorPower

function getOperatorPower(address operator, address vault, uint96 subnetwork) external view returns (uint256) 

Gets the power of an operator for a specific vault and subnetwork

Parameters

NameTypeDescription
operatoraddressThe operator address
vaultaddressThe vault address
subnetworkuint96The subnetwork address

Returns

NameTypeDescription
uint256The power of the operator for the given vault and subnetwork

getOperatorPowerAt

function getOperatorPowerAt(
uint48 timestamp,
address operator,
address vault,
uint96 subnetwork
) external view returns (uint256)

Gets the power of an operator for a specific vault and subnetwork at a specific timestamp

Parameters

NameTypeDescription
timestampuint48The timestamp
operatoraddressThe operator address
vaultaddressThe vault address
subnetworkuint96The subnetwork address

Returns

NameTypeDescription
uint256The power of the operator for the given vault and subnetwork at the given timestamp

getOperatorPower

function getOperatorPower(
address operator
) external view returns (uint256)

Gets the power of an operator

Parameters

NameTypeDescription
operatoraddressThe operator address

Returns

NameTypeDescription
uint256The power of the operator

getOperatorPowerAt

function getOperatorPowerAt(uint48 timestamp, address operator) external view returns (uint256) 

Gets the power of an operator at a specific timestamp

Parameters

NameTypeDescription
timestampuint48The timestamp
operatoraddressThe operator address

Returns

NameTypeDescription
uint256The power of the operator at the given timestamp

getOperatorPower

function getOperatorPower(
address operator,
address[] memory vaults,
uint160[] memory subnetworks
) external view returns (uint256)

Gets the power of an operator for specific vaults and subnetworks

Parameters

NameTypeDescription
operatoraddressThe operator address
vaultsaddress[] memoryThe list of vault addresses
subnetworksuint160[] memoryThe list of subnetwork addresses

Returns

NameTypeDescription
uint256The power of the operator for the given vaults and subnetworks

getOperatorPowerAt

function getOperatorPowerAt(
uint48 timestamp,
address operator,
address[] memory vaults,
uint160[] memory subnetworks
) external view returns (uint256)

Gets the power of an operator for specific vaults and subnetworks at a specific timestamp

Parameters

NameTypeDescription
timestampuint48The timestamp
operatoraddressThe operator address
vaultsaddress[] memoryThe list of vault addresses
subnetworksuint160[] memoryThe list of subnetwork addresses

Returns

NameTypeDescription
uint256The power of the operator for the given vaults and subnetworks at the given timestamp

totalPower

function totalPower(
address[] memory operators
) external view returns (uint256)

Gets the total power of a list of operators

Parameters

NameTypeDescription
operatorsaddress[] memoryThe list of operator addresses

Returns

NameTypeDescription
uint256The total power of the given operators