@@ -1273,14 +1273,14 @@ impl pallet_tangle_lst::Config for Runtime {
12731273}
12741274
12751275parameter_types ! {
1276- pub const RewardsPID : PalletId = PalletId ( * b"py/tnrew" ) ;
1277- pub const MaxDepositCap : u128 = UNIT * 100_000_000 ;
1278- pub const MaxIncentiveCap : u128 = UNIT * 100_000_000 ;
1279- pub const MaxApy : Perbill = Perbill :: from_percent ( 2 ) ;
1280- pub const MinDepositCap : u128 = 0 ;
1281- pub const MinIncentiveCap : u128 = 0 ;
1282- pub const MaxVaultNameLen : u32 = 64 ;
1283- pub const MaxVaultLogoLen : u32 = 256 ;
1276+ pub const RewardsPID : PalletId = tangle_primitives :: types :: rewards :: PALLET_ID ;
1277+ pub const MaxDepositCap : Balance = tangle_primitives :: types :: rewards :: mainnet :: MAX_DEPOSIT_CAP ;
1278+ pub const MaxIncentiveCap : Balance = tangle_primitives :: types :: rewards :: mainnet :: MAX_INCENTIVE_CAP ;
1279+ pub const MaxApy : Perbill = tangle_primitives :: types :: rewards :: mainnet :: MAX_APY ;
1280+ pub const MinDepositCap : Balance = tangle_primitives :: types :: rewards :: MIN_DEPOSIT_CAP ;
1281+ pub const MinIncentiveCap : Balance = tangle_primitives :: types :: rewards :: MIN_INCENTIVE_CAP ;
1282+ pub const MaxVaultNameLen : u32 = tangle_primitives :: types :: rewards :: MAX_VAULT_NAME_LENGTH ;
1283+ pub const MaxVaultLogoLen : u32 = tangle_primitives :: types :: rewards :: MAX_VAULT_LOGO_LENGTH ;
12841284}
12851285
12861286impl pallet_rewards:: Config for Runtime {
@@ -1299,56 +1299,60 @@ impl pallet_rewards::Config for Runtime {
12991299 type MaxVaultNameLength = MaxVaultNameLen ;
13001300 type MaxVaultLogoLength = MaxVaultLogoLen ;
13011301 type VaultMetadataOrigin = EnsureRootOrHalfCouncil ;
1302- type MaxPendingRewardsPerOperator = ConstU32 < 100 > ;
1302+ type MaxPendingRewardsPerOperator =
1303+ ConstU32 < { tangle_primitives:: types:: rewards:: MAX_PENDING_REWARDS_PER_OPERATOR } > ;
13031304 type WeightInfo = ( ) ;
13041305}
13051306
13061307parameter_types ! {
1307- pub const MinOperatorBondAmount : Balance = 100 ;
1308+ pub const MinOperatorBondAmount : Balance = tangle_primitives:: multi_asset_delegation:: MIN_OPERATOR_BOND_AMOUNT ;
1309+ pub const MinDelegateAmount : Balance = tangle_primitives:: multi_asset_delegation:: MIN_DELEGATE_AMOUNT ;
1310+ pub PID : PalletId = tangle_primitives:: multi_asset_delegation:: PALLET_ID ;
13081311
1309- pub const MinDelegateAmount : Balance = 1 ;
1310- pub PID : PalletId = PalletId ( * b"PotStake" ) ;
13111312 #[ derive( PartialEq , Eq , Clone , Copy , Debug , Encode , Decode , MaxEncodedLen , TypeInfo ) ]
1312- pub const MaxDelegatorBlueprints : u32 = 50 ;
1313- #[ derive( PartialEq , Eq , Clone , Copy , Debug , Encode , Decode , MaxEncodedLen , TypeInfo ) ]
1314- pub const MaxOperatorBlueprints : u32 = 50 ;
1313+ pub const MaxDelegatorBlueprints : u32 = tangle_primitives:: multi_asset_delegation:: MAX_DELEGATOR_BLUEPRINTS ;
1314+
13151315 #[ derive( PartialEq , Eq , Clone , Copy , Debug , Encode , Decode , MaxEncodedLen , TypeInfo ) ]
1316- pub const MaxWithdrawRequests : u32 = 5 ;
1316+ pub const MaxOperatorBlueprints : u32 = tangle_primitives:: multi_asset_delegation:: MAX_OPERATOR_BLUEPRINTS ;
1317+
13171318 #[ derive( PartialEq , Eq , Clone , Copy , Debug , Encode , Decode , MaxEncodedLen , TypeInfo ) ]
1318- pub const MaxUnstakeRequests : u32 = 5 ;
1319+ pub const MaxWithdrawRequests : u32 = tangle_primitives:: multi_asset_delegation:: MAX_WITHDRAW_REQUESTS ;
1320+
13191321 #[ derive( PartialEq , Eq , Clone , Copy , Debug , Encode , Decode , MaxEncodedLen , TypeInfo ) ]
1320- pub const MaxDelegations : u32 = 50 ;
1322+ pub const MaxUnstakeRequests : u32 = tangle_primitives :: multi_asset_delegation :: MAX_UNSTAKE_REQUESTS ;
13211323
1324+ #[ derive( PartialEq , Eq , Clone , Copy , Debug , Encode , Decode , MaxEncodedLen , TypeInfo ) ]
1325+ pub const MaxDelegations : u32 = tangle_primitives:: multi_asset_delegation:: MAX_DELEGATIONS ;
13221326}
13231327
13241328#[ cfg( feature = "fast-runtime" ) ]
13251329parameter_types ! {
13261330 #[ derive( PartialEq , Eq , Clone , Copy , Debug , Encode , Decode , MaxEncodedLen , TypeInfo ) ]
1327- pub const LeaveOperatorsDelay : u32 = 1 ;
1331+ pub const LeaveOperatorsDelay : u32 = tangle_primitives :: multi_asset_delegation :: LEAVE_OPERATORS_DELAY_FAST ;
13281332
13291333 #[ derive( PartialEq , Eq , Clone , Copy , Debug , Encode , Decode , MaxEncodedLen , TypeInfo ) ]
1330- pub const LeaveDelegatorsDelay : u32 = 1 ;
1334+ pub const LeaveDelegatorsDelay : u32 = tangle_primitives :: multi_asset_delegation :: LEAVE_DELEGATORS_DELAY_FAST ;
13311335
13321336 #[ derive( PartialEq , Eq , Clone , Copy , Debug , Encode , Decode , MaxEncodedLen , TypeInfo ) ]
1333- pub const DelegationBondLessDelay : u32 = 1 ;
1337+ pub const DelegationBondLessDelay : u32 = tangle_primitives :: multi_asset_delegation :: DELEGATION_BOND_LESS_DELAY_FAST ;
13341338
13351339 #[ derive( PartialEq , Eq , Clone , Copy , Debug , Encode , Decode , MaxEncodedLen , TypeInfo ) ]
1336- pub const OperatorBondLessDelay : u32 = 1 ;
1340+ pub const OperatorBondLessDelay : u32 = tangle_primitives :: multi_asset_delegation :: OPERATOR_BOND_LESS_DELAY_FAST ;
13371341}
13381342
13391343#[ cfg( not( feature = "fast-runtime" ) ) ]
13401344parameter_types ! {
13411345 #[ derive( PartialEq , Eq , Clone , Copy , Debug , Encode , Decode , MaxEncodedLen , TypeInfo ) ]
1342- pub const LeaveOperatorsDelay : u32 = 10 ;
1346+ pub const LeaveOperatorsDelay : u32 = tangle_primitives :: multi_asset_delegation :: LEAVE_OPERATORS_DELAY ;
13431347
13441348 #[ derive( PartialEq , Eq , Clone , Copy , Debug , Encode , Decode , MaxEncodedLen , TypeInfo ) ]
1345- pub const LeaveDelegatorsDelay : u32 = 10 ;
1349+ pub const LeaveDelegatorsDelay : u32 = tangle_primitives :: multi_asset_delegation :: LEAVE_DELEGATORS_DELAY ;
13461350
13471351 #[ derive( PartialEq , Eq , Clone , Copy , Debug , Encode , Decode , MaxEncodedLen , TypeInfo ) ]
1348- pub const DelegationBondLessDelay : u32 = 5 ;
1352+ pub const DelegationBondLessDelay : u32 = tangle_primitives :: multi_asset_delegation :: DELEGATION_BOND_LESS_DELAY ;
13491353
13501354 #[ derive( PartialEq , Eq , Clone , Copy , Debug , Encode , Decode , MaxEncodedLen , TypeInfo ) ]
1351- pub const OperatorBondLessDelay : u32 = 5 ;
1355+ pub const OperatorBondLessDelay : u32 = tangle_primitives :: multi_asset_delegation :: OPERATOR_BOND_LESS_DELAY ;
13521356}
13531357
13541358impl pallet_multi_asset_delegation:: Config for Runtime {
@@ -2235,4 +2239,28 @@ impl_runtime_apis! {
22352239 Services :: service_requests_with_blueprints_by_operator( operator) . map_err( Into :: into)
22362240 }
22372241 }
2242+
2243+ impl pallet_rewards_rpc_runtime_api:: RewardsApi <Block , AccountId , AssetId , Balance > for Runtime {
2244+ fn query_user_rewards(
2245+ account_id: AccountId ,
2246+ asset_id: tangle_primitives:: services:: Asset <AssetId >,
2247+ ) -> Result <Balance , sp_runtime:: DispatchError > {
2248+ Rewards :: calculate_rewards( & account_id, asset_id)
2249+ }
2250+ }
2251+
2252+ impl pallet_credits_rpc_runtime_api:: CreditsApi <Block , AccountId , Balance , AssetId > for Runtime {
2253+ fn query_user_credits(
2254+ account_id: AccountId ,
2255+ ) -> Result <Balance , sp_runtime:: DispatchError > {
2256+ Credits :: get_accrued_amount( & account_id, None )
2257+ }
2258+
2259+ fn query_user_credits_with_asset(
2260+ account_id: AccountId ,
2261+ asset_id: AssetId ,
2262+ ) -> Result <Balance , sp_runtime:: DispatchError > {
2263+ Credits :: get_accrued_amount_for_asset( & account_id, None , asset_id)
2264+ }
2265+ }
22382266}
0 commit comments