pub struct AllowListReader { /* private fields */ }Expand description
Reads the GPv2AllowListAuthentication contract to check solver authorization.
§Example
use alloy_primitives::address;
use cow_rs::settlement::reader::AllowListReader;
let allow_list = address!("2c4c28DDBdAc9C5E7055b4C863b72eA0149D8aFE");
let reader = AllowListReader::new("https://rpc.sepolia.org", allow_list);
let is_solver = reader.is_solver(address!("1111111111111111111111111111111111111111")).await?;Implementations§
Source§impl AllowListReader
impl AllowListReader
Sourcepub fn new(rpc_url: impl Into<String>, allow_list: Address) -> Self
pub fn new(rpc_url: impl Into<String>, allow_list: Address) -> Self
Create a new allow-list reader.
§Arguments
rpc_url- The JSON-RPC endpoint URL.allow_list- TheAddressof theGPv2AllowListAuthenticationcontract.
§Returns
A new AllowListReader targeting the specified contract.
Sourcepub const fn allow_list_address(&self) -> Address
pub const fn allow_list_address(&self) -> Address
Sourcepub async fn is_solver(&self, address: Address) -> Result<bool, CowError>
pub async fn is_solver(&self, address: Address) -> Result<bool, CowError>
Check whether an address is an authorized solver.
Calls isSolver(address) on the allow-list contract.
§Arguments
address- TheAddressto check.
§Returns
true if the address is an authorized solver.
§Errors
Returns CowError::Rpc on RPC failure or CowError::Parse if
the response cannot be decoded.
Trait Implementations§
Source§impl Clone for AllowListReader
impl Clone for AllowListReader
Source§fn clone(&self) -> AllowListReader
fn clone(&self) -> AllowListReader
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AllowListReader
impl !RefUnwindSafe for AllowListReader
impl Send for AllowListReader
impl Sync for AllowListReader
impl Unpin for AllowListReader
impl UnsafeUnpin for AllowListReader
impl !UnwindSafe for AllowListReader
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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