difftreelog
fix PR
in: master
2 files changed
pallets/common/src/erc.rsdiffbeforeafterboth--- a/pallets/common/src/erc.rs
+++ b/pallets/common/src/erc.rs
@@ -285,11 +285,11 @@
let limits = &self.collection.limits;
Ok(vec![
- eth::CollectionLimit::from_opt_int(
+ eth::CollectionLimit::new(
eth::CollectionLimitField::AccountTokenOwnership,
limits.account_token_ownership_limit,
),
- eth::CollectionLimit::from_opt_int(
+ eth::CollectionLimit::new(
eth::CollectionLimitField::SponsoredDataSize,
limits.sponsored_data_size,
),
@@ -297,7 +297,7 @@
.sponsored_data_rate_limit
.and_then(|limit| {
if let SponsoringRateLimit::Blocks(blocks) = limit {
- Some(eth::CollectionLimit::from_int(
+ Some(eth::CollectionLimit::new::<u32>(
eth::CollectionLimitField::SponsoredDataRateLimit,
blocks,
))
@@ -305,31 +305,28 @@
None
}
})
- .unwrap_or(eth::CollectionLimit::from_int(
+ .unwrap_or(eth::CollectionLimit::new::<u32>(
eth::CollectionLimitField::SponsoredDataRateLimit,
Default::default(),
)),
- eth::CollectionLimit::from_opt_int(
- eth::CollectionLimitField::TokenLimit,
- limits.token_limit,
- ),
- eth::CollectionLimit::from_opt_int(
+ eth::CollectionLimit::new(eth::CollectionLimitField::TokenLimit, limits.token_limit),
+ eth::CollectionLimit::new(
eth::CollectionLimitField::SponsorTransferTimeout,
limits.sponsor_transfer_timeout,
),
- eth::CollectionLimit::from_opt_int(
+ eth::CollectionLimit::new(
eth::CollectionLimitField::SponsorApproveTimeout,
limits.sponsor_approve_timeout,
),
- eth::CollectionLimit::from_opt_bool(
+ eth::CollectionLimit::new(
eth::CollectionLimitField::OwnerCanTransfer,
limits.owner_can_transfer,
),
- eth::CollectionLimit::from_opt_bool(
+ eth::CollectionLimit::new(
eth::CollectionLimitField::OwnerCanDestroy,
limits.owner_can_destroy,
),
- eth::CollectionLimit::from_opt_bool(
+ eth::CollectionLimit::new(
eth::CollectionLimitField::TransferEnabled,
limits.transfers_enabled,
),
pallets/common/src/eth.rsdiffbeforeafterboth97 }97 }98}98}99100impl From<bool> for OptionUint {101 fn from(value: bool) -> Self {102 Self {103 status: true,104 value: if value {105 uint256::from(1)106 } else {107 Default::default()108 },109 }110 }111}99112100impl From<Option<bool>> for OptionUint {113impl From<Option<bool>> for OptionUint {101 fn from(value: Option<bool>) -> Self {114 fn from(value: Option<bool>) -> Self {102 match value {115 match value {103 Some(value) => Self {116 Some(value) => Self::from(value),104 status: true,105 value: if value {106 uint256::from(1)107 } else {108 Default::default()109 },110 },111 None => Self {117 None => Self {112 status: false,118 status: false,113 value: Default::default(),119 value: Default::default(),241}247}242248243impl CollectionLimit {249impl CollectionLimit {244 /// Make [`CollectionLimit`] from [`CollectionLimitField`] and int value.250 /// Create [`CollectionLimit`] from field and value.245 pub fn from_int(field: CollectionLimitField, value: u32) -> Self {251 pub fn new<T>(field: CollectionLimitField, value: T) -> Self246 Self {252 where247 field,248 value: value.into(),249 }250 }251252 /// Make [`CollectionLimit`] from [`CollectionLimitField`] and optional int value.253 pub fn from_opt_int(field: CollectionLimitField, value: Option<u32>) -> Self {253 OptionUint: From<T>,254 Self {255 field,256 value: value.into(),257 }258 }259260 /// Make [`CollectionLimit`] from [`CollectionLimitField`] and bool value.261 pub fn from_opt_bool(field: CollectionLimitField, value: Option<bool>) -> Self {254 {262 Self {255 Self {263 field,256 field,264 value: value.into(),257 value: value.into(),