difftreelog
Merge pull request #542 from UniqueNetwork/fix/RFT_and_fractionalizer
in: master
14 files changed
pallets/refungible/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/refungible/src/benchmarking.rs
+++ b/pallets/refungible/src/benchmarking.rs
@@ -281,15 +281,6 @@
let item = create_max_item(&collection, &sender, [(owner.clone(), 100)])?;
}: {<Pallet<T>>::repartition(&collection, &owner, item, 200)?}
- set_parent_nft_unchecked {
- bench_init!{
- owner: sub; collection: collection(owner);
- sender: cross_from_sub(owner); owner: cross_sub;
- };
- let item = create_max_item(&collection, &sender, [(owner.clone(), 100)])?;
-
- }: {<Pallet<T>>::set_parent_nft_unchecked(&collection, item, owner, T::CrossAccountId::from_eth(H160::default()))?}
-
token_owner {
bench_init!{
owner: sub; collection: collection(owner);
pallets/refungible/src/erc_token.rsdiffbeforeafterboth--- a/pallets/refungible/src/erc_token.rs
+++ b/pallets/refungible/src/erc_token.rs
@@ -29,22 +29,21 @@
convert::TryInto,
ops::Deref,
};
-use evm_coder::{ToLog, execution::*, generate_stubgen, solidity, solidity_interface, types::*, weight};
+use evm_coder::{ToLog, execution::*, generate_stubgen, solidity_interface, types::*, weight};
use pallet_common::{
CommonWeightInfo,
- erc::{CommonEvmHandler, PrecompileResult, static_property::key},
- eth::map_eth_to_id,
+ erc::{CommonEvmHandler, PrecompileResult},
+ eth::collection_id_to_address,
};
use pallet_evm::{account::CrossAccountId, PrecompileHandle};
use pallet_evm_coder_substrate::{call, dispatch_to_evm, WithRecorder};
use pallet_structure::{SelfWeightOf as StructureWeight, weights::WeightInfo as _};
-use sp_core::H160;
use sp_std::vec::Vec;
-use up_data_structs::{mapping::TokenAddressMapping, PropertyScope, TokenId};
+use up_data_structs::TokenId;
use crate::{
Allowance, Balance, common::CommonWeights, Config, Pallet, RefungibleHandle, SelfWeightOf,
- TokenProperties, TotalSupply, weights::WeightInfo,
+ TotalSupply, weights::WeightInfo,
};
pub struct RefungibleTokenHandle<T: Config>(pub RefungibleHandle<T>, pub TokenId);
@@ -52,63 +51,14 @@
#[solidity_interface(name = ERC1633)]
impl<T: Config> RefungibleTokenHandle<T> {
fn parent_token(&self) -> Result<address> {
- self.consume_store_reads(2)?;
- let props = <TokenProperties<T>>::get((self.id, self.1));
- let key = key::parent_nft();
-
- let key_scoped = PropertyScope::Eth
- .apply(key)
- .expect("property key shouldn't exceed length limit");
- if let Some(value) = props.get(&key_scoped) {
- Ok(H160::from_slice(value.as_slice()))
- } else {
- Ok(*T::CrossTokenAddressMapping::token_to_address(self.id, self.1).as_eth())
- }
+ Ok(collection_id_to_address(self.id))
}
fn parent_token_id(&self) -> Result<uint256> {
- self.consume_store_reads(2)?;
- let props = <TokenProperties<T>>::get((self.id, self.1));
- let key = key::parent_nft();
-
- let key_scoped = PropertyScope::Eth
- .apply(key)
- .expect("property key shouldn't exceed length limit");
- if let Some(value) = props.get(&key_scoped) {
- let nft_token_address = H160::from_slice(value.as_slice());
- let nft_token_account = T::CrossAccountId::from_eth(nft_token_address);
- let (_, token_id) = T::CrossTokenAddressMapping::address_to_token(&nft_token_account)
- .ok_or("parent NFT should contain NFT token address")?;
-
- Ok(token_id.into())
- } else {
- Ok(self.1.into())
- }
+ Ok(self.1.into())
}
}
-#[solidity_interface(name = ERC1633UniqueExtensions)]
-impl<T: Config> RefungibleTokenHandle<T> {
- #[solidity(rename_selector = "setParentNFT")]
- #[weight(<CommonWeights<T>>::token_owner() + <SelfWeightOf<T>>::set_parent_nft_unchecked())]
- fn set_parent_nft(
- &mut self,
- caller: caller,
- collection: address,
- nft_id: uint256,
- ) -> Result<bool> {
- self.consume_store_reads(1)?;
- let caller = T::CrossAccountId::from_eth(caller);
- let nft_collection = map_eth_to_id(&collection).ok_or("collection not found")?;
- let nft_token = nft_id.try_into()?;
-
- <Pallet<T>>::set_parent_nft(&self.0, self.1, caller, nft_collection, nft_token)
- .map_err(dispatch_to_evm::<T>)?;
-
- Ok(true)
- }
-}
-
#[derive(ToLog)]
pub enum ERC20Events {
/// @dev This event is emitted when the amount of tokens (value) is sent
@@ -307,7 +257,7 @@
#[solidity_interface(
name = UniqueRefungibleToken,
- is(ERC20, ERC20UniqueExtensions, ERC1633, ERC1633UniqueExtensions)
+ is(ERC20, ERC20UniqueExtensions, ERC1633)
)]
impl<T: Config> RefungibleTokenHandle<T> where T::AccountId: From<[u8; 32]> {}
pallets/refungible/src/lib.rsdiffbeforeafterboth--- a/pallets/refungible/src/lib.rs
+++ b/pallets/refungible/src/lib.rs
@@ -1379,68 +1379,4 @@
Some(res)
}
}
-
- /// Sets the NFT token as a parent for the RFT token
- ///
- /// Throws if `sender` is not the owner of the NFT token.
- /// Throws if `sender` is not the owner of all of the RFT token pieces.
- pub fn set_parent_nft(
- collection: &RefungibleHandle<T>,
- rft_token_id: TokenId,
- sender: T::CrossAccountId,
- nft_collection: CollectionId,
- nft_token: TokenId,
- ) -> DispatchResult {
- let handle = <CollectionHandle<T>>::try_get(nft_collection)?;
- if handle.mode != CollectionMode::NFT {
- return Err("Only NFT token could be parent to RFT".into());
- }
- let dispatch = T::CollectionDispatch::dispatch(handle);
- let dispatch = dispatch.as_dyn();
-
- let owner = dispatch.token_owner(nft_token).ok_or("owner not found")?;
- if owner != sender {
- return Err("Only owned token could be set as parent".into());
- }
-
- let nft_token_address =
- T::CrossTokenAddressMapping::token_to_address(nft_collection, nft_token);
-
- Self::set_parent_nft_unchecked(collection, rft_token_id, sender, nft_token_address)
- }
-
- /// Sets the NFT token as a parent for the RFT token
- ///
- /// `sender` should be the owner of the NFT token.
- /// Throws if `sender` is not the owner of all of the RFT token pieces.
- pub fn set_parent_nft_unchecked(
- collection: &RefungibleHandle<T>,
- rft_token_id: TokenId,
- sender: T::CrossAccountId,
- nft_token_address: T::CrossAccountId,
- ) -> DispatchResult {
- let owner_balance = <Balance<T>>::get((collection.id, rft_token_id, &sender));
- let total_supply = <TotalSupply<T>>::get((collection.id, rft_token_id));
- if total_supply != owner_balance {
- return Err("token has multiple owners".into());
- }
-
- let parent_nft_property_key = key::parent_nft();
-
- let parent_nft_property_value =
- property_value_from_bytes(&nft_token_address.as_eth().to_fixed_bytes())
- .expect("address should fit in value length limit");
-
- <Pallet<T>>::set_scoped_token_property(
- collection.id,
- rft_token_id,
- PropertyScope::Eth,
- Property {
- key: parent_nft_property_key,
- value: parent_nft_property_value,
- },
- )?;
-
- Ok(())
- }
}
pallets/refungible/src/stubs/UniqueRefungibleToken.rawdiffbeforeafterbothbinary blob — no preview
pallets/refungible/src/stubs/UniqueRefungibleToken.soldiffbeforeafterboth--- a/pallets/refungible/src/stubs/UniqueRefungibleToken.sol
+++ b/pallets/refungible/src/stubs/UniqueRefungibleToken.sol
@@ -21,22 +21,6 @@
}
}
-/// @dev the ERC-165 identifier for this interface is 0x042f1106
-contract ERC1633UniqueExtensions is Dummy, ERC165 {
- /// @dev EVM selector for this function is: 0x042f1106,
- /// or in textual repr: setParentNFT(address,uint256)
- function setParentNFT(address collection, uint256 nftId)
- public
- returns (bool)
- {
- require(false, stub_error);
- collection;
- nftId;
- dummy = 0;
- return false;
- }
-}
-
/// @dev the ERC-165 identifier for this interface is 0x5755c3f2
contract ERC1633 is Dummy, ERC165 {
/// @dev EVM selector for this function is: 0x80a54001,
@@ -222,6 +206,5 @@
ERC165,
ERC20,
ERC20UniqueExtensions,
- ERC1633,
- ERC1633UniqueExtensions
+ ERC1633
{}
pallets/refungible/src/weights.rsdiffbeforeafterboth1// Template adopted from https://github.com/paritytech/substrate/blob/master/.maintain/frame-weight-template.hbs23//! Autogenerated weights for pallet_refungible4//!5//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev6//! DATE: 2022-08-15, STEPS: `50`, REPEAT: 80, LOW RANGE: `[]`, HIGH RANGE: `[]`7//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 102489// Executed Command:10// target/release/unique-collator11// benchmark12// pallet13// --pallet14// pallet-refungible15// --wasm-execution16// compiled17// --extrinsic18// *19// --template20// .maintain/frame-weight-template.hbs21// --steps=5022// --repeat=8023// --heap-pages=409624// --output=./pallets/refungible/src/weights.rs2526#![cfg_attr(rustfmt, rustfmt_skip)]27#![allow(unused_parens)]28#![allow(unused_imports)]29#![allow(clippy::unnecessary_cast)]3031use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};32use sp_std::marker::PhantomData;3334/// Weight functions needed for pallet_refungible.35pub trait WeightInfo {36 fn create_item() -> Weight;37 fn create_multiple_items(b: u32, ) -> Weight;38 fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight;39 fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight;40 fn burn_item_partial() -> Weight;41 fn burn_item_fully() -> Weight;42 fn transfer_normal() -> Weight;43 fn transfer_creating() -> Weight;44 fn transfer_removing() -> Weight;45 fn transfer_creating_removing() -> Weight;46 fn approve() -> Weight;47 fn transfer_from_normal() -> Weight;48 fn transfer_from_creating() -> Weight;49 fn transfer_from_removing() -> Weight;50 fn transfer_from_creating_removing() -> Weight;51 fn burn_from() -> Weight;52 fn set_token_property_permissions(b: u32, ) -> Weight;53 fn set_token_properties(b: u32, ) -> Weight;54 fn delete_token_properties(b: u32, ) -> Weight;55 fn repartition_item() -> Weight;56 fn set_parent_nft_unchecked() -> Weight;57 fn token_owner() -> Weight;58}5960/// Weights for pallet_refungible using the Substrate node and recommended hardware.61pub struct SubstrateWeight<T>(PhantomData<T>);62impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {63 // Storage: Refungible TokensMinted (r:1 w:1)64 // Storage: Refungible AccountBalance (r:1 w:1)65 // Storage: Refungible Balance (r:0 w:1)66 // Storage: Refungible TotalSupply (r:0 w:1)67 // Storage: Refungible Owned (r:0 w:1)68 fn create_item() -> Weight {69 (29_527_000 as Weight)70 .saturating_add(T::DbWeight::get().reads(2 as Weight))71 .saturating_add(T::DbWeight::get().writes(5 as Weight))72 }73 // Storage: Refungible TokensMinted (r:1 w:1)74 // Storage: Refungible AccountBalance (r:1 w:1)75 // Storage: Refungible Balance (r:0 w:4)76 // Storage: Refungible TotalSupply (r:0 w:4)77 // Storage: Refungible Owned (r:0 w:4)78 fn create_multiple_items(b: u32, ) -> Weight {79 (28_541_000 as Weight)80 // Standard Error: 4_00081 .saturating_add((6_671_000 as Weight).saturating_mul(b as Weight))82 .saturating_add(T::DbWeight::get().reads(2 as Weight))83 .saturating_add(T::DbWeight::get().writes(2 as Weight))84 .saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(b as Weight)))85 }86 // Storage: Refungible TokensMinted (r:1 w:1)87 // Storage: Refungible AccountBalance (r:4 w:4)88 // Storage: Refungible Balance (r:0 w:4)89 // Storage: Refungible TotalSupply (r:0 w:4)90 // Storage: Refungible Owned (r:0 w:4)91 fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight {92 (24_366_000 as Weight)93 // Standard Error: 5_00094 .saturating_add((9_338_000 as Weight).saturating_mul(b as Weight))95 .saturating_add(T::DbWeight::get().reads(1 as Weight))96 .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))97 .saturating_add(T::DbWeight::get().writes(1 as Weight))98 .saturating_add(T::DbWeight::get().writes((4 as Weight).saturating_mul(b as Weight)))99 }100 // Storage: Refungible TokensMinted (r:1 w:1)101 // Storage: Refungible TotalSupply (r:0 w:1)102 // Storage: Refungible AccountBalance (r:4 w:4)103 // Storage: Refungible Balance (r:0 w:4)104 // Storage: Refungible Owned (r:0 w:4)105 fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight {106 (27_574_000 as Weight)107 // Standard Error: 4_000108 .saturating_add((7_193_000 as Weight).saturating_mul(b as Weight))109 .saturating_add(T::DbWeight::get().reads(1 as Weight))110 .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))111 .saturating_add(T::DbWeight::get().writes(2 as Weight))112 .saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(b as Weight)))113 }114 // Storage: Refungible TotalSupply (r:1 w:1)115 // Storage: Refungible Balance (r:3 w:1)116 // Storage: Refungible AccountBalance (r:1 w:1)117 // Storage: Refungible Owned (r:0 w:1)118 fn burn_item_partial() -> Weight {119 (42_943_000 as Weight)120 .saturating_add(T::DbWeight::get().reads(5 as Weight))121 .saturating_add(T::DbWeight::get().writes(4 as Weight))122 }123 // Storage: Refungible TotalSupply (r:1 w:1)124 // Storage: Refungible Balance (r:1 w:1)125 // Storage: Refungible AccountBalance (r:1 w:1)126 // Storage: Refungible TokensBurnt (r:1 w:1)127 // Storage: Refungible Owned (r:0 w:1)128 // Storage: Refungible TokenProperties (r:0 w:1)129 fn burn_item_fully() -> Weight {130 (36_861_000 as Weight)131 .saturating_add(T::DbWeight::get().reads(4 as Weight))132 .saturating_add(T::DbWeight::get().writes(6 as Weight))133 }134 // Storage: Refungible Balance (r:2 w:2)135 // Storage: Refungible TotalSupply (r:1 w:0)136 fn transfer_normal() -> Weight {137 (27_789_000 as Weight)138 .saturating_add(T::DbWeight::get().reads(3 as Weight))139 .saturating_add(T::DbWeight::get().writes(2 as Weight))140 }141 // Storage: Refungible Balance (r:2 w:2)142 // Storage: Refungible AccountBalance (r:1 w:1)143 // Storage: Refungible TotalSupply (r:1 w:0)144 // Storage: Refungible Owned (r:0 w:1)145 fn transfer_creating() -> Weight {146 (32_893_000 as Weight)147 .saturating_add(T::DbWeight::get().reads(4 as Weight))148 .saturating_add(T::DbWeight::get().writes(4 as Weight))149 }150 // Storage: Refungible Balance (r:2 w:2)151 // Storage: Refungible AccountBalance (r:1 w:1)152 // Storage: Refungible TotalSupply (r:1 w:0)153 // Storage: Refungible Owned (r:0 w:1)154 fn transfer_removing() -> Weight {155 (34_703_000 as Weight)156 .saturating_add(T::DbWeight::get().reads(4 as Weight))157 .saturating_add(T::DbWeight::get().writes(4 as Weight))158 }159 // Storage: Refungible Balance (r:2 w:2)160 // Storage: Refungible AccountBalance (r:2 w:2)161 // Storage: Refungible TotalSupply (r:1 w:0)162 // Storage: Refungible Owned (r:0 w:2)163 fn transfer_creating_removing() -> Weight {164 (37_547_000 as Weight)165 .saturating_add(T::DbWeight::get().reads(5 as Weight))166 .saturating_add(T::DbWeight::get().writes(6 as Weight))167 }168 // Storage: Refungible Balance (r:1 w:0)169 // Storage: Refungible Allowance (r:0 w:1)170 fn approve() -> Weight {171 (20_039_000 as Weight)172 .saturating_add(T::DbWeight::get().reads(1 as Weight))173 .saturating_add(T::DbWeight::get().writes(1 as Weight))174 }175 // Storage: Refungible Allowance (r:1 w:1)176 // Storage: Refungible Balance (r:2 w:2)177 // Storage: Refungible TotalSupply (r:1 w:0)178 fn transfer_from_normal() -> Weight {179 (37_628_000 as Weight)180 .saturating_add(T::DbWeight::get().reads(4 as Weight))181 .saturating_add(T::DbWeight::get().writes(3 as Weight))182 }183 // Storage: Refungible Allowance (r:1 w:1)184 // Storage: Refungible Balance (r:2 w:2)185 // Storage: Refungible AccountBalance (r:1 w:1)186 // Storage: Refungible TotalSupply (r:1 w:0)187 // Storage: Refungible Owned (r:0 w:1)188 fn transfer_from_creating() -> Weight {189 (42_072_000 as Weight)190 .saturating_add(T::DbWeight::get().reads(5 as Weight))191 .saturating_add(T::DbWeight::get().writes(5 as Weight))192 }193 // Storage: Refungible Allowance (r:1 w:1)194 // Storage: Refungible Balance (r:2 w:2)195 // Storage: Refungible AccountBalance (r:1 w:1)196 // Storage: Refungible TotalSupply (r:1 w:0)197 // Storage: Refungible Owned (r:0 w:1)198 fn transfer_from_removing() -> Weight {199 (43_024_000 as Weight)200 .saturating_add(T::DbWeight::get().reads(5 as Weight))201 .saturating_add(T::DbWeight::get().writes(5 as Weight))202 }203 // Storage: Refungible Allowance (r:1 w:1)204 // Storage: Refungible Balance (r:2 w:2)205 // Storage: Refungible AccountBalance (r:2 w:2)206 // Storage: Refungible TotalSupply (r:1 w:0)207 // Storage: Refungible Owned (r:0 w:2)208 fn transfer_from_creating_removing() -> Weight {209 (45_910_000 as Weight)210 .saturating_add(T::DbWeight::get().reads(6 as Weight))211 .saturating_add(T::DbWeight::get().writes(7 as Weight))212 }213 // Storage: Refungible Allowance (r:1 w:1)214 // Storage: Refungible TotalSupply (r:1 w:1)215 // Storage: Refungible Balance (r:1 w:1)216 // Storage: Refungible AccountBalance (r:1 w:1)217 // Storage: Refungible TokensBurnt (r:1 w:1)218 // Storage: Refungible Owned (r:0 w:1)219 // Storage: Refungible TokenProperties (r:0 w:1)220 fn burn_from() -> Weight {221 (48_584_000 as Weight)222 .saturating_add(T::DbWeight::get().reads(5 as Weight))223 .saturating_add(T::DbWeight::get().writes(7 as Weight))224 }225 // Storage: Common CollectionPropertyPermissions (r:1 w:1)226 fn set_token_property_permissions(b: u32, ) -> Weight {227 (0 as Weight)228 // Standard Error: 60_000229 .saturating_add((15_533_000 as Weight).saturating_mul(b as Weight))230 .saturating_add(T::DbWeight::get().reads(1 as Weight))231 .saturating_add(T::DbWeight::get().writes(1 as Weight))232 }233 // Storage: Common CollectionPropertyPermissions (r:1 w:0)234 // Storage: Refungible TokenProperties (r:1 w:1)235 fn set_token_properties(b: u32, ) -> Weight {236 (0 as Weight)237 // Standard Error: 3_609_000238 .saturating_add((590_204_000 as Weight).saturating_mul(b as Weight))239 .saturating_add(T::DbWeight::get().reads(2 as Weight))240 .saturating_add(T::DbWeight::get().writes(1 as Weight))241 }242 // Storage: Common CollectionPropertyPermissions (r:1 w:0)243 // Storage: Refungible TokenProperties (r:1 w:1)244 fn delete_token_properties(b: u32, ) -> Weight {245 (0 as Weight)246 // Standard Error: 3_637_000247 .saturating_add((603_468_000 as Weight).saturating_mul(b as Weight))248 .saturating_add(T::DbWeight::get().reads(2 as Weight))249 .saturating_add(T::DbWeight::get().writes(1 as Weight))250 }251 // Storage: Refungible TotalSupply (r:1 w:1)252 // Storage: Refungible Balance (r:1 w:1)253 fn repartition_item() -> Weight {254 (22_356_000 as Weight)255 .saturating_add(T::DbWeight::get().reads(2 as Weight))256 .saturating_add(T::DbWeight::get().writes(2 as Weight))257 }258 // Storage: Refungible Balance (r:1 w:0)259 // Storage: Refungible TotalSupply (r:1 w:0)260 // Storage: Refungible TokenProperties (r:1 w:1)261 fn set_parent_nft_unchecked() -> Weight {262 (12_015_000 as Weight)263 .saturating_add(T::DbWeight::get().reads(3 as Weight))264 .saturating_add(T::DbWeight::get().writes(1 as Weight))265 }266 // Storage: Refungible Balance (r:2 w:0)267 fn token_owner() -> Weight {268 (9_431_000 as Weight)269 .saturating_add(T::DbWeight::get().reads(2 as Weight))270 }271}272273// For backwards compatibility and tests274impl WeightInfo for () {275 // Storage: Refungible TokensMinted (r:1 w:1)276 // Storage: Refungible AccountBalance (r:1 w:1)277 // Storage: Refungible Balance (r:0 w:1)278 // Storage: Refungible TotalSupply (r:0 w:1)279 // Storage: Refungible Owned (r:0 w:1)280 fn create_item() -> Weight {281 (29_527_000 as Weight)282 .saturating_add(RocksDbWeight::get().reads(2 as Weight))283 .saturating_add(RocksDbWeight::get().writes(5 as Weight))284 }285 // Storage: Refungible TokensMinted (r:1 w:1)286 // Storage: Refungible AccountBalance (r:1 w:1)287 // Storage: Refungible Balance (r:0 w:4)288 // Storage: Refungible TotalSupply (r:0 w:4)289 // Storage: Refungible Owned (r:0 w:4)290 fn create_multiple_items(b: u32, ) -> Weight {291 (28_541_000 as Weight)292 // Standard Error: 4_000293 .saturating_add((6_671_000 as Weight).saturating_mul(b as Weight))294 .saturating_add(RocksDbWeight::get().reads(2 as Weight))295 .saturating_add(RocksDbWeight::get().writes(2 as Weight))296 .saturating_add(RocksDbWeight::get().writes((3 as Weight).saturating_mul(b as Weight)))297 }298 // Storage: Refungible TokensMinted (r:1 w:1)299 // Storage: Refungible AccountBalance (r:4 w:4)300 // Storage: Refungible Balance (r:0 w:4)301 // Storage: Refungible TotalSupply (r:0 w:4)302 // Storage: Refungible Owned (r:0 w:4)303 fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight {304 (24_366_000 as Weight)305 // Standard Error: 5_000306 .saturating_add((9_338_000 as Weight).saturating_mul(b as Weight))307 .saturating_add(RocksDbWeight::get().reads(1 as Weight))308 .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))309 .saturating_add(RocksDbWeight::get().writes(1 as Weight))310 .saturating_add(RocksDbWeight::get().writes((4 as Weight).saturating_mul(b as Weight)))311 }312 // Storage: Refungible TokensMinted (r:1 w:1)313 // Storage: Refungible TotalSupply (r:0 w:1)314 // Storage: Refungible AccountBalance (r:4 w:4)315 // Storage: Refungible Balance (r:0 w:4)316 // Storage: Refungible Owned (r:0 w:4)317 fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight {318 (27_574_000 as Weight)319 // Standard Error: 4_000320 .saturating_add((7_193_000 as Weight).saturating_mul(b as Weight))321 .saturating_add(RocksDbWeight::get().reads(1 as Weight))322 .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))323 .saturating_add(RocksDbWeight::get().writes(2 as Weight))324 .saturating_add(RocksDbWeight::get().writes((3 as Weight).saturating_mul(b as Weight)))325 }326 // Storage: Refungible TotalSupply (r:1 w:1)327 // Storage: Refungible Balance (r:3 w:1)328 // Storage: Refungible AccountBalance (r:1 w:1)329 // Storage: Refungible Owned (r:0 w:1)330 fn burn_item_partial() -> Weight {331 (42_943_000 as Weight)332 .saturating_add(RocksDbWeight::get().reads(5 as Weight))333 .saturating_add(RocksDbWeight::get().writes(4 as Weight))334 }335 // Storage: Refungible TotalSupply (r:1 w:1)336 // Storage: Refungible Balance (r:1 w:1)337 // Storage: Refungible AccountBalance (r:1 w:1)338 // Storage: Refungible TokensBurnt (r:1 w:1)339 // Storage: Refungible Owned (r:0 w:1)340 // Storage: Refungible TokenProperties (r:0 w:1)341 fn burn_item_fully() -> Weight {342 (36_861_000 as Weight)343 .saturating_add(RocksDbWeight::get().reads(4 as Weight))344 .saturating_add(RocksDbWeight::get().writes(6 as Weight))345 }346 // Storage: Refungible Balance (r:2 w:2)347 // Storage: Refungible TotalSupply (r:1 w:0)348 fn transfer_normal() -> Weight {349 (27_789_000 as Weight)350 .saturating_add(RocksDbWeight::get().reads(3 as Weight))351 .saturating_add(RocksDbWeight::get().writes(2 as Weight))352 }353 // Storage: Refungible Balance (r:2 w:2)354 // Storage: Refungible AccountBalance (r:1 w:1)355 // Storage: Refungible TotalSupply (r:1 w:0)356 // Storage: Refungible Owned (r:0 w:1)357 fn transfer_creating() -> Weight {358 (32_893_000 as Weight)359 .saturating_add(RocksDbWeight::get().reads(4 as Weight))360 .saturating_add(RocksDbWeight::get().writes(4 as Weight))361 }362 // Storage: Refungible Balance (r:2 w:2)363 // Storage: Refungible AccountBalance (r:1 w:1)364 // Storage: Refungible TotalSupply (r:1 w:0)365 // Storage: Refungible Owned (r:0 w:1)366 fn transfer_removing() -> Weight {367 (34_703_000 as Weight)368 .saturating_add(RocksDbWeight::get().reads(4 as Weight))369 .saturating_add(RocksDbWeight::get().writes(4 as Weight))370 }371 // Storage: Refungible Balance (r:2 w:2)372 // Storage: Refungible AccountBalance (r:2 w:2)373 // Storage: Refungible TotalSupply (r:1 w:0)374 // Storage: Refungible Owned (r:0 w:2)375 fn transfer_creating_removing() -> Weight {376 (37_547_000 as Weight)377 .saturating_add(RocksDbWeight::get().reads(5 as Weight))378 .saturating_add(RocksDbWeight::get().writes(6 as Weight))379 }380 // Storage: Refungible Balance (r:1 w:0)381 // Storage: Refungible Allowance (r:0 w:1)382 fn approve() -> Weight {383 (20_039_000 as Weight)384 .saturating_add(RocksDbWeight::get().reads(1 as Weight))385 .saturating_add(RocksDbWeight::get().writes(1 as Weight))386 }387 // Storage: Refungible Allowance (r:1 w:1)388 // Storage: Refungible Balance (r:2 w:2)389 // Storage: Refungible TotalSupply (r:1 w:0)390 fn transfer_from_normal() -> Weight {391 (37_628_000 as Weight)392 .saturating_add(RocksDbWeight::get().reads(4 as Weight))393 .saturating_add(RocksDbWeight::get().writes(3 as Weight))394 }395 // Storage: Refungible Allowance (r:1 w:1)396 // Storage: Refungible Balance (r:2 w:2)397 // Storage: Refungible AccountBalance (r:1 w:1)398 // Storage: Refungible TotalSupply (r:1 w:0)399 // Storage: Refungible Owned (r:0 w:1)400 fn transfer_from_creating() -> Weight {401 (42_072_000 as Weight)402 .saturating_add(RocksDbWeight::get().reads(5 as Weight))403 .saturating_add(RocksDbWeight::get().writes(5 as Weight))404 }405 // Storage: Refungible Allowance (r:1 w:1)406 // Storage: Refungible Balance (r:2 w:2)407 // Storage: Refungible AccountBalance (r:1 w:1)408 // Storage: Refungible TotalSupply (r:1 w:0)409 // Storage: Refungible Owned (r:0 w:1)410 fn transfer_from_removing() -> Weight {411 (43_024_000 as Weight)412 .saturating_add(RocksDbWeight::get().reads(5 as Weight))413 .saturating_add(RocksDbWeight::get().writes(5 as Weight))414 }415 // Storage: Refungible Allowance (r:1 w:1)416 // Storage: Refungible Balance (r:2 w:2)417 // Storage: Refungible AccountBalance (r:2 w:2)418 // Storage: Refungible TotalSupply (r:1 w:0)419 // Storage: Refungible Owned (r:0 w:2)420 fn transfer_from_creating_removing() -> Weight {421 (45_910_000 as Weight)422 .saturating_add(RocksDbWeight::get().reads(6 as Weight))423 .saturating_add(RocksDbWeight::get().writes(7 as Weight))424 }425 // Storage: Refungible Allowance (r:1 w:1)426 // Storage: Refungible TotalSupply (r:1 w:1)427 // Storage: Refungible Balance (r:1 w:1)428 // Storage: Refungible AccountBalance (r:1 w:1)429 // Storage: Refungible TokensBurnt (r:1 w:1)430 // Storage: Refungible Owned (r:0 w:1)431 // Storage: Refungible TokenProperties (r:0 w:1)432 fn burn_from() -> Weight {433 (48_584_000 as Weight)434 .saturating_add(RocksDbWeight::get().reads(5 as Weight))435 .saturating_add(RocksDbWeight::get().writes(7 as Weight))436 }437 // Storage: Common CollectionPropertyPermissions (r:1 w:1)438 fn set_token_property_permissions(b: u32, ) -> Weight {439 (0 as Weight)440 // Standard Error: 60_000441 .saturating_add((15_533_000 as Weight).saturating_mul(b as Weight))442 .saturating_add(RocksDbWeight::get().reads(1 as Weight))443 .saturating_add(RocksDbWeight::get().writes(1 as Weight))444 }445 // Storage: Common CollectionPropertyPermissions (r:1 w:0)446 // Storage: Refungible TokenProperties (r:1 w:1)447 fn set_token_properties(b: u32, ) -> Weight {448 (0 as Weight)449 // Standard Error: 3_609_000450 .saturating_add((590_204_000 as Weight).saturating_mul(b as Weight))451 .saturating_add(RocksDbWeight::get().reads(2 as Weight))452 .saturating_add(RocksDbWeight::get().writes(1 as Weight))453 }454 // Storage: Common CollectionPropertyPermissions (r:1 w:0)455 // Storage: Refungible TokenProperties (r:1 w:1)456 fn delete_token_properties(b: u32, ) -> Weight {457 (0 as Weight)458 // Standard Error: 3_637_000459 .saturating_add((603_468_000 as Weight).saturating_mul(b as Weight))460 .saturating_add(RocksDbWeight::get().reads(2 as Weight))461 .saturating_add(RocksDbWeight::get().writes(1 as Weight))462 }463 // Storage: Refungible TotalSupply (r:1 w:1)464 // Storage: Refungible Balance (r:1 w:1)465 fn repartition_item() -> Weight {466 (22_356_000 as Weight)467 .saturating_add(RocksDbWeight::get().reads(2 as Weight))468 .saturating_add(RocksDbWeight::get().writes(2 as Weight))469 }470 // Storage: Refungible Balance (r:1 w:0)471 // Storage: Refungible TotalSupply (r:1 w:0)472 // Storage: Refungible TokenProperties (r:1 w:1)473 fn set_parent_nft_unchecked() -> Weight {474 (12_015_000 as Weight)475 .saturating_add(RocksDbWeight::get().reads(3 as Weight))476 .saturating_add(RocksDbWeight::get().writes(1 as Weight))477 }478 // Storage: Refungible Balance (r:2 w:0)479 fn token_owner() -> Weight {480 (9_431_000 as Weight)481 .saturating_add(RocksDbWeight::get().reads(2 as Weight))482 }483}1// Template adopted from https://github.com/paritytech/substrate/blob/master/.maintain/frame-weight-template.hbs23//! Autogenerated weights for pallet_refungible4//!5//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev6//! DATE: 2022-08-15, STEPS: `50`, REPEAT: 80, LOW RANGE: `[]`, HIGH RANGE: `[]`7//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 102489// Executed Command:10// target/release/unique-collator11// benchmark12// pallet13// --pallet14// pallet-refungible15// --wasm-execution16// compiled17// --extrinsic18// *19// --template20// .maintain/frame-weight-template.hbs21// --steps=5022// --repeat=8023// --heap-pages=409624// --output=./pallets/refungible/src/weights.rs2526#![cfg_attr(rustfmt, rustfmt_skip)]27#![allow(unused_parens)]28#![allow(unused_imports)]29#![allow(clippy::unnecessary_cast)]3031use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};32use sp_std::marker::PhantomData;3334/// Weight functions needed for pallet_refungible.35pub trait WeightInfo {36 fn create_item() -> Weight;37 fn create_multiple_items(b: u32, ) -> Weight;38 fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight;39 fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight;40 fn burn_item_partial() -> Weight;41 fn burn_item_fully() -> Weight;42 fn transfer_normal() -> Weight;43 fn transfer_creating() -> Weight;44 fn transfer_removing() -> Weight;45 fn transfer_creating_removing() -> Weight;46 fn approve() -> Weight;47 fn transfer_from_normal() -> Weight;48 fn transfer_from_creating() -> Weight;49 fn transfer_from_removing() -> Weight;50 fn transfer_from_creating_removing() -> Weight;51 fn burn_from() -> Weight;52 fn set_token_property_permissions(b: u32, ) -> Weight;53 fn set_token_properties(b: u32, ) -> Weight;54 fn delete_token_properties(b: u32, ) -> Weight;55 fn repartition_item() -> Weight;56 fn token_owner() -> Weight;57}5859/// Weights for pallet_refungible using the Substrate node and recommended hardware.60pub struct SubstrateWeight<T>(PhantomData<T>);61impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {62 // Storage: Refungible TokensMinted (r:1 w:1)63 // Storage: Refungible AccountBalance (r:1 w:1)64 // Storage: Refungible Balance (r:0 w:1)65 // Storage: Refungible TotalSupply (r:0 w:1)66 // Storage: Refungible Owned (r:0 w:1)67 fn create_item() -> Weight {68 (29_527_000 as Weight)69 .saturating_add(T::DbWeight::get().reads(2 as Weight))70 .saturating_add(T::DbWeight::get().writes(5 as Weight))71 }72 // Storage: Refungible TokensMinted (r:1 w:1)73 // Storage: Refungible AccountBalance (r:1 w:1)74 // Storage: Refungible Balance (r:0 w:4)75 // Storage: Refungible TotalSupply (r:0 w:4)76 // Storage: Refungible Owned (r:0 w:4)77 fn create_multiple_items(b: u32, ) -> Weight {78 (28_541_000 as Weight)79 // Standard Error: 4_00080 .saturating_add((6_671_000 as Weight).saturating_mul(b as Weight))81 .saturating_add(T::DbWeight::get().reads(2 as Weight))82 .saturating_add(T::DbWeight::get().writes(2 as Weight))83 .saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(b as Weight)))84 }85 // Storage: Refungible TokensMinted (r:1 w:1)86 // Storage: Refungible AccountBalance (r:4 w:4)87 // Storage: Refungible Balance (r:0 w:4)88 // Storage: Refungible TotalSupply (r:0 w:4)89 // Storage: Refungible Owned (r:0 w:4)90 fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight {91 (24_366_000 as Weight)92 // Standard Error: 5_00093 .saturating_add((9_338_000 as Weight).saturating_mul(b as Weight))94 .saturating_add(T::DbWeight::get().reads(1 as Weight))95 .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))96 .saturating_add(T::DbWeight::get().writes(1 as Weight))97 .saturating_add(T::DbWeight::get().writes((4 as Weight).saturating_mul(b as Weight)))98 }99 // Storage: Refungible TokensMinted (r:1 w:1)100 // Storage: Refungible TotalSupply (r:0 w:1)101 // Storage: Refungible AccountBalance (r:4 w:4)102 // Storage: Refungible Balance (r:0 w:4)103 // Storage: Refungible Owned (r:0 w:4)104 fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight {105 (27_574_000 as Weight)106 // Standard Error: 4_000107 .saturating_add((7_193_000 as Weight).saturating_mul(b as Weight))108 .saturating_add(T::DbWeight::get().reads(1 as Weight))109 .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))110 .saturating_add(T::DbWeight::get().writes(2 as Weight))111 .saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(b as Weight)))112 }113 // Storage: Refungible TotalSupply (r:1 w:1)114 // Storage: Refungible Balance (r:3 w:1)115 // Storage: Refungible AccountBalance (r:1 w:1)116 // Storage: Refungible Owned (r:0 w:1)117 fn burn_item_partial() -> Weight {118 (42_943_000 as Weight)119 .saturating_add(T::DbWeight::get().reads(5 as Weight))120 .saturating_add(T::DbWeight::get().writes(4 as Weight))121 }122 // Storage: Refungible TotalSupply (r:1 w:1)123 // Storage: Refungible Balance (r:1 w:1)124 // Storage: Refungible AccountBalance (r:1 w:1)125 // Storage: Refungible TokensBurnt (r:1 w:1)126 // Storage: Refungible Owned (r:0 w:1)127 // Storage: Refungible TokenProperties (r:0 w:1)128 fn burn_item_fully() -> Weight {129 (36_861_000 as Weight)130 .saturating_add(T::DbWeight::get().reads(4 as Weight))131 .saturating_add(T::DbWeight::get().writes(6 as Weight))132 }133 // Storage: Refungible Balance (r:2 w:2)134 // Storage: Refungible TotalSupply (r:1 w:0)135 fn transfer_normal() -> Weight {136 (27_789_000 as Weight)137 .saturating_add(T::DbWeight::get().reads(3 as Weight))138 .saturating_add(T::DbWeight::get().writes(2 as Weight))139 }140 // Storage: Refungible Balance (r:2 w:2)141 // Storage: Refungible AccountBalance (r:1 w:1)142 // Storage: Refungible TotalSupply (r:1 w:0)143 // Storage: Refungible Owned (r:0 w:1)144 fn transfer_creating() -> Weight {145 (32_893_000 as Weight)146 .saturating_add(T::DbWeight::get().reads(4 as Weight))147 .saturating_add(T::DbWeight::get().writes(4 as Weight))148 }149 // Storage: Refungible Balance (r:2 w:2)150 // Storage: Refungible AccountBalance (r:1 w:1)151 // Storage: Refungible TotalSupply (r:1 w:0)152 // Storage: Refungible Owned (r:0 w:1)153 fn transfer_removing() -> Weight {154 (34_703_000 as Weight)155 .saturating_add(T::DbWeight::get().reads(4 as Weight))156 .saturating_add(T::DbWeight::get().writes(4 as Weight))157 }158 // Storage: Refungible Balance (r:2 w:2)159 // Storage: Refungible AccountBalance (r:2 w:2)160 // Storage: Refungible TotalSupply (r:1 w:0)161 // Storage: Refungible Owned (r:0 w:2)162 fn transfer_creating_removing() -> Weight {163 (37_547_000 as Weight)164 .saturating_add(T::DbWeight::get().reads(5 as Weight))165 .saturating_add(T::DbWeight::get().writes(6 as Weight))166 }167 // Storage: Refungible Balance (r:1 w:0)168 // Storage: Refungible Allowance (r:0 w:1)169 fn approve() -> Weight {170 (20_039_000 as Weight)171 .saturating_add(T::DbWeight::get().reads(1 as Weight))172 .saturating_add(T::DbWeight::get().writes(1 as Weight))173 }174 // Storage: Refungible Allowance (r:1 w:1)175 // Storage: Refungible Balance (r:2 w:2)176 // Storage: Refungible TotalSupply (r:1 w:0)177 fn transfer_from_normal() -> Weight {178 (37_628_000 as Weight)179 .saturating_add(T::DbWeight::get().reads(4 as Weight))180 .saturating_add(T::DbWeight::get().writes(3 as Weight))181 }182 // Storage: Refungible Allowance (r:1 w:1)183 // Storage: Refungible Balance (r:2 w:2)184 // Storage: Refungible AccountBalance (r:1 w:1)185 // Storage: Refungible TotalSupply (r:1 w:0)186 // Storage: Refungible Owned (r:0 w:1)187 fn transfer_from_creating() -> Weight {188 (42_072_000 as Weight)189 .saturating_add(T::DbWeight::get().reads(5 as Weight))190 .saturating_add(T::DbWeight::get().writes(5 as Weight))191 }192 // Storage: Refungible Allowance (r:1 w:1)193 // Storage: Refungible Balance (r:2 w:2)194 // Storage: Refungible AccountBalance (r:1 w:1)195 // Storage: Refungible TotalSupply (r:1 w:0)196 // Storage: Refungible Owned (r:0 w:1)197 fn transfer_from_removing() -> Weight {198 (43_024_000 as Weight)199 .saturating_add(T::DbWeight::get().reads(5 as Weight))200 .saturating_add(T::DbWeight::get().writes(5 as Weight))201 }202 // Storage: Refungible Allowance (r:1 w:1)203 // Storage: Refungible Balance (r:2 w:2)204 // Storage: Refungible AccountBalance (r:2 w:2)205 // Storage: Refungible TotalSupply (r:1 w:0)206 // Storage: Refungible Owned (r:0 w:2)207 fn transfer_from_creating_removing() -> Weight {208 (45_910_000 as Weight)209 .saturating_add(T::DbWeight::get().reads(6 as Weight))210 .saturating_add(T::DbWeight::get().writes(7 as Weight))211 }212 // Storage: Refungible Allowance (r:1 w:1)213 // Storage: Refungible TotalSupply (r:1 w:1)214 // Storage: Refungible Balance (r:1 w:1)215 // Storage: Refungible AccountBalance (r:1 w:1)216 // Storage: Refungible TokensBurnt (r:1 w:1)217 // Storage: Refungible Owned (r:0 w:1)218 // Storage: Refungible TokenProperties (r:0 w:1)219 fn burn_from() -> Weight {220 (48_584_000 as Weight)221 .saturating_add(T::DbWeight::get().reads(5 as Weight))222 .saturating_add(T::DbWeight::get().writes(7 as Weight))223 }224 // Storage: Common CollectionPropertyPermissions (r:1 w:1)225 fn set_token_property_permissions(b: u32, ) -> Weight {226 (0 as Weight)227 // Standard Error: 60_000228 .saturating_add((15_533_000 as Weight).saturating_mul(b as Weight))229 .saturating_add(T::DbWeight::get().reads(1 as Weight))230 .saturating_add(T::DbWeight::get().writes(1 as Weight))231 }232 // Storage: Common CollectionPropertyPermissions (r:1 w:0)233 // Storage: Refungible TokenProperties (r:1 w:1)234 fn set_token_properties(b: u32, ) -> Weight {235 (0 as Weight)236 // Standard Error: 3_609_000237 .saturating_add((590_204_000 as Weight).saturating_mul(b as Weight))238 .saturating_add(T::DbWeight::get().reads(2 as Weight))239 .saturating_add(T::DbWeight::get().writes(1 as Weight))240 }241 // Storage: Common CollectionPropertyPermissions (r:1 w:0)242 // Storage: Refungible TokenProperties (r:1 w:1)243 fn delete_token_properties(b: u32, ) -> Weight {244 (0 as Weight)245 // Standard Error: 3_637_000246 .saturating_add((603_468_000 as Weight).saturating_mul(b as Weight))247 .saturating_add(T::DbWeight::get().reads(2 as Weight))248 .saturating_add(T::DbWeight::get().writes(1 as Weight))249 }250 // Storage: Refungible TotalSupply (r:1 w:1)251 // Storage: Refungible Balance (r:1 w:1)252 fn repartition_item() -> Weight {253 (22_356_000 as Weight)254 .saturating_add(T::DbWeight::get().reads(2 as Weight))255 .saturating_add(T::DbWeight::get().writes(2 as Weight))256 }257 // Storage: Refungible Balance (r:2 w:0)258 fn token_owner() -> Weight {259 (9_431_000 as Weight)260 .saturating_add(T::DbWeight::get().reads(2 as Weight))261 }262}263264// For backwards compatibility and tests265impl WeightInfo for () {266 // Storage: Refungible TokensMinted (r:1 w:1)267 // Storage: Refungible AccountBalance (r:1 w:1)268 // Storage: Refungible Balance (r:0 w:1)269 // Storage: Refungible TotalSupply (r:0 w:1)270 // Storage: Refungible Owned (r:0 w:1)271 fn create_item() -> Weight {272 (29_527_000 as Weight)273 .saturating_add(RocksDbWeight::get().reads(2 as Weight))274 .saturating_add(RocksDbWeight::get().writes(5 as Weight))275 }276 // Storage: Refungible TokensMinted (r:1 w:1)277 // Storage: Refungible AccountBalance (r:1 w:1)278 // Storage: Refungible Balance (r:0 w:4)279 // Storage: Refungible TotalSupply (r:0 w:4)280 // Storage: Refungible Owned (r:0 w:4)281 fn create_multiple_items(b: u32, ) -> Weight {282 (28_541_000 as Weight)283 // Standard Error: 4_000284 .saturating_add((6_671_000 as Weight).saturating_mul(b as Weight))285 .saturating_add(RocksDbWeight::get().reads(2 as Weight))286 .saturating_add(RocksDbWeight::get().writes(2 as Weight))287 .saturating_add(RocksDbWeight::get().writes((3 as Weight).saturating_mul(b as Weight)))288 }289 // Storage: Refungible TokensMinted (r:1 w:1)290 // Storage: Refungible AccountBalance (r:4 w:4)291 // Storage: Refungible Balance (r:0 w:4)292 // Storage: Refungible TotalSupply (r:0 w:4)293 // Storage: Refungible Owned (r:0 w:4)294 fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight {295 (24_366_000 as Weight)296 // Standard Error: 5_000297 .saturating_add((9_338_000 as Weight).saturating_mul(b as Weight))298 .saturating_add(RocksDbWeight::get().reads(1 as Weight))299 .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))300 .saturating_add(RocksDbWeight::get().writes(1 as Weight))301 .saturating_add(RocksDbWeight::get().writes((4 as Weight).saturating_mul(b as Weight)))302 }303 // Storage: Refungible TokensMinted (r:1 w:1)304 // Storage: Refungible TotalSupply (r:0 w:1)305 // Storage: Refungible AccountBalance (r:4 w:4)306 // Storage: Refungible Balance (r:0 w:4)307 // Storage: Refungible Owned (r:0 w:4)308 fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight {309 (27_574_000 as Weight)310 // Standard Error: 4_000311 .saturating_add((7_193_000 as Weight).saturating_mul(b as Weight))312 .saturating_add(RocksDbWeight::get().reads(1 as Weight))313 .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))314 .saturating_add(RocksDbWeight::get().writes(2 as Weight))315 .saturating_add(RocksDbWeight::get().writes((3 as Weight).saturating_mul(b as Weight)))316 }317 // Storage: Refungible TotalSupply (r:1 w:1)318 // Storage: Refungible Balance (r:3 w:1)319 // Storage: Refungible AccountBalance (r:1 w:1)320 // Storage: Refungible Owned (r:0 w:1)321 fn burn_item_partial() -> Weight {322 (42_943_000 as Weight)323 .saturating_add(RocksDbWeight::get().reads(5 as Weight))324 .saturating_add(RocksDbWeight::get().writes(4 as Weight))325 }326 // Storage: Refungible TotalSupply (r:1 w:1)327 // Storage: Refungible Balance (r:1 w:1)328 // Storage: Refungible AccountBalance (r:1 w:1)329 // Storage: Refungible TokensBurnt (r:1 w:1)330 // Storage: Refungible Owned (r:0 w:1)331 // Storage: Refungible TokenProperties (r:0 w:1)332 fn burn_item_fully() -> Weight {333 (36_861_000 as Weight)334 .saturating_add(RocksDbWeight::get().reads(4 as Weight))335 .saturating_add(RocksDbWeight::get().writes(6 as Weight))336 }337 // Storage: Refungible Balance (r:2 w:2)338 // Storage: Refungible TotalSupply (r:1 w:0)339 fn transfer_normal() -> Weight {340 (27_789_000 as Weight)341 .saturating_add(RocksDbWeight::get().reads(3 as Weight))342 .saturating_add(RocksDbWeight::get().writes(2 as Weight))343 }344 // Storage: Refungible Balance (r:2 w:2)345 // Storage: Refungible AccountBalance (r:1 w:1)346 // Storage: Refungible TotalSupply (r:1 w:0)347 // Storage: Refungible Owned (r:0 w:1)348 fn transfer_creating() -> Weight {349 (32_893_000 as Weight)350 .saturating_add(RocksDbWeight::get().reads(4 as Weight))351 .saturating_add(RocksDbWeight::get().writes(4 as Weight))352 }353 // Storage: Refungible Balance (r:2 w:2)354 // Storage: Refungible AccountBalance (r:1 w:1)355 // Storage: Refungible TotalSupply (r:1 w:0)356 // Storage: Refungible Owned (r:0 w:1)357 fn transfer_removing() -> Weight {358 (34_703_000 as Weight)359 .saturating_add(RocksDbWeight::get().reads(4 as Weight))360 .saturating_add(RocksDbWeight::get().writes(4 as Weight))361 }362 // Storage: Refungible Balance (r:2 w:2)363 // Storage: Refungible AccountBalance (r:2 w:2)364 // Storage: Refungible TotalSupply (r:1 w:0)365 // Storage: Refungible Owned (r:0 w:2)366 fn transfer_creating_removing() -> Weight {367 (37_547_000 as Weight)368 .saturating_add(RocksDbWeight::get().reads(5 as Weight))369 .saturating_add(RocksDbWeight::get().writes(6 as Weight))370 }371 // Storage: Refungible Balance (r:1 w:0)372 // Storage: Refungible Allowance (r:0 w:1)373 fn approve() -> Weight {374 (20_039_000 as Weight)375 .saturating_add(RocksDbWeight::get().reads(1 as Weight))376 .saturating_add(RocksDbWeight::get().writes(1 as Weight))377 }378 // Storage: Refungible Allowance (r:1 w:1)379 // Storage: Refungible Balance (r:2 w:2)380 // Storage: Refungible TotalSupply (r:1 w:0)381 fn transfer_from_normal() -> Weight {382 (37_628_000 as Weight)383 .saturating_add(RocksDbWeight::get().reads(4 as Weight))384 .saturating_add(RocksDbWeight::get().writes(3 as Weight))385 }386 // Storage: Refungible Allowance (r:1 w:1)387 // Storage: Refungible Balance (r:2 w:2)388 // Storage: Refungible AccountBalance (r:1 w:1)389 // Storage: Refungible TotalSupply (r:1 w:0)390 // Storage: Refungible Owned (r:0 w:1)391 fn transfer_from_creating() -> Weight {392 (42_072_000 as Weight)393 .saturating_add(RocksDbWeight::get().reads(5 as Weight))394 .saturating_add(RocksDbWeight::get().writes(5 as Weight))395 }396 // Storage: Refungible Allowance (r:1 w:1)397 // Storage: Refungible Balance (r:2 w:2)398 // Storage: Refungible AccountBalance (r:1 w:1)399 // Storage: Refungible TotalSupply (r:1 w:0)400 // Storage: Refungible Owned (r:0 w:1)401 fn transfer_from_removing() -> Weight {402 (43_024_000 as Weight)403 .saturating_add(RocksDbWeight::get().reads(5 as Weight))404 .saturating_add(RocksDbWeight::get().writes(5 as Weight))405 }406 // Storage: Refungible Allowance (r:1 w:1)407 // Storage: Refungible Balance (r:2 w:2)408 // Storage: Refungible AccountBalance (r:2 w:2)409 // Storage: Refungible TotalSupply (r:1 w:0)410 // Storage: Refungible Owned (r:0 w:2)411 fn transfer_from_creating_removing() -> Weight {412 (45_910_000 as Weight)413 .saturating_add(RocksDbWeight::get().reads(6 as Weight))414 .saturating_add(RocksDbWeight::get().writes(7 as Weight))415 }416 // Storage: Refungible Allowance (r:1 w:1)417 // Storage: Refungible TotalSupply (r:1 w:1)418 // Storage: Refungible Balance (r:1 w:1)419 // Storage: Refungible AccountBalance (r:1 w:1)420 // Storage: Refungible TokensBurnt (r:1 w:1)421 // Storage: Refungible Owned (r:0 w:1)422 // Storage: Refungible TokenProperties (r:0 w:1)423 fn burn_from() -> Weight {424 (48_584_000 as Weight)425 .saturating_add(RocksDbWeight::get().reads(5 as Weight))426 .saturating_add(RocksDbWeight::get().writes(7 as Weight))427 }428 // Storage: Common CollectionPropertyPermissions (r:1 w:1)429 fn set_token_property_permissions(b: u32, ) -> Weight {430 (0 as Weight)431 // Standard Error: 60_000432 .saturating_add((15_533_000 as Weight).saturating_mul(b as Weight))433 .saturating_add(RocksDbWeight::get().reads(1 as Weight))434 .saturating_add(RocksDbWeight::get().writes(1 as Weight))435 }436 // Storage: Common CollectionPropertyPermissions (r:1 w:0)437 // Storage: Refungible TokenProperties (r:1 w:1)438 fn set_token_properties(b: u32, ) -> Weight {439 (0 as Weight)440 // Standard Error: 3_609_000441 .saturating_add((590_204_000 as Weight).saturating_mul(b as Weight))442 .saturating_add(RocksDbWeight::get().reads(2 as Weight))443 .saturating_add(RocksDbWeight::get().writes(1 as Weight))444 }445 // Storage: Common CollectionPropertyPermissions (r:1 w:0)446 // Storage: Refungible TokenProperties (r:1 w:1)447 fn delete_token_properties(b: u32, ) -> Weight {448 (0 as Weight)449 // Standard Error: 3_637_000450 .saturating_add((603_468_000 as Weight).saturating_mul(b as Weight))451 .saturating_add(RocksDbWeight::get().reads(2 as Weight))452 .saturating_add(RocksDbWeight::get().writes(1 as Weight))453 }454 // Storage: Refungible TotalSupply (r:1 w:1)455 // Storage: Refungible Balance (r:1 w:1)456 fn repartition_item() -> Weight {457 (22_356_000 as Weight)458 .saturating_add(RocksDbWeight::get().reads(2 as Weight))459 .saturating_add(RocksDbWeight::get().writes(2 as Weight))460 }461 // Storage: Refungible Balance (r:2 w:0)462 fn token_owner() -> Weight {463 (9_431_000 as Weight)464 .saturating_add(RocksDbWeight::get().reads(2 as Weight))465 }466}pallets/unique/src/eth/mod.rsdiffbeforeafterboth--- a/pallets/unique/src/eth/mod.rs
+++ b/pallets/unique/src/eth/mod.rs
@@ -154,17 +154,6 @@
Ok(data)
}
-fn parent_nft_property_permissions() -> PropertyKeyPermission {
- PropertyKeyPermission {
- key: key::parent_nft(),
- permission: PropertyPermission {
- mutable: false,
- collection_admin: false,
- token_owner: true,
- },
- }
-}
-
fn create_refungible_collection_internal<
T: Config + pallet_nonfungible::Config + pallet_refungible::Config,
>(
@@ -188,16 +177,6 @@
let collection_id = T::CollectionDispatch::create(caller.clone(), data)
.map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;
-
- let handle = <CollectionHandle<T>>::try_get(collection_id).map_err(dispatch_to_evm::<T>)?;
- <PalletCommon<T>>::set_scoped_token_property_permissions(
- &handle,
- &caller,
- PropertyScope::Eth,
- vec![parent_nft_property_permissions()],
- )
- .map_err(dispatch_to_evm::<T>)?;
-
let address = pallet_common::eth::collection_id_to_address(collection_id);
Ok(address)
}
primitives/data-structs/src/lib.rsdiffbeforeafterboth--- a/primitives/data-structs/src/lib.rs
+++ b/primitives/data-structs/src/lib.rs
@@ -1050,7 +1050,6 @@
pub enum PropertyScope {
None,
Rmrk,
- Eth,
}
impl PropertyScope {
@@ -1059,7 +1058,6 @@
let scope_str: &[u8] = match self {
Self::None => return Ok(key),
Self::Rmrk => b"rmrk",
- Self::Eth => b"eth",
};
[scope_str, b":", key.as_slice()]
tests/src/eth/api/UniqueRefungibleToken.soldiffbeforeafterboth--- a/tests/src/eth/api/UniqueRefungibleToken.sol
+++ b/tests/src/eth/api/UniqueRefungibleToken.sol
@@ -12,15 +12,6 @@
function supportsInterface(bytes4 interfaceID) external view returns (bool);
}
-/// @dev the ERC-165 identifier for this interface is 0x042f1106
-interface ERC1633UniqueExtensions is Dummy, ERC165 {
- /// @dev EVM selector for this function is: 0x042f1106,
- /// or in textual repr: setParentNFT(address,uint256)
- function setParentNFT(address collection, uint256 nftId)
- external
- returns (bool);
-}
-
/// @dev the ERC-165 identifier for this interface is 0x5755c3f2
interface ERC1633 is Dummy, ERC165 {
/// @dev EVM selector for this function is: 0x80a54001,
@@ -140,6 +131,5 @@
ERC165,
ERC20,
ERC20UniqueExtensions,
- ERC1633,
- ERC1633UniqueExtensions
+ ERC1633
{}
tests/src/eth/base.test.tsdiffbeforeafterboth--- a/tests/src/eth/base.test.ts
+++ b/tests/src/eth/base.test.ts
@@ -94,7 +94,7 @@
});
itWeb3('ERC721 support', async ({web3}) => {
- expect(await contract(web3).methods.supportsInterface('0x58800161').call()).to.be.true;
+ expect(await contract(web3).methods.supportsInterface('0x780e9d63').call()).to.be.true;
});
itWeb3('ERC721Metadata support', async ({web3}) => {
tests/src/eth/fractionalizer/Fractionalizer.soldiffbeforeafterboth--- a/tests/src/eth/fractionalizer/Fractionalizer.sol
+++ b/tests/src/eth/fractionalizer/Fractionalizer.sol
@@ -16,8 +16,8 @@
}
address rftCollection;
mapping(address => bool) nftCollectionAllowList;
- mapping(address => mapping(uint256 => uint256)) nft2rftMapping;
- mapping(address => Token) rft2nftMapping;
+ mapping(address => mapping(uint256 => uint256)) public nft2rftMapping;
+ mapping(address => Token) public rft2nftMapping;
bytes32 refungibleCollectionType = keccak256(bytes("ReFungible"));
receive() external payable onlyOwner {}
@@ -137,7 +137,6 @@
rft2nftMapping[rftTokenAddress] = Token(_collection, _token);
rftTokenContract = UniqueRefungibleToken(rftTokenAddress);
- rftTokenContract.setParentNFT(_collection, _token);
} else {
rftTokenId = nft2rftMapping[_collection][_token];
rftTokenAddress = rftCollectionContract.tokenContractAddress(rftTokenId);
tests/src/eth/fractionalizer/fractionalizer.test.tsdiffbeforeafterboth--- a/tests/src/eth/fractionalizer/fractionalizer.test.ts
+++ b/tests/src/eth/fractionalizer/fractionalizer.test.ts
@@ -223,6 +223,28 @@
},
});
});
+
+ itWeb3('Test fractionalizer NFT <-> RFT mapping ', async ({api, web3, privateKeyWrapper}) => {
+ const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
+
+ const {fractionalizer, rftCollectionAddress} = await initFractionalizer(api, web3, privateKeyWrapper, owner);
+ const {rftTokenAddress, nftCollectionAddress, nftTokenId} = await createRFTToken(api, web3, owner, fractionalizer, 100n);
+
+ const {collectionId, tokenId} = tokenIdFromAddress(rftTokenAddress);
+ const refungibleAddress = collectionIdToAddress(collectionId);
+ expect(rftCollectionAddress).to.be.equal(refungibleAddress);
+ const refungibleTokenContract = uniqueRefungibleToken(web3, rftTokenAddress, owner);
+ await refungibleTokenContract.methods.approve(fractionalizer.options.address, 100).send();
+
+ const rft2nft = await fractionalizer.methods.rft2nftMapping(rftTokenAddress).call();
+ expect(rft2nft).to.be.like({
+ _collection: nftCollectionAddress,
+ _tokenId: nftTokenId,
+ });
+
+ const nft2rft = await fractionalizer.methods.nft2rftMapping(nftCollectionAddress, nftTokenId).call();
+ expect(nft2rft).to.be.eq(tokenId.toString());
+ });
});
tests/src/eth/reFungibleToken.test.tsdiffbeforeafterboth--- a/tests/src/eth/reFungibleToken.test.ts
+++ b/tests/src/eth/reFungibleToken.test.ts
@@ -655,31 +655,6 @@
await requirePallets(this, [Pallets.ReFungible]);
});
- itWeb3('Parent NFT token address and id', async ({api, web3, privateKeyWrapper}) => {
- const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
-
- const {collectionIdAddress: nftCollectionAddress} = await createNonfungibleCollection(api, web3, owner);
- const nftContract = uniqueNFT(web3, nftCollectionAddress, owner);
- const nftTokenId = await nftContract.methods.nextTokenId().call();
- await nftContract.methods.mint(owner, nftTokenId).send();
- const nftCollectionId = collectionIdFromAddress(nftCollectionAddress);
-
- const {collectionIdAddress, collectionId} = await createRefungibleCollection(api, web3, owner);
- const refungibleContract = uniqueRefungible(web3, collectionIdAddress, owner);
- const refungibleTokenId = await refungibleContract.methods.nextTokenId().call();
- await refungibleContract.methods.mint(owner, refungibleTokenId).send();
-
- const rftTokenAddress = tokenIdToAddress(collectionId, refungibleTokenId);
- const refungibleTokenContract = uniqueRefungibleToken(web3, rftTokenAddress, owner);
- await refungibleTokenContract.methods.setParentNFT(nftCollectionAddress, nftTokenId).send();
-
- const tokenAddress = await refungibleTokenContract.methods.parentToken().call();
- const tokenId = await refungibleTokenContract.methods.parentTokenId().call();
- const nftTokenAddress = tokenIdToAddress(nftCollectionId, nftTokenId);
- expect(tokenAddress).to.be.equal(nftTokenAddress);
- expect(tokenId).to.be.equal(nftTokenId);
- });
-
itWeb3('Default parent token address and id', async ({api, web3, privateKeyWrapper}) => {
const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
@@ -693,7 +668,7 @@
const tokenAddress = await refungibleTokenContract.methods.parentToken().call();
const tokenId = await refungibleTokenContract.methods.parentTokenId().call();
- expect(tokenAddress).to.be.equal(rftTokenAddress);
+ expect(tokenAddress).to.be.equal(collectionIdAddress);
expect(tokenId).to.be.equal(refungibleTokenId);
});
});
tests/src/eth/reFungibleTokenAbi.jsondiffbeforeafterboth--- a/tests/src/eth/reFungibleTokenAbi.json
+++ b/tests/src/eth/reFungibleTokenAbi.json
@@ -127,16 +127,6 @@
},
{
"inputs": [
- { "internalType": "address", "name": "collection", "type": "address" },
- { "internalType": "uint256", "name": "nftId", "type": "uint256" }
- ],
- "name": "setParentNFT",
- "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
{ "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }
],
"name": "supportsInterface",