Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #107 & Update types.json #109

Merged
merged 4 commits into from
Nov 25, 2019
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
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>"
}
}