diff --git a/srml/staking/src/lib.rs b/srml/staking/src/lib.rs index 2ab27acae..5caa9474c 100644 --- a/srml/staking/src/lib.rs +++ b/srml/staking/src/lib.rs @@ -583,13 +583,14 @@ decl_module! { /// called by controller fn deposit_extra(origin, value: RingBalanceOf, 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 = >::now(); + let mut ledger = Self::ledger(&controller).unwrap(); let StakingLedger { stash, active_ring, diff --git a/types.json b/types.json index 7eacd5184..081c517b0 100644 --- a/types.json +++ b/types.json @@ -1,48 +1,64 @@ { - "EpochDuration": "u64", - "EraIndex": "u32", - "RingBalanceOf": "u128", - "KtonBalanceOf": "u128", - "ExtendedBalance": "u128", - "ValidatorPrefs": { - "unstake_threshold": "Compact", - "validator_payment_ratio": "Perbill" - }, - "StakingBalance": { - "_enum": { - "Ring": "RingBalanceOf", - "Kton": "KtonBalanceOf" - } - }, - "TimeDepositItem": { - "value": "Compact", - "start_time": "Compact", - "expire_time": "Compact" - }, - "NormalLock": { - "amount": "u128", - "util": "Moment", - }, - "StakingLock": { - "staking_amount": "u128", - "unbondings": "Vec" - }, - "StakingLedger": { - "stash": "AccountId", - "active_ring": "Compact", - "active_deposit_ring": "Compact", - "active_kton": "Compact", - "deposit_items": "Vec", - "ring_staking_lock": "StakingLock", - "kton_staking_lock": "StakingLock" - }, - "IndividualExposure": { - "who": "AccountId", - "value": "ExtendedBalance" - }, - "Exposure": { - "total": "ExtendedBalance", - "own": "ExtendedBalance", - "others": "Vec" - } + "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" + }, + + "ValidatorPrefs": { + "unstake_threshold": "Compact", + "validator_payment_ratio": "Perbill" + }, + + "StakingLedger": { + "stash": "AccountId", + "active_ring": "Compact", + "active_deposit_ring": "Compact", + "active_kton": "Compact", + "deposit_items": "Vec", + "ring_staking_lock": "StakingLock", + "kton_staking_lock": "StakingLock" + }, + "TimeDepositItem": { + "value": "Compact", + "start_time": "Compact", + "expire_time": "Compact" + }, + + "BalanceLock": { + "id": "Vec", + "withdraw_lock": "WithdrawLock", + "reasons": "WithdrawReasons" + }, + "WithdrawLock": { + "_enum": { + "Normal": "NormalLock", + "WithStaking": "StakingLock" + } + }, + "NormalLock": { + "amount": "u128", + "until": "Moment" + }, + "StakingLock": { + "staking_amount": "u128", + "unbondings": "Vec" + } } \ No newline at end of file