pub struct PolymeshInk { /* private fields */ }
Expand description
Upgradable wrapper for the Polymesh Runtime API.
Contracts can use this to maintain support accross major Polymesh releases.
Implementations§
Source§impl PolymeshInk
impl PolymeshInk
pub fn new() -> PolymeshResult<Self>
pub fn new_with_hash(hash: Hash) -> Self
Sourcepub fn update_code_hash(&mut self, hash: Hash)
pub fn update_code_hash(&mut self, hash: Hash)
Update code hash.
pub fn check_for_upgrade(&mut self) -> PolymeshResult<()>
Sourcepub fn system_remark(&self, remark: Vec<u8>) -> PolymeshResult<()>
pub fn system_remark(&self, remark: Vec<u8>) -> PolymeshResult<()>
Wrap the system.remark
extrinsic. Only useful for testing.
Sourcepub fn create_portfolio(&self, name: Vec<u8>) -> PolymeshResult<PortfolioId>
pub fn create_portfolio(&self, name: Vec<u8>) -> PolymeshResult<PortfolioId>
Creates a portfolio with the given name
.
Sourcepub fn accept_portfolio_custody(
&self,
auth_id: u64,
portfolio_kind: PortfolioKind,
) -> PolymeshResult<PortfolioId>
pub fn accept_portfolio_custody( &self, auth_id: u64, portfolio_kind: PortfolioKind, ) -> PolymeshResult<PortfolioId>
Accepts custody of a portfolio.
Sourcepub fn quit_portfolio_custody(
&self,
portfolio_id: PortfolioId,
) -> PolymeshResult<()>
pub fn quit_portfolio_custody( &self, portfolio_id: PortfolioId, ) -> PolymeshResult<()>
Quits custodianship of a portfolio returning control back to the owner.
Sourcepub fn move_portfolio_funds(
&self,
source_portfolio_id: PortfolioId,
destination_portfolio_id: PortfolioId,
funds: Vec<Fund>,
) -> PolymeshResult<()>
pub fn move_portfolio_funds( &self, source_portfolio_id: PortfolioId, destination_portfolio_id: PortfolioId, funds: Vec<Fund>, ) -> PolymeshResult<()>
Moves the given funds
from source_portfolio_id
to destination_portfolio_id
.
Sourcepub fn portfolio_asset_balances(
&self,
portfolio_id: PortfolioId,
asset_id: AssetId,
) -> PolymeshResult<Balance>
pub fn portfolio_asset_balances( &self, portfolio_id: PortfolioId, asset_id: AssetId, ) -> PolymeshResult<Balance>
Returns the Balance
for the asset_id
in the given portfolio_id
.
Sourcepub fn check_portfolios_in_custody(
&self,
custodian_did: IdentityId,
portfolio_id: PortfolioId,
) -> PolymeshResult<bool>
pub fn check_portfolios_in_custody( &self, custodian_did: IdentityId, portfolio_id: PortfolioId, ) -> PolymeshResult<bool>
Returns true
if portfolio_id
is in custody of custodian_did
, otherwise returns false
.
Sourcepub fn create_venue(
&self,
venue_details: VenueDetails,
venue_type: VenueType,
) -> PolymeshResult<VenueId>
pub fn create_venue( &self, venue_details: VenueDetails, venue_type: VenueType, ) -> PolymeshResult<VenueId>
Creates a Settlement Venue.
Sourcepub fn settlement_execute(
&self,
venue_id: Option<VenueId>,
legs: Vec<Leg>,
portfolios: BTreeSet<PortfolioId>,
) -> PolymeshResult<()>
pub fn settlement_execute( &self, venue_id: Option<VenueId>, legs: Vec<Leg>, portfolios: BTreeSet<PortfolioId>, ) -> PolymeshResult<()>
Creates and manually executes a settlement to transfer assets.
Sourcepub fn asset_issue(
&self,
asset_id: AssetId,
amount_to_issue: Balance,
portfolio_kind: PortfolioKind,
) -> PolymeshResult<()>
pub fn asset_issue( &self, asset_id: AssetId, amount_to_issue: Balance, portfolio_kind: PortfolioKind, ) -> PolymeshResult<()>
Issues amount_to_issue
new tokens to portfolio_kind
.
Sourcepub fn asset_redeem(
&self,
asset_id: AssetId,
amount_to_redeem: Balance,
portfolio_kind: PortfolioKind,
) -> PolymeshResult<()>
pub fn asset_redeem( &self, asset_id: AssetId, amount_to_redeem: Balance, portfolio_kind: PortfolioKind, ) -> PolymeshResult<()>
Redeems amount_to_redeem
tokens from portfolio_kind
.
Sourcepub fn asset_create_and_issue(
&self,
asset_name: AssetName,
asset_type: AssetType,
divisible: bool,
amount_to_issue: Option<Balance>,
) -> PolymeshResult<AssetId>
pub fn asset_create_and_issue( &self, asset_name: AssetName, asset_type: AssetType, divisible: bool, amount_to_issue: Option<Balance>, ) -> PolymeshResult<AssetId>
Creates a new asset and issues amount_to_issue
tokens of that asset to the default portfolio of the caller.
Sourcepub fn asset_balance_of(
&self,
asset_id: AssetId,
did: IdentityId,
) -> PolymeshResult<Balance>
pub fn asset_balance_of( &self, asset_id: AssetId, did: IdentityId, ) -> PolymeshResult<Balance>
Returns the asset_id
Balance
for the given did
.
Sourcepub fn asset_total_supply(&self, asset_id: AssetId) -> PolymeshResult<Balance>
pub fn asset_total_supply(&self, asset_id: AssetId) -> PolymeshResult<Balance>
Returns the total supply of asset_id
.
Sourcepub fn distribution_summary(
&self,
ca_id: CAId,
) -> PolymeshResult<Option<DistributionSummary>>
pub fn distribution_summary( &self, ca_id: CAId, ) -> PolymeshResult<Option<DistributionSummary>>
Get corporate action distribution summary.
Sourcepub fn dividend_claim(&self, ca_id: CAId) -> PolymeshResult<()>
pub fn dividend_claim(&self, ca_id: CAId) -> PolymeshResult<()>
Claims dividends from a distribution.
Sourcepub fn create_dividend(&self, dividend: SimpleDividend) -> PolymeshResult<()>
pub fn create_dividend(&self, dividend: SimpleDividend) -> PolymeshResult<()>
Create a simple dividend distribution.
Sourcepub fn add_and_affirm_instruction(
&self,
venue_id: Option<VenueId>,
legs: Vec<Leg>,
portfolios: BTreeSet<PortfolioId>,
) -> PolymeshResult<InstructionId>
pub fn add_and_affirm_instruction( &self, venue_id: Option<VenueId>, legs: Vec<Leg>, portfolios: BTreeSet<PortfolioId>, ) -> PolymeshResult<InstructionId>
Adds and affirms an instruction.
Sourcepub fn create_custody_portfolio(
&self,
portfolio_owner_id: IdentityId,
portfolio_name: PortfolioName,
) -> PolymeshResult<PortfolioId>
pub fn create_custody_portfolio( &self, portfolio_owner_id: IdentityId, portfolio_name: PortfolioName, ) -> PolymeshResult<PortfolioId>
Creates a portoflio owned by portfolio_owner_id
and transfer its custody to the smart contract.
Returns the PortfolioId
of the new portfolio.
Sourcepub fn asset_metadata_local_name_to_key(
&self,
asset_id: AssetId,
asset_metadata_name: AssetMetadataName,
) -> PolymeshResult<Option<AssetMetadataLocalKey>>
pub fn asset_metadata_local_name_to_key( &self, asset_id: AssetId, asset_metadata_name: AssetMetadataName, ) -> PolymeshResult<Option<AssetMetadataLocalKey>>
Returns the AssetMetadataLocalKey
for the given asset_id
and asset_metadata_name
.
Sourcepub fn asset_metadata_value(
&self,
asset_id: AssetId,
asset_metadata_key: AssetMetadataKey,
) -> PolymeshResult<Option<AssetMetadataValue>>
pub fn asset_metadata_value( &self, asset_id: AssetId, asset_metadata_key: AssetMetadataKey, ) -> PolymeshResult<Option<AssetMetadataValue>>
Returns the AssetMetadataValue
for the given asset_id
and asset_metadata_key
.
Sourcepub fn nft_owner(
&self,
asset_id: AssetId,
nft: NFTId,
) -> PolymeshResult<Option<PortfolioId>>
pub fn nft_owner( &self, asset_id: AssetId, nft: NFTId, ) -> PolymeshResult<Option<PortfolioId>>
Returns the PortfolioId
that holds the NFT.
Sourcepub fn holds_nfts(
&self,
portfolio_id: PortfolioId,
asset_id: AssetId,
nfts: Vec<NFTId>,
) -> PolymeshResult<()>
pub fn holds_nfts( &self, portfolio_id: PortfolioId, asset_id: AssetId, nfts: Vec<NFTId>, ) -> PolymeshResult<()>
Returns Ok
if portfolio_id
holds all nfts
. Otherwise, returns PolymeshError::NotNftOwner
.
Source§impl PolymeshInk
impl PolymeshInk
Sourcepub fn get_caller_did() -> PolymeshResult<IdentityId>
pub fn get_caller_did() -> PolymeshResult<IdentityId>
Get the identity of the caller.
Sourcepub fn get_our_did() -> PolymeshResult<IdentityId>
pub fn get_our_did() -> PolymeshResult<IdentityId>
Get the identity of the contract.
Sourcepub fn get_key_did(acc: AccountId) -> PolymeshResult<IdentityId>
pub fn get_key_did(acc: AccountId) -> PolymeshResult<IdentityId>
Get the identity of a key.
Sourcepub fn get_our_next_asset_id() -> PolymeshResult<AssetId>
pub fn get_our_next_asset_id() -> PolymeshResult<AssetId>
Returns the next AssetId
for the caller.
Sourcepub fn get_next_asset_id(account_id: AccountId) -> PolymeshResult<AssetId>
pub fn get_next_asset_id(account_id: AccountId) -> PolymeshResult<AssetId>
Returns the next AssetId
for the given account_id
.
Trait Implementations§
Source§impl Clone for PolymeshInk
impl Clone for PolymeshInk
Source§fn clone(&self) -> PolymeshInk
fn clone(&self) -> PolymeshInk
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for PolymeshInk
impl Debug for PolymeshInk
Source§impl Decode for PolymeshInk
impl Decode for PolymeshInk
Source§fn decode<__CodecInputEdqy: Input>(
__codec_input_edqy: &mut __CodecInputEdqy,
) -> Result<Self, Error>
fn decode<__CodecInputEdqy: Input>( __codec_input_edqy: &mut __CodecInputEdqy, ) -> Result<Self, Error>
Source§fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
Source§impl Default for PolymeshInk
impl Default for PolymeshInk
Source§fn default() -> PolymeshInk
fn default() -> PolymeshInk
Source§impl Encode for PolymeshInk
impl Encode for PolymeshInk
Source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
Source§fn encode_to<__CodecOutputEdqy: Output + ?Sized>(
&self,
__codec_dest_edqy: &mut __CodecOutputEdqy,
)
fn encode_to<__CodecOutputEdqy: Output + ?Sized>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy, )
Source§fn using_encoded<__CodecOutputReturn, __CodecUsingEncodedCallback: FnOnce(&[u8]) -> __CodecOutputReturn>(
&self,
f: __CodecUsingEncodedCallback,
) -> __CodecOutputReturn
fn using_encoded<__CodecOutputReturn, __CodecUsingEncodedCallback: FnOnce(&[u8]) -> __CodecOutputReturn>( &self, f: __CodecUsingEncodedCallback, ) -> __CodecOutputReturn
Source§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Source§impl StorageLayout for PolymeshInk
impl StorageLayout for PolymeshInk
Source§impl TypeInfo for PolymeshInk
impl TypeInfo for PolymeshInk
impl EncodeLike for PolymeshInk
Auto Trait Implementations§
impl Freeze for PolymeshInk
impl RefUnwindSafe for PolymeshInk
impl Send for PolymeshInk
impl Sync for PolymeshInk
impl Unpin for PolymeshInk
impl UnwindSafe for PolymeshInk
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> DecodeLimit for Twhere
T: Decode,
impl<T> DecodeLimit for Twhere
T: Decode,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.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 moreSource§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.Source§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
Source§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
Source§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
T
. Read moreSource§impl<P, Key> StorableHint<Key> for Pwhere
P: Packed,
Key: StorageKey,
impl<P, Key> StorableHint<Key> for Pwhere
P: Packed,
Key: StorageKey,
Source§impl<P> StorageKey for Pwhere
P: Packed,
impl<P> StorageKey for Pwhere
P: Packed,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.Source§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
Source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from
.Source§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
Source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T
.