Skip to content

Add chain exts for direct recycle/burn from ink! smart contracts #2564

@LandynDev

Description

@LandynDev

Is your feature request related to a problem? Please describe.

ink! smart contracts on subtensor that need to recycle or burn alpha stake must currently transfer funds to a designated external wallet, which then performs the operation. This intermediary wallet holds controllable funds, creating custodial risk regardless of intent. There is no way for a WASM smart contract to call recycle or burn directly via the chain extension interface.

Describe the solution you'd like

Add 4 new chain extension functions allowing ink! contracts to invoke recycle/burn directly

Name Description
RecycleAlphaV1 Recycle alpha stake from the contract
BurnAlphaV1 Burn alpha stake from the contract
AddStakeRecycleV1 Atomically add TAO stake then recycle alpha
AddStakeBurnV1 Atomically add TAO stake then burn alpha

The current AddStakeV1 chain extension only returns a success/error code, not the resulting alpha amount. While a contract could work around this by calling AddStakeV1 followed by RecycleAlphaV1(MAX), this recycles all alpha the contract holds on that subnet — not just the alpha from that specific stake. This is fine for simple contracts, but may break down for contracts that hold alpha for multiple purposes on the same subnet.

The AddStakeRecycleV1 and AddStakeBurnV1 functions handle this atomically in a single call, recycling/burning only the alpha produced by that specific stake. This provides the robustness needed for a general-purpose chain extension interface.

Describe alternatives you've considered

The current approach: transferring collected fees to a designated wallet that performs recycle/burn externally. This works functionally but requires trust in the wallet operator and introduces a single point of failure. It also prevents fully autonomous contract operation.

Additional context

Primary use case: smart contracts collecting subnet fees that need to autonomously recycle those fees back into the subnet without human intervention or off-chain infrastructure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions