Crate pallet_time_release

Source
Expand description

Transfer Funds as Frozen with a Time Delayed Release

§Time-Release Pallet

Provides a way to schedule a balance freeze on an account.

§Summary

The time-release pallet employs a graded release approach, which thaws a specific amount of balance every period of time, until all balance is thawed.

Note: This pallet is a fork and modification of the ORML-vesting.

§Release Schedule

The schedule of a release on hold is described by the data structure ReleaseSchedule. Starting from the specified block number denoted as start, the schedule operates on a periodic basis. For each period amount of blocks, a designated per_period amount of balance is unfrozen. This process continues until the specified number of periods, denoted as period_count, is reached. It’s important to highlight that in release schedules, the concept of time is measured in terms of block numbers. Accessing all ReleaseSchedule instances associated with an account is possible through querying the chain state.

§Actions

The Time-Release pallet provides for:

  • Creating a transfer with a schedule for release
    • Transfers for scheduled release may be pre-scheduled
  • Claiming balances that are released
  • Governance updates of schedules
§Creating a transfer with a schedule for release

In this model, tokens are transferred to a recipient’s account using the transfer extrinsic and added to a “frozen” balance with a vesting schedule. Tokens in the frozen balance are available for claiming based on the defined vesting schedule they were initially transferred with.

§Pre-scheduled time-release transfers

Transfers intended for time-release may be pre-scheduled using the schedule_transfer extrinsic. In this workflow, tokens are locked in the sender’s account balance, in order to guarantee sufficient funds for a subsequent execution of the transfer extrinsic at a pre-determined block number.

§Claiming balances that are released

When a particular amount of tokens become eligible for release based on their vesting schedule, those “thawed” tokens may be claimed by the recipient in one of two ways:

  • Manual claim: by executing the claim extrinsic
  • Opportunistic auto-claim: when new vesting schedules with token amounts are added to a recipient’s account, any amounts then eligible for redemption are auto-claimed on the user’s behalf

§Interactions

§Extrinsics

Name/DescriptionCallerPaymentKey EventsRuntime Added
transfer
Transfer tokens to another account with an unlock schedule
Token AccountTokensReleaseScheduleAdded24
schedule_transfer
Lock tokens in a sender’s account for later execution of the execute_scheduled_named_transfer extrinsic at a pre-determined block number
Token AccountTokens<see scheduler pallet>144
execute_scheduled_named_transfer
Executes a scheduled transfer that was previously scheduled using the schedule_transfer extrinsic.
Scheduler palletTokensReleaseScheduleAdded144
claim
Remove the lock on tokens for the calling account when the schedule allows
Account with LockTokensClaimed24
claim_for
Remove the lock on tokens for a different account when the schedule allows
Any Token AccountTokensClaimed24
update_release_schedules
Governance action to update existing schedules
GovernanceTokensReleaseSchedulesUpdated24

See Rust Docs for more details.

§State Queries

NameDescriptionQueryRuntime Added
Release ScheduleRetrieves the release schedule for an accountreleaseSchedules24

See the Rust Docs for additional state queries and details.

Re-exports§

Modules§

  • The pallet module in each FRAME pallet hosts the most important items needed to construct this pallet.
  • Types for the TimeRelease Pallet
  • Autogenerated weights for pallet_time_release