Enum pallet_ip_pallet::pallet::Call
source · pub enum Call<T: Config> {
mint_nft {
name: String,
description: String,
filing_date: String,
jurisdiction: String,
},
offer_license {
nft_id: T::NFTId,
payment_type: PaymentType<T>,
is_exclusive: bool,
duration: BlockNumberFor<T>,
},
offer_purchase {
nft_id: T::NFTId,
payment_type: PaymentType<T>,
},
accept_license {
offer_id: T::OfferId,
},
accept_purchase {
offer_id: T::OfferId,
},
make_periodic_payment {
contract_id: T::ContractId,
},
expire_license {
contract_id: T::ContractId,
},
complete_purchase {
contract_id: T::ContractId,
},
// some variants omitted
}Expand description
Contains a variant per dispatchable extrinsic that this pallet has.
Variants§
mint_nft
Creates a new NFT representing intellectual property
§Arguments
origin- The account creating the NFTname- Name of the intellectual property (max length:Config::MaxNameLength)description- Detailed description (max length:Config::MaxDescriptionLength)filing_date- When the IP was filed (max length:Config::MaxNameLength)jurisdiction- Where the IP is registered (max length:Config::MaxNameLength)
§Events
Event::NftMinted- When NFT is successfully created
§Errors
Error::NameTooLong- If name exceeds maximum lengthError::DescriptionTooLong- If description exceeds maximum lengthError::FilingDateTooLong- If filing date exceeds maximum lengthError::JurisdictionTooLong- If jurisdiction exceeds maximum length
offer_license
Creates a license offer for an NFT
Allows other accounts to license the NFT under specified terms.
§Arguments
origin- Must be signed by the NFT ownernft_id- ID of the NFT to licensepayment_type- Payment terms (seePaymentType)is_exclusive- Whether this is an exclusive licenseduration- How long the license lasts (in blocks)
§Events
Event::LicenseOffered- When offer is created
§Errors
Error::NftNotFound- If NFT doesn’t existError::NotNftOwner- If caller doesn’t own the NFTError::NftInEscrow- If NFT is in escrowError::ExclusiveLicenseExists- If trying to create offer while exclusive license exists
offer_purchase
Creates a purchase offer for an NFT
Allows other accounts to purchase the NFT.
§Arguments
origin- Must be signed by the NFT ownernft_id- ID of the NFT to purchasepayment_type- Payment terms (seePaymentType)
§Events
Event::PurchaseOffered- When offer is created
§Errors
Error::NftNotFound- If NFT doesn’t existError::NotNftOwner- If caller doesn’t own the NFTError::NftInEscrow- If NFT is in escrow
accept_license
Accepts a license offer
Allows the licensee to accept the offer and create a license contract.
§Arguments
origin- Must be signed by the licenseeoffer_id- ID of the offer to accept
§Events
Event::ContractCreated- When contract is created
§Errors
Error::OfferNotFound- If offer doesn’t existError::NotALicenseOffer- If offer is not a license offer
accept_purchase
Accepts a purchase offer
Allows the buyer to accept the offer and create a purchase contract.
§Arguments
origin- Must be signed by the buyeroffer_id- ID of the offer to accept
§Events
Event::ContractCreated- When contract is created
§Errors
Error::OfferNotFound- If offer doesn’t existError::NotAPurchaseOffer- If offer is not a purchase offer
make_periodic_payment
Makes a periodic payment for a contract
Processes the next scheduled payment for a periodic payment contract. Handles payment calculation including any penalties from missed payments.
§Arguments
origin- Must be signed by the payer (licensee/buyer)contract_id- ID of the contract to make a payment for
§Events
Event::PeriodicPaymentMade- When payment is successfully processedEvent::PaymentsCompleted- When this was the final payment dueEvent::PaymentMade- For the actual currency transfer
§Errors
Error::ContractNotFound- If contract doesn’t existError::NotPeriodicPayment- If contract uses one-time payment instead of periodicError::PaymentNotDue- If current block is before next_payment_block or no payments are dueError::InsufficientBalance- If payer doesn’t have enough fundsError::ZeroPayment- If calculated payment amount is zero
Fields
contract_id: T::ContractIdexpire_license
Expires a license contract after its duration has ended
Allows any party to expire a license contract once its duration has passed. Cleans up contract storage and updates NFT contract mappings.
§Arguments
origin- Any signed partycontract_id- ID of the license contract to expire
§Events
Event::ContractExpired- When license is successfully expired
§Errors
Error::ContractNotFound- If contract doesn’t existError::NotALicenseContract- If contract is a purchase contractError::LicenseNotExpired- If license duration hasn’t ended yet
§State Changes
- Removes contract from
Contractsstorage - Updates
NFTContractsmapping to remove expired license
Fields
contract_id: T::ContractIdcomplete_purchase
Completes a purchase contract after all payments are made
Finalizes NFT ownership transfer and cleans up contract storage. Can only be called when all payments have been completed.
§Arguments
origin- Any signed partycontract_id- ID of the purchase contract to complete
§Events
Event::ContractCompleted- When purchase is successfully completedEvent::NftRemovedFromEscrow- When NFT is released from escrow
§Errors
Error::ContractNotFound- If contract doesn’t existError::NotAPurchaseContract- If contract is a license contractError::NotPeriodicPayment- If contract is not a periodic payment contractError::PaymentNotCompleted- If any payments are still due
§State Changes
- Removes contract from
Contractsstorage - Updates
NFTContractsmapping to remove contract - Updates
Nftsstorage to reflect new owner - Removes NFT from
EscrowedNftsstorage
Fields
contract_id: T::ContractIdImplementations§
source§impl<T: Config> Call<T>
impl<T: Config> Call<T>
sourcepub fn new_call_variant_mint_nft(
name: String,
description: String,
filing_date: String,
jurisdiction: String,
) -> Self
pub fn new_call_variant_mint_nft( name: String, description: String, filing_date: String, jurisdiction: String, ) -> Self
Create a call with the variant mint_nft.
sourcepub fn new_call_variant_offer_license(
nft_id: T::NFTId,
payment_type: PaymentType<T>,
is_exclusive: bool,
duration: BlockNumberFor<T>,
) -> Self
pub fn new_call_variant_offer_license( nft_id: T::NFTId, payment_type: PaymentType<T>, is_exclusive: bool, duration: BlockNumberFor<T>, ) -> Self
Create a call with the variant offer_license.
sourcepub fn new_call_variant_offer_purchase(
nft_id: T::NFTId,
payment_type: PaymentType<T>,
) -> Self
pub fn new_call_variant_offer_purchase( nft_id: T::NFTId, payment_type: PaymentType<T>, ) -> Self
Create a call with the variant offer_purchase.
sourcepub fn new_call_variant_accept_license(offer_id: T::OfferId) -> Self
pub fn new_call_variant_accept_license(offer_id: T::OfferId) -> Self
Create a call with the variant accept_license.
sourcepub fn new_call_variant_accept_purchase(offer_id: T::OfferId) -> Self
pub fn new_call_variant_accept_purchase(offer_id: T::OfferId) -> Self
Create a call with the variant accept_purchase.
sourcepub fn new_call_variant_make_periodic_payment(
contract_id: T::ContractId,
) -> Self
pub fn new_call_variant_make_periodic_payment( contract_id: T::ContractId, ) -> Self
Create a call with the variant make_periodic_payment.
sourcepub fn new_call_variant_expire_license(contract_id: T::ContractId) -> Self
pub fn new_call_variant_expire_license(contract_id: T::ContractId) -> Self
Create a call with the variant expire_license.
sourcepub fn new_call_variant_complete_purchase(contract_id: T::ContractId) -> Self
pub fn new_call_variant_complete_purchase(contract_id: T::ContractId) -> Self
Create a call with the variant complete_purchase.
Trait Implementations§
source§impl<T: Config> CheckIfFeeless for Call<T>
impl<T: Config> CheckIfFeeless for Call<T>
source§fn is_feeless(&self, origin: &Self::Origin) -> bool
fn is_feeless(&self, origin: &Self::Origin) -> bool
#[pallet::feeless_if]source§impl<T: Config> Decode for Call<T>
impl<T: Config> Decode for Call<T>
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>
§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,
§fn skip<I>(input: &mut I) -> Result<(), Error>where
I: Input,
fn skip<I>(input: &mut I) -> Result<(), Error>where
I: Input,
§fn encoded_fixed_size() -> Option<usize>
fn encoded_fixed_size() -> Option<usize>
source§impl<T: Config> Encode for Call<T>
impl<T: Config> Encode for Call<T>
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, )
§fn using_encoded<R, F>(&self, f: F) -> R
fn using_encoded<R, F>(&self, f: F) -> R
§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
source§impl<T: Config> GetCallIndex for Call<T>
impl<T: Config> GetCallIndex for Call<T>
source§fn get_call_index(&self) -> u8
fn get_call_index(&self) -> u8
source§fn get_call_indices() -> &'static [u8] ⓘ
fn get_call_indices() -> &'static [u8] ⓘ
GetCallName].source§impl<T: Config> GetCallName for Call<T>
impl<T: Config> GetCallName for Call<T>
source§fn get_call_name(&self) -> &'static str
fn get_call_name(&self) -> &'static str
source§fn get_call_names() -> &'static [&'static str]
fn get_call_names() -> &'static [&'static str]
GetCallIndex].source§impl<T: Config> GetDispatchInfo for Call<T>
impl<T: Config> GetDispatchInfo for Call<T>
source§fn get_dispatch_info(&self) -> DispatchInfo
fn get_dispatch_info(&self) -> DispatchInfo
DispatchInfo, containing relevant information of this dispatch. Read moresource§impl<T> TypeInfo for Call<T>where
PhantomData<(T,)>: TypeInfo + 'static,
T::NFTId: TypeInfo + 'static,
PaymentType<T>: TypeInfo + 'static,
BlockNumberFor<T>: TypeInfo + 'static,
T::OfferId: TypeInfo + 'static,
T::ContractId: TypeInfo + 'static,
T: Config + 'static,
impl<T> TypeInfo for Call<T>where
PhantomData<(T,)>: TypeInfo + 'static,
T::NFTId: TypeInfo + 'static,
PaymentType<T>: TypeInfo + 'static,
BlockNumberFor<T>: TypeInfo + 'static,
T::OfferId: TypeInfo + 'static,
T::ContractId: TypeInfo + 'static,
T: Config + 'static,
source§impl<T: Config> UnfilteredDispatchable for Call<T>
impl<T: Config> UnfilteredDispatchable for Call<T>
source§type RuntimeOrigin = <T as Config>::RuntimeOrigin
type RuntimeOrigin = <T as Config>::RuntimeOrigin
frame_system::Config::RuntimeOrigin).source§fn dispatch_bypass_filter(
self,
origin: Self::RuntimeOrigin,
) -> DispatchResultWithPostInfo
fn dispatch_bypass_filter( self, origin: Self::RuntimeOrigin, ) -> DispatchResultWithPostInfo
impl<T: Config> EncodeLike for Call<T>
impl<T: Config> Eq for Call<T>
Auto Trait Implementations§
impl<T> Freeze for Call<T>
impl<T> RefUnwindSafe for Call<T>where
<T as Config>::NFTId: RefUnwindSafe,
<<<T as Config>::Block as Block>::Header as Header>::Number: RefUnwindSafe,
<T as Config>::OfferId: RefUnwindSafe,
<T as Config>::ContractId: RefUnwindSafe,
<<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance: RefUnwindSafe,
<T as Config>::Index: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Call<T>where
T: Send,
impl<T> Sync for Call<T>where
T: Sync,
impl<T> Unpin for Call<T>
impl<T> UnwindSafe for Call<T>where
<T as Config>::NFTId: UnwindSafe,
<<<T as Config>::Block as Block>::Header as Header>::Number: UnwindSafe,
<T as Config>::OfferId: UnwindSafe,
<T as Config>::ContractId: UnwindSafe,
<<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance: UnwindSafe,
<T as Config>::Index: UnwindSafe,
T: UnwindSafe,
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
§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
§fn checked_from<T>(t: T) -> Option<Self>where
Self: TryFrom<T>,
fn checked_from<T>(t: T) -> Option<Self>where
Self: TryFrom<T>,
§fn checked_into<T>(self) -> Option<T>where
Self: TryInto<T>,
fn checked_into<T>(self) -> Option<T>where
Self: TryInto<T>,
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)§impl<T> DecodeAll for Twhere
T: Decode,
impl<T> DecodeAll for Twhere
T: Decode,
§fn decode_all(input: &mut &[u8]) -> Result<T, Error>
fn decode_all(input: &mut &[u8]) -> Result<T, Error>
Self and consume all of the given input data. Read more§impl<T> DecodeLimit for Twhere
T: Decode,
impl<T> DecodeLimit for Twhere
T: Decode,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Hashable for Twhere
T: Codec,
impl<T> Hashable for Twhere
T: Codec,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more§impl<T> IsType<T> for T
impl<T> IsType<T> for T
§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
§impl<T> KeyedVec for Twhere
T: Codec,
impl<T> KeyedVec for Twhere
T: Codec,
§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
T. Read more§impl<T, U> TryIntoKey<U> for Twhere
U: TryFromKey<T>,
impl<T, U> TryIntoKey<U> for Twhere
U: TryFromKey<T>,
type Error = <U as TryFromKey<T>>::Error
fn try_into_key(self) -> Result<U, <U as TryFromKey<T>>::Error>
§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from.§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T.