Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/general/chain-state-values.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ description: Explore chain constants and storage values for Polkadot, Kusama, an

#### Minimum Validator Commission

The minimum commission a Polkadot Validator can set is {{ rpc("polkadot-assethub", "Staking", "MinCommission", 0, is_constant=false, readable="percentage") }}. [This does not guarantee entry into the active set and earning rewards](https://docs.polkadot.com/infrastructure/running-a-validator/#running-a-validator).
The minimum commission a Polkadot Validator can set is {{ rpc("polkadot-assethub", "Staking", "MinCommission", 0, is_constant=false, readable="percentage_perbill") }}. [This does not guarantee entry into the active set and earning rewards](https://docs.polkadot.com/infrastructure/running-a-validator/#running-a-validator).

#### Multisig Deposit Base

Expand All @@ -101,7 +101,7 @@ description: Explore chain constants and storage values for Polkadot, Kusama, an

#### Nomination Pool Max Commission

The maximum commission that can be set for a Polkadot nomination pool is {{ rpc("polkadot-assethub", "NominationPools", "GlobalMaxCommission", 100000000, is_constant=false, readable="percentage") }}.
The maximum commission that can be set for a Polkadot nomination pool is {{ rpc("polkadot-assethub", "NominationPools", "GlobalMaxCommission", 100000000, is_constant=false, readable="percentage_perbill") }}.

#### Nomination Pool Members

Expand Down Expand Up @@ -245,7 +245,7 @@ description: Explore chain constants and storage values for Polkadot, Kusama, an

#### Minimum Validator Commission

The minimum commission a Kusama Validator can set is {{ rpc("kusama-assethub", "Staking", "MinCommission", 0, is_constant=false, readable="percentage") }}. [This does not guarantee entry into the active set and earning rewards](https://docs.polkadot.com/infrastructure/running-a-validator/#running-a-validator).
The minimum commission a Kusama Validator can set is {{ rpc("kusama-assethub", "Staking", "MinCommission", 0, is_constant=false, readable="percentage_perbill") }}. [This does not guarantee entry into the active set and earning rewards](https://docs.polkadot.com/infrastructure/running-a-validator/#running-a-validator).

#### Multisig Deposit Base

Expand All @@ -257,7 +257,7 @@ description: Explore chain constants and storage values for Polkadot, Kusama, an

#### Nomination Pool Max Commission

The maximum commission that can be set for a Kusama nomination pool is {{ rpc("kusama-assethub", "NominationPools", "GlobalMaxCommission", 100000000, is_constant=false, readable="percentage") }}.
The maximum commission that can be set for a Kusama nomination pool is {{ rpc("kusama-assethub", "NominationPools", "GlobalMaxCommission", 100000000, is_constant=false, readable="percentage_perbill") }}.

#### Nomination Pool Members

Expand Down Expand Up @@ -316,7 +316,7 @@ description: Explore chain constants and storage values for Polkadot, Kusama, an

#### Unbonding Duration

The unbonding duration on Kusama is set to {{ rpc("kusama-assethub", "Staking", "BondingDuration", 0, is_constant=true, readable="blocks_to_days") }} days. This is
The unbonding duration on Kusama is set to {{ rpc("kusama-assethub", "Staking", "BondingDuration", 0, is_constant=true, readable="eras_to_days_kusama") }} days. This is
calculated by taking the **bonding duration** (in eras), multiplying it by the **length of a single
era** (in hours), and dividing by the **hours in a day** (24). Example: 28 × 6 ÷ 24 = 7 days.

Expand Down
11 changes: 10 additions & 1 deletion macros/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,31 @@ def format(value, filter):
match filter:
case "percentage":
return f"{value / 10000}%"
case "percentage_perbill":
return f"{value / 10000000}%" # Perbill: 1e9 = 100%
case "human_readable":
return f"{human_readable(10, value)} DOT"
case "human_readable_kusama":
return f"{human_readable(12, value)} KSM"
case "blocks_to_days":
return str(blocks_to_days(value))
case "eras_to_days_kusama":
return str(eras_to_days(value, 6)) # Kusama era = 6 hours
case "precise_ksm":
return f"{human_readable(12, value, rounded=False)} KSM"
case "precise_dot":
return f"{human_readable(10, value, rounded=False)} DOT"
case _:
return str(value)

def blocks_to_days(blocks):
def blocks_to_days(blocks):
return (blocks * 6) / 86400

def eras_to_days(eras, era_hours):
# BondingDuration is denominated in eras, not blocks:
# eras * era length (hours) / hours-per-day
return (eras * era_hours) / 24

def get_network_url(network):
match network:
case "polkadot":
Expand Down