Skip to content

Commit 74d9787

Browse files
committed
try serialize
1 parent e945964 commit 74d9787

File tree

2 files changed

+19
-16
lines changed

2 files changed

+19
-16
lines changed

pallets/mining/eligibility/proxy/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pallet-randomness-collective-flip = { version = '2.0.0', default_features = fals
3737
pallet-transaction-payment = { version = '2.0.0', default_features = false }
3838
pallet-treasury = { version = '2.0.0', default-features = false }
3939
serde_json = '1.0.47'
40-
serde = { version = '1.0.102', optional = true, features = ['derive'] }
40+
serde = { version = '1.0.102', features = ['derive'] }
4141
sp-core = { version = '2.0.0', default_features = false }
4242
sp-io = { version = '2.0.0', default_features = false }
4343
sp-runtime = { version = '2.0.0', default_features = false }

pallets/mining/eligibility/proxy/src/lib.rs

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use frame_support::{
2121
Parameter,
2222
};
2323
use frame_system::ensure_signed;
24-
// use serde::{Serialize, Deserialize};
24+
use serde::{Serialize, Deserialize};
2525
use sp_io::hashing::blake2_128;
2626
use sp_runtime::{
2727
traits::{
@@ -56,11 +56,11 @@ pub trait Trait:
5656

5757
type BalanceOf<T> = <<T as Trait>::Currency as Currency<<T as frame_system::Trait>::AccountId>>::Balance;
5858

59-
#[derive(Encode, Decode, Clone, PartialEq, Eq)]
60-
#[cfg_attr(feature = "std", derive(Debug))]
59+
#[derive(Encode, Decode, Debug, Clone, PartialEq, Eq)]
60+
#[cfg_attr(feature = "std", derive())]
6161
pub struct MiningEligibilityProxy(pub [u8; 16]);
6262

63-
#[derive(Encode, Decode, Default, Clone, PartialEq, Debug)]
63+
#[derive(Encode, Decode, Debug, Default, Clone, PartialEq, Serialize)]
6464
#[cfg_attr(feature = "std", derive())]
6565
pub struct MiningEligibilityProxyResult<U, V, W, X> {
6666
pub proxy_claim_requestor_account_id: U, /* Supernode (proxy) account id requesting DHX rewards as proxy to
@@ -70,10 +70,13 @@ pub struct MiningEligibilityProxyResult<U, V, W, X> {
7070
pub proxy_claim_block_redeemed: X,
7171
}
7272

73-
#[derive(Encode, Decode, Default, Clone, Eq, PartialEq, Debug)]
74-
// #[derive(Encode, Decode, Default, Clone, Eq, PartialEq, Debug, Serialize)]
73+
#[derive(Encode, Decode, Debug, Default, Clone, Eq, PartialEq, Serialize)]
7574
#[cfg_attr(feature = "std", derive())]
76-
pub struct MiningEligibilityProxyClaimRewardeeData<U, V, W, X> {
75+
pub struct MiningEligibilityProxyClaimRewardeeData<T, U, V, W, X> where
76+
<T as frame_system::Trait>::AccountId: Serialize,
77+
<<T as Trait>::Currency as Currency<<T as frame_system::Trait>::AccountId>>::Balance: Serialize,
78+
<T as frame_system::Trait>::BlockNumber: Serialize,
79+
{
7780
pub proxy_claim_rewardee_account_id: U, // Rewardee miner associated with supernode (proxy) account id
7881
pub proxy_claim_reward_amount: V, // Reward in DHX tokens for specific rewardee miner
7982
pub proxy_claim_start_block: W, // Start block associated with mining claim
@@ -409,10 +412,10 @@ impl<T: Trait> Module<T> {
409412
"Latest field proxy_claim_total_reward_amount {:#?}",
410413
_mining_eligibility_proxy_result.proxy_claim_total_reward_amount
411414
);
412-
// debug::info!(
413-
// "Latest field proxy_claim_rewardees_data {:#?}",
414-
// serde_json::to_string_pretty(&_mining_eligibility_proxy_result.proxy_claim_rewardees_data)
415-
// );
415+
debug::info!(
416+
"Latest field proxy_claim_rewardees_data {:#?}",
417+
serde_json::to_string_pretty(&_mining_eligibility_proxy_result.proxy_claim_rewardees_data)
418+
);
416419
debug::info!(
417420
"Latest field proxy_claim_block_redeemed {:#?}",
418421
_mining_eligibility_proxy_result.proxy_claim_block_redeemed
@@ -448,10 +451,10 @@ impl<T: Trait> Module<T> {
448451
"Inserted field proxy_claim_total_reward_amount {:#?}",
449452
_mining_eligibility_proxy_result.proxy_claim_total_reward_amount
450453
);
451-
// debug::info!(
452-
// "Inserted field proxy_claim_rewardees_data {:#?}",
453-
// serde_json::to_string_pretty(&_mining_eligibility_proxy_result.proxy_claim_rewardees_data)
454-
// );
454+
debug::info!(
455+
"Inserted field proxy_claim_rewardees_data {:#?}",
456+
serde_json::to_string_pretty(&_mining_eligibility_proxy_result.proxy_claim_rewardees_data)
457+
);
455458
debug::info!(
456459
"Inserted field proxy_claim_block_redeemed {:#?}",
457460
_mining_eligibility_proxy_result.proxy_claim_block_redeemed

0 commit comments

Comments
 (0)