Skip to content

Commit a005613

Browse files
authored
Frequency Transaction Pallet Documentation Improvement (#1990)
# 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 - Frequency Tx Pallet Readme
1 parent 3625aed commit a005613

File tree

2 files changed

+60
-16
lines changed

2 files changed

+60
-16
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Frequency Transaction Pallet
2+
3+
Allows users to perform transactions using Capacity.
4+
5+
## Summary
6+
7+
Frequency supports the following alternative payments:
8+
9+
- Capacity: A refillable resource limited to a subset of transactions.
10+
11+
The Frequency Transaction Pallet proxies or nests one or more calls inside of the root call to enable them to be paid using an alternative method.
12+
For example, to call something like `add_ipfs_message(params)` with Capacity, one would call `pay_with_capacity(add_ipfs_message(params))`.
13+
The `pay_with_capacity` will verify that the inner call is allowed with Capacity.
14+
15+
### Requirements for Paying with Capacity
16+
17+
The account must:
18+
1. Be a current control key on a Provider.
19+
2. Have a minimum balance of the existential deposit.
20+
3. Must have enough Capacity for the call remaining in the current Epoch.
21+
22+
### Capacity Stable Weights
23+
24+
Token costs on a specific transaction can fluctuate due to benchmark changes, but the costs of Capacity calls are setup to be relatively consistent.
25+
This consistency is because the price of a Capacity transaction uses a separate set of benchmark weights, which are kept constant at a given point in time.
26+
While periodic updates do occur, the costs typically stay the same or may even decrease over time.
27+
28+
### Actions
29+
30+
The Frequency Transaction pallet provides for:
31+
32+
- Transacting using only Capacity
33+
34+
## Interactions
35+
36+
### Extrinsics
37+
38+
| Name/Description | Caller | Payment | Key Events | Runtime Added |
39+
| -------------------------------- | ------------- | ------- | ------------------------------------------------------------------------------------------------------------- | ------------- |
40+
| `pay_with_capacity`<br />Proxies a single Capacity allowed call | Provider | Capacity | [`CapacityWithdrawn`](https://frequency-chain.github.io/frequency/pallet_capacity/pallet/enum.Event.html#variant.CapacityWithdrawn)* | 1 |
41+
| `pay_with_capacity_batch_all`<br />Proxies a batch (limit 10) of Capacity allowed calls | Provider | Capacity | [`CapacityWithdrawn`](https://frequency-chain.github.io/frequency/pallet_capacity/pallet/enum.Event.html#variant.CapacityWithdrawn)* | 1 |
42+
43+
\* Note: This is just the event noting the use of Capacity. Additional events for the call being proxied will still occur.
44+
45+
See [Rust Docs](https://frequency-chain.github.io/frequency/pallet_frequency_tx_payment/pallet/struct.Pallet.html) for more details.
46+
47+
### RPCs
48+
49+
Note: May be restricted based on node settings and configuration.
50+
51+
| Name | Description | Call | Node Version |
52+
| ------- | ----------------- | ---------------------------------------------------------------------------------------------------- | ------------ |
53+
| Compute Capacity Fee | Calculates the expected Capacity cost of the supplied transaction | [`computeCapacityFeeDetails`](https://frequency-chain.github.io/frequency/pallet_frequency_tx_payment_rpc/trait.CapacityPaymentApiServer.html#tymethod.compute_capacity_fee_details) | v1.8.0+ |
54+
55+
See [Rust Docs](https://frequency-chain.github.io/frequency/pallet_frequency_tx_payment_rpc/trait.CapacityPaymentApiServer.html) for more details.

pallets/frequency-tx-payment/src/lib.rs

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,13 @@
1-
//! # Frequency-Transactions Pallet
2-
//! The Frequency-transaction pallet allows users to transact using either capacity or token.
1+
//! Allows transactions in alternative payment methods such as capacity
32
//!
3+
//! ## Quick Links
44
//! - [Configuration: `Config`](Config)
55
//! - [Extrinsics: `Call`](Call)
6+
//! - [Runtime API: `CapacityTransactionPaymentRuntimeApi`](../pallet_frequency_tx_payment_runtime_api/trait.CapacityTransactionPaymentRuntimeApi.html)
7+
//! - [Custom RPC API: `CapacityPaymentApiServer`](../pallet_frequency_tx_payment_rpc/trait.CapacityPaymentApiServer.html)
68
//! - [Event Enum: `Event`](Event)
79
//! - [Error Enum: `Error`](Error)
8-
//!
9-
//! ## Overview
10-
//! Capacity is a refillable resource that can be used to make transactions on the network.
11-
//! This pallets allows users to toggle between submitting transactions with capacity or tokens.
12-
//! Note that tipping for capacity transactions is not allowed and is set to zero. Users who
13-
//! use tokens to transact can continue to use a tip.
14-
//!
15-
//! The key that is used to pay with Capacity must have a minimum balance of the existential deposit.
16-
//!
17-
//! The Frequency-transaction pallet provides functions for:
18-
//!
19-
//! - pay_with_capacity
20-
//!
21-
10+
#![doc = include_str!("../README.md")]
2211
// Substrate macros are tripping the clippy::expect_used lint.
2312
#![allow(clippy::expect_used)]
2413
#![cfg_attr(not(feature = "std"), no_std)]

0 commit comments

Comments
 (0)