Skip to content

Commit 303db90

Browse files
committed
add new proxy types
1 parent 8389088 commit 303db90

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

runtime/src/lib.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,13 +620,17 @@ pub enum ProxyType {
620620
Owner, // Subnet owner Calls
621621
NonCritical,
622622
NonTransfer,
623+
Transfer,
624+
SmallTransfer,
623625
Senate,
624626
NonFungibile, // Nothing involving moving TAO
625627
Triumvirate,
626628
Governance, // Both above governance
627629
Staking,
628630
Registration,
629631
}
632+
// Transfers below SMALL_TRANSFER_LIMIT are considered small transfers
633+
pub const SMALL_TRANSFER_LIMIT: Balance = 500_000_000; // 0.5 TAO
630634
impl Default for ProxyType {
631635
fn default() -> Self {
632636
Self::Any
@@ -645,6 +649,22 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
645649
| RuntimeCall::SubtensorModule(pallet_subtensor::Call::burned_register { .. })
646650
| RuntimeCall::SubtensorModule(pallet_subtensor::Call::root_register { .. })
647651
),
652+
ProxyType::Transfer => matches!(
653+
c,
654+
RuntimeCall::Balances(pallet_balances::Call::transfer_keep_alive { .. })
655+
| RuntimeCall::Balances(pallet_balances::Call::transfer_allow_death { .. })
656+
| RuntimeCall::Balances(pallet_balances::Call::transfer_all { .. })
657+
),
658+
ProxyType::SmallTransfer => match c {
659+
RuntimeCall::Balances(pallet_balances::Call::transfer_keep_alive {
660+
value, ..
661+
}) => *value < SMALL_TRANSFER_LIMIT,
662+
RuntimeCall::Balances(pallet_balances::Call::transfer_allow_death {
663+
value,
664+
..
665+
}) => *value < SMALL_TRANSFER_LIMIT,
666+
_ => false,
667+
},
648668
ProxyType::Owner => matches!(c, RuntimeCall::AdminUtils(..)),
649669
ProxyType::NonCritical => !matches!(
650670
c,

0 commit comments

Comments
 (0)