Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
695 changes: 627 additions & 68 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ An index is a short and easy-to-remember version of an address. Claiming an inde

The Recovery pallet is an M-of-N social recovery tool for users to gain access to their accounts if the private key or other authentication mechanism is lost. Through this pallet, a user is able to make calls on-behalf-of another account which they have recovered. The recovery process is protected by trusted "friends" whom the original account owner chooses. A threshold (M) out of N friends are needed to give another account access to the recoverable account.

#### [Uniques (NFTs)](https://github.com/paritytech/substrate/tree/master/frame/uniques)
#### [Uniques (NFTs)](https://github.com/paritytech/polkadot-sdk/tree/master/frame/uniques)

A simple, secure module for dealing with non-fungible assets.

Expand Down Expand Up @@ -235,7 +235,7 @@ the following:
### Pallets

The runtime in this project is constructed using many FRAME pallets that ship with the
[core Substrate repository](https://github.com/paritytech/substrate/tree/master/frame) and a
[core Substrate repository](https://github.com/paritytech/polkadot-sdk/tree/master/frame) and a
template pallet that is [defined in the `pallets`](./pallets/template/src/lib.rs) directory.

A FRAME pallet is compromised of a number of blockchain primitives:
Expand Down
2 changes: 1 addition & 1 deletion docs/learning-path.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Now that you have an idea for the environment, dive deeper into both the Rust tr
- [PolkaWallet Flutter SDK](https://github.com/polkawallet-io/sdk)
- [Front End template](https://github.com/substrate-developer-hub/substrate-front-end-template) from Parity

2. Review tooling for data caching and query -[Useful API sidecar](https://github.com/paritytech/substrate-api-sidecar) from Parity -[Awesome Substrate tools section](https://substrate.io/ecosystem/resources/awesome-substrate/#tools)
2. Review tooling for data caching and query -[Useful API sidecar](https://github.com/paritytech/polkadot-sdk-api-sidecar) from Parity -[Awesome Substrate tools section](https://substrate.io/ecosystem/resources/awesome-substrate/#tools)

### Tools and Tips

Expand Down
22 changes: 11 additions & 11 deletions docs/pallets-review/fruniques.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,34 @@

## Spawn mechanism

Taken from #1
Taken from #1

`Fruniques` is a stateful pallet. It needs to store additional data to maintain various relationships and state. We need to design/build the data structure for this additional state, as described below.

There are a few NFT protocols in the Polkadot ecosystem: https://wiki.polkadot.network/docs/learn-nft

Of these, we should build to the [`Uniques` ](https://wiki.polkadot.network/docs/learn-nft#uniques) patterns. It is the implementation from Parity and I believe the most recent. It is the only one compatible with Statemint/Statemine. We can build to multiple protocols if it makes sense, but let's start with `Uniques`.
Of these, we should build to the [`Uniques` ](https://wiki.polkadot.network/docs/learn-nft#uniques) patterns. It is the implementation from Parity and I believe the most recent. It is the only one compatible with Statemint/Statemine. We can build to multiple protocols if it makes sense, but let's start with `Uniques`.

In addition to a regular `Unique`, a [`Frunique`](https://hashed.systems/hashed-chain) needs to store a reference to the parent, a different `Unique`. There also needs to be a heuristic for specifying if metadata is inherited from the parent or not. It seems like Metadata is a set of Key:Value pairs that can be assigned at the `class` level (a group or collection of NFTs) and at the `instance` level (a single NFT).
In addition to a regular `Unique`, a [`Frunique`](https://hashed.systems/hashed-chain) needs to store a reference to the parent, a different `Unique`. There also needs to be a heuristic for specifying if metadata is inherited from the parent or not. It seems like Metadata is a set of Key:Value pairs that can be assigned at the `class` level (a group or collection of NFTs) and at the `instance` level (a single NFT).

Here's the function `set_attribute`:
https://github.com/paritytech/substrate/blob/master/frame/uniques/src/lib.rs#L959
Here's the function `set_attribute`:
https://github.com/paritytech/polkadot-sdk/blob/master/frame/uniques/src/lib.rs#L959

Let's map the cannabis lifecycle.
Let's map the cannabis lifecycle.
> NOTE: the cannabis use case may be able to be implemented with a lighter weight protocol, but it seems like it might be handy to use the same structure
1. Seeds come from a vendor as a package with a count, e.g. 100 seeds in a bag. This bag is an `InstanceId` even though it actually contains 100 seeds.
1. Seeds come from a vendor as a package with a count, e.g. 100 seeds in a bag. This bag is an `InstanceId` even though it actually contains 100 seeds.
2. Seeds that germinate get cubed; others are scrapped.
3. When a seed is cubed, it receives its own `InstanceID` (I've been calling this a `spawn` function) for the first time. The count of seeds that did germinate should be tracked, but not individually, and they are scrapped.
4. Successful cubed seeds become mother plants; perhaps through some iteration or trial/error to discover most productive mother(s).
5. Mother plants produce clones (and may produce flower directly).
7. The parent-->child relationship is well represented as a [Directed Acyclic Graph](https://hazelcast.com/glossary/directed-acyclic-graph), which is what we are building on chain.
7. The parent-->child relationship is well represented as a [Directed Acyclic Graph](https://hazelcast.com/glossary/directed-acyclic-graph), which is what we are building on chain.
8. Clones may be sold directly to clone buyers.
7. Clones produce flower, measured in weight. When flower is harvested, the weight values of the material are recorded as continuous value. So the `InstanceId` would map this specific `bag of weed`, and there would also be a data element for weight.
7. Clones produce flower, measured in weight. When flower is harvested, the weight values of the material are recorded as continuous value. So the `InstanceId` would map this specific `bag of weed`, and there would also be a data element for weight.

The sum of this continuous value for all peers should always equal the continuous value of the parent. This is a critical feature that maintains the economic hierarchy of the NFTs. Tax credits can be subdivided based on this continuous value, but just like the weed, none can be lost or compromised along the way. This feature - the `NFT Rollup` enables many use cases.
The sum of this continuous value for all peers should always equal the continuous value of the parent. This is a critical feature that maintains the economic hierarchy of the NFTs. Tax credits can be subdivided based on this continuous value, but just like the weed, none can be lost or compromised along the way. This feature - the `NFT Rollup` enables many use cases.

9. Flower gets tested, and results are implied across that entire harvest/mother? The test results include a set of files and also a set of values. We need a structure to assign this data/metadata across the appropriate `InstanceIds`.
10. Flower is sold to dispensaries.
10. Flower is sold to dispensaries.

- [ ] Research and prototype a pallet data storage mapping to hold the appropriate data to maintain the hierarchy and enforce the aggregation rules.

Expand Down
25 changes: 13 additions & 12 deletions pallets/afloat/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,26 @@ log = "0.4"
codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false }
serde = { version = "1.0.140", default-features = false, features = ["derive"] }
scale-info = { version = "2.5.0", default-features = false, features = [
"derive"
"derive",
] }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false }
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false, optional = true }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false }
pallet-uniques = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false }
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false }
pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false }
frame-support = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false }
frame-system = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false }
frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false, optional = true }
sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false }
pallet-uniques = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false }
pallet-balances = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false }
pallet-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false }
pallet-fruniques = { path = "../fruniques", default-features = false, version = "0.1.0-dev" }
pallet-rbac = { path = "../rbac/", default-features = false, version = "4.0.0-dev" }
pallet-gated-marketplace = { path = "../gated-marketplace/", default-features = false, version = "4.0.0-dev" }
pallet-mapped-assets = { path = "../mapped-assets/", default-features = false, version = "4.0.0-dev" }
sp-io = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false }

[dev-dependencies]
sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sp-core = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1" }
sp-io = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1" }
sp-runtime = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1" }
sp-std = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1" }

[features]
default = ["std"]
Expand Down
3 changes: 2 additions & 1 deletion pallets/afloat/src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ use pallet_gated_marketplace::types::{Marketplace, MarketplaceRole};
use sp_runtime::{traits::StaticLookup, Permill};
// use frame_support::traits::OriginTrait;
use core::convert::TryInto;
use frame_support::{sp_io::hashing::blake2_256, traits::Time};
use frame_support::traits::Time;
use pallet_rbac::types::{IdOrVec, RoleBasedAccessControl, RoleId};
use scale_info::prelude::vec;
use sp_io::hashing::blake2_256;
use sp_runtime::{
sp_std::{str, vec::Vec},
traits::Zero,
Expand Down
2 changes: 1 addition & 1 deletion pallets/afloat/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub mod pallet {
use frame_system::{pallet_prelude::*, RawOrigin};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GPT summary of 23cf5d - d08de7:

  • Changed the value of the constant STORAGE_VERSION from 1 to 0.

use pallet_fruniques::types::{Attributes, CollectionDescription, FruniqueRole, ParentInfo};
use pallet_gated_marketplace::types::*;
const STORAGE_VERSION: StorageVersion = StorageVersion::new(1);
const STORAGE_VERSION: StorageVersion = StorageVersion::new(0);

use crate::types::*;
use pallet_rbac::types::RoleBasedAccessControl;
Expand Down
13 changes: 9 additions & 4 deletions pallets/afloat/src/mock.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate as pallet_afloat;
use crate::{self as pallet_afloat, types::InitialSetupArgs};
use frame_support::{
parameter_types,
traits::{AsEnsureOriginWithArg, ConstU128, ConstU32, ConstU64, Currency},
traits::{AsEnsureOriginWithArg, ConstU32, ConstU64, Currency},
};
use frame_system as system;
use sp_core::H256;
Expand Down Expand Up @@ -167,6 +167,7 @@ impl pallet_balances::Config for Test {
type FreezeIdentifier = ();
type MaxHolds = ();
type MaxFreezes = ();
type RuntimeFreezeReason = ();
}

parameter_types! {
Expand Down Expand Up @@ -207,9 +208,13 @@ pub trait AssetsCallback<AssetId, AccountId> {

pub struct AssetsCallbackHandle;
impl pallet_mapped_assets::AssetsCallback<u32, u64> for AssetsCallbackHandle {
fn created(_id: &AssetId, _owner: &u64) -> Result<(), ()> {}
fn created(_id: &AssetId, _owner: &u64) -> Result<(), ()> {
Ok(())
}

fn destroyed(_id: &AssetId) -> Result<(), ()> {}
fn destroyed(_id: &AssetId) -> Result<(), ()> {
Ok(())
}
}

impl pallet_mapped_assets::Config for Test {
Expand Down
3 changes: 2 additions & 1 deletion pallets/afloat/src/types.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use super::*;
use frame_support::{pallet_prelude::*, sp_io::hashing::blake2_256};
use frame_support::pallet_prelude::*;
use pallet_fruniques::types::FruniqueRole;
use sp_io::hashing::blake2_256;
use sp_runtime::sp_std::vec::Vec;

pub type ShortString = BoundedVec<u8, ConstU32<55>>;
Expand Down
20 changes: 10 additions & 10 deletions pallets/bitcoin-vaults/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ codec = { package = "parity-scale-codec", version = "3.6.1", default-features =
serde = { version = "1.0.140", default-features = false, features = ["derive"] }
lite-json = { version = "0.2", default-features = false }
scale-info = { version = "2.5.0", default-features = false, features = [
"derive"
"derive",
] }
frame-support = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false }
frame-system = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false }
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false, optional = true }
sp-core = { version = "21.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false }
sp-io = { version = "23.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false }
sp-runtime = { version = "24.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false }
sp-std = { version = "8.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false }
sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false, optional = true }
frame-support = { version = "4.0.0-dev", git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false }
frame-system = { version = "4.0.0-dev", git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false }
frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false, optional = true }
sp-core = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false }
sp-io = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false }
sp-std = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false }
sp-keystore = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false, optional = true }

[dev-dependencies]
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false }
pallet-balances = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false }

[features]
default = ["std"]
Expand Down
3 changes: 2 additions & 1 deletion pallets/bitcoin-vaults/src/functions.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::*;
use crate::types::*;
use frame_support::{pallet_prelude::*, sp_io::hashing::blake2_256};
use frame_support::pallet_prelude::*;
use frame_system::{
offchain::{SendUnsignedTransaction, Signer},
pallet_prelude::BlockNumberFor,
Expand All @@ -9,6 +9,7 @@ use lite_json::{
json::{JsonValue, NumberValue},
parse_json, Serialize as jsonSerialize,
};
use sp_io::hashing::blake2_256;
use sp_runtime::{
offchain::{http, Duration},
sp_std::{str, vec::Vec},
Expand Down
6 changes: 4 additions & 2 deletions pallets/bitcoin-vaults/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ pub mod pallet {
//#[cfg(feature = "std")]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GPT summary of 4f80e0 - 6c66f6:

  • Removed use frame_support::serde::{Deserialize, Serialize};
  • Added use sp_io::hashing::blake2_256;
  • Changed StorageVersion from 1 to 0
  • Added GenesisConfig struct

//use frame_support::serde::{Deserialize, Serialize};
use crate::types::*;
use frame_support::{pallet_prelude::BoundedVec, sp_io::hashing::blake2_256, traits::Get};
use frame_support::{pallet_prelude::BoundedVec, traits::Get};
use frame_system::{
offchain::{AppCrypto, CreateSignedTransaction, SignedPayload, Signer},
pallet_prelude::*,
};
use sp_io::hashing::blake2_256;
use sp_runtime::{
offchain::{
storage_lock::{BlockAndTime, StorageLock},
Expand All @@ -34,9 +35,10 @@ pub mod pallet {
transaction_validity::{InvalidTransaction, TransactionValidity, ValidTransaction},
};

const STORAGE_VERSION: StorageVersion = StorageVersion::new(1);
const STORAGE_VERSION: StorageVersion = StorageVersion::new(0);

/* --- Genesis Structs Section --- */

#[pallet::genesis_config]
pub struct GenesisConfig<T: Config> {
pub bdk_services_url: Vec<u8>,
Expand Down
1 change: 1 addition & 0 deletions pallets/bitcoin-vaults/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ impl pallet_balances::Config for Test {
type FreezeIdentifier = ();
type MaxHolds = ();
type MaxFreezes = ();
type RuntimeFreezeReason = ();
}

parameter_types! {
Expand Down
3 changes: 2 additions & 1 deletion pallets/bitcoin-vaults/src/types.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use super::*;
use frame_support::{pallet_prelude::*, sp_io::hashing::blake2_256};
use frame_support::pallet_prelude::*;
use frame_system::offchain::{SignedPayload, SigningTypes};
use sp_core::crypto::KeyTypeId;
use sp_io::hashing::blake2_256;
use sp_runtime::sp_std::vec::Vec;

pub type Description<T> = BoundedVec<u8, <T as Config>::VaultDescriptionMaxLen>;
Expand Down
15 changes: 8 additions & 7 deletions pallets/confidential-docs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,17 @@ targets = ["x86_64-unknown-linux-gnu"]
[dependencies]
codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false }
scale-info = { version = "2.5.0", default-features = false, features = [
"derive"
"derive",
] }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false }
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false, optional = true }
frame-support = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false }
frame-system = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false }
frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false, optional = true }
sp-io = { version = "23.0.0", git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false }

[dev-dependencies]
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false }
sp-core = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false }
sp-io = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false }

[features]
default = ["std"]
Expand Down
3 changes: 2 additions & 1 deletion pallets/confidential-docs/src/functions.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use super::*;
use frame_support::{pallet_prelude::*, sp_io::hashing::blake2_256};
use frame_support::pallet_prelude::*;
use sp_io::hashing::blake2_256;
//use frame_system::pallet_prelude::*;
use crate::types::*;

Expand Down
2 changes: 1 addition & 1 deletion pallets/confidential-docs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub mod pallet {
use frame_support::pallet_prelude::*;
use frame_system::pallet_prelude::*;

const STORAGE_VERSION: StorageVersion = StorageVersion::new(1);
const STORAGE_VERSION: StorageVersion = StorageVersion::new(0);

#[pallet::config]
pub trait Config: frame_system::Config {
Expand Down
Loading