Skip to content

Commit 2c60e93

Browse files
committed
Update docs: replace V2 functions with ProxyCall dispatcher
1 parent d24d951 commit 2c60e93

1 file changed

Lines changed: 9 additions & 19 deletions

File tree

docs/wasm-contracts.md

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,7 @@ Subtensor provides a custom chain extension that allows smart contracts to inter
4444
| 13 | `add_proxy` | Add a staking proxy for the caller | `(AccountId)` | Error code |
4545
| 14 | `remove_proxy` | Remove a staking proxy for the caller | `(AccountId)` | Error code |
4646
| 15 | `get_alpha_price` | Get the current alpha price for a subnet | `(NetUid)` | `u64` (price × 10⁹) |
47-
| 16 | `add_stake_v2` | Add stake with explicit coldkey (proxy-aware) | `(AccountId, AccountId, NetUid, TaoCurrency)` | Error code |
48-
| 17 | `remove_stake_v2` | Remove stake with explicit coldkey | `(AccountId, AccountId, NetUid, AlphaCurrency)` | Error code |
49-
| 18 | `unstake_all_v2` | Unstake all TAO with explicit coldkey | `(AccountId, AccountId)` | Error code |
50-
| 19 | `unstake_all_alpha_v2` | Unstake all Alpha with explicit coldkey | `(AccountId, AccountId)` | Error code |
51-
| 20 | `move_stake_v2` | Move stake between hotkeys with explicit coldkey | `(AccountId, AccountId, AccountId, NetUid, NetUid, AlphaCurrency)` | Error code |
52-
| 21 | `transfer_stake_v2` | Transfer stake between coldkeys (requires Transfer proxy) | `(AccountId, AccountId, AccountId, NetUid, NetUid, AlphaCurrency)` | Error code |
53-
| 22 | `swap_stake_v2` | Swap stake between subnets with explicit coldkey | `(AccountId, AccountId, NetUid, NetUid, AlphaCurrency)` | Error code |
54-
| 23 | `add_stake_limit_v2` | Add stake with price limit and explicit coldkey | `(AccountId, AccountId, NetUid, TaoCurrency, TaoCurrency, bool)` | Error code |
55-
| 24 | `remove_stake_limit_v2` | Remove stake with price limit and explicit coldkey | `(AccountId, AccountId, NetUid, AlphaCurrency, TaoCurrency, bool)` | Error code |
56-
| 25 | `swap_stake_limit_v2` | Swap stake with price limit and explicit coldkey | `(AccountId, AccountId, NetUid, NetUid, AlphaCurrency, TaoCurrency, bool)` | Error code |
57-
| 26 | `remove_stake_full_limit_v2` | Full unstake with price limit and explicit coldkey | `(AccountId, AccountId, NetUid, Option<TaoCurrency>)` | Error code |
58-
| 27 | `set_coldkey_auto_stake_hotkey_v2` | Set auto-stake hotkey with explicit coldkey | `(AccountId, NetUid, AccountId)` | Error code |
47+
| 16 | `proxy_call` | Dispatch any RuntimeCall through pallet_proxy | `(AccountId, Option<u8>, BoundedVec<u8, 1024>)` | Error code |
5948

6049
Example usage in your ink! contract:
6150
```rust
@@ -100,16 +89,17 @@ Chain extension functions that modify state return error codes as `u32` values.
10089
| 19 | `ProxyNotFound` | Proxy relationship not found |
10190
| 20 | `NotAuthorizedProxy` | Caller is not an authorized proxy for the account |
10291

103-
#### V2 Functions (Proxy-Aware)
92+
#### ProxyCall (ID 16) — Proxy-Aware Generic Dispatcher
10493

105-
Functions 16-27 are V2 versions that accept an explicit `coldkey` parameter as the first argument. These functions:
94+
Instead of per-function proxy variants, a single `proxy_call` extension dispatches any SCALE-encoded `RuntimeCall` through `pallet_proxy`. Parameters:
10695

107-
- If `coldkey == caller`: Execute directly (no proxy check needed)
108-
- If `coldkey != caller`: Verify caller has appropriate proxy permissions for coldkey
96+
- `real_coldkey: AccountId` — the account to act on behalf of
97+
- `force_proxy_type: Option<u8>` — optional proxy type filter (e.g., `5` for Staking), or `None` to match any
98+
- `call_data: BoundedVec<u8, 1024>` — SCALE-encoded `RuntimeCall`
10999

110-
**Proxy Types Required:**
111-
- Most V2 functions require `ProxyType::Staking`
112-
- `transfer_stake_v2` (ID 21) requires `ProxyType::Transfer`
100+
Behavior:
101+
- If `real_coldkey == caller`: dispatches the call directly (no proxy needed)
102+
- If `real_coldkey != caller`: routes through `pallet_proxy::proxy()`, which checks proxy permissions via `InstanceFilter` — correctly supporting `Any`, `Staking`, `Transfer`, and all other proxy types
113103

114104
### Call Filter
115105

0 commit comments

Comments
 (0)