-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtraits.rs
38 lines (30 loc) · 1.16 KB
/
traits.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
use ink::prelude::vec::Vec;
use ink::primitives::AccountId;
use crate::data::{Balance, Id};
use crate::errors::PSP37Error;
#[ink::trait_definition]
pub trait PSP37 {
/// Returns the amount of tokens of token type `id` owned by `account`.
/// If `id` is `None` returns the total number of `owner`'s tokens.
#[ink(message)]
fn balance_of(&self, owner: AccountId, id: Option<Id>) -> Balance;
/// Returns the total amount of token type `id` in the supply.
/// If `id` is `None` returns the total number of tokens.
#[ink(message)]
fn total_supply(&self, id: Option<Id>) -> Balance;
#[ink(message)]
fn allowance(&self, owner: AccountId, operator: AccountId, id: Option<Id>) -> Balance;
#[ink(message)]
fn approve(&mut self, operator: AccountId, id: Option<Id>, value: Balance) -> Result<(), PSP37Error>;
#[ink(message)]
fn transfer(&mut self, to: AccountId, id: Id, value: u128, data: Vec<u8>) -> Result<(), PSP37Error>;
#[ink(message)]
fn transfer_from(
&mut self,
from: AccountId,
to: AccountId,
id: Id,
value: u128,
data: Vec<u8>,
) -> Result<(), PSP37Error>;
}