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

feat: paseo upgrate migration #1511

Closed
wants to merge 19 commits into from
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
feat: change benefit receiving account (#1493)
Wsteth authored Nov 9, 2024
commit f251aac5e7aaf2361883a0d9d89fafa1380919ce
10 changes: 5 additions & 5 deletions pallets/system-staking/src/lib.rs
Original file line number Diff line number Diff line change
@@ -87,7 +87,7 @@ pub mod pallet {
>;

#[pallet::constant]
type TreasuryAccount: Get<Self::AccountId>;
type BenefitReceivingAccount: Get<Self::AccountId>;

/// Max token length 500
#[pallet::constant]
@@ -509,7 +509,7 @@ pub mod pallet {
Ok(().into())
}

/// payout to treasury
/// payout to receiving account
#[pallet::call_index(3)]
#[pallet::weight(<T as Config>::WeightInfo::payout())]
pub fn payout(origin: OriginFor<T>, token: CurrencyIdOf<T>) -> DispatchResultWithPostInfo {
@@ -539,11 +539,11 @@ pub mod pallet {
token_amount,
)?;

// Transfer vtoken(benefits) to TreasuryAccount
// Transfer vtoken(benefits) to BenefitReceivingAccount
T::MultiCurrency::transfer(
vtoken_id,
&pallet_account,
&T::TreasuryAccount::get(),
&T::BenefitReceivingAccount::get(),
vtoken_amount,
)
.map_err(|_| Error::<T>::PayoutFailed)?;
@@ -552,7 +552,7 @@ pub mod pallet {
token,
vtoken: vtoken_id,
from: pallet_account,
to: T::TreasuryAccount::get(),
to: T::BenefitReceivingAccount::get(),
amount: vtoken_amount,
vfree: vfree_amount,
free: free_amount,
7 changes: 5 additions & 2 deletions pallets/system-staking/src/mock.rs
Original file line number Diff line number Diff line change
@@ -59,6 +59,8 @@ pub const BOB: AccountId = AccountId32::new([1u8; 32]);
pub const CHARLIE: AccountId = AccountId32::new([3u8; 32]);
pub const TREASURY_ACCOUNT: AccountId32 = AccountId32::new([9u8; 32]);

pub const BENEFIT_RECEIVING_ACCOUNT: AccountId32 = AccountId32::new([9u8; 32]);

frame_support::construct_runtime!(
pub enum Runtime {
System: frame_system,
@@ -79,6 +81,7 @@ type Block = frame_system::mocking::MockBlock<Runtime>;

parameter_types! {
pub const BlockHashCount: u64 = 250;
pub const TreasuryAccount: AccountId32 = TREASURY_ACCOUNT;
}

#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
@@ -296,7 +299,7 @@ impl bifrost_farming::Config for Runtime {
}

parameter_types! {
pub const TreasuryAccount: AccountId32 = TREASURY_ACCOUNT;
pub const BenefitReceivingAccount: AccountId32 = BENEFIT_RECEIVING_ACCOUNT;
pub const BlocksPerRound: u32 = 5;
pub const MaxTokenLen: u32 = 50;
pub const MaxFarmingPoolIdLen: u32 = 100;
@@ -309,7 +312,7 @@ impl system_staking::Config for Runtime {
type WeightInfo = ();
type FarmingInfo = Farming;
type VtokenMintingInterface = VtokenMinting;
type TreasuryAccount = TreasuryAccount;
type BenefitReceivingAccount = BenefitReceivingAccount;
type PalletId = SystemStakingPalletId;
type BlocksPerRound = BlocksPerRound;
type MaxTokenLen = MaxTokenLen;
2 changes: 1 addition & 1 deletion runtime/bifrost-kusama/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1417,7 +1417,7 @@ impl bifrost_system_staking::Config for Runtime {
type WeightInfo = weights::bifrost_system_staking::BifrostWeight<Runtime>;
type FarmingInfo = Farming;
type VtokenMintingInterface = VtokenMinting;
type TreasuryAccount = BifrostTreasuryAccount;
type BenefitReceivingAccount = BifrostTreasuryAccount;
type PalletId = SystemStakingPalletId;
type BlocksPerRound = BlocksPerRound;
type MaxTokenLen = MaxTokenLen;
5 changes: 3 additions & 2 deletions runtime/bifrost-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1159,6 +1159,7 @@ parameter_types! {
pub const BlocksPerRound: u32 = prod_or_fast!(1500, 50);
pub const MaxTokenLen: u32 = 500;
pub const MaxFarmingPoolIdLen: u32 = 100;
pub BenefitReceivingAccount: AccountId = FeeSharePalletId::get().into_account_truncating();
}

impl bifrost_system_staking::Config for Runtime {
@@ -1168,7 +1169,7 @@ impl bifrost_system_staking::Config for Runtime {
type WeightInfo = weights::bifrost_system_staking::BifrostWeight<Runtime>;
type FarmingInfo = Farming;
type VtokenMintingInterface = VtokenMinting;
type TreasuryAccount = BifrostTreasuryAccount;
type BenefitReceivingAccount = BenefitReceivingAccount;
type PalletId = SystemStakingPalletId;
type BlocksPerRound = BlocksPerRound;
type MaxTokenLen = MaxTokenLen;
@@ -1496,7 +1497,7 @@ impl leverage_staking::Config for Runtime {
parameter_types! {
pub const ClearingDuration: u32 = prod_or_fast!(1 * DAYS, 10 * MINUTES);
pub const NameLengthLimit: u32 = 20;
pub BifrostCommissionReceiver: AccountId = TreasuryPalletId::get().into_account_truncating();
pub BifrostCommissionReceiver: AccountId = FeeSharePalletId::get().into_account_truncating();
}

impl bifrost_channel_commission::Config for Runtime {