difftreelog
feat dispatch call to Native fingible
in: master
6 files changed
pallets/common/src/dispatch.rsdiffbeforeafterboth94 /// * `handle` - Collection handle.94 /// * `handle` - Collection handle.95 fn dispatch(handle: CollectionHandle<T>) -> Self;95 fn dispatch(handle: CollectionHandle<T>) -> Self;9697 /// Get the collection handle for the corresponding implementation.98 fn into_inner(self) -> CollectionHandle<T>;9996100 /// Get the implementation of [`CommonCollectionOperations`].97 /// Get the implementation of [`CommonCollectionOperations`].101 fn as_dyn(&self) -> &dyn CommonCollectionOperations<T>;98 fn as_dyn(&self) -> &dyn CommonCollectionOperations<T>;pallets/common/src/lib.rsdiffbeforeafterboth125impl<T: Config> CollectionHandle<T> {125impl<T: Config> CollectionHandle<T> {126 /// Same as [CollectionHandle::new] but with an explicit gas limit.126 /// Same as [CollectionHandle::new] but with an explicit gas limit.127 pub fn new_with_gas_limit(id: CollectionId, gas_limit: u64) -> Option<Self> {127 pub fn new_with_gas_limit(id: CollectionId, gas_limit: u64) -> Option<Self> {128 <CollectionById<T>>::get(id).map(|collection| Self {128 Self::new_with_recorder(id, SubstrateRecorder::new(gas_limit))129 id,130 collection,131 recorder: SubstrateRecorder::new(gas_limit),132 })133 }129 }134130135 /// Same as [CollectionHandle::new] but with an existed [`SubstrateRecorder`].131 /// Same as [CollectionHandle::new] but with an existed [`SubstrateRecorder`].runtime/common/dispatch.rsdiffbeforeafterboth118 }118 }119 }119 }120121 fn into_inner(self) -> CollectionHandle<T> {122 match self {123 Self::Fungible(f) => f.into_inner(),124 Self::Nonfungible(f) => f.into_inner(),125 Self::Refungible(f) => f.into_inner(),126 Self::NativeFungible(f) => f.into_inner(),127 }128 }129120130 fn as_dyn(&self) -> &dyn CommonCollectionOperations<T> {121 fn as_dyn(&self) -> &dyn CommonCollectionOperations<T> {131 match self {122 match self {189 Self::Fungible(h) => h.call(handle),180 Self::Fungible(h) => h.call(handle),190 Self::Nonfungible(h) => h.call(handle),181 Self::Nonfungible(h) => h.call(handle),191 Self::Refungible(h) => h.call(handle),182 Self::Refungible(h) => h.call(handle),192 Self::NativeFungible(f) => todo!(),183 Self::NativeFungible(h) => h.call(handle),193 }184 }194 } else if let Some((collection_id, token_id)) =185 } else if let Some((collection_id, token_id)) =195 <T as pallet_common::Config>::EvmTokenAddressMapping::address_to_token(186 <T as pallet_common::Config>::EvmTokenAddressMapping::address_to_token(tests/src/eth/fungible.test.tsdiffbeforeafterboth33 'substrate' as const,33 'substrate' as const,34 'ethereum' as const,34 'ethereum' as const,35 ].map(testCase => {35 ].map(testCase => {36 itEth(`Can perform mintCross() for ${testCase} address`, async ({helper}) => {36 itEth.only(`Can perform mintCross() for ${testCase} address`, async ({helper}) => {37 // 1. Create receiver depending on the test case:37 // 1. Create receiver depending on the test case:38 const receiverEth = helper.eth.createAccount();38 const receiverEth = helper.eth.createAccount();39 const receiverCrossEth = helper.ethCrossAccount.fromAddress(receiverEth);39 const receiverCrossEth = helper.ethCrossAccount.fromAddress(receiverEth);tests/src/eth/nativeFungible.test.tsdiffbeforeafterbothno syntactic changes
tests/src/eth/util/playgrounds/unique.dev.tsdiffbeforeafterboth142142143 async collection(address: string, mode: TCollectionMode, caller?: string, mergeDeprecated = false) {143 async collection(address: string, mode: TCollectionMode, caller?: string, mergeDeprecated = false) {144 let abi;144 let abi;145 if (address === '0' && mode === 'ft') {145 if (address === '0x17C4e6453cC49aaAAEaCA894E6d9683e00000000' && mode === 'ft') {146 abi = nativeFungibleAbi;146 abi = nativeFungibleAbi;147 } else {147 } else {148 abi ={148 abi ={