This repository was archived by the owner on Oct 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlib.rs
More file actions
53 lines (45 loc) · 1.33 KB
/
lib.rs
File metadata and controls
53 lines (45 loc) · 1.33 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//! Living Assets precompile module.
#![cfg_attr(not(feature = "std"), no_std)]
use fp_evm::{Precompile, PrecompileHandle, PrecompileOutput};
use parity_scale_codec::Encode;
use precompile_utils::{EvmResult, FunctionModifier, PrecompileHandleExt};
use sp_std::{fmt::Debug, marker::PhantomData};
#[precompile_utils_macro::generate_function_selector]
#[derive(Debug, PartialEq)]
pub enum Action {
/// Get tocken URI
TockenURI = "tokenURI(uint256)",
/// Owner of
OwnerOf = "ownerOf(uint256)",
}
/// Wrapper for the precompile function.
pub struct CollectionManagerPrecompile<AddressMapping, AccountId>(
PhantomData<(AddressMapping, AccountId)>,
)
where
AddressMapping: pallet_evm::AddressMapping<AccountId>,
AccountId: Encode + Debug;
impl<AddressMapping, AccountId> Precompile
for CollectionManagerPrecompile<AddressMapping, AccountId>
where
AddressMapping: pallet_evm::AddressMapping<AccountId>,
AccountId: Encode + Debug,
{
fn execute(handle: &mut impl PrecompileHandle) -> EvmResult<PrecompileOutput> {
let selector = handle.read_selector()?;
handle.check_function_modifier(match selector {
Action::TockenURI => FunctionModifier::NonPayable,
Action::OwnerOf => FunctionModifier::NonPayable,
})?;
match selector {
Action::TockenURI => {
todo!()
},
Action::OwnerOf => {
todo!()
},
}
}
}
#[cfg(test)]
mod tests;