difftreelog
Merge pull request #330 from UniqueNetwork/release-v918001
in: master
Release v918001
9 files changed
Cargo.lockdiffbeforeafterboth--- a/Cargo.lock
+++ b/Cargo.lock
@@ -8706,13 +8706,10 @@
"derivative",
"fp-rpc",
"fp-self-contained",
- "frame-benchmarking",
"frame-executive",
"frame-support",
"frame-system",
- "frame-system-benchmarking",
"frame-system-rpc-runtime-api",
- "hex-literal",
"orml-vesting",
"pallet-aura",
"pallet-balances",
Cargo.tomldiffbeforeafterboth--- a/Cargo.toml
+++ b/Cargo.toml
@@ -5,8 +5,11 @@
'pallets/*',
'client/*',
'primitives/*',
- 'runtime/*',
'crates/*',
]
+exclude = [
+ "runtime/unique",
+ "runtime/quartz"
+]
[profile.release]
panic = 'unwind'
Dockerfile-parachaindiffbeforeafterboth--- a/Dockerfile-parachain
+++ b/Dockerfile-parachain
@@ -1,5 +1,5 @@
# ===== Rust builder =====
-FROM phusion/baseimage:focal-1.0.0 as rust-builder
+FROM phusion/baseimage:focal-1.1.0 as rust-builder
LABEL maintainer="Unique.Network"
ARG RUST_TOOLCHAIN=nightly-2021-11-11
@@ -77,7 +77,7 @@
# ===== RUN ======
-FROM phusion/baseimage:focal-1.0.0
+FROM phusion/baseimage:focal-1.1.0
ARG PROFILE=release
node/cli/src/chain_spec.rsdiffbeforeafterboth--- a/node/cli/src/chain_spec.rs
+++ b/node/cli/src/chain_spec.rs
@@ -72,12 +72,12 @@
impl RuntimeIdentification for Box<dyn sc_service::ChainSpec> {
fn runtime_id(&self) -> RuntimeId {
#[cfg(feature = "unique-runtime")]
- if self.id().starts_with("unique") {
+ if self.id().starts_with("unique") || self.id().starts_with("unq") {
return RuntimeId::Unique;
}
#[cfg(feature = "quartz-runtime")]
- if self.id().starts_with("quartz") {
+ if self.id().starts_with("quartz") || self.id().starts_with("qtz") {
return RuntimeId::Quartz;
}
pallets/unique/src/eth/sponsoring.rsdiffbeforeafterboth1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617//! Implements EVM sponsoring logic via OnChargeEVMTransaction1819use crate::{Config, sponsorship::*};20use evm_coder::{Call, abi::AbiReader};21use pallet_common::{CollectionHandle, eth::map_eth_to_id};22use sp_core::H160;23use sp_std::prelude::*;24use up_sponsorship::SponsorshipHandler;25use core::marker::PhantomData;26use core::convert::TryInto;27use up_data_structs::TokenId;28use up_evm_mapping::EvmBackwardsAddressMapping;29use pallet_common::account::CrossAccountId;3031use pallet_nonfungible::erc::{UniqueNFTCall, ERC721UniqueExtensionsCall, ERC721Call};32use pallet_fungible::erc::{UniqueFungibleCall, ERC20Call};3334pub struct UniqueEthSponsorshipHandler<T: Config>(PhantomData<*const T>);35impl<T: Config> SponsorshipHandler<H160, (H160, Vec<u8>)> for UniqueEthSponsorshipHandler<T> {36 fn get_sponsor(who: &H160, call: &(H160, Vec<u8>)) -> Option<H160> {37 let collection_id = map_eth_to_id(&call.0)?;38 let collection = <CollectionHandle<T>>::new(collection_id)?;39 let sponsor = collection.sponsorship.sponsor()?.clone();40 let sponsor =41 <T as pallet_common::Config>::EvmBackwardsAddressMapping::from_account_id(sponsor);42 let who = T::CrossAccountId::from_eth(*who);43 let (method_id, mut reader) = AbiReader::new_call(&call.1).ok()?;44 match &collection.mode {45 crate::CollectionMode::NFT => {46 let call = <UniqueNFTCall<T>>::parse(method_id, &mut reader).ok()??;47 match call {48 UniqueNFTCall::ERC721UniqueExtensions(49 ERC721UniqueExtensionsCall::Transfer { token_id, .. },50 ) => {51 let token_id: TokenId = token_id.try_into().ok()?;52 withdraw_transfer::<T>(&collection, &who, &token_id).map(|()| sponsor)53 }54 UniqueNFTCall::ERC721(ERC721Call::TransferFrom { token_id, from, .. }) => {55 let token_id: TokenId = token_id.try_into().ok()?;56 let from = T::CrossAccountId::from_eth(from);57 withdraw_transfer::<T>(&collection, &from, &token_id).map(|()| sponsor)58 }59 UniqueNFTCall::ERC721(ERC721Call::Approve { token_id, .. }) => {60 let token_id: TokenId = token_id.try_into().ok()?;61 withdraw_approve::<T>(&collection, who.as_sub(), &token_id)62 .map(|()| sponsor)63 }64 _ => None,65 }66 }67 crate::CollectionMode::Fungible(_) => {68 let call = <UniqueFungibleCall<T>>::parse(method_id, &mut reader).ok()??;69 #[allow(clippy::single_match)]70 match call {71 UniqueFungibleCall::ERC20(ERC20Call::Transfer { .. }) => {72 withdraw_transfer::<T>(&collection, &who, &TokenId::default())73 .map(|()| sponsor)74 }75 UniqueFungibleCall::ERC20(ERC20Call::TransferFrom { from, .. }) => {76 let from = T::CrossAccountId::from_eth(from);77 withdraw_transfer::<T>(&collection, &from, &TokenId::default())78 .map(|()| sponsor)79 }80 UniqueFungibleCall::ERC20(ERC20Call::Approve { .. }) => {81 withdraw_approve::<T>(&collection, who.as_sub(), &TokenId::default())82 .map(|()| sponsor)83 }84 _ => None,85 }86 }87 _ => None,88 }89 }90}1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617//! Implements EVM sponsoring logic via OnChargeEVMTransaction1819use crate::{Config, sponsorship::*};20use evm_coder::{Call, abi::AbiReader};21use pallet_common::{CollectionHandle, eth::map_eth_to_id};22use sp_core::H160;23use sp_std::prelude::*;24use up_sponsorship::SponsorshipHandler;25use core::marker::PhantomData;26use core::convert::TryInto;27use up_data_structs::{TokenId, CreateItemData, CreateNftData};28use up_evm_mapping::EvmBackwardsAddressMapping;29use pallet_common::account::CrossAccountId;3031use pallet_nonfungible::erc::{32 UniqueNFTCall, ERC721UniqueExtensionsCall, ERC721MintableCall, ERC721Call,33};34use pallet_fungible::erc::{UniqueFungibleCall, ERC20Call};3536pub struct UniqueEthSponsorshipHandler<T: Config>(PhantomData<*const T>);37impl<T: Config> SponsorshipHandler<H160, (H160, Vec<u8>)> for UniqueEthSponsorshipHandler<T> {38 fn get_sponsor(who: &H160, call: &(H160, Vec<u8>)) -> Option<H160> {39 let collection_id = map_eth_to_id(&call.0)?;40 let collection = <CollectionHandle<T>>::new(collection_id)?;41 let sponsor = collection.sponsorship.sponsor()?.clone();42 let sponsor =43 <T as pallet_common::Config>::EvmBackwardsAddressMapping::from_account_id(sponsor);44 let who = T::CrossAccountId::from_eth(*who);45 let (method_id, mut reader) = AbiReader::new_call(&call.1).ok()?;46 match &collection.mode {47 crate::CollectionMode::NFT => {48 let call = <UniqueNFTCall<T>>::parse(method_id, &mut reader).ok()??;49 match call {50 UniqueNFTCall::ERC721UniqueExtensions(51 ERC721UniqueExtensionsCall::Transfer { token_id, .. },52 ) => {53 let token_id: TokenId = token_id.try_into().ok()?;54 withdraw_transfer::<T>(&collection, &who, &token_id).map(|()| sponsor)55 }56 UniqueNFTCall::ERC721Mintable(57 ERC721MintableCall::Mint { token_id, .. }58 | ERC721MintableCall::MintWithTokenUri { token_id, .. },59 ) => {60 let _token_id: TokenId = token_id.try_into().ok()?;61 withdraw_create_item::<T>(62 &collection,63 &who,64 &CreateItemData::NFT(CreateNftData::default()),65 )66 .map(|()| sponsor)67 }68 UniqueNFTCall::ERC721(ERC721Call::TransferFrom { token_id, from, .. }) => {69 let token_id: TokenId = token_id.try_into().ok()?;70 let from = T::CrossAccountId::from_eth(from);71 withdraw_transfer::<T>(&collection, &from, &token_id).map(|()| sponsor)72 }73 UniqueNFTCall::ERC721(ERC721Call::Approve { token_id, .. }) => {74 let token_id: TokenId = token_id.try_into().ok()?;75 withdraw_approve::<T>(&collection, who.as_sub(), &token_id)76 .map(|()| sponsor)77 }78 _ => None,79 }80 }81 crate::CollectionMode::Fungible(_) => {82 let call = <UniqueFungibleCall<T>>::parse(method_id, &mut reader).ok()??;83 #[allow(clippy::single_match)]84 match call {85 UniqueFungibleCall::ERC20(ERC20Call::Transfer { .. }) => {86 withdraw_transfer::<T>(&collection, &who, &TokenId::default())87 .map(|()| sponsor)88 }89 UniqueFungibleCall::ERC20(ERC20Call::TransferFrom { from, .. }) => {90 let from = T::CrossAccountId::from_eth(from);91 withdraw_transfer::<T>(&collection, &from, &TokenId::default())92 .map(|()| sponsor)93 }94 UniqueFungibleCall::ERC20(ERC20Call::Approve { .. }) => {95 withdraw_approve::<T>(&collection, who.as_sub(), &TokenId::default())96 .map(|()| sponsor)97 }98 _ => None,99 }100 }101 _ => None,102 }103 }104}pallets/unique/src/sponsorship.rsdiffbeforeafterboth--- a/pallets/unique/src/sponsorship.rs
+++ b/pallets/unique/src/sponsorship.rs
@@ -103,7 +103,7 @@
pub fn withdraw_create_item<T: Config>(
collection: &CollectionHandle<T>,
- who: &T::AccountId,
+ who: &T::CrossAccountId,
_properties: &CreateItemData,
) -> Option<()> {
if _properties.data_size() as u32 > collection.limits.sponsored_data_size() {
@@ -120,14 +120,14 @@
CreateItemData::ReFungible(_) => REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT,
});
- if let Some(last_tx_block) = <CreateItemBasket<T>>::get((collection.id, &who)) {
+ if let Some(last_tx_block) = <CreateItemBasket<T>>::get((collection.id, who.as_sub())) {
let timeout = last_tx_block + limit.into();
if block_number < timeout {
return None;
}
}
- CreateItemBasket::<T>::insert((collection.id, who.clone()), block_number);
+ CreateItemBasket::<T>::insert((collection.id, who.as_sub()), block_number);
Some(())
}
@@ -246,7 +246,12 @@
..
} => {
let (sponsor, collection) = load(*collection_id)?;
- withdraw_create_item::<T>(&collection, who, data).map(|()| sponsor)
+ withdraw_create_item::<T>(
+ &collection,
+ &T::CrossAccountId::from_sub(who.clone()),
+ data,
+ )
+ .map(|()| sponsor)
}
Call::transfer {
collection_id,
runtime/opal/src/lib.rsdiffbeforeafterboth--- a/runtime/opal/src/lib.rs
+++ b/runtime/opal/src/lib.rs
@@ -152,7 +152,7 @@
spec_name: create_runtime_str!(RUNTIME_NAME),
impl_name: create_runtime_str!(RUNTIME_NAME),
authoring_version: 1,
- spec_version: 918000,
+ spec_version: 918001,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
runtime/quartz/src/lib.rsdiffbeforeafterboth--- a/runtime/quartz/src/lib.rs
+++ b/runtime/quartz/src/lib.rs
@@ -152,7 +152,7 @@
spec_name: create_runtime_str!(RUNTIME_NAME),
impl_name: create_runtime_str!(RUNTIME_NAME),
authoring_version: 1,
- spec_version: 918000,
+ spec_version: 918001,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
runtime/unique/src/lib.rsdiffbeforeafterboth--- a/runtime/unique/src/lib.rs
+++ b/runtime/unique/src/lib.rs
@@ -151,7 +151,7 @@
spec_name: create_runtime_str!(RUNTIME_NAME),
impl_name: create_runtime_str!(RUNTIME_NAME),
authoring_version: 1,
- spec_version: 918000,
+ spec_version: 918001,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,