@@ -561,6 +561,30 @@ pub mod pallet {
561
561
562
562
#[ pallet:: call]
563
563
impl < T : Config > Pallet < T > {
564
+ /// Wrapper around _legacy-like_ `unbond_and_unstake`.
565
+ ///
566
+ /// Used to support legacy Ledger users so they can start the unlocking process for their funds.
567
+ #[ pallet:: call_index( 4 ) ]
568
+ #[ pallet:: weight( T :: WeightInfo :: unlock( ) ) ]
569
+ pub fn unbond_and_unstake (
570
+ origin : OriginFor < T > ,
571
+ _contract_id : T :: SmartContract ,
572
+ #[ pallet:: compact] value : Balance ,
573
+ ) -> DispatchResult {
574
+ // Once new period begins, all stakes are reset to zero, so all it remains to be done is the `unlock`
575
+ Self :: unlock ( origin, value)
576
+ }
577
+
578
+ /// Wrapper around _legacy-like_ `withdraw_unbonded`.
579
+ ///
580
+ /// Used to support legacy Ledger users so they can reclaim unlocked chunks back into
581
+ /// their _transferable_ free balance.
582
+ #[ pallet:: call_index( 5 ) ]
583
+ #[ pallet:: weight( T :: WeightInfo :: claim_unlocked( T :: MaxNumberOfStakedContracts :: get( ) ) ) ]
584
+ pub fn withdraw_unbonded ( origin : OriginFor < T > ) -> DispatchResultWithPostInfo {
585
+ Self :: claim_unlocked ( origin)
586
+ }
587
+
564
588
/// Used to enable or disable maintenance mode.
565
589
/// Can only be called by manager origin.
566
590
#[ pallet:: call_index( 0 ) ]
@@ -706,7 +730,7 @@ pub mod pallet {
706
730
/// This doesn't remove the dApp completely from the system just yet, but it can no longer be used for staking.
707
731
///
708
732
/// Can be called by dApp staking manager origin.
709
- #[ pallet:: call_index( 4 ) ]
733
+ #[ pallet:: call_index( 6 ) ]
710
734
#[ pallet:: weight( T :: WeightInfo :: unregister( ) ) ]
711
735
pub fn unregister (
712
736
origin : OriginFor < T > ,
@@ -744,7 +768,7 @@ pub mod pallet {
744
768
/// After adjustment, lock amount must be greater than zero and in total must be equal or greater than the minimum locked amount.
745
769
///
746
770
/// Locked amount can immediately be used for staking.
747
- #[ pallet:: call_index( 5 ) ]
771
+ #[ pallet:: call_index( 7 ) ]
748
772
#[ pallet:: weight( T :: WeightInfo :: lock( ) ) ]
749
773
pub fn lock ( origin : OriginFor < T > , #[ pallet:: compact] amount : Balance ) -> DispatchResult {
750
774
Self :: ensure_pallet_enabled ( ) ?;
@@ -783,7 +807,7 @@ pub mod pallet {
783
807
/// Only the amount that isn't actively used for staking can be unlocked.
784
808
/// If the amount is greater than the available amount for unlocking, everything is unlocked.
785
809
/// If the remaining locked amount would take the account below the minimum locked amount, everything is unlocked.
786
- #[ pallet:: call_index( 6 ) ]
810
+ #[ pallet:: call_index( 8 ) ]
787
811
#[ pallet:: weight( T :: WeightInfo :: unlock( ) ) ]
788
812
pub fn unlock ( origin : OriginFor < T > , #[ pallet:: compact] amount : Balance ) -> DispatchResult {
789
813
Self :: ensure_pallet_enabled ( ) ?;
@@ -836,7 +860,7 @@ pub mod pallet {
836
860
}
837
861
838
862
/// Claims all of fully unlocked chunks, removing the lock from them.
839
- #[ pallet:: call_index( 7 ) ]
863
+ #[ pallet:: call_index( 9 ) ]
840
864
#[ pallet:: weight( T :: WeightInfo :: claim_unlocked( T :: MaxNumberOfStakedContracts :: get( ) ) ) ]
841
865
pub fn claim_unlocked ( origin : OriginFor < T > ) -> DispatchResultWithPostInfo {
842
866
Self :: ensure_pallet_enabled ( ) ?;
@@ -866,7 +890,7 @@ pub mod pallet {
866
890
Ok ( Some ( T :: WeightInfo :: claim_unlocked ( removed_entries) ) . into ( ) )
867
891
}
868
892
869
- #[ pallet:: call_index( 8 ) ]
893
+ #[ pallet:: call_index( 10 ) ]
870
894
#[ pallet:: weight( T :: WeightInfo :: relock_unlocking( ) ) ]
871
895
pub fn relock_unlocking ( origin : OriginFor < T > ) -> DispatchResult {
872
896
Self :: ensure_pallet_enabled ( ) ?;
@@ -903,7 +927,7 @@ pub mod pallet {
903
927
/// and same for `Build&Earn` subperiod.
904
928
///
905
929
/// Staked amount is only eligible for rewards from the next era onwards.
906
- #[ pallet:: call_index( 9 ) ]
930
+ #[ pallet:: call_index( 11 ) ]
907
931
#[ pallet:: weight( T :: WeightInfo :: stake( ) ) ]
908
932
pub fn stake (
909
933
origin : OriginFor < T > ,
@@ -1030,7 +1054,7 @@ pub mod pallet {
1030
1054
/// In case amount is unstaked during `Voting` subperiod, the `voting` amount is reduced.
1031
1055
/// In case amount is unstaked during `Build&Earn` subperiod, first the `build_and_earn` is reduced,
1032
1056
/// and any spillover is subtracted from the `voting` amount.
1033
- #[ pallet:: call_index( 10 ) ]
1057
+ #[ pallet:: call_index( 12 ) ]
1034
1058
#[ pallet:: weight( T :: WeightInfo :: unstake( ) ) ]
1035
1059
pub fn unstake (
1036
1060
origin : OriginFor < T > ,
@@ -1132,7 +1156,7 @@ pub mod pallet {
1132
1156
1133
1157
/// Claims some staker rewards, if user has any.
1134
1158
/// In the case of a successfull call, at least one era will be claimed, with the possibility of multiple claims happening.
1135
- #[ pallet:: call_index( 11 ) ]
1159
+ #[ pallet:: call_index( 13 ) ]
1136
1160
#[ pallet:: weight( {
1137
1161
let max_span_length = T :: EraRewardSpanLength :: get( ) ;
1138
1162
T :: WeightInfo :: claim_staker_rewards_ongoing_period( max_span_length)
@@ -1226,7 +1250,7 @@ pub mod pallet {
1226
1250
}
1227
1251
1228
1252
/// Used to claim bonus reward for a smart contract, if eligible.
1229
- #[ pallet:: call_index( 12 ) ]
1253
+ #[ pallet:: call_index( 14 ) ]
1230
1254
#[ pallet:: weight( T :: WeightInfo :: claim_bonus_reward( ) ) ]
1231
1255
pub fn claim_bonus_reward (
1232
1256
origin : OriginFor < T > ,
@@ -1291,7 +1315,7 @@ pub mod pallet {
1291
1315
}
1292
1316
1293
1317
/// Used to claim dApp reward for the specified era.
1294
- #[ pallet:: call_index( 13 ) ]
1318
+ #[ pallet:: call_index( 15 ) ]
1295
1319
#[ pallet:: weight( T :: WeightInfo :: claim_dapp_reward( ) ) ]
1296
1320
pub fn claim_dapp_reward (
1297
1321
origin : OriginFor < T > ,
@@ -1347,7 +1371,7 @@ pub mod pallet {
1347
1371
1348
1372
/// Used to unstake funds from a contract that was unregistered after an account staked on it.
1349
1373
/// This is required if staker wants to re-stake these funds on another active contract during the ongoing period.
1350
- #[ pallet:: call_index( 14 ) ]
1374
+ #[ pallet:: call_index( 16 ) ]
1351
1375
#[ pallet:: weight( T :: WeightInfo :: unstake_from_unregistered( ) ) ]
1352
1376
pub fn unstake_from_unregistered (
1353
1377
origin : OriginFor < T > ,
@@ -1416,7 +1440,7 @@ pub mod pallet {
1416
1440
/// Entry is considered to be expired if:
1417
1441
/// 1. It's from a past period & the account wasn't a loyal staker, meaning there's no claimable bonus reward.
1418
1442
/// 2. It's from a period older than the oldest claimable period, regardless whether the account was loyal or not.
1419
- #[ pallet:: call_index( 15 ) ]
1443
+ #[ pallet:: call_index( 17 ) ]
1420
1444
#[ pallet:: weight( T :: WeightInfo :: cleanup_expired_entries(
1421
1445
T :: MaxNumberOfStakedContracts :: get( )
1422
1446
) ) ]
@@ -1481,7 +1505,7 @@ pub mod pallet {
1481
1505
/// Not intended to be used in production, except in case of unforseen circumstances.
1482
1506
///
1483
1507
/// Can only be called by manager origin.
1484
- #[ pallet:: call_index( 16 ) ]
1508
+ #[ pallet:: call_index( 18 ) ]
1485
1509
#[ pallet:: weight( T :: WeightInfo :: force( ) ) ]
1486
1510
pub fn force ( origin : OriginFor < T > , forcing_type : ForcingType ) -> DispatchResult {
1487
1511
Self :: ensure_pallet_enabled ( ) ?;
0 commit comments