Skip to content

Commit

Permalink
Merge pull request #109 from AurevoirXavier/fix-bug
Browse files Browse the repository at this point in the history
Fix #107 & Update `types.json`
  • Loading branch information
hackfisher authored Nov 25, 2019
2 parents 49261db + 56d5cb2 commit 51aecb1
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 47 deletions.
3 changes: 2 additions & 1 deletion srml/staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -583,13 +583,14 @@ decl_module! {
/// called by controller
fn deposit_extra(origin, value: RingBalanceOf<T>, promise_month: u32) {
let controller = ensure_signed(origin)?;
let mut ledger = Self::ledger(&controller).ok_or("not a controller")?;
if Self::ledger(&controller).is_none() { return Err("not a controller"); }

ensure!(promise_month >= 3 && promise_month <= 36, "months at least is 3 and at most is 36.");

Self::clear_mature_deposits(&controller);

let now = <timestamp::Module<T>>::now();
let mut ledger = Self::ledger(&controller).unwrap();
let StakingLedger {
stash,
active_ring,
Expand Down
108 changes: 62 additions & 46 deletions types.json
Original file line number Diff line number Diff line change
@@ -1,48 +1,64 @@
{
"EpochDuration": "u64",
"EraIndex": "u32",
"RingBalanceOf": "u128",
"KtonBalanceOf": "u128",
"ExtendedBalance": "u128",
"ValidatorPrefs": {
"unstake_threshold": "Compact<u32>",
"validator_payment_ratio": "Perbill"
},
"StakingBalance": {
"_enum": {
"Ring": "RingBalanceOf",
"Kton": "KtonBalanceOf"
}
},
"TimeDepositItem": {
"value": "Compact<RingBalanceOf>",
"start_time": "Compact<Moment>",
"expire_time": "Compact<Moment>"
},
"NormalLock": {
"amount": "u128",
"util": "Moment",
},
"StakingLock": {
"staking_amount": "u128",
"unbondings": "Vec<NormalLock>"
},
"StakingLedger": {
"stash": "AccountId",
"active_ring": "Compact<RingBalanceOf>",
"active_deposit_ring": "Compact<RingBalanceOf>",
"active_kton": "Compact<KtonBalanceOf>",
"deposit_items": "Vec<TimeDepositItem>",
"ring_staking_lock": "StakingLock",
"kton_staking_lock": "StakingLock"
},
"IndividualExposure": {
"who": "AccountId",
"value": "ExtendedBalance"
},
"Exposure": {
"total": "ExtendedBalance",
"own": "ExtendedBalance",
"others": "Vec<IndividualExposure>"
}
"EpochDuration": "u64",
"EraIndex": "u32",

"RingBalanceOf": "u128",
"KtonBalanceOf": "u128",
"ExtendedBalance": "u128",
"StakingBalance": {
"_enum": {
"Ring": "RingBalanceOf",
"Kton": "KtonBalanceOf"
}
},

"IndividualExposure": {
"who": "AccountId",
"value": "ExtendedBalance"
},
"Exposure": {
"total": "ExtendedBalance",
"own": "ExtendedBalance",
"others": "Vec<IndividualExposure>"
},

"ValidatorPrefs": {
"unstake_threshold": "Compact<u32>",
"validator_payment_ratio": "Perbill"
},

"StakingLedger": {
"stash": "AccountId",
"active_ring": "Compact<RingBalanceOf>",
"active_deposit_ring": "Compact<RingBalanceOf>",
"active_kton": "Compact<KtonBalanceOf>",
"deposit_items": "Vec<TimeDepositItem>",
"ring_staking_lock": "StakingLock",
"kton_staking_lock": "StakingLock"
},
"TimeDepositItem": {
"value": "Compact<RingBalanceOf>",
"start_time": "Compact<Moment>",
"expire_time": "Compact<Moment>"
},

"BalanceLock": {
"id": "Vec<u8>",
"withdraw_lock": "WithdrawLock",
"reasons": "WithdrawReasons"
},
"WithdrawLock": {
"_enum": {
"Normal": "NormalLock",
"WithStaking": "StakingLock"
}
},
"NormalLock": {
"amount": "u128",
"until": "Moment"
},
"StakingLock": {
"staking_amount": "u128",
"unbondings": "Vec<NormalLock>"
}
}

0 comments on commit 51aecb1

Please sign in to comment.