Struct polymesh_ink::PolymeshInk
source · 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>
Create a portfolio.
sourcepub fn accept_portfolio_custody(
&self,
auth_id: u64,
portfolio: PortfolioKind
) -> PolymeshResult<PortfolioId>
pub fn accept_portfolio_custody( &self, auth_id: u64, portfolio: PortfolioKind ) -> PolymeshResult<PortfolioId>
Accept custody of a portfolio.
sourcepub fn quit_portfolio_custody(
&self,
portfolio: PortfolioId
) -> PolymeshResult<()>
pub fn quit_portfolio_custody( &self, portfolio: PortfolioId ) -> PolymeshResult<()>
Quit custodianship of a portfolio returning control back to the owner.
sourcepub fn move_portfolio_funds(
&self,
src: PortfolioId,
dest: PortfolioId,
funds: Vec<Fund>
) -> PolymeshResult<()>
pub fn move_portfolio_funds( &self, src: PortfolioId, dest: PortfolioId, funds: Vec<Fund> ) -> PolymeshResult<()>
Move funds between portfolios.
sourcepub fn portfolio_asset_balances(
&self,
portfolio: PortfolioId,
ticker: Ticker
) -> PolymeshResult<Balance>
pub fn portfolio_asset_balances( &self, portfolio: PortfolioId, ticker: Ticker ) -> PolymeshResult<Balance>
Get portfolio balance.
sourcepub fn check_portfolios_in_custody(
&self,
did: IdentityId,
portfolio: PortfolioId
) -> PolymeshResult<bool>
pub fn check_portfolios_in_custody( &self, did: IdentityId, portfolio: PortfolioId ) -> PolymeshResult<bool>
Check portfolios_in_custody.
sourcepub fn create_venue(
&self,
details: VenueDetails,
ty: VenueType
) -> PolymeshResult<VenueId>
pub fn create_venue( &self, details: VenueDetails, ty: VenueType ) -> PolymeshResult<VenueId>
Create a Settlement Venue.
sourcepub fn settlement_execute(
&self,
venue: VenueId,
legs: Vec<Leg>,
portfolios: Vec<PortfolioId>
) -> PolymeshResult<()>
pub fn settlement_execute( &self, venue: VenueId, legs: Vec<Leg>, portfolios: Vec<PortfolioId> ) -> PolymeshResult<()>
Create and execute a settlement to transfer assets.
sourcepub fn asset_issue(
&self,
ticker: Ticker,
amount: Balance,
portfolio: PortfolioKind
) -> PolymeshResult<()>
pub fn asset_issue( &self, ticker: Ticker, amount: Balance, portfolio: PortfolioKind ) -> PolymeshResult<()>
Asset issue tokens.
sourcepub fn asset_redeem(
&self,
ticker: Ticker,
amount: Balance,
portfolio: PortfolioKind
) -> PolymeshResult<()>
pub fn asset_redeem( &self, ticker: Ticker, amount: Balance, portfolio: PortfolioKind ) -> PolymeshResult<()>
Asset redeem tokens.
sourcepub fn asset_create_and_issue(
&self,
name: AssetName,
ticker: Ticker,
asset_type: AssetType,
divisible: bool,
issue: Option<Balance>
) -> PolymeshResult<()>
pub fn asset_create_and_issue( &self, name: AssetName, ticker: Ticker, asset_type: AssetType, divisible: bool, issue: Option<Balance> ) -> PolymeshResult<()>
Very simple create asset and issue.
sourcepub fn asset_balance_of(
&self,
ticker: Ticker,
did: IdentityId
) -> PolymeshResult<Balance>
pub fn asset_balance_of( &self, ticker: Ticker, did: IdentityId ) -> PolymeshResult<Balance>
Get an identity’s asset balance.
sourcepub fn asset_total_supply(&self, ticker: Ticker) -> PolymeshResult<Balance>
pub fn asset_total_supply(&self, ticker: Ticker) -> PolymeshResult<Balance>
Get the total_supply
of an asset.
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<()>
Cliam 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: VenueId,
legs: Vec<Leg>,
portfolios: Vec<PortfolioId>
) -> PolymeshResult<InstructionId>
pub fn add_and_affirm_instruction( &self, venue_id: VenueId, legs: Vec<Leg>, portfolios: Vec<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,
ticker: Ticker,
asset_metadata_name: AssetMetadataName
) -> PolymeshResult<Option<AssetMetadataLocalKey>>
pub fn asset_metadata_local_name_to_key( &self, ticker: Ticker, asset_metadata_name: AssetMetadataName ) -> PolymeshResult<Option<AssetMetadataLocalKey>>
Returns the AssetMetadataLocalKey
for the given ticker
and asset_metadata_name
.
sourcepub fn asset_metadata_value(
&self,
ticker: Ticker,
asset_metadata_key: AssetMetadataKey
) -> PolymeshResult<Option<AssetMetadataValue>>
pub fn asset_metadata_value( &self, ticker: Ticker, asset_metadata_key: AssetMetadataKey ) -> PolymeshResult<Option<AssetMetadataValue>>
Returns the AssetMetadataValue
for the given ticker
and asset_metadata_key
.
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.
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> 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,
§type PreferredKey = AutoKey
type PreferredKey = AutoKey
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
.