Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
open-runtime-module-library
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Noxim
open-runtime-module-library
Commits
0937081f
Unverified
Commit
0937081f
authored
4 years ago
by
Shaopeng Wang
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add NFT trait. (#309)
parent
84d2f8c2
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
traits/src/lib.rs
+2
-0
2 additions, 0 deletions
traits/src/lib.rs
traits/src/nft.rs
+28
-0
28 additions, 0 deletions
traits/src/nft.rs
with
30 additions
and
0 deletions
traits/src/lib.rs
+
2
−
0
View file @
0937081f
...
...
@@ -17,6 +17,7 @@ pub use currency::{
};
pub
use
data_provider
::{
DataFeeder
,
DataProvider
,
DataProviderExtended
};
pub
use
get_by_key
::
GetByKey
;
pub
use
nft
::
NFT
;
pub
use
price
::{
DefaultPriceProvider
,
PriceProvider
};
pub
use
rewards
::
RewardHandler
;
...
...
@@ -25,6 +26,7 @@ pub mod auction;
pub
mod
currency
;
pub
mod
data_provider
;
pub
mod
get_by_key
;
pub
mod
nft
;
pub
mod
price
;
pub
mod
rewards
;
...
...
This diff is collapsed.
Click to expand it.
traits/src/nft.rs
0 → 100644
+
28
−
0
View file @
0937081f
use
codec
::
FullCodec
;
use
sp_runtime
::{
traits
::{
AtLeast32BitUnsigned
,
MaybeSerializeDeserialize
},
DispatchResult
,
};
use
sp_std
::
fmt
::
Debug
;
/// Abstraction over a non-fungible token system.
pub
trait
NFT
<
AccountId
>
{
/// The NFT class identifier.
type
ClassId
:
Default
+
Copy
;
/// The NFT token identifier.
type
TokenId
:
Default
+
Copy
;
/// The balance of account.
type
Balance
:
AtLeast32BitUnsigned
+
FullCodec
+
Copy
+
MaybeSerializeDeserialize
+
Debug
+
Default
;
/// The number of NFTs assigned to `who`.
fn
balance
(
who
:
&
AccountId
)
->
Self
::
Balance
;
/// The owner of the given token ID. Returns `None` if the token does not
/// exist.
fn
owner
(
token
:
(
Self
::
ClassId
,
Self
::
TokenId
))
->
Option
<
AccountId
>
;
/// Transfer the given token ID from one account to another.
fn
transfer
(
from
:
&
AccountId
,
to
:
&
AccountId
,
token
:
(
Self
::
ClassId
,
Self
::
TokenId
))
->
DispatchResult
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment