Skip to main content

VaultInstance

Struct VaultInstance 

Source
pub struct VaultInstance<P, N = Ethereum> { /* private fields */ }
Expand description

A Vault instance.

Contains type-safe methods for interacting with an on-chain instance of the Vault contract located at a given address, using a given provider P.

If the contract bytecode is available (see the sol! documentation on how to provide it), the deploy and deploy_builder methods can be used to deploy a new instance of the contract.

See the module-level documentation for all the available methods.

Implementations§

Source§

impl<P: Provider<N>, N: Network> VaultInstance<P, N>

Instantiation and getters/setters.

Source

pub const fn new(address: Address, __provider: P) -> Self

Creates a new wrapper around an on-chain Vault contract instance.

See the wrapper’s documentation for more details.

Source

pub const fn address(&self) -> &Address

Returns a reference to the address.

Source

pub fn set_address(&mut self, address: Address)

Sets the address.

Source

pub fn at(self, address: Address) -> Self

Sets the address and returns self.

Source

pub const fn provider(&self) -> &P

Returns a reference to the provider.

Source§

impl<P: Clone, N> VaultInstance<&P, N>

Source

pub fn with_cloned_provider(self) -> VaultInstance<P, N>

Clones the provider and returns a new instance with the cloned provider.

Source§

impl<P: Provider<N>, N: Network> VaultInstance<P, N>

Function calls.

Source

pub fn call_builder<C: SolCall>(&self, call: &C) -> SolCallBuilder<&P, C, N>

Creates a new call builder using this contract instance’s provider and address.

Note that the call can be any function call, not just those defined in this contract. Prefer using the other methods for building type-safe contract calls.

Source

pub fn DEFAULT_ADMIN_ROLE( &self, ) -> SolCallBuilder<&P, DEFAULT_ADMIN_ROLECall, N>

Creates a new call builder for the [DEFAULT_ADMIN_ROLE] function.

Source

pub fn EMERGENCY_TIMELOCK( &self, ) -> SolCallBuilder<&P, EMERGENCY_TIMELOCKCall, N>

Creates a new call builder for the [EMERGENCY_TIMELOCK] function.

Source

pub fn PROTOCOL_ROLE(&self) -> SolCallBuilder<&P, PROTOCOL_ROLECall, N>

Creates a new call builder for the [PROTOCOL_ROLE] function.

Source

pub fn activateEmergency(&self) -> SolCallBuilder<&P, activateEmergencyCall, N>

Creates a new call builder for the [activateEmergency] function.

Source

pub fn available(&self, user: Address) -> SolCallBuilder<&P, availableCall, N>

Creates a new call builder for the [available] function.

Source

pub fn balance(&self, _0: Address) -> SolCallBuilder<&P, balanceCall, N>

Creates a new call builder for the [balance] function.

Source

pub fn collateralToken(&self) -> SolCallBuilder<&P, collateralTokenCall, N>

Creates a new call builder for the [collateralToken] function.

Source

pub fn depositFor( &self, user: Address, amount: U256, ) -> SolCallBuilder<&P, depositForCall, N>

Creates a new call builder for the [depositFor] function.

Source

pub fn emergencyActivatedAt( &self, ) -> SolCallBuilder<&P, emergencyActivatedAtCall, N>

Creates a new call builder for the [emergencyActivatedAt] function.

Source

pub fn emergencyDrainPool( &self, marketId: U256, recipient: Address, ) -> SolCallBuilder<&P, emergencyDrainPoolCall, N>

Creates a new call builder for the [emergencyDrainPool] function.

Source

pub fn emergencyMode(&self) -> SolCallBuilder<&P, emergencyModeCall, N>

Creates a new call builder for the [emergencyMode] function.

Source

pub fn emergencyWithdraw(&self) -> SolCallBuilder<&P, emergencyWithdrawCall, N>

Creates a new call builder for the [emergencyWithdraw] function.

Source

pub fn getRoleAdmin( &self, role: FixedBytes<32>, ) -> SolCallBuilder<&P, getRoleAdminCall, N>

Creates a new call builder for the [getRoleAdmin] function.

Source

pub fn grantRole( &self, role: FixedBytes<32>, account: Address, ) -> SolCallBuilder<&P, grantRoleCall, N>

Creates a new call builder for the [grantRole] function.

Source

pub fn hasRole( &self, role: FixedBytes<32>, account: Address, ) -> SolCallBuilder<&P, hasRoleCall, N>

Creates a new call builder for the [hasRole] function.

Source

pub fn lock( &self, user: Address, amount: U256, ) -> SolCallBuilder<&P, lockCall, N>

Creates a new call builder for the [lock] function.

Source

pub fn locked(&self, _0: Address) -> SolCallBuilder<&P, lockedCall, N>

Creates a new call builder for the [locked] function.

Source

pub fn marketPool(&self, _0: U256) -> SolCallBuilder<&P, marketPoolCall, N>

Creates a new call builder for the [marketPool] function.

Source

pub fn redeemFromPool( &self, marketId: U256, to: Address, amount: U256, ) -> SolCallBuilder<&P, redeemFromPoolCall, N>

Creates a new call builder for the [redeemFromPool] function.

Source

pub fn renounceRole( &self, role: FixedBytes<32>, callerConfirmation: Address, ) -> SolCallBuilder<&P, renounceRoleCall, N>

Creates a new call builder for the [renounceRole] function.

Source

pub fn revokeRole( &self, role: FixedBytes<32>, account: Address, ) -> SolCallBuilder<&P, revokeRoleCall, N>

Creates a new call builder for the [revokeRole] function.

Source

pub fn settleFill( &self, user: Address, marketId: U256, toPool: U256, feeCollector: Address, protocolFee: U256, unlockAmount: U256, withdrawUser: bool, ) -> SolCallBuilder<&P, settleFillCall, N>

Creates a new call builder for the [settleFill] function.

Source

pub fn supportsInterface( &self, interfaceId: FixedBytes<4>, ) -> SolCallBuilder<&P, supportsInterfaceCall, N>

Creates a new call builder for the [supportsInterface] function.

Source

pub fn unlock( &self, user: Address, amount: U256, ) -> SolCallBuilder<&P, unlockCall, N>

Creates a new call builder for the [unlock] function.

Source

pub fn withdrawTo( &self, user: Address, amount: U256, ) -> SolCallBuilder<&P, withdrawToCall, N>

Creates a new call builder for the [withdrawTo] function.

Source§

impl<P: Provider<N>, N: Network> VaultInstance<P, N>

Event filters.

Source

pub fn event_filter<E: SolEvent>(&self) -> Event<&P, E, N>

Creates a new event filter using this contract instance’s provider and address.

Note that the type can be any event, not just those defined in this contract. Prefer using the other methods for building type-safe event filters.

Source

pub fn AddedToMarketPool_filter(&self) -> Event<&P, AddedToMarketPool, N>

Creates a new event filter for the AddedToMarketPool event.

Source

pub fn CollateralTransferred_filter( &self, ) -> Event<&P, CollateralTransferred, N>

Creates a new event filter for the CollateralTransferred event.

Source

pub fn Deposited_filter(&self) -> Event<&P, Deposited, N>

Creates a new event filter for the Deposited event.

Source

pub fn EmergencyModeActivated_filter( &self, ) -> Event<&P, EmergencyModeActivated, N>

Creates a new event filter for the EmergencyModeActivated event.

Source

pub fn EmergencyPoolDrained_filter(&self) -> Event<&P, EmergencyPoolDrained, N>

Creates a new event filter for the EmergencyPoolDrained event.

Source

pub fn EmergencyWithdrawn_filter(&self) -> Event<&P, EmergencyWithdrawn, N>

Creates a new event filter for the EmergencyWithdrawn event.

Source

pub fn Locked_filter(&self) -> Event<&P, Locked, N>

Creates a new event filter for the Locked event.

Source

pub fn RedeemedFromPool_filter(&self) -> Event<&P, RedeemedFromPool, N>

Creates a new event filter for the RedeemedFromPool event.

Source

pub fn RoleAdminChanged_filter(&self) -> Event<&P, RoleAdminChanged, N>

Creates a new event filter for the RoleAdminChanged event.

Source

pub fn RoleGranted_filter(&self) -> Event<&P, RoleGranted, N>

Creates a new event filter for the RoleGranted event.

Source

pub fn RoleRevoked_filter(&self) -> Event<&P, RoleRevoked, N>

Creates a new event filter for the RoleRevoked event.

Source

pub fn Unlocked_filter(&self) -> Event<&P, Unlocked, N>

Creates a new event filter for the Unlocked event.

Source

pub fn Withdrawn_filter(&self) -> Event<&P, Withdrawn, N>

Creates a new event filter for the Withdrawn event.

Trait Implementations§

Source§

impl<P: Clone, N: Clone> Clone for VaultInstance<P, N>

Source§

fn clone(&self) -> VaultInstance<P, N>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<P, N> Debug for VaultInstance<P, N>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<P, N> Freeze for VaultInstance<P, N>
where P: Freeze,

§

impl<P, N> RefUnwindSafe for VaultInstance<P, N>

§

impl<P, N> Send for VaultInstance<P, N>
where P: Send, N: Send,

§

impl<P, N> Sync for VaultInstance<P, N>
where P: Sync, N: Sync,

§

impl<P, N> Unpin for VaultInstance<P, N>
where P: Unpin, N: Unpin,

§

impl<P, N> UnsafeUnpin for VaultInstance<P, N>
where P: UnsafeUnpin,

§

impl<P, N> UnwindSafe for VaultInstance<P, N>
where P: UnwindSafe, N: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> TryClone for T
where T: Clone,

Source§

fn try_clone(&self) -> Result<T, Error>

Clones self, possibly returning an error.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more