AssetHub new feature: bond with specific unbond period

Bonding some token with a specific unbond period is a standard mechanism for many system e.g voting in democracy.

Currently if I have a democracy parachain I would:

  • require users to move their asset from asset-hub (AH) to the parachain with a reserve transfer operation
  • require users to trust that the parachain handle the token reserved on AH correctly and don’t rug-pull

moreover I can’t use the same bonded token for multiple purpose in multiple parachain. If I have 2 parachains which wants to use some bonded token together it is not doable.

Proposition: allow user on AH to bond their token for specified purpose with a specific unbond period.

Maybe an API like this:
chains register listening for a purpose, account can bound/unbond some asset for a purpose:

/// A chain is listening for notifications for a specific purpose for an asset.
fn register_listening(origin: chain, asset_id, purpose)

/// Account sets a bonding period for a purpose for an asset.
fn set_bonding_period(origin: account, asset_id, purpose, unbond_period)

/// Account modifies the bonding period for a purpose for an asset.
/// It takes effect after the difference with the bonding period is passed, chains are notified.
fn modify_bonding_period(origin: account, asset_id, purpose, unbond_period)

/// Account bonds some token for a purpose.
/// Chains are notified the total bonded amount with the current unbond_period.
fn bond(origin: account, asset_id, asset_amount, purpose)

/// Account starts unbonding a specific amount of tokens for a specific purpose
/// Chains are notified the new bonded amount with the current unbond_period.
fn start_unbonding(orign: account, asset_id, asset_amount, purpose)

/// Account collects the unbonded tokens of a specific purpose
fn collect_unbonded(origin: account, asset_id, purpose)

We could also improve the API to allow a possible slashing mechanism by letting account allowing chains to slash their asset bonded for a specific purpose.
(Though it might requires more research as someone could unbound by slashing himself if we allow slashing an account to some destination)
This could be useful for staking.

Side-note: It might already be possible to implement such mecanism by doing a reserve transfer with a beneficiary account controlled by a smart contract in some parachains.
Maybe we should also add smart contracts to AH to give the possibility to implement such logic in a permission-less way.

What do you think?

1 Like

proof-of-bond could be interesting to come up with new mechanics.