Skip to content

Commit

Permalink
Add metadata for front end (#219)
Browse files Browse the repository at this point in the history
  • Loading branch information
AurevoirXavier authored Jan 18, 2023
1 parent 5aaffee commit 2301211
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions pallet/account-migration/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ use pallet_vesting::VestingInfo;
use sp_core::sr25519::{Public, Signature};
use sp_runtime::{
traits::{IdentityLookup, Verify},
AccountId32,
AccountId32, RuntimeDebug,
};
use sp_std::prelude::*;

Expand Down Expand Up @@ -126,7 +126,7 @@ pub mod pallet {
// The size of encoded `pallet_asset::AssetAccount` is 18 bytes.
#[pallet::storage]
#[pallet::getter(fn kton_account_of)]
pub type KtonAccounts<T: Config> = StorageMap<_, Blake2_128Concat, AccountId32, [u8; 18]>;
pub type KtonAccounts<T: Config> = StorageMap<_, Blake2_128Concat, AccountId32, AssetAccount>;

/// [`pallet_vesting::Vesting`] data.
///
Expand Down Expand Up @@ -308,6 +308,29 @@ pub mod pallet {
}
pub use pallet::*;

// Copy from <https://github.dev/paritytech/substrate/blob/polkadot-v0.9.30/frame/assets/src/types.rs#L115>.
// Due to its visibility.
#[allow(missing_docs)]
#[derive(PartialEq, Eq, Encode, Decode, MaxEncodedLen, TypeInfo, RuntimeDebug)]
pub struct AssetAccount {
balance: Balance,
is_frozen: bool,
reason: ExistenceReason,
extra: (),
}
#[allow(missing_docs)]
#[derive(PartialEq, Eq, Encode, Decode, MaxEncodedLen, TypeInfo, RuntimeDebug)]
pub enum ExistenceReason {
#[codec(index = 0)]
Consumer,
#[codec(index = 1)]
Sufficient,
#[codec(index = 2)]
DepositHeld(Balance),
#[codec(index = 3)]
DepositRefunded,
}

/// Build a Darwinia account migration message.
pub fn sr25519_signable_message(spec_name: &[u8], account_id_20: &AccountId20) -> Vec<u8> {
[
Expand Down

0 comments on commit 2301211

Please sign in to comment.