Skip to content

Commit

Permalink
Time Release Pallet Documentation Improvement (#1978)
Browse files Browse the repository at this point in the history
# Goal
The goal of this PR is to improve the documentation of the Pallets and
make that documentation be able to be used on docs.frequency.xyz.

Part of frequency-chain/docs#59

# Discussion
- Time Release Pallet (No RPCs for this pallet)
- Small fixes in the template
  • Loading branch information
wilwade authored May 23, 2024
1 parent 5f428ef commit fc1224d
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 34 deletions.
8 changes: 4 additions & 4 deletions pallets/README.template.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ The {Name} pallet provides for:

### Extrinsics

| Name/Description | Caller | Payment | Key Events | Runtime Added |
| -------------------------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------- | ------------- |
| `{extrinsic}`<br />{Description} | Tokens | Free | [`{Event}`](https://frequency-chain.github.io/frequency/{pallet_name}/pallet/enum.Event.html#variant.{Event}) | 1 |
| Name/Description | Caller | Payment | Key Events | Runtime Added |
| -------------------------------- | ------------- | ------- | ------------------------------------------------------------------------------------------------------------- | ------------- |
| `{extrinsic}`<br />{Description} | Token Account | Tokens | [`{Event}`](https://frequency-chain.github.io/frequency/{pallet_name}/pallet/enum.Event.html#variant.{Event}) | 1 |

See [Rust Docs](https://frequency-chain.github.io/frequency/{pallet_name}/pallet/struct.Pallet.html) for more details.

### State Queries

| Name | Description | Query | Runtime Added |
| --------- | ------------------- | ------------------------ | ------------- |
| {Query 1} | {Query Desctiption} | `{queryCallInCamelCase}` | 1 |
| {Query 1} | {Query Description} | `{queryCallInCamelCase}` | 1 |

See the [Rust Docs](https://frequency-chain.github.io/frequency/{pallet_name}/pallet/storage_types/index.html) for additional state queries and details.

Expand Down
39 changes: 35 additions & 4 deletions pallets/time-release/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,42 @@
# Time-Release Module
# Time-Release Pallet

This pallet is a fork of the [ORML-vesting]( [vesting](https://github.com/open-web3-stack/open-runtime-module-library/tree/master/vesting)).
Provides a way to schedule a balance freeze on an account.

## Overview
## Summary

The `time-release` module offers a method for scheduling a balance freeze on an account. It employs a *graded release* approach, which thaws a specific amount of balance every period of time, until all balance is thawed.
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](<[vesting](https://github.com/open-web3-stack/open-runtime-module-library/tree/master/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
- Claiming balances that are released
- Governance updates of schedules

## Interactions

### Extrinsics

| Name/Description | Caller | Payment | Key Events | Runtime Added |
| ------------------------------------------------------------------------------------------- | ----------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- |
| `transfer`<br />Transfer tokens to another account with an unlock schedule | Token Account | Tokens | [`ReleaseScheduleAdded`](https://frequency-chain.github.io/frequency/pallet_time_release/pallet/enum.Event.html#variant.ReleaseScheduleAdded) | 24 |
| `claim`<br />Remove the lock on tokens for the calling account when the schedule allows | Account with Lock | Tokens | [`Claimed`](https://frequency-chain.github.io/frequency/pallet_time_release/pallet/enum.Event.html#variant.Claimed) | 24 |
| `claim_for`<br />Remove the lock on tokens for a different account when the schedule allows | Any Token Account | Tokens | [`Claimed`](https://frequency-chain.github.io/frequency/pallet_time_release/pallet/enum.Event.html#variant.Claimed) | 24 |
| `update_release_schedules`<br />Governance action to update existing schedules | Governance | Tokens | [`ReleaseSchedulesUpdated`](https://frequency-chain.github.io/frequency/pallet_time_release/pallet/enum.Event.html#variant.ReleaseSchedulesUpdated) | 24 |

See [Rust Docs](https://frequency-chain.github.io/frequency/pallet_time_release/pallet/struct.Pallet.html) for more details.

### State Queries

| Name | Description | Query | Runtime Added |
| ---------------- | --------------------------------------------- | ------------------ | ------------- |
| Release Schedule | Retrieves the release schedule for an account | `releaseSchedules` | 24 |

See the [Rust Docs](https://frequency-chain.github.io/frequency/pallet_time_release/pallet/storage_types/index.html) for additional state queries and details.
33 changes: 7 additions & 26 deletions pallets/time-release/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,30 +1,11 @@
//! # Time-Release Module
//! Transfer Funds as Frozen with a Time Delayed Release
//!
//! This pallet is a fork of the [ORML-vesting]( [vesting](https://github.com/open-web3-stack/open-runtime-module-library/tree/master/vesting)) polkadot-v0.9.39.
//!
//! ## Overview
//!
//! Time-release module provides a means of scheduled release (thaw) of a frozen balance in an account.
//! It uses the *graded release* approach, which thaws a specific amount of balance per period (measured
//! in blocks), until all frozen balances are thawed.
//!
//! ### Release Schedule
//!
//! The schedule of a release is described by data structure `ReleaseSchedule`:
//! from the block number of `start`, for every `period` amount of blocks,
//! `per_period` amount of balance would thaw, until number of periods
//! `period_count` reached. Note in release schedules, *time* is measured by
//! block number. All `ReleaseSchedule`s under an account could be queried in
//! chain state.
//!
//! ## Interface
//!
//! ### Dispatchable Functions
//!
//! - `transfer` - Add a new release schedule for an account.
//! - `claim` - Claim thawed balances.
//! - `update_release_schedules` - Update all release schedules under an
//! account, `root` origin required.
//! ## Quick Links
//! - [Configuration: `Config`](Config)
//! - [Extrinsics: `Call`](Call)
//! - [Event Enum: `Event`](Event)
//! - [Error Enum: `Error`](Error)
#![doc = include_str!("../README.md")]
// Substrate macros are tripping the clippy::expect_used lint.
#![allow(clippy::expect_used)]
#![cfg_attr(not(feature = "std"), no_std)]
Expand Down

0 comments on commit fc1224d

Please sign in to comment.