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/rewards notransfer GASP-1688 #856

Closed
wants to merge 1 commit into from
Closed
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
18 changes: 17 additions & 1 deletion pallets/proof-of-stake/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ use sp_runtime::traits::AccountIdConversion;

use frame_support::{
pallet_prelude::*,
traits::{tokens::currency::MultiTokenCurrency, ExistenceRequirement, Get},
traits::{tokens::currency::MultiTokenCurrency, Contains, ExistenceRequirement, Get},
transactional,
};

Expand Down Expand Up @@ -446,6 +446,9 @@ pub mod pallet {

type WeightInfo: WeightInfo;
type ValuationApi: ValutationApiTrait<Self>;

/// Tokens which cannot be transfered by extrinsics/user or use in pool, unless foundation override
type NontransferableTokens: Contains<CurrencyIdOf<Self>>;
}

#[pallet::error]
Expand Down Expand Up @@ -483,6 +486,8 @@ pub mod pallet {
NoThirdPartyPartyRewardsToClaim,
// cannot promote solo token
SoloTokenPromotionForbiddenError,
/// Asset cannot be used for rewards
NontransferableToken,
}

#[pallet::event]
Expand Down Expand Up @@ -770,6 +775,12 @@ pub mod pallet {
schedule_end: SessionId,
) -> DispatchResult {
let sender = ensure_signed(origin)?;

ensure!(
!T::NontransferableTokens::contains(&token_id),
Error::<T>::NontransferableToken
);

Self::reward_pool_impl(sender, pool, token_id, amount, schedule_end)
}

Expand All @@ -792,6 +803,11 @@ pub mod pallet {
) -> DispatchResultWithPostInfo {
let sender = ensure_signed(origin)?;

ensure!(
!T::NontransferableTokens::contains(&reward_token),
Error::<T>::NontransferableToken
);

Self::activate_liquidity_for_3rdparty_rewards_impl(
sender,
liquidity_token_id,
Expand Down
1 change: 1 addition & 0 deletions rollup/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ impl pallet_proof_of_stake::Config for Runtime {
type Min3rdPartyRewardVolume = cfg::pallet_proof_of_stake::Min3rdPartyRewardVolume;
type SchedulesPerBlock = cfg::pallet_proof_of_stake::SchedulesPerBlock;
type ValuationApi = Xyk;
type NontransferableTokens = tokens::NontransferableTokens;
}

impl pallet_bootstrap::BootstrapBenchmarkingConfig for Runtime {}
Expand Down
Loading