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

Sora fix #1546

Merged
merged 9 commits into from
Dec 16, 2024
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
14 changes: 12 additions & 2 deletions pallets/bb-bnc/src/incentive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.

use crate::{traits::BbBNCInterface, *};
use bifrost_primitives::PoolId;
use bifrost_primitives::{PoolId, BNC};
pub use pallet::*;
use sp_std::collections::btree_map::BTreeMap;

Expand Down Expand Up @@ -229,7 +229,17 @@ impl<T: Config> Pallet<T> {
&T::IncentivePalletId::get().into_account_truncating(),
who,
reward,
)
)?;
if currency == &BNC {
let _vtoken_value = T::VtokenMinting::mint(
who.clone(),
BNC,
reward,
BoundedVec::default(),
None,
)?;
}
Ok(())
})?;
Rewards::<T>::remove(who);
Self::deposit_event(Event::Rewarded {
Expand Down
12 changes: 11 additions & 1 deletion pallets/bb-bnc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub mod incentive;
pub mod traits;
pub mod weights;

use bifrost_primitives::{Balance, CurrencyId, PoolId};
use bifrost_primitives::{Balance, CurrencyId, FarmingInfo, PoolId, VtokenMintingInterface};
use frame_support::{
pallet_prelude::*,
sp_runtime::{
Expand Down Expand Up @@ -137,6 +137,15 @@ pub mod pallet {
#[pallet::constant]
type MarkupRefreshLimit: Get<u32>;

type VtokenMinting: VtokenMintingInterface<
AccountIdOf<Self>,
CurrencyIdOf<Self>,
BalanceOf<Self>,
>;

/// The interface to call Farming module functions.
type FarmingInfo: FarmingInfo<BalanceOf<Self>, CurrencyIdOf<Self>, AccountIdOf<Self>>;

#[pallet::constant]
type OneYear: Get<BlockNumberFor<Self>>;

Expand Down Expand Up @@ -1296,6 +1305,7 @@ pub mod pallet {

Self::_checkpoint(who, position, old_locked, _locked.clone())?;

T::FarmingInfo::refresh_gauge_pool(who)?;
Self::deposit_event(Event::Withdrawn {
who: who.clone(),
position,
Expand Down
2 changes: 2 additions & 0 deletions pallets/bb-bnc/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,8 @@ impl bb_bnc::Config for Runtime {
type VoteWeightMultiplier = VoteWeightMultiplier;
type MaxPositions = MaxPositions;
type MarkupRefreshLimit = MarkupRefreshLimit;
type VtokenMinting = VtokenMinting;
type FarmingInfo = ();
type FourYears = FourYears;
type OneYear = OneYear;
}
Expand Down
2 changes: 2 additions & 0 deletions pallets/buy-back/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,8 @@ impl bb_bnc::Config for Runtime {
type VoteWeightMultiplier = VoteWeightMultiplier;
type MaxPositions = MaxPositions;
type MarkupRefreshLimit = MarkupRefreshLimit;
type VtokenMinting = VtokenMinting;
type FarmingInfo = ();
type FourYears = MaxBlock;
type OneYear = OneYear;
}
Expand Down
2 changes: 2 additions & 0 deletions pallets/clouds-convert/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ impl bb_bnc::Config for Runtime {
type VoteWeightMultiplier = VoteWeightMultiplier;
type MaxPositions = MaxPositions;
type MarkupRefreshLimit = MarkupRefreshLimit;
type VtokenMinting = ();
type FarmingInfo = ();
type FourYears = MaxBlock;
type OneYear = OneYear;
}
Expand Down
Loading