Skip to content

Commit

Permalink
enable more proxy types (#1856)
Browse files Browse the repository at this point in the history
Signed-off-by: Cheng JIANG <[email protected]>

Signed-off-by: Cheng JIANG <[email protected]>
  • Loading branch information
GopherJ authored Aug 19, 2022
1 parent 34f7995 commit 5918d1a
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 12 deletions.
18 changes: 15 additions & 3 deletions runtime/heiko/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,7 @@ pub enum ProxyType {
Farming,
Streaming,
Governance,
AMM,
}
impl Default for ProxyType {
fn default() -> Self {
Expand All @@ -941,6 +942,7 @@ impl InstanceFilter<Call> for ProxyType {
| Call::Loans(pallet_loans::Call::repay_borrow_all { .. })
| Call::Loans(pallet_loans::Call::collateral_asset { .. })
| Call::Loans(pallet_loans::Call::liquidate_borrow { .. })
| Call::Loans(pallet_loans::Call::add_reward { .. })
| Call::Loans(pallet_loans::Call::claim_reward { .. })
| Call::Loans(pallet_loans::Call::claim_reward_for_market { .. })
)
Expand All @@ -950,17 +952,18 @@ impl InstanceFilter<Call> for ProxyType {
c,
Call::LiquidStaking(pallet_liquid_staking::Call::stake { .. })
| Call::LiquidStaking(pallet_liquid_staking::Call::unstake { .. })
| Call::LiquidStaking(pallet_liquid_staking::Call::cancel_unstake { .. })
)
}
ProxyType::Crowdloans => {
matches!(
c,
Call::Crowdloans(pallet_crowdloans::Call::contribute { .. },)
| Call::Crowdloans(pallet_crowdloans::Call::withdraw { .. })
| Call::Crowdloans(pallet_crowdloans::Call::claim { .. })
| Call::Crowdloans(pallet_crowdloans::Call::redeem { .. })
| Call::Crowdloans(pallet_crowdloans::Call::withdraw_for { .. })
| Call::Crowdloans(pallet_crowdloans::Call::claim_for { .. })
| Call::Crowdloans(pallet_crowdloans::Call::withdraw { .. })
| Call::Crowdloans(pallet_crowdloans::Call::withdraw_for { .. })
| Call::Crowdloans(pallet_crowdloans::Call::redeem { .. })
)
}
ProxyType::Farming => {
Expand Down Expand Up @@ -991,6 +994,15 @@ impl InstanceFilter<Call> for ProxyType {
| Call::Utility(..)
)
}
ProxyType::AMM => {
matches!(
c,
Call::AMM(pallet_amm::Call::add_liquidity { .. })
| Call::AMM(pallet_amm::Call::remove_liquidity { .. })
| Call::AMMRoute(pallet_router::Call::swap_tokens_for_exact_tokens { .. })
| Call::AMMRoute(pallet_router::Call::swap_exact_tokens_for_tokens { .. })
)
}
}
}
fn is_superset(&self, o: &Self) -> bool {
Expand Down
15 changes: 15 additions & 0 deletions runtime/kerria/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1076,6 +1076,8 @@ pub enum ProxyType {
Farming,
Streaming,
Governance,
AMM,
EVM,
}
impl Default for ProxyType {
fn default() -> Self {
Expand Down Expand Up @@ -1148,6 +1150,19 @@ impl InstanceFilter<Call> for ProxyType {
| Call::Utility(..)
)
}
ProxyType::AMM => {
matches!(
c,
Call::AMM(pallet_amm::Call::add_liquidity { .. })
| Call::AMM(pallet_amm::Call::remove_liquidity { .. })
| Call::AMMRoute(pallet_router::Call::swap_tokens_for_exact_tokens { .. })
| Call::AMMRoute(pallet_router::Call::swap_exact_tokens_for_tokens { .. })
)
}
// EVM
ProxyType::EVM => {
matches!(c, Call::Ethereum(..) | Call::EVM(_) | Call::BaseFee(_))
}
}
}
fn is_superset(&self, o: &Self) -> bool {
Expand Down
18 changes: 15 additions & 3 deletions runtime/parallel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,7 @@ pub enum ProxyType {
Farming,
Streaming,
Governance,
AMM,
}
impl Default for ProxyType {
fn default() -> Self {
Expand All @@ -961,6 +962,7 @@ impl InstanceFilter<Call> for ProxyType {
| Call::Loans(pallet_loans::Call::repay_borrow_all { .. })
| Call::Loans(pallet_loans::Call::collateral_asset { .. })
| Call::Loans(pallet_loans::Call::liquidate_borrow { .. })
| Call::Loans(pallet_loans::Call::add_reward { .. })
| Call::Loans(pallet_loans::Call::claim_reward { .. })
| Call::Loans(pallet_loans::Call::claim_reward_for_market { .. })
)
Expand All @@ -970,17 +972,18 @@ impl InstanceFilter<Call> for ProxyType {
c,
Call::LiquidStaking(pallet_liquid_staking::Call::stake { .. })
| Call::LiquidStaking(pallet_liquid_staking::Call::unstake { .. })
| Call::LiquidStaking(pallet_liquid_staking::Call::cancel_unstake { .. })
)
}
ProxyType::Crowdloans => {
matches!(
c,
Call::Crowdloans(pallet_crowdloans::Call::contribute { .. },)
| Call::Crowdloans(pallet_crowdloans::Call::withdraw { .. })
| Call::Crowdloans(pallet_crowdloans::Call::claim { .. })
| Call::Crowdloans(pallet_crowdloans::Call::redeem { .. })
| Call::Crowdloans(pallet_crowdloans::Call::withdraw_for { .. })
| Call::Crowdloans(pallet_crowdloans::Call::claim_for { .. })
| Call::Crowdloans(pallet_crowdloans::Call::withdraw { .. })
| Call::Crowdloans(pallet_crowdloans::Call::withdraw_for { .. })
| Call::Crowdloans(pallet_crowdloans::Call::redeem { .. })
)
}
ProxyType::Farming => {
Expand Down Expand Up @@ -1011,6 +1014,15 @@ impl InstanceFilter<Call> for ProxyType {
| Call::Utility(..)
)
}
ProxyType::AMM => {
matches!(
c,
Call::AMM(pallet_amm::Call::add_liquidity { .. })
| Call::AMM(pallet_amm::Call::remove_liquidity { .. })
| Call::AMMRoute(pallet_router::Call::swap_tokens_for_exact_tokens { .. })
| Call::AMMRoute(pallet_router::Call::swap_exact_tokens_for_tokens { .. })
)
}
}
}
fn is_superset(&self, o: &Self) -> bool {
Expand Down
23 changes: 17 additions & 6 deletions runtime/vanilla/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1078,7 +1078,8 @@ pub enum ProxyType {
Farming,
Streaming,
Governance,
Evm,
AMM,
EVM,
}
impl Default for ProxyType {
fn default() -> Self {
Expand All @@ -1101,6 +1102,7 @@ impl InstanceFilter<Call> for ProxyType {
| Call::Loans(pallet_loans::Call::repay_borrow_all { .. })
| Call::Loans(pallet_loans::Call::collateral_asset { .. })
| Call::Loans(pallet_loans::Call::liquidate_borrow { .. })
| Call::Loans(pallet_loans::Call::add_reward { .. })
| Call::Loans(pallet_loans::Call::claim_reward { .. })
| Call::Loans(pallet_loans::Call::claim_reward_for_market { .. })
)
Expand All @@ -1110,17 +1112,18 @@ impl InstanceFilter<Call> for ProxyType {
c,
Call::LiquidStaking(pallet_liquid_staking::Call::stake { .. })
| Call::LiquidStaking(pallet_liquid_staking::Call::unstake { .. })
| Call::LiquidStaking(pallet_liquid_staking::Call::cancel_unstake { .. })
)
}
ProxyType::Crowdloans => {
matches!(
c,
Call::Crowdloans(pallet_crowdloans::Call::contribute { .. },)
| Call::Crowdloans(pallet_crowdloans::Call::withdraw { .. })
| Call::Crowdloans(pallet_crowdloans::Call::claim { .. })
| Call::Crowdloans(pallet_crowdloans::Call::redeem { .. })
| Call::Crowdloans(pallet_crowdloans::Call::withdraw_for { .. })
| Call::Crowdloans(pallet_crowdloans::Call::claim_for { .. })
| Call::Crowdloans(pallet_crowdloans::Call::withdraw { .. })
| Call::Crowdloans(pallet_crowdloans::Call::withdraw_for { .. })
| Call::Crowdloans(pallet_crowdloans::Call::redeem { .. })
)
}
ProxyType::Farming => {
Expand Down Expand Up @@ -1151,8 +1154,16 @@ impl InstanceFilter<Call> for ProxyType {
| Call::Utility(..)
)
}
// EVM
ProxyType::Evm => {
ProxyType::AMM => {
matches!(
c,
Call::AMM(pallet_amm::Call::add_liquidity { .. })
| Call::AMM(pallet_amm::Call::remove_liquidity { .. })
| Call::AMMRoute(pallet_router::Call::swap_tokens_for_exact_tokens { .. })
| Call::AMMRoute(pallet_router::Call::swap_exact_tokens_for_tokens { .. })
)
}
ProxyType::EVM => {
matches!(c, Call::Ethereum(..) | Call::EVM(_) | Call::BaseFee(_))
}
}
Expand Down

0 comments on commit 5918d1a

Please sign in to comment.