OfferV2Instance

Struct OfferV2Instance 

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

A OfferV2 instance.

Contains type-safe methods for interacting with an on-chain instance of the OfferV2 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<T: Transport + Clone, P: Provider<T, N>, N: Network> OfferV2Instance<T, P, N>

Instantiation and getters/setters.

Source

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

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

See the wrapper’s documentation for more details.

Source

pub async fn deploy(provider: P) -> Result<OfferV2Instance<T, P, N>>

Deploys this contract using the given provider and constructor arguments, if any.

Returns a new instance of the contract, if the deployment was successful.

For more fine-grained control over the deployment process, use deploy_builder instead.

Source

pub fn deploy_builder(provider: P) -> RawCallBuilder<T, P, N>

Creates a RawCallBuilder for deploying this contract using the given provider and constructor arguments, if any.

This is a simple wrapper around creating a RawCallBuilder with the data set to the bytecode concatenated with the constructor’s ABI-encoded arguments.

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<T, P: Clone, N> OfferV2Instance<T, &P, N>

Source

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

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

Source§

impl<T: Transport + Clone, P: Provider<T, N>, N: Network> OfferV2Instance<T, P, N>

Function calls.

Source

pub fn call_builder<C: SolCall>(&self, call: &C) -> SolCallBuilder<T, &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 addComputePeersV2( &self, offerId: FixedBytes<32>, peers: Vec<<RegisterComputePeerV2 as SolType>::RustType>, ) -> SolCallBuilder<T, &P, addComputePeersV2Call, N>

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

Source

pub fn addComputeUnitsV2( &self, peerId: FixedBytes<32>, unitIds: Vec<FixedBytes<32>>, resource: <RegisterPeerResource as SolType>::RustType, ) -> SolCallBuilder<T, &P, addComputeUnitsV2Call, N>

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

Source

pub fn bytesPerRam(&self) -> SolCallBuilder<T, &P, bytesPerRamCall, N>

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

Source

pub fn bytesPerStorage(&self) -> SolCallBuilder<T, &P, bytesPerStorageCall, N>

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

Source

pub fn changeResourceDetails( &self, peerId: FixedBytes<32>, resourceId: FixedBytes<32>, details: String, ) -> SolCallBuilder<T, &P, changeResourceDetailsCall, N>

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

Source

pub fn changeResourceMaxSupplyV2( &self, peerId: FixedBytes<32>, resourceId: FixedBytes<32>, newMaxSupply: U256, ) -> SolCallBuilder<T, &P, changeResourceMaxSupplyV2Call, N>

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

Source

pub fn changeResourcePriceV2( &self, offerId: FixedBytes<32>, resourceId: FixedBytes<32>, newPrice: U256, ) -> SolCallBuilder<T, &P, changeResourcePriceV2Call, N>

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

Source

pub fn createDatacenter( &self, datacenter: <RegisterDatacenter as SolType>::RustType, ) -> SolCallBuilder<T, &P, createDatacenterCall, N>

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

Source

pub fn createDatacenters( &self, datacenters: Vec<<RegisterDatacenter as SolType>::RustType>, ) -> SolCallBuilder<T, &P, createDatacentersCall, N>

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

Source

pub fn getOfferDatacenter( &self, offerId: FixedBytes<32>, ) -> SolCallBuilder<T, &P, getOfferDatacenterCall, N>

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

Source

pub fn ramPerVcpu(&self) -> SolCallBuilder<T, &P, ramPerVcpuCall, N>

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

Source

pub fn registerMarketOfferV2( &self, paymentToken: Address, resourcePrices: Vec<<RegisterResourcePrice as SolType>::RustType>, peers: Vec<<RegisterComputePeerV2 as SolType>::RustType>, datacenterId: FixedBytes<32>, ) -> SolCallBuilder<T, &P, registerMarketOfferV2Call, N>

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

Source

pub fn registerPeerResource( &self, peerId: FixedBytes<32>, resource: <RegisterPeerResource as SolType>::RustType, ) -> SolCallBuilder<T, &P, registerPeerResourceCall, N>

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

Source

pub fn registerResource( &self, ty: <ResourceType as SolType>::RustType, metadata: String, ) -> SolCallBuilder<T, &P, registerResourceCall, N>

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

Source

pub fn registerResources( &self, resources: Vec<<ResourceDescription as SolType>::RustType>, ) -> SolCallBuilder<T, &P, registerResourcesCall, N>

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

Source

pub fn removeComputePeerV2( &self, peerId: FixedBytes<32>, ) -> SolCallBuilder<T, &P, removeComputePeerV2Call, N>

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

Source

pub fn removeComputeUnitV2( &self, unitId: FixedBytes<32>, associatedResourceId: FixedBytes<32>, ) -> SolCallBuilder<T, &P, removeComputeUnitV2Call, N>

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

Source

pub fn removeOfferV2( &self, offerId: FixedBytes<32>, ) -> SolCallBuilder<T, &P, removeOfferV2Call, N>

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

Source

pub fn removePeerResource( &self, peerId: FixedBytes<32>, resourceId: FixedBytes<32>, ) -> SolCallBuilder<T, &P, removePeerResourceCall, N>

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

Source

pub fn setOfferDatacenter( &self, offerId: FixedBytes<32>, datacenterId: FixedBytes<32>, ) -> SolCallBuilder<T, &P, setOfferDatacenterCall, N>

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

Source

pub fn updateDatacenter( &self, id: FixedBytes<32>, tier: U256, certifications: Vec<String>, ) -> SolCallBuilder<T, &P, updateDatacenterCall, N>

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

Source

pub fn updateResourceMetadata( &self, resourceId: FixedBytes<32>, metadata: String, ) -> SolCallBuilder<T, &P, updateResourceMetadataCall, N>

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

Source

pub fn upgradeMarketOfferV2( &self, offerId: FixedBytes<32>, resourcePrices: Vec<<RegisterResourcePrice as SolType>::RustType>, peers: Vec<<UpgradeComputePeerV2 as SolType>::RustType>, datacenterId: FixedBytes<32>, ) -> SolCallBuilder<T, &P, upgradeMarketOfferV2Call, N>

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

Source

pub fn vcpuPerCu(&self) -> SolCallBuilder<T, &P, vcpuPerCuCall, N>

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

Source§

impl<T: Transport + Clone, P: Provider<T, N>, N: Network> OfferV2Instance<T, P, N>

Event filters.

Source

pub fn event_filter<E: SolEvent>(&self) -> Event<T, &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 ComputeUnitCreated_filter(&self) -> Event<T, &P, ComputeUnitCreated, N>

Creates a new event filter for the ComputeUnitCreated event.

Source

pub fn ComputeUnitRemoved_filter(&self) -> Event<T, &P, ComputeUnitRemoved, N>

Creates a new event filter for the ComputeUnitRemoved event.

Source

pub fn DatacenterCreated_filter(&self) -> Event<T, &P, DatacenterCreated, N>

Creates a new event filter for the DatacenterCreated event.

Source

pub fn DatacenterUpdated_filter(&self) -> Event<T, &P, DatacenterUpdated, N>

Creates a new event filter for the DatacenterUpdated event.

Source

pub fn MarketOfferRegistered_filter( &self, ) -> Event<T, &P, MarketOfferRegistered, N>

Creates a new event filter for the MarketOfferRegistered event.

Source

pub fn MarketOfferRemoved_filter(&self) -> Event<T, &P, MarketOfferRemoved, N>

Creates a new event filter for the MarketOfferRemoved event.

Source

pub fn OfferDatacenterUpdated_filter( &self, ) -> Event<T, &P, OfferDatacenterUpdated, N>

Creates a new event filter for the OfferDatacenterUpdated event.

Source

pub fn OfferV2Created_filter(&self) -> Event<T, &P, OfferV2Created, N>

Creates a new event filter for the OfferV2Created event.

Source

pub fn PeerCreated_filter(&self) -> Event<T, &P, PeerCreated, N>

Creates a new event filter for the PeerCreated event.

Source

pub fn PeerRemoved_filter(&self) -> Event<T, &P, PeerRemoved, N>

Creates a new event filter for the PeerRemoved event.

Source

pub fn PeerResourceDetailsUpdated_filter( &self, ) -> Event<T, &P, PeerResourceDetailsUpdated, N>

Creates a new event filter for the PeerResourceDetailsUpdated event.

Source

pub fn PeerResourceRegistered_filter( &self, ) -> Event<T, &P, PeerResourceRegistered, N>

Creates a new event filter for the PeerResourceRegistered event.

Source

pub fn PeerResourceRemoved_filter(&self) -> Event<T, &P, PeerResourceRemoved, N>

Creates a new event filter for the PeerResourceRemoved event.

Source

pub fn PeerResourceSupplyUpdated_filter( &self, ) -> Event<T, &P, PeerResourceSupplyUpdated, N>

Creates a new event filter for the PeerResourceSupplyUpdated event.

Source

pub fn ProtocolVersionUpgraded_filter( &self, ) -> Event<T, &P, ProtocolVersionUpgraded, N>

Creates a new event filter for the ProtocolVersionUpgraded event.

Source

pub fn ResourceCreated_filter(&self) -> Event<T, &P, ResourceCreated, N>

Creates a new event filter for the ResourceCreated event.

Source

pub fn ResourceMetadataUpdated_filter( &self, ) -> Event<T, &P, ResourceMetadataUpdated, N>

Creates a new event filter for the ResourceMetadataUpdated event.

Source

pub fn ResourcePriceUpdated_filter( &self, ) -> Event<T, &P, ResourcePriceUpdated, N>

Creates a new event filter for the ResourcePriceUpdated event.

Trait Implementations§

Source§

impl<T: Clone, P: Clone, N: Clone> Clone for OfferV2Instance<T, P, N>

Source§

fn clone(&self) -> OfferV2Instance<T, 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<T, P, N> Debug for OfferV2Instance<T, P, N>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T, P, N> Freeze for OfferV2Instance<T, P, N>
where P: Freeze,

§

impl<T, P, N> RefUnwindSafe for OfferV2Instance<T, P, N>

§

impl<T, P, N> Send for OfferV2Instance<T, P, N>
where P: Send, N: Send, T: Send,

§

impl<T, P, N> Sync for OfferV2Instance<T, P, N>
where P: Sync, N: Sync, T: Sync,

§

impl<T, P, N> Unpin for OfferV2Instance<T, P, N>
where P: Unpin, N: Unpin, T: Unpin,

§

impl<T, P, N> UnwindSafe for OfferV2Instance<T, P, N>
where P: UnwindSafe, N: UnwindSafe, T: 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, 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<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
Source§

impl<T> ErasedDestructor for T
where T: 'static,