pub struct ELChainReader {
pub provider: String,
/* private fields */
}client-elcontracts only.Fields§
§provider: StringImplementations§
Source§impl ELChainReader
impl ELChainReader
Sourcepub fn new(
allocation_manager: Option<Address>,
delegation_manager: Address,
rewards_coordinator: Address,
avs_directory: Address,
permission_controller: Option<Address>,
provider: String,
) -> ELChainReader
pub fn new( allocation_manager: Option<Address>, delegation_manager: Address, rewards_coordinator: Address, avs_directory: Address, permission_controller: Option<Address>, provider: String, ) -> ELChainReader
Creates a new ELChainReader instance with the given parameters.
§Arguments
allocation_manager- The address of the allocation manager contract.delegation_manager- The address of the delegation manager contract.rewards_coordinator- The address of the rewards coordinator contract.avs_directory- The address of the avs directory contract.permission_controller- The address of the permission controller contract.provider- The provider to use for the RPC client.
§Returns
A new ELChainReader instance.
Sourcepub async fn build(
delegation_manager: Address,
avs_directory: Address,
rewards_coordinator: Address,
client: &String,
) -> Result<ELChainReader, ElContractsError>
pub async fn build( delegation_manager: Address, avs_directory: Address, rewards_coordinator: Address, client: &String, ) -> Result<ELChainReader, ElContractsError>
Builds a new ELChainReader instance, getting the AllocationManager and PermissionController addresses
from the delegation manager.
§Arguments
delegation_manager- The address of the delegation manager contract.avs_directory- The address of the avs directory contract.rewards_coordinator- The address of the rewards coordinator contract.client- The provider to use for the RPC client to call the contracts.
§Returns
A new ELChainReader instance.
§Errors
Sourcepub async fn calculate_delegation_approval_digest_hash(
&self,
staker: Address,
operator: Address,
delegation_approver: Address,
approve_salt: FixedBytes<32>,
expiry: Uint<256, 4>,
) -> Result<FixedBytes<32>, ElContractsError>
pub async fn calculate_delegation_approval_digest_hash( &self, staker: Address, operator: Address, delegation_approver: Address, approve_salt: FixedBytes<32>, expiry: Uint<256, 4>, ) -> Result<FixedBytes<32>, ElContractsError>
Calculate the delegation approval digest hash
§Arguments
staker- The staker’s addressoperator- The operator’s addressdelegation_approver- The delegation approver’s addressapprove_salt- The approve saltexpiry- The expiry
§Returns
FixedBytes<32>- The delegation approval digest hash
§Errors
ElContractsError- if the call to the contract fails
Sourcepub async fn calculate_operator_avs_registration_digest_hash(
&self,
operator: Address,
avs: Address,
salt: FixedBytes<32>,
expiry: Uint<256, 4>,
) -> Result<FixedBytes<32>, ElContractsError>
pub async fn calculate_operator_avs_registration_digest_hash( &self, operator: Address, avs: Address, salt: FixedBytes<32>, expiry: Uint<256, 4>, ) -> Result<FixedBytes<32>, ElContractsError>
Sourcepub async fn get_distribution_roots_length(
&self,
) -> Result<Uint<256, 4>, ElContractsError>
pub async fn get_distribution_roots_length( &self, ) -> Result<Uint<256, 4>, ElContractsError>
Sourcepub async fn curr_rewards_calculation_end_timestamp(
&self,
) -> Result<u32, ElContractsError>
pub async fn curr_rewards_calculation_end_timestamp( &self, ) -> Result<u32, ElContractsError>
Sourcepub async fn get_current_claimable_distribution_root(
&self,
) -> Result<DistributionRoot, ElContractsError>
pub async fn get_current_claimable_distribution_root( &self, ) -> Result<DistributionRoot, ElContractsError>
Sourcepub async fn get_root_index_from_hash(
&self,
hash: FixedBytes<32>,
) -> Result<u32, ElContractsError>
pub async fn get_root_index_from_hash( &self, hash: FixedBytes<32>, ) -> Result<u32, ElContractsError>
Sourcepub async fn get_cumulative_claimed(
&self,
earner_address: Address,
token: Address,
) -> Result<Uint<256, 4>, ElContractsError>
pub async fn get_cumulative_claimed( &self, earner_address: Address, token: Address, ) -> Result<Uint<256, 4>, ElContractsError>
Get the cumulative claimed amount for a given earner address and token.
§Arguments
earner_address- The address of the earner.token- The address of the token.
§Returns
Result<U256, ElContractsError>- The cumulative claimed amount if the call is successful.
§Errors
ElContractsError- if the call to the contract fails.
Sourcepub async fn check_claim(
&self,
claim: RewardsMerkleClaim,
) -> Result<bool, ElContractsError>
pub async fn check_claim( &self, claim: RewardsMerkleClaim, ) -> Result<bool, ElContractsError>
Check if a claim would currently pass the validations in process_claim
§Arguments
claim- The claim to check
§Returns
Result<bool, ElContractsError>- True if the claim would pass the validations, false otherwise
§Errors
ElContractsError- if the call to the contract fails. Also fails if no root has been submitted yet.
Sourcepub async fn get_operator_avs_split(
&self,
operator: Address,
avs: Address,
) -> Result<u16, ElContractsError>
pub async fn get_operator_avs_split( &self, operator: Address, avs: Address, ) -> Result<u16, ElContractsError>
Sourcepub async fn get_operator_pi_split(
&self,
operator: Address,
) -> Result<u16, ElContractsError>
pub async fn get_operator_pi_split( &self, operator: Address, ) -> Result<u16, ElContractsError>
Sourcepub async fn get_operator_set_split(
&self,
operator: Address,
operator_set: OperatorSet,
) -> Result<u16, ElContractsError>
pub async fn get_operator_set_split( &self, operator: Address, operator_set: OperatorSet, ) -> Result<u16, ElContractsError>
Gets the split for a specific operator for a given OperatorSet
§Arguments
operator- The operator addressOperatorSet- The operator set which consists of avs address and id.
§Returns
- u16 - The split for a specific
operatorfor a givenOperatorSet, if the call is successful
§Errors
ElContractsError- if the call to the contract fails.
Sourcepub async fn get_strategy_and_underlying_erc20_token(
&self,
strategy_addr: Address,
) -> Result<(IStrategyInstance<FillProvider<JoinFill<Identity, JoinFill<GasFiller, JoinFill<BlobGasFiller, JoinFill<NonceFiller, ChainIdFiller>>>>, RootProvider>>, IERC20Instance<FillProvider<JoinFill<Identity, JoinFill<GasFiller, JoinFill<BlobGasFiller, JoinFill<NonceFiller, ChainIdFiller>>>>, RootProvider>>, Address), ElContractsError>
pub async fn get_strategy_and_underlying_erc20_token( &self, strategy_addr: Address, ) -> Result<(IStrategyInstance<FillProvider<JoinFill<Identity, JoinFill<GasFiller, JoinFill<BlobGasFiller, JoinFill<NonceFiller, ChainIdFiller>>>>, RootProvider>>, IERC20Instance<FillProvider<JoinFill<Identity, JoinFill<GasFiller, JoinFill<BlobGasFiller, JoinFill<NonceFiller, ChainIdFiller>>>>, RootProvider>>, Address), ElContractsError>
Sourcepub async fn is_operator_registered(
&self,
operator: Address,
) -> Result<bool, ElContractsError>
pub async fn is_operator_registered( &self, operator: Address, ) -> Result<bool, ElContractsError>
Get the staker’s shares in all of the strategies in which they have nonzero shares
§Arguments
staker_address- The staker’s addressblock_number- The block number
§Returns
Vec<Address>- An array of strategy addressesVec<U256>- An array with the amount of shares the staker has in each strategy
§Errors
ElContractsError- if the call to the contract fails
Sourcepub async fn get_delegated_operator(
&self,
staker_address: Address,
) -> Result<Address, ElContractsError>
pub async fn get_delegated_operator( &self, staker_address: Address, ) -> Result<Address, ElContractsError>
Sourcepub async fn get_strategy_and_underlying_token(
&self,
strategy_addr: Address,
) -> Result<(IStrategyInstance<FillProvider<JoinFill<Identity, JoinFill<GasFiller, JoinFill<BlobGasFiller, JoinFill<NonceFiller, ChainIdFiller>>>>, RootProvider>>, Address), ElContractsError>
pub async fn get_strategy_and_underlying_token( &self, strategy_addr: Address, ) -> Result<(IStrategyInstance<FillProvider<JoinFill<Identity, JoinFill<GasFiller, JoinFill<BlobGasFiller, JoinFill<NonceFiller, ChainIdFiller>>>>, RootProvider>>, Address), ElContractsError>
Sourcepub async fn get_allocatable_magnitude(
&self,
operator_address: Address,
strategy_address: Address,
) -> Result<u64, ElContractsError>
pub async fn get_allocatable_magnitude( &self, operator_address: Address, strategy_address: Address, ) -> Result<u64, ElContractsError>
For a strategy, get the amount of magnitude not currently allocated to any operator set
§Arguments
operator_address- The operator’s address to querystrategy_address- The strategy’s address to get allocatable magnitude for
§Returns
u64- The magnitude available to be allocated to an operator set
§Errors
ElContractsError- if the call to the contract fails
Sourcepub async fn get_max_magnitudes(
&self,
operator_address: Address,
strategy_addresses: Vec<Address>,
) -> Result<Vec<u64>, ElContractsError>
pub async fn get_max_magnitudes( &self, operator_address: Address, strategy_addresses: Vec<Address>, ) -> Result<Vec<u64>, ElContractsError>
Get the maximum magnitude an operator can allocate for the given strategies
§Arguments
operator_address- The operator’s address to querystrategy_addresses- The strategy’s addresses to get max magnitudes for
§Returns
Vec<u64>- The maximum magnitudes for the strategies
§Errors
ElContractsError- if the call to the contract fails
Sourcepub async fn get_allocation_info(
&self,
operator_address: Address,
strategy_address: Address,
) -> Result<Vec<AllocationInfo>, ElContractsError>
pub async fn get_allocation_info( &self, operator_address: Address, strategy_address: Address, ) -> Result<Vec<AllocationInfo>, ElContractsError>
Get the allocation info given a strategy and an operator. Returns the info for each operator set where an operator has allocation.
§Arguments
operator_address- The operator’s address to querystrategy_address- The strategy’s address to get allocation info for
§Returns
Vec<AllocationInfo>- The allocation info for each operator set
§Errors
ElContractsError- if the call to the contract fails
Get the shares that an operator owns in a set of strategies
§Arguments
operator_address- The operator’s address to get shares forstrategy_addresses- The strategy’s addresses to get shares for
§Returns
Vec<U256>- The list of shares for each strategy
§Errors
ElContractsError- if the call to the contract fails
Get the shares that a list of operators own in a set of strategies
§Arguments
operator_addresses- The list of operators’ addresses to get shares forstrategy_addresses- The strategy’s addresses to get shares for
§Returns
Vec<Vec<U256>>- The list of shares for each operator
§Errors
ElContractsError- if the call to the contract fails
Sourcepub async fn get_num_operator_sets_for_operator(
&self,
operator_addr: Address,
) -> Result<Uint<256, 4>, ElContractsError>
pub async fn get_num_operator_sets_for_operator( &self, operator_addr: Address, ) -> Result<Uint<256, 4>, ElContractsError>
Sourcepub async fn get_operator_sets_for_operator(
&self,
operator_addr: Address,
) -> Result<Vec<OperatorSet>, ElContractsError>
pub async fn get_operator_sets_for_operator( &self, operator_addr: Address, ) -> Result<Vec<OperatorSet>, ElContractsError>
Sourcepub async fn is_operator_registered_with_operator_set(
&self,
operator_address: Address,
operator_set: OperatorSet,
) -> Result<bool, ElContractsError>
pub async fn is_operator_registered_with_operator_set( &self, operator_address: Address, operator_set: OperatorSet, ) -> Result<bool, ElContractsError>
Check if an operator is registered with a specific operator set
§Arguments
operator_address- The operator’s address to queryoperator_set- The operator set to check if the operator is registered with
§Returns
bool- true if the operator is registered with the operator set, false otherwise
§Errors
ElContractsError- if the call to the contract fails
Sourcepub async fn get_operators_for_operator_set(
&self,
operator_set: OperatorSet,
) -> Result<Vec<Address>, ElContractsError>
pub async fn get_operators_for_operator_set( &self, operator_set: OperatorSet, ) -> Result<Vec<Address>, ElContractsError>
Sourcepub async fn get_num_operators_for_operator_set(
&self,
operator_set: OperatorSet,
) -> Result<Uint<256, 4>, ElContractsError>
pub async fn get_num_operators_for_operator_set( &self, operator_set: OperatorSet, ) -> Result<Uint<256, 4>, ElContractsError>
Sourcepub async fn get_strategies_for_operator_set(
&self,
operator_set: OperatorSet,
) -> Result<Vec<Address>, ElContractsError>
pub async fn get_strategies_for_operator_set( &self, operator_set: OperatorSet, ) -> Result<Vec<Address>, ElContractsError>
Get the slashable shares for an operator.
§Arguments
operator_address- The operator’s address to queryoperator_set- The operator set to querystrategies- The strategies to query
§Returns
Vec<U256>- The amount of slashable shares for each strategy
§Errors
ElContractsError- if the call to the contract fails
Get the minimum amount of shares that are slashable by the operator sets. Not supported for M2 AVSs.
§Arguments
operator_sets- The operator sets to query
§Returns
Vec<OperatorSetStakes>- The operator sets, their strategies, operators, and slashable stakes
§Errors
ElContractsError- if the call to the contract fails
Given a list of operator sets, for each one get:
- the operators,
- the strategies,
- the minimum amount of shares that are slashable before a given block. Not supported for M2 AVSs.
§Arguments
operator_sets- The operator sets to queryfuture_block- The block at which to get allocation information. It must be greater that the current block number.
§Returns
Vec<OperatorSetStakes>- The operator sets, their strategies, operators, and slashable stakes
§Errors
ElContractsError- if the call to the contract fails
Sourcepub async fn get_allocation_delay(
&self,
operator_address: Address,
) -> Result<u32, ElContractsError>
pub async fn get_allocation_delay( &self, operator_address: Address, ) -> Result<u32, ElContractsError>
Get the allocation delay for an operator. Is the number of blocks between an operator allocating slashable magnitude and the magnitude becoming slashable.
§Arguments
operator_address- The operator’s address to query
§Returns
u32- The allocation delay
§Errors
ElContractsError- if the call to the contract failsAllocationDelayNotSet- if the allocation delay is not set
Sourcepub async fn get_registered_sets(
&self,
operator_address: Address,
) -> Result<Vec<OperatorSet>, ElContractsError>
pub async fn get_registered_sets( &self, operator_address: Address, ) -> Result<Vec<OperatorSet>, ElContractsError>
Sourcepub async fn can_call(
&self,
account_address: Address,
appointee_address: Address,
target: Address,
selector: FixedBytes<4>,
) -> Result<bool, ElContractsError>
pub async fn can_call( &self, account_address: Address, appointee_address: Address, target: Address, selector: FixedBytes<4>, ) -> Result<bool, ElContractsError>
Check if the given caller has permissions to call the function
§Arguments
account_address- The account address to checkappointee_address- The caller address to check permissions fortarget- The target address to check permissions forselector- The selector of the function to check permissions for
§Returns
bool- true if the account has permissions to call the function, false otherwise
§Errors
ElContractsError- if the call to the contract fails
Sourcepub async fn list_appointees(
&self,
account_address: Address,
target: Address,
selector: FixedBytes<4>,
) -> Result<Vec<Address>, ElContractsError>
pub async fn list_appointees( &self, account_address: Address, target: Address, selector: FixedBytes<4>, ) -> Result<Vec<Address>, ElContractsError>
Get the list of appointees for a given account and function
§Arguments
account_address- The account address to get appointees fortarget- The target address to get appointees forselector- The selector of the function to get appointees for
§Returns
Vec<Address>- The list of appointees
§Errors
ElContractsError- if the call to the contract fails
Sourcepub async fn list_appointee_permissions(
&self,
account_address: Address,
appointee_address: Address,
) -> Result<(Vec<Address>, Vec<FixedBytes<4>>), ElContractsError>
pub async fn list_appointee_permissions( &self, account_address: Address, appointee_address: Address, ) -> Result<(Vec<Address>, Vec<FixedBytes<4>>), ElContractsError>
Get the list of permissions of an appointee for a given account
§Arguments
account_address- The account address to get appointee permissions forappointee_address- The appointee address to get permissions
§Returns
Vec<Address>- The list of targetsVec<FixedBytes<4>>- The list of selectors
§Errors
ElContractsError- if the call to the contract fails
Sourcepub async fn list_pending_admins(
&self,
account_address: Address,
) -> Result<Vec<Address>, ElContractsError>
pub async fn list_pending_admins( &self, account_address: Address, ) -> Result<Vec<Address>, ElContractsError>
Sourcepub async fn list_admins(
&self,
account_address: Address,
) -> Result<Vec<Address>, ElContractsError>
pub async fn list_admins( &self, account_address: Address, ) -> Result<Vec<Address>, ElContractsError>
Sourcepub async fn is_pending_admin(
&self,
account_address: Address,
pending_admin_address: Address,
) -> Result<bool, ElContractsError>
pub async fn is_pending_admin( &self, account_address: Address, pending_admin_address: Address, ) -> Result<bool, ElContractsError>
Check if an address is a pending admin of another account
§Arguments
account_address- The account addresspending_admin_address- The pending admin address to check
§Returns
bool- true if the pending_admin_address is a pending admin, false otherwise
§Errors
ElContractsError- if the call to the contract fails
Sourcepub async fn is_admin(
&self,
account_address: Address,
admin_address: Address,
) -> Result<bool, ElContractsError>
pub async fn is_admin( &self, account_address: Address, admin_address: Address, ) -> Result<bool, ElContractsError>
Sourcepub async fn is_operator_slashable(
&self,
operator_address: Address,
operator_set: OperatorSet,
) -> Result<bool, ElContractsError>
pub async fn is_operator_slashable( &self, operator_address: Address, operator_set: OperatorSet, ) -> Result<bool, ElContractsError>
Checks if an operator is slashable by an operator set.
§Arguments
operator_address- The operator to check slashability foroperator_set- The operator set to check slashability for
§Returns
bool- true if the operator is registered or their slashableUntil block has not passed. This is because even when operators are deregistered, they still remain slashable for a period of time.
§Errors
ElContractsError- if the call to the contract fails
Sourcepub async fn get_allocated_stake(
&self,
operator_set: OperatorSet,
operators: Vec<Address>,
strategies: Vec<Address>,
) -> Result<Vec<Vec<Uint<256, 4>>>, ElContractsError>
pub async fn get_allocated_stake( &self, operator_set: OperatorSet, operators: Vec<Address>, strategies: Vec<Address>, ) -> Result<Vec<Vec<Uint<256, 4>>>, ElContractsError>
Returns the current allocated stake, irrespective of the operator’s slashable status for the OperatorSet.
§Arguments
operators- The operators to queryoperator_set- The operator set to querystrategies- The strategies to query
§Returns
Vec<Vec<U256>>- Current Allocated Stake
§Errors
ElContractsError- if the call to the contract fails
Sourcepub async fn get_encumbered_magnitude(
&self,
operator: Address,
strategy_address: Address,
) -> Result<u64, ElContractsError>
pub async fn get_encumbered_magnitude( &self, operator: Address, strategy_address: Address, ) -> Result<u64, ElContractsError>
Trait Implementations§
Source§impl Clone for ELChainReader
impl Clone for ELChainReader
Source§fn clone(&self) -> ELChainReader
fn clone(&self) -> ELChainReader
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ELChainReader
impl RefUnwindSafe for ELChainReader
impl Send for ELChainReader
impl Sync for ELChainReader
impl Unpin for ELChainReader
impl UnwindSafe for ELChainReader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more