Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
1xstj committed Jan 29, 2025
1 parent d4e1d6a commit dd99823
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
8 changes: 4 additions & 4 deletions pallets/rewards/src/functions/rewards.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ impl<T: Config> Pallet<T> {
original_apy: Percent,
) -> Option<Percent> {
if deposit_cap.is_zero() {
return None
return None;
}

let propotion = Percent::from_rational(total_deposit, deposit_cap);
Expand All @@ -195,7 +195,7 @@ impl<T: Config> Pallet<T> {
pub fn calculate_reward_per_block(total_reward: BalanceOf<T>) -> Option<BalanceOf<T>> {
let apy_blocks = ApyBlocks::<T>::get();
if apy_blocks.is_zero() {
return None
return None;
}

log::debug!("calculate_reward_per_block : total_reward: {:?}", total_reward);
Expand All @@ -214,7 +214,7 @@ impl<T: Config> Pallet<T> {

// If we haven't reached the decay period yet, no decay
if blocks_since_last_claim <= start_period {
return Percent::from_percent(100)
return Percent::from_percent(100);
}

let decay_rate = DecayRate::<T>::get();
Expand Down Expand Up @@ -260,7 +260,7 @@ impl<T: Config> Pallet<T> {
let deposit_cap = reward.deposit_cap;

if reward.incentive_cap > total_deposit {
return Err(Error::<T>::TotalDepositLessThanIncentiveCap.into())
return Err(Error::<T>::TotalDepositLessThanIncentiveCap.into());
}

let apy = Self::calculate_propotional_apy(total_deposit, deposit_cap, reward.apy)
Expand Down
2 changes: 1 addition & 1 deletion pallets/rewards/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ impl tangle_primitives::traits::MultiAssetDelegationInfo<AccountId, Balance, Blo

fn is_operator_active(operator: &AccountId) -> bool {
if operator == &mock_pub_key(10) {
return false
return false;
}
true
}
Expand Down
10 changes: 6 additions & 4 deletions pallets/rewards/src/mock_evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,9 @@ impl fp_self_contained::SelfContainedCall for RuntimeCall {
len: usize,
) -> Option<Result<(), TransactionValidityError>> {
match self {
RuntimeCall::Ethereum(call) =>
call.pre_dispatch_self_contained(info, dispatch_info, len),
RuntimeCall::Ethereum(call) => {
call.pre_dispatch_self_contained(info, dispatch_info, len)
},
_ => None,
}
}
Expand All @@ -216,8 +217,9 @@ impl fp_self_contained::SelfContainedCall for RuntimeCall {
info: Self::SignedInfo,
) -> Option<sp_runtime::DispatchResultWithInfo<sp_runtime::traits::PostDispatchInfoOf<Self>>> {
match self {
call @ RuntimeCall::Ethereum(pallet_ethereum::Call::transact { .. }) =>
Some(call.dispatch(RuntimeOrigin::from(RawOrigin::EthereumTransaction(info)))),
call @ RuntimeCall::Ethereum(pallet_ethereum::Call::transact { .. }) => {
Some(call.dispatch(RuntimeOrigin::from(RawOrigin::EthereumTransaction(info))))
},
_ => None,
}
}
Expand Down

0 comments on commit dd99823

Please sign in to comment.