-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix dependencies #20
fix dependencies #20
Changes from all commits
50e8ae7
cfb660d
93d00b7
c71011f
90c5ad4
d5a7d32
e5bfaa6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
[workspace] | ||
resolver = "2" | ||
members = [ | ||
'pallets/bitcoin-vaults', | ||
'pallets/confidential-docs', | ||
'pallets/rbac', | ||
'pallets/fruniques', | ||
'pallets/gated-marketplace', | ||
'pallets/mapped-assets', | ||
'pallets/afloat', | ||
'pallets/fund-admin', | ||
'pallets/fund-admin-records', | ||
'pallets/bitcoin-vaults', | ||
'pallets/confidential-docs', | ||
'pallets/rbac', | ||
'pallets/fruniques', | ||
'pallets/gated-marketplace', | ||
'pallets/mapped-assets', | ||
'pallets/afloat', | ||
'pallets/fund-admin', | ||
'pallets/fund-admin-records', | ||
] | ||
|
||
[profile.release] | ||
panic = 'unwind' |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,7 +64,7 @@ impl<T: Config> Pallet<T> { | |
AfloatCollectionId::<T>::put(collection_id); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
Ok(()) | ||
} else { | ||
return Err(Error::<T>::FailedToCreateFruniquesCollection.into()); | ||
return Err(Error::<T>::FailedToCreateFruniquesCollection.into()) | ||
} | ||
} | ||
|
||
|
@@ -461,8 +461,8 @@ impl<T: Config> Pallet<T> { | |
); | ||
//ensure user has enough afloat balance | ||
ensure!( | ||
Self::do_get_afloat_balance(who.clone()) | ||
>= offer.price_per_credit * tax_credit_amount.into(), | ||
Self::do_get_afloat_balance(who.clone()) >= | ||
offer.price_per_credit * tax_credit_amount.into(), | ||
Error::<T>::NotEnoughAfloatBalanceAvailable | ||
); | ||
let zero_balance: T::Balance = Zero::zero(); | ||
|
@@ -609,7 +609,7 @@ impl<T: Config> Pallet<T> { | |
let tax_credit_amount_u32 = if let Ok(amount) = transaction.tax_credit_amount.try_into() { | ||
amount | ||
} else { | ||
return Err(Error::<T>::TaxCreditAmountOverflow.into()); | ||
return Err(Error::<T>::TaxCreditAmountOverflow.into()) | ||
}; | ||
|
||
let child_offer_id = pallet_gated_marketplace::Pallet::<T>::do_enlist_sell_offer( | ||
|
@@ -713,7 +713,7 @@ impl<T: Config> Pallet<T> { | |
<AfloatOffers<T>>::try_mutate(offer_id, |offer| -> DispatchResult { | ||
let offer = offer.as_mut().ok_or(Error::<T>::OfferNotFound)?; | ||
if transaction.tax_credit_amount > offer.tax_credit_amount_remaining { | ||
return Err(Error::<T>::Underflow.into()); | ||
return Err(Error::<T>::Underflow.into()) | ||
} | ||
offer.tax_credit_amount_remaining = | ||
offer.tax_credit_amount_remaining - transaction.tax_credit_amount; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,6 @@ use sp_runtime::{ | |
testing::Header, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. GPT summary of afee51 - eabfa5:
|
||
traits::{BlakeTwo256, IdentityLookup}, | ||
}; | ||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>; | ||
type Block = frame_system::mocking::MockBlock<Test>; | ||
use frame_system::EnsureRoot; | ||
use system::EnsureSigned; | ||
|
@@ -26,9 +25,6 @@ parameter_types! { | |
// Configure a mock runtime to test the pallet. | ||
frame_support::construct_runtime!( | ||
pub enum Test where | ||
Block = Block, | ||
NodeBlock = Block, | ||
UncheckedExtrinsic = UncheckedExtrinsic, | ||
{ | ||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>}, | ||
GatedMarketplace: pallet_gated_marketplace::{Pallet, Call, Storage, Event<T>}, | ||
|
@@ -55,7 +51,7 @@ impl system::Config for Test { | |
type Hashing = BlakeTwo256; | ||
type AccountId = u64; | ||
type Lookup = IdentityLookup<Self::AccountId>; | ||
type Header = Header; | ||
type Block = Block; | ||
type RuntimeEvent = RuntimeEvent; | ||
type BlockHashCount = BlockHashCount; | ||
type Version = (); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,7 +33,7 @@ impl<T: Config> Pallet<T> { | |
vault_members.clone().into_iter().try_for_each(|acc| { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. GPT summary of 046dcc - a963f9:
|
||
// check if all users have an xpub | ||
if !<XpubsByOwner<T>>::contains_key(acc.clone()) { | ||
return Err(Error::<T>::XPubNotFound); | ||
return Err(Error::<T>::XPubNotFound) | ||
} | ||
<VaultsBySigner<T>>::try_mutate(acc, |vault_vec| vault_vec.try_push(vault_id.clone())) | ||
.map_err(|_| Error::<T>::SignerVaultLimit) | ||
|
@@ -153,8 +153,8 @@ impl<T: Config> Pallet<T> { | |
ensure!(vault.is_vault_member(&signer), Error::<T>::SignerPermissionsNeeded); | ||
// if its finalized then fire error "already finalized" or "already broadcasted" | ||
ensure!( | ||
proposal.status.eq(&ProposalStatus::Pending) | ||
|| proposal.status.eq(&ProposalStatus::Finalized), | ||
proposal.status.eq(&ProposalStatus::Pending) || | ||
proposal.status.eq(&ProposalStatus::Finalized), | ||
Error::<T>::PendingProposalRequired | ||
); | ||
// signs must be greater or equal than threshold | ||
|
@@ -265,7 +265,7 @@ impl<T: Config> Pallet<T> { | |
} | ||
} else { | ||
// xpub registered and the account doesnt own it: unavailable | ||
return XpubStatus::Taken; | ||
return XpubStatus::Taken | ||
} | ||
// Does the user owns the registered xpub? if yes, available | ||
} | ||
|
@@ -338,9 +338,9 @@ impl<T: Config> Pallet<T> { | |
pub fn get_pending_vaults() -> Vec<[u8; 32]> { | ||
<Vaults<T>>::iter() | ||
.filter_map(|(entry, vault)| { | ||
if vault.descriptors.output_descriptor.is_empty() | ||
&& (vault.offchain_status.eq(&BDKStatus::<T::VaultDescriptionMaxLen>::Pending) | ||
|| vault.offchain_status.eq( | ||
if vault.descriptors.output_descriptor.is_empty() && | ||
(vault.offchain_status.eq(&BDKStatus::<T::VaultDescriptionMaxLen>::Pending) || | ||
vault.offchain_status.eq( | ||
&BDKStatus::<T::VaultDescriptionMaxLen>::RecoverableError( | ||
BoundedVec::<u8, T::VaultDescriptionMaxLen>::default(), | ||
), | ||
|
@@ -356,11 +356,11 @@ impl<T: Config> Pallet<T> { | |
pub fn get_pending_proposals() -> Vec<[u8; 32]> { | ||
<Proposals<T>>::iter() | ||
.filter_map(|(id, proposal)| { | ||
if proposal.psbt.is_empty() | ||
&& (proposal | ||
if proposal.psbt.is_empty() && | ||
(proposal | ||
.offchain_status | ||
.eq(&BDKStatus::<T::VaultDescriptionMaxLen>::Pending) | ||
|| proposal.offchain_status.eq( | ||
.eq(&BDKStatus::<T::VaultDescriptionMaxLen>::Pending) || | ||
proposal.offchain_status.eq( | ||
&BDKStatus::<T::VaultDescriptionMaxLen>::RecoverableError( | ||
BoundedVec::<u8, T::VaultDescriptionMaxLen>::default(), | ||
), | ||
|
@@ -393,7 +393,7 @@ impl<T: Config> Pallet<T> { | |
<Proposals<T>>::iter() | ||
.filter_map(|(id, p)| { | ||
if p.can_be_finalized() { | ||
return Some(id); | ||
return Some(id) | ||
} | ||
None | ||
}) | ||
|
@@ -434,13 +434,13 @@ impl<T: Config> Pallet<T> { | |
let vec_body = response.body().collect::<Vec<u8>>(); | ||
let msj_str = | ||
str::from_utf8(vec_body.as_slice()).unwrap_or("Error 400: Bad request"); | ||
return Err(Self::build_offchain_err(false, msj_str)); | ||
return Err(Self::build_offchain_err(false, msj_str)) | ||
}, | ||
500..=599 => { | ||
let vec_body = response.body().collect::<Vec<u8>>(); | ||
let msj_str = | ||
str::from_utf8(vec_body.as_slice()).unwrap_or("Error 500: Server error"); | ||
return Err(Self::build_offchain_err(false, msj_str)); | ||
return Err(Self::build_offchain_err(false, msj_str)) | ||
}, | ||
_ => return Err(Self::build_offchain_err(true, "Unknown error")), | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -279,7 +279,7 @@ pub mod pallet { | |
// transactions without it | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. GPT summary of 67d442 - 632f22:
|
||
let signer = Signer::<T, T::AuthorityId>::any_account(); | ||
if !signer.can_sign() { | ||
return; | ||
return | ||
} | ||
|
||
// Check if this OCW can modify the vaults | ||
|
@@ -745,7 +745,7 @@ pub mod pallet { | |
let tx_res = | ||
Self::do_insert_descriptors(vault_payload.vault_id, descriptors, status); | ||
if tx_res.is_err() { | ||
return Some(tx_res); | ||
return Some(tx_res) | ||
} | ||
None | ||
}) | ||
|
@@ -775,7 +775,7 @@ pub mod pallet { | |
let tx_res = | ||
Self::do_insert_psbt(proposal_psbt.proposal_id, bounded_psbt, status); | ||
if tx_res.is_err() { | ||
return Some(tx_res); | ||
return Some(tx_res) | ||
} | ||
None | ||
}) | ||
|
@@ -826,19 +826,19 @@ pub mod pallet { | |
match call { | ||
Call::ocw_insert_descriptors { ref payload, ref signature } => { | ||
if !SignedPayload::<T>::verify::<T::AuthorityId>(payload, signature.clone()) { | ||
return InvalidTransaction::BadProof.into(); | ||
return InvalidTransaction::BadProof.into() | ||
} | ||
valid_tx(b"unsigned_extrinsic_with_signed_payload".to_vec()) | ||
}, // compiler complains if they aren't on different match arms | ||
Call::ocw_insert_psbts { ref payload, ref signature } => { | ||
if !SignedPayload::<T>::verify::<T::AuthorityId>(payload, signature.clone()) { | ||
return InvalidTransaction::BadProof.into(); | ||
return InvalidTransaction::BadProof.into() | ||
} | ||
valid_tx(b"unsigned_extrinsic_with_signed_payload".to_vec()) | ||
}, | ||
Call::ocw_finalize_psbts { ref payload, ref signature } => { | ||
if !SignedPayload::<T>::verify::<T::AuthorityId>(payload, signature.clone()) { | ||
return InvalidTransaction::BadProof.into(); | ||
return InvalidTransaction::BadProof.into() | ||
} | ||
valid_tx(b"unsigned_extrinsic_with_signed_payload".to_vec()) | ||
}, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,17 +13,13 @@ use sp_runtime::{ | |
traits::{BlakeTwo256, Extrinsic as ExtrinsicT, IdentifyAccount, IdentityLookup, Verify}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
//RuntimeAppPublic, | ||
}; | ||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>; | ||
type Block = frame_system::mocking::MockBlock<Test>; | ||
//use sp_runtime::generic::SignedPayload; | ||
use sp_core::sr25519::Signature; | ||
|
||
// Configure a mock runtime to test the pallet. | ||
frame_support::construct_runtime!( | ||
pub enum Test where | ||
Block = Block, | ||
NodeBlock = Block, | ||
UncheckedExtrinsic = UncheckedExtrinsic, | ||
{ | ||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>}, | ||
BitcoinVaults: pallet_bitcoin_vaults::{Pallet, Call, Storage, Event<T>, ValidateUnsigned}, | ||
|
@@ -113,7 +109,7 @@ impl frame_system::Config for Test { | |
type Hashing = BlakeTwo256; | ||
type AccountId = sp_core::sr25519::Public; | ||
type Lookup = IdentityLookup<Self::AccountId>; | ||
type Header = Header; | ||
type Block = Block; | ||
type RuntimeEvent = RuntimeEvent; | ||
type BlockHashCount = ConstU64<250>; | ||
type DbWeight = (); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,15 +8,11 @@ use sp_runtime::{ | |
traits::{BlakeTwo256, IdentityLookup}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
}; | ||
|
||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>; | ||
type Block = frame_system::mocking::MockBlock<Test>; | ||
|
||
// Configure a mock runtime to test the pallet. | ||
frame_support::construct_runtime!( | ||
pub enum Test where | ||
Block = Block, | ||
NodeBlock = Block, | ||
UncheckedExtrinsic = UncheckedExtrinsic, | ||
{ | ||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>}, | ||
ConfidentialDocs: pallet_confidential_docs::{Pallet, Call, Storage, Event<T>}, | ||
|
@@ -41,7 +37,7 @@ impl system::Config for Test { | |
type Hashing = BlakeTwo256; | ||
type AccountId = u64; | ||
type Lookup = IdentityLookup<Self::AccountId>; | ||
type Header = Header; | ||
type Block = Block; | ||
type RuntimeEvent = RuntimeEvent; | ||
type BlockHashCount = BlockHashCount; | ||
type Version = (); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -117,8 +117,8 @@ impl<T: Config> GroupMember<T> { | |
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
pub fn can_remove_group_member(&self, group_member: &GroupMember<T>) -> bool { | ||
group_member.role != GroupRole::Owner | ||
&& (self.role == GroupRole::Owner | ||
|| (self.role == GroupRole::Admin && group_member.authorizer == self.member)) | ||
group_member.role != GroupRole::Owner && | ||
(self.role == GroupRole::Owner || | ||
(self.role == GroupRole::Admin && group_member.authorizer == self.member)) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,13 +23,13 @@ scale-info = { default-features = false, version = "2.0.1", features = [ | |
frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. GPT summary of d76a5a - 2ee1e0:
|
||
frame-system = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } | ||
frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0", optional = true } | ||
sp-runtime = { default-features = false, version = "7.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } | ||
sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } | ||
pallet-uniques = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } | ||
pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } | ||
pallet-rbac = { path = "../rbac/", default-features = false, version = "4.0.0-dev" } | ||
|
||
[dev-dependencies] | ||
sp-core = { default-features = false, version = "7.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } | ||
sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } | ||
sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } | ||
|
||
[features] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,7 +62,7 @@ impl<T: Config> Pallet<T> { | |
) -> AttributeValue<T> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. GPT summary of 140932 - a8e637:
|
||
if let Some(a) = pallet_uniques::Pallet::<T>::attribute(class_id, instance_id, key) { | ||
return BoundedVec::<u8, T::ValueLimit>::try_from(a) | ||
.expect("Error on converting the attribute to BoundedVec"); | ||
.expect("Error on converting the attribute to BoundedVec") | ||
} | ||
BoundedVec::<u8, T::ValueLimit>::default() | ||
} | ||
|
@@ -80,14 +80,14 @@ impl<T: Config> Pallet<T> { | |
|
||
pub fn collection_exists(class_id: &T::CollectionId) -> bool { | ||
if let Some(_owner) = pallet_uniques::Pallet::<T>::collection_owner(*class_id) { | ||
return true; | ||
return true | ||
} | ||
false | ||
} | ||
|
||
pub fn instance_exists(class_id: &T::CollectionId, instance_id: &T::ItemId) -> bool { | ||
if let Some(_owner) = pallet_uniques::Pallet::<T>::owner(*class_id, *instance_id) { | ||
return true; | ||
return true | ||
} | ||
false | ||
} | ||
|
@@ -182,15 +182,15 @@ impl<T: Config> Pallet<T> { | |
where | ||
<T as pallet_uniques::Config>::ItemId: From<u32>, | ||
{ | ||
let nex_item: ItemId = <NextFrunique<T>>::try_get(collection).unwrap_or(0); | ||
<NextFrunique<T>>::insert(collection, nex_item + 1); | ||
let nex_item: ItemId = <NextFrunique<T>>::try_get(collection.clone()).unwrap_or(0); | ||
<NextFrunique<T>>::insert(collection.clone(), nex_item + 1); | ||
|
||
let item = Self::u32_to_instance_id(nex_item); | ||
pallet_uniques::Pallet::<T>::do_mint(collection, item, owner, |_| Ok(()))?; | ||
pallet_uniques::Pallet::<T>::do_mint(collection.clone(), item, owner, |_| Ok(()))?; | ||
|
||
pallet_uniques::Pallet::<T>::set_metadata( | ||
frame_system::RawOrigin::Root.into(), | ||
collection, | ||
collection.clone(), | ||
item.clone(), | ||
metadata, | ||
false, | ||
|
@@ -314,7 +314,7 @@ impl<T: Config> Pallet<T> { | |
Self::do_mint(collection, owner.clone(), metadata.clone(), attributes)?; | ||
|
||
if let Some(ref parent_info) = parent_info { | ||
return Self::do_nft_division(collection, item, metadata, parent_info, owner); | ||
return Self::do_nft_division(collection, item, metadata, parent_info, owner) | ||
} | ||
|
||
let frunique_data = FruniqueData { | ||
|
@@ -382,7 +382,7 @@ impl<T: Config> Pallet<T> { | |
verified_by: None, | ||
}; | ||
|
||
<FruniqueInfo<T>>::insert(collection, item, frunique_data); | ||
<FruniqueInfo<T>>::insert(collection.clone(), item, frunique_data); | ||
|
||
let frunique_child: ChildInfo<T> = ChildInfo { | ||
collection_id: collection, | ||
|
@@ -422,13 +422,14 @@ impl<T: Config> Pallet<T> { | |
ensure!(Self::collection_exists(&collection), Error::<T>::CollectionNotFound); | ||
ensure!(Self::instance_exists(&collection, &item), Error::<T>::FruniqueNotFound); | ||
|
||
let frunique_data: FruniqueData<T> = <FruniqueInfo<T>>::try_get(collection, item).unwrap(); | ||
let frunique_data: FruniqueData<T> = | ||
<FruniqueInfo<T>>::try_get(collection.clone(), item).unwrap(); | ||
|
||
ensure!(!frunique_data.frozen, Error::<T>::FruniqueFrozen); | ||
ensure!(!frunique_data.redeemed, Error::<T>::FruniqueAlreadyRedeemed); | ||
|
||
<FruniqueInfo<T>>::try_mutate::<_, _, _, DispatchError, _>( | ||
collection, | ||
collection.clone(), | ||
item, | ||
|frunique_data| -> DispatchResult { | ||
let frunique = frunique_data.as_mut().ok_or(Error::<T>::FruniqueNotFound)?; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GPT summary of c2a02c - fe7e2a:
resolver = "2"
to the[workspace]
sectionmembers
listpanic = 'unwind'
to the[profile.release]
section