From 5aecbbc6360be617e27f21b3ec91723f697e5703 Mon Sep 17 00:00:00 2001 From: marc2332 Date: Tue, 21 Nov 2023 16:30:50 +0100 Subject: [PATCH 1/9] fix: Wrap up Mana Calculator --- .../ManaCalculator/actions/calculateBPS.ts | 2 +- .../components/BlocksAllowance.tsx | 60 ------------------- .../components/ManaCalculator.tsx | 4 +- .../components/ValidatorSettings.tsx | 33 +--------- .../ManaCalculator/components/index.ts | 1 - src/components/ManaCalculator/constants.ts | 6 +- .../ManaCalculator/hooks/useManaState.ts | 31 +++------- .../ManaCalculator/hooks/useResults.ts | 14 +++-- .../hooks/useResultsWithUnit.ts | 2 - 9 files changed, 23 insertions(+), 130 deletions(-) delete mode 100644 src/components/ManaCalculator/components/BlocksAllowance.tsx diff --git a/src/components/ManaCalculator/actions/calculateBPS.ts b/src/components/ManaCalculator/actions/calculateBPS.ts index adf6427c0ca..8b454fb5180 100644 --- a/src/components/ManaCalculator/actions/calculateBPS.ts +++ b/src/components/ManaCalculator/actions/calculateBPS.ts @@ -1,5 +1,5 @@ import { EPOCH_DURATION } from '../constants'; export function calculateBPS(mana: number, congestion: number): number { - return mana / congestion / EPOCH_DURATION; + return mana / congestion; } diff --git a/src/components/ManaCalculator/components/BlocksAllowance.tsx b/src/components/ManaCalculator/components/BlocksAllowance.tsx deleted file mode 100644 index 3eb412d3566..00000000000 --- a/src/components/ManaCalculator/components/BlocksAllowance.tsx +++ /dev/null @@ -1,60 +0,0 @@ -import React from 'react'; -import { - Area, - AreaChart, - CartesianGrid, - ResponsiveContainer, - Tooltip, - XAxis, - YAxis, -} from 'recharts'; -import { stringifyUnit, Unit } from '../hooks'; -import { EpochReward } from '../types'; -import { chartTooltip } from './ChartTooltip'; - -export function BlocksAllowance({ - results, - unit, -}: { - results: EpochReward[]; - unit: Unit; -}) { - const unitString = stringifyUnit(unit); - return ( - <> -

Blocks Allowance

- - - - - - - - - - - - - - - - - ); -} diff --git a/src/components/ManaCalculator/components/ManaCalculator.tsx b/src/components/ManaCalculator/components/ManaCalculator.tsx index c28102e6dd8..131ae08dfe5 100644 --- a/src/components/ManaCalculator/components/ManaCalculator.tsx +++ b/src/components/ManaCalculator/components/ManaCalculator.tsx @@ -14,14 +14,13 @@ import { RoleSection, OtherParametersSection, ManaAccumulation, - BlocksAllowance, } from './'; export function ManaCalculator() { const [state, setState] = useState(getDefaultParameters(NetworkType.IOTA)); const manaState = useGivenManaState(state, setState); const results = useResultsPerEpoch(manaState.state); - const { data, manaUnit, blocksUnit } = useResultsWithUnit(results); + const { data, manaUnit } = useResultsWithUnit(results); return (

Configuration

@@ -32,7 +31,6 @@ export function ManaCalculator() {

Results

-
); } diff --git a/src/components/ManaCalculator/components/ValidatorSettings.tsx b/src/components/ManaCalculator/components/ValidatorSettings.tsx index 95be4df6508..d7cc8384f2b 100644 --- a/src/components/ManaCalculator/components/ValidatorSettings.tsx +++ b/src/components/ManaCalculator/components/ValidatorSettings.tsx @@ -5,19 +5,11 @@ import { useManaState } from '../hooks'; export function ValidatorSettings() { const { state: { - validator: { - performanceFactor, - fixedCost, - shareOfYourStakeLocked, - attractedNewDelegatedStake, - attractedDelegatedStakeFromOtherPools, - }, + validator: { performanceFactor, fixedCost, attractedNewDelegatedStake }, }, handleOwnPFChange, handleOwnFCChange, - handleShareOfYourStakeLockedChange, handleAttractedNewDelegatedStakeChange, - handleAttractedDelegatedStakeFromOtherPoolsChange, } = useManaState(); return (
handleOwnFCChange(Number(e.target.value))} > -
- - - handleShareOfYourStakeLockedChange(Number(e.target.value)) - } - > -
@@ -61,19 +43,6 @@ export function ValidatorSettings() { handleAttractedNewDelegatedStakeChange(Number(e.target.value)) } > -
- - - handleAttractedDelegatedStakeFromOtherPoolsChange( - Number(e.target.value), - ) - } - >
); } diff --git a/src/components/ManaCalculator/components/index.ts b/src/components/ManaCalculator/components/index.ts index 144baf9e54b..dfac57d8bbb 100644 --- a/src/components/ManaCalculator/components/index.ts +++ b/src/components/ManaCalculator/components/index.ts @@ -7,4 +7,3 @@ export * from './RoleSection'; export * from './OutputForm'; export * from './NetworkSection'; export * from './ManaAcculation'; -export * from './BlocksAllowance'; diff --git a/src/components/ManaCalculator/constants.ts b/src/components/ManaCalculator/constants.ts index 3eeccf01891..64131d888f3 100644 --- a/src/components/ManaCalculator/constants.ts +++ b/src/components/ManaCalculator/constants.ts @@ -21,7 +21,7 @@ export const IOTA_SUPPLY = 4600000000000000; export const IOTA_CONGESTION = { [CongestionType.HIGH]: 350000000, [CongestionType.MEDIUM]: 0, // Dynamic - [CongestionType.LOW]: 5000000, + [CongestionType.LOW]: 500000, }; export const IOTA_GENERATION_PER_SLOT = Math.pow(2, -17); @@ -37,9 +37,9 @@ export const IOTA_DELEGATED = 600; // IOTA export const SHIMMER_SUPPLY = 1813620509000000; export const SHIMMER_CONGESTION = { - [CongestionType.HIGH]: 350000000, + [CongestionType.HIGH]: 275000000, [CongestionType.MEDIUM]: 0, // Dynamic - [CongestionType.LOW]: 5000000, + [CongestionType.LOW]: 500000, }; export const SHIMMER_GENERATION_PER_SLOT = Math.pow(2, -16); diff --git a/src/components/ManaCalculator/hooks/useManaState.ts b/src/components/ManaCalculator/hooks/useManaState.ts index 92f5c47b90c..495e75bf19f 100644 --- a/src/components/ManaCalculator/hooks/useManaState.ts +++ b/src/components/ManaCalculator/hooks/useManaState.ts @@ -122,13 +122,6 @@ export function useGivenManaState( }); } - function handleShareOfYourStakeLockedChange(value: number) { - setState({ - ...state, - validator: { ...state.validator, shareOfYourStakeLocked: value }, - }); - } - function handleAttractedNewDelegatedStakeChange(value: number) { setState({ ...state, @@ -136,16 +129,6 @@ export function useGivenManaState( }); } - function handleAttractedDelegatedStakeFromOtherPoolsChange(value: number) { - setState({ - ...state, - validator: { - ...state.validator, - attractedDelegatedStakeFromOtherPools: value, - }, - }); - } - function handleInitialEpochChange(value: number) { setState({ ...state, @@ -199,7 +182,6 @@ export function useGivenManaState( handleDelete, handleStakeChange, handleAddValidator, - handleAttractedDelegatedStakeFromOtherPoolsChange, handleAttractedNewDelegatedStakeChange, handleCongestionChange, handleDelegatedStakeChange, @@ -210,7 +192,6 @@ export function useGivenManaState( handleOwnFCChange, handleOwnPFChange, handleUserChange, - handleShareOfYourStakeLockedChange, handleOwnStakeChange, handlePFChange, handleValidatorChange, @@ -235,12 +216,13 @@ export function getDefaultParameters( }; const finalNetworkParams = networkParams[network]; + const validators = getValidators(network); return { ...finalNetworkParams, initialEpoch: INITIAL_EPOCH, finalEpoch: FINAL_EPOCH, - validators: getValidators(network), + validators, userType: UserType.DELEGATOR, congestion: CongestionType.LOW, delegator: { @@ -249,9 +231,12 @@ export function getDefaultParameters( validator: { performanceFactor: 1.0, fixedCost: 0.0, - shareOfYourStakeLocked: 100.0, - attractedNewDelegatedStake: finalNetworkParams.stakedTokens * 1.5, - attractedDelegatedStakeFromOtherPools: 0.1, + shareOfYourStakeLocked: 1.0, + attractedNewDelegatedStake: + (finalNetworkParams.stakedTokens * + validators.reduce((a, b) => a + b.lockedStake, 0)) / + validators.reduce((a, b) => a + b.delegatedStake, 0), + attractedDelegatedStakeFromOtherPools: 0, }, network, } as ManaCalculatorProps; diff --git a/src/components/ManaCalculator/hooks/useResults.ts b/src/components/ManaCalculator/hooks/useResults.ts index 3d883be690e..5e53f02ff77 100644 --- a/src/components/ManaCalculator/hooks/useResults.ts +++ b/src/components/ManaCalculator/hooks/useResults.ts @@ -3,6 +3,7 @@ import { calculatePassiveRewards, calculateBPS, } from '../actions'; +import { EPOCH_DURATION } from '../constants'; import { UserType } from '../enums'; import { ManaState, ValidatorParameters } from '../types'; @@ -14,8 +15,6 @@ export function useResults(state: ManaState) { state.generationPerSlot, ); - const passiveBPS = calculateBPS(passiveRewards, state.congestionAmount); - const validatorParameters = state.userType === UserType.VALIDATOR ? ({ @@ -41,11 +40,16 @@ export function useResults(state: ManaState) { state.generationPerSlot, ); - const generatedBPS = calculateBPS(generatedRewards, state.congestionAmount); - const totalBPS = generatedBPS + passiveBPS; + const yourBlocksPerEpoch = passiveRewards / state.congestionAmount; + const yourAdditionalBlocksPerEpoch = + generatedRewards / state.congestionAmount; + + const yourTPS = yourBlocksPerEpoch / EPOCH_DURATION; + const yourAdditionalTPS = yourAdditionalBlocksPerEpoch / EPOCH_DURATION; + const totalBPS = yourTPS + yourAdditionalTPS; const msToTransaction = (1 / totalBPS) * 1_000; - const passiveMsToTransaction = (1 / passiveBPS) * 1_000; + const passiveMsToTransaction = (1 / yourTPS) * 1_000; return { generatedRewards, diff --git a/src/components/ManaCalculator/hooks/useResultsWithUnit.ts b/src/components/ManaCalculator/hooks/useResultsWithUnit.ts index 3f437dbd262..72fb955136d 100644 --- a/src/components/ManaCalculator/hooks/useResultsWithUnit.ts +++ b/src/components/ManaCalculator/hooks/useResultsWithUnit.ts @@ -49,7 +49,6 @@ const getUnit = (value: number): Unit => { interface UseResultsWithUnit { data: EpochReward[]; manaUnit: Unit; - blocksUnit: Unit; } export function getSizeOfUnit(unit: Unit): number { @@ -79,6 +78,5 @@ export function useResultsWithUnit(results: EpochReward[]): UseResultsWithUnit { return { data, manaUnit, - blocksUnit, }; } From 0b4faa0e85cd6f73448e1ce2fbce65b057d06c28 Mon Sep 17 00:00:00 2001 From: oliviasaa Date: Wed, 22 Nov 2023 03:51:55 +0000 Subject: [PATCH 2/9] math check --- .../components/DelegatorSettings.tsx | 30 +++++++++ .../components/OtherParametersSection.tsx | 10 ++- .../ManaCalculator/components/OutputForm.tsx | 61 ++++++++++++++++--- .../ManaCalculator/components/RoleSection.tsx | 26 ++++---- .../components/ValidatorSettings.tsx | 23 ++++--- .../ManaCalculator/components/index.ts | 1 + src/components/ManaCalculator/constants.ts | 2 +- .../ManaCalculator/enums/parameters.enum.ts | 1 + .../ManaCalculator/hooks/useManaState.ts | 4 +- .../ManaCalculator/hooks/useResults.ts | 42 +++++++++++-- src/components/ManaCalculator/utils.ts | 3 +- 11 files changed, 163 insertions(+), 40 deletions(-) create mode 100644 src/components/ManaCalculator/components/DelegatorSettings.tsx diff --git a/src/components/ManaCalculator/components/DelegatorSettings.tsx b/src/components/ManaCalculator/components/DelegatorSettings.tsx new file mode 100644 index 00000000000..ead0fa71e41 --- /dev/null +++ b/src/components/ManaCalculator/components/DelegatorSettings.tsx @@ -0,0 +1,30 @@ +import React from 'react'; +import { Details } from '@docusaurus/theme-common/Details'; +import { useManaState } from '../hooks'; +import { fromMicro, toMicro, roundMax } from '../utils'; + +export function DelegatorSettings() { + const { + state, + handleOwnPFChange, + handleOwnFCChange, + handleOwnStakeChange, + handleAttractedNewDelegatedStakeChange, + } = useManaState(); + return ( +
+ + + handleOwnStakeChange(toMicro(Number(e.target.value))) + } + > +
+
+ ); +} diff --git a/src/components/ManaCalculator/components/OtherParametersSection.tsx b/src/components/ManaCalculator/components/OtherParametersSection.tsx index 5d60e49610d..5aa3c621125 100644 --- a/src/components/ManaCalculator/components/OtherParametersSection.tsx +++ b/src/components/ManaCalculator/components/OtherParametersSection.tsx @@ -1,6 +1,7 @@ import React from 'react'; import { useManaState } from '../hooks/useManaState'; import Select from 'react-select'; +import { UserType } from '../enums'; import { CongestionType } from '../enums'; import { AdvancedSettingsValidator } from './AdvancedSettingsValidator'; @@ -45,7 +46,14 @@ export function OtherParametersSection() { value={state.finalEpoch} onChange={(e) => handleFinalEpochChange(Number(e.target.value))} > - + {state.userType === UserType.HOLDER ? ( + <> + + ) : ( + <> + < AdvancedSettingsValidator /> + + )} ); } diff --git a/src/components/ManaCalculator/components/OutputForm.tsx b/src/components/ManaCalculator/components/OutputForm.tsx index 4a7a88340d0..c54c306fc15 100644 --- a/src/components/ManaCalculator/components/OutputForm.tsx +++ b/src/components/ManaCalculator/components/OutputForm.tsx @@ -1,6 +1,7 @@ import React from 'react'; import { useManaState, useResults } from '../hooks'; import { fromMicro, roundMax } from '../utils'; +import { UserType } from '../enums'; import humanizeDuration from 'humanize-duration'; export function OutputForm() { @@ -8,7 +9,8 @@ export function OutputForm() { const results = useResults(state); const passiveRewards = roundMax(fromMicro(results.passiveRewards), 6); const manaGenerated = roundMax(fromMicro(results.generatedRewards), 6); - const totalBPS = roundMax(results.totalBPS, 2); + const blockAllowance = roundMax(results.blockAllowance, 2); + const totalBPS = roundMax(results.totalBPS, 20); const humanizer = humanizeDuration.humanizer({ units: ['y', 'mo', 'w', 'd', 'h', 'm', 's', 'ms'], maxDecimalPoints: 3, @@ -18,27 +20,70 @@ export function OutputForm() { return (
+ { state.userType === UserType.VALIDATOR ? ( + <>
- Mana generation (by holding):{' '} - {passiveRewards} + Generation (by just holding) in the input period:{' '} + {passiveRewards} Mana
- Mana rewards: {manaGenerated} + Mana rewards from staking in the input period: {manaGenerated} Mana
- Total BPS granted: {totalBPS} + Total Block Allowance granted after the input period: {roundMax(blockAllowance,3)} standard blocks +
+
+ Time it takes to accumulate enough mana for a standard block... +
+
+ ...as a holder (owning {fromMicro(state.heldTokens)} tokens and not staking any of them):{' '} + {passiveMsToTransaction} +
+
+ ...as a validator (owning {fromMicro(state.heldTokens)} tokens and staking {fromMicro(state.stakedOrDelegatedTokens)} of them):{' '} + {msToTransaction} +
+ + ) : + state.userType === UserType.DELEGATOR ? ( + <> +
+ Generation (by just holding) in the input period:{' '} + {passiveRewards} Mana +
+
+ Mana rewards from delegating in the input period: {manaGenerated} Mana +
+
+ Total Block Allowance granted after the input period: {roundMax(blockAllowance,3)} standard blocks +
+
+ Time it takes to accumulate enough mana for a standard block...
- Time it takes to accumulate enough mana for a standard transaction... + ...as a holder (owning {fromMicro(state.heldTokens)} tokens and not delegating any of them):{' '} + {passiveMsToTransaction}
- ...as a delegator/validator:{' '} + ...as a delegator (owning {fromMicro(state.heldTokens)} tokens and delegating {fromMicro(state.stakedOrDelegatedTokens)} of them):{' '} {msToTransaction}
+ + ): ( + <> +
+ Generation in the input period:{' '} + {passiveRewards} Mana +
+
+ Total Block Allowance granted after the input period: {roundMax(blockAllowance,3)} standard blocks +
- ...as a holder:{' '} + Time it takes to accumulate enough mana for a standard block:{' '} {passiveMsToTransaction}
+ + )}
); } diff --git a/src/components/ManaCalculator/components/RoleSection.tsx b/src/components/ManaCalculator/components/RoleSection.tsx index 48c4bc26f21..85cadffa2a8 100644 --- a/src/components/ManaCalculator/components/RoleSection.tsx +++ b/src/components/ManaCalculator/components/RoleSection.tsx @@ -4,6 +4,7 @@ import Select from 'react-select'; import { UserType } from '../enums'; import { fromMicro, toMicro } from '../utils'; import { ValidatorSettings } from './ValidatorSettings'; +import { DelegatorSettings } from './DelegatorSettings'; export function RoleSection() { const { @@ -31,30 +32,24 @@ export function RoleSection() { options={[ { value: UserType.DELEGATOR, label: `Delegator` }, { value: UserType.VALIDATOR, label: `Validator` }, + { value: UserType.HOLDER, label: `Holder` }, ]} />
- + handleOwnHoldChange(toMicro(Number(e.target.value)))} >
- {state.userType === UserType.VALIDATOR ? ( + { + state.userType === UserType.VALIDATOR ? ( <> - - - handleOwnStakeChange(toMicro(Number(e.target.value))) - } - > -
- + - ) : ( + ) : + state.userType === UserType.DELEGATOR ? ( <> + handleOwnStakeChange(toMicro(Number(e.target.value))) + } + > +
handleOwnPFChange(Number(e.target.value))} >
@@ -30,15 +39,15 @@ export function ValidatorSettings() { className='mana_calculator__compact input--vertical-spaced' type='number' step='0.01' - value={fixedCost} + value={state.validator.fixedCost} onChange={(e) => handleOwnFCChange(Number(e.target.value))} > handleAttractedNewDelegatedStakeChange(Number(e.target.value)) } diff --git a/src/components/ManaCalculator/components/index.ts b/src/components/ManaCalculator/components/index.ts index dfac57d8bbb..92fa8d84681 100644 --- a/src/components/ManaCalculator/components/index.ts +++ b/src/components/ManaCalculator/components/index.ts @@ -3,6 +3,7 @@ export * from './ManaCalculator'; export * from './OtherParametersSection'; export * from './ValidatorCard'; export * from './ValidatorSettings'; +export * from './DelegatorSettings'; export * from './RoleSection'; export * from './OutputForm'; export * from './NetworkSection'; diff --git a/src/components/ManaCalculator/constants.ts b/src/components/ManaCalculator/constants.ts index 64131d888f3..2ccf3c798e7 100644 --- a/src/components/ManaCalculator/constants.ts +++ b/src/components/ManaCalculator/constants.ts @@ -3,7 +3,7 @@ import { CongestionType } from './enums/parameters.enum'; // GENERIC export const INITIAL_EPOCH = 1; -export const FINAL_EPOCH = 1000; +export const FINAL_EPOCH = 10; export const SLOT_DURATION = 10; export const SLOTS_IN_EPOCH = 8192; export const EPOCH_DURATION = SLOTS_IN_EPOCH * SLOT_DURATION; diff --git a/src/components/ManaCalculator/enums/parameters.enum.ts b/src/components/ManaCalculator/enums/parameters.enum.ts index faff9332bdb..5f5a8e8f4a5 100644 --- a/src/components/ManaCalculator/enums/parameters.enum.ts +++ b/src/components/ManaCalculator/enums/parameters.enum.ts @@ -1,6 +1,7 @@ export enum UserType { DELEGATOR, VALIDATOR, + HOLDER, } export enum NetworkType { diff --git a/src/components/ManaCalculator/hooks/useManaState.ts b/src/components/ManaCalculator/hooks/useManaState.ts index 495e75bf19f..75cd3d844d0 100644 --- a/src/components/ManaCalculator/hooks/useManaState.ts +++ b/src/components/ManaCalculator/hooks/useManaState.ts @@ -234,8 +234,8 @@ export function getDefaultParameters( shareOfYourStakeLocked: 1.0, attractedNewDelegatedStake: (finalNetworkParams.stakedTokens * - validators.reduce((a, b) => a + b.lockedStake, 0)) / - validators.reduce((a, b) => a + b.delegatedStake, 0), + validators.reduce((a, b) => a + b.delegatedStake, 0)) / + validators.reduce((a, b) => a + b.lockedStake, 0), attractedDelegatedStakeFromOtherPools: 0, }, network, diff --git a/src/components/ManaCalculator/hooks/useResults.ts b/src/components/ManaCalculator/hooks/useResults.ts index 5e53f02ff77..2268bda04f5 100644 --- a/src/components/ManaCalculator/hooks/useResults.ts +++ b/src/components/ManaCalculator/hooks/useResults.ts @@ -40,21 +40,51 @@ export function useResults(state: ManaState) { state.generationPerSlot, ); - const yourBlocksPerEpoch = passiveRewards / state.congestionAmount; - const yourAdditionalBlocksPerEpoch = + const passiveRewardsInTheFirstEpoch = calculatePassiveRewards( + state.heldTokens, + state.initialEpoch, + state.initialEpoch + 1, + state.generationPerSlot, + ); + + + const generatedRewardsInTheFirstEpoch = calculateManaRewards( + state.stakedOrDelegatedTokens, + state.delegator.validator, + validatorParameters, + state.validators, + state.initialEpoch, + state.initialEpoch + 1, + state.userType, + state.network, + state.generationPerSlot, + ); + + const yourPassiveBlocksInPeriod = passiveRewards / state.congestionAmount; + const yourAdditionalBlocksInPeriod = generatedRewards / state.congestionAmount; - const yourTPS = yourBlocksPerEpoch / EPOCH_DURATION; - const yourAdditionalTPS = yourAdditionalBlocksPerEpoch / EPOCH_DURATION; - const totalBPS = yourTPS + yourAdditionalTPS; + const yourPassiveBlocksInTheFirstEpoch = passiveRewardsInTheFirstEpoch / state.congestionAmount; + const yourAdditionalBlocksInTheFirstEpoch = + generatedRewardsInTheFirstEpoch / state.congestionAmount; + + const yourTotalBlocksInPeriod = yourPassiveBlocksInPeriod + yourAdditionalBlocksInPeriod + + const yourTotalBlocksInTheFirstEpoch = yourPassiveBlocksInTheFirstEpoch + yourAdditionalBlocksInTheFirstEpoch + + const blockAllowance = yourTotalBlocksInPeriod; + + const yourBPSasHolder = yourPassiveBlocksInTheFirstEpoch / EPOCH_DURATION; + const totalBPS = yourTotalBlocksInTheFirstEpoch / EPOCH_DURATION; const msToTransaction = (1 / totalBPS) * 1_000; - const passiveMsToTransaction = (1 / yourTPS) * 1_000; + const passiveMsToTransaction = (1 / yourBPSasHolder) * 1_000; return { generatedRewards, passiveRewards, totalBPS, + blockAllowance, msToTransaction, passiveMsToTransaction, }; diff --git a/src/components/ManaCalculator/utils.ts b/src/components/ManaCalculator/utils.ts index 9a6ca572255..5d1f2f870f8 100644 --- a/src/components/ManaCalculator/utils.ts +++ b/src/components/ManaCalculator/utils.ts @@ -7,6 +7,7 @@ import { SHIMMER_GENERATION_PER_SLOT, SHIMMER_SUPPLY, SHIMMER_THROUGHPUT, + SLOT_DURATION, SLOTS_IN_EPOCH, } from './constants'; import { CongestionType, NetworkType, UserType } from './enums'; @@ -51,7 +52,7 @@ export function getNetworkCongestion( const generation = getNetworkGenerationPerSlot(network); const throughput = getNetworkThroughput(network); - return (supply * generation) / (10 * throughput); + return (supply * generation) / (SLOT_DURATION * throughput); } else { if (network == NetworkType.IOTA) { return IOTA_CONGESTION[congestionType]; From 724bebbcfd27632db016e1ac79482c9ad7e1d6a1 Mon Sep 17 00:00:00 2001 From: oliviasaa Date: Wed, 22 Nov 2023 08:40:16 +0000 Subject: [PATCH 3/9] fix formatting --- .../components/DelegatorSettings.tsx | 12 +- .../components/OtherParametersSection.tsx | 11 +- .../ManaCalculator/components/OutputForm.tsx | 150 ++++++++++-------- .../ManaCalculator/components/RoleSection.tsx | 15 +- .../components/ValidatorSettings.tsx | 17 +- .../ManaCalculator/hooks/useResults.ts | 12 +- 6 files changed, 121 insertions(+), 96 deletions(-) diff --git a/src/components/ManaCalculator/components/DelegatorSettings.tsx b/src/components/ManaCalculator/components/DelegatorSettings.tsx index ead0fa71e41..62b484323db 100644 --- a/src/components/ManaCalculator/components/DelegatorSettings.tsx +++ b/src/components/ManaCalculator/components/DelegatorSettings.tsx @@ -16,13 +16,13 @@ export function DelegatorSettings() { summary='Delegator Settings' className='mana_calculator__card mana_calculator_inner__card' > - + - handleOwnStakeChange(toMicro(Number(e.target.value))) - } + className='mana_calculator__compact inlined' + value={fromMicro(state.stakedOrDelegatedTokens)} + onChange={(e) => handleOwnStakeChange(toMicro(Number(e.target.value)))} >
diff --git a/src/components/ManaCalculator/components/OtherParametersSection.tsx b/src/components/ManaCalculator/components/OtherParametersSection.tsx index 5aa3c621125..197e68d5ddd 100644 --- a/src/components/ManaCalculator/components/OtherParametersSection.tsx +++ b/src/components/ManaCalculator/components/OtherParametersSection.tsx @@ -47,12 +47,11 @@ export function OtherParametersSection() { onChange={(e) => handleFinalEpochChange(Number(e.target.value))} > {state.userType === UserType.HOLDER ? ( - <> - - ) : ( - <> - < AdvancedSettingsValidator /> - + <> + ) : ( + <> + + )} ); diff --git a/src/components/ManaCalculator/components/OutputForm.tsx b/src/components/ManaCalculator/components/OutputForm.tsx index c54c306fc15..bf9ae37b349 100644 --- a/src/components/ManaCalculator/components/OutputForm.tsx +++ b/src/components/ManaCalculator/components/OutputForm.tsx @@ -20,69 +20,93 @@ export function OutputForm() { return (
- { state.userType === UserType.VALIDATOR ? ( - <> -
- Generation (by just holding) in the input period:{' '} - {passiveRewards} Mana -
-
- Mana rewards from staking in the input period: {manaGenerated} Mana -
-
- Total Block Allowance granted after the input period: {roundMax(blockAllowance,3)} standard blocks -
-
- Time it takes to accumulate enough mana for a standard block... -
-
- ...as a holder (owning {fromMicro(state.heldTokens)} tokens and not staking any of them):{' '} - {passiveMsToTransaction} -
-
- ...as a validator (owning {fromMicro(state.heldTokens)} tokens and staking {fromMicro(state.stakedOrDelegatedTokens)} of them):{' '} - {msToTransaction} -
- - ) : - state.userType === UserType.DELEGATOR ? ( - <> -
- Generation (by just holding) in the input period:{' '} - {passiveRewards} Mana -
-
- Mana rewards from delegating in the input period: {manaGenerated} Mana -
-
- Total Block Allowance granted after the input period: {roundMax(blockAllowance,3)} standard blocks -
-
- Time it takes to accumulate enough mana for a standard block... -
-
- ...as a holder (owning {fromMicro(state.heldTokens)} tokens and not delegating any of them):{' '} - {passiveMsToTransaction} -
-
- ...as a delegator (owning {fromMicro(state.heldTokens)} tokens and delegating {fromMicro(state.stakedOrDelegatedTokens)} of them):{' '} - {msToTransaction} -
- - ): ( - <> -
- Generation in the input period:{' '} - {passiveRewards} Mana -
-
- Total Block Allowance granted after the input period: {roundMax(blockAllowance,3)} standard blocks -
-
- Time it takes to accumulate enough mana for a standard block:{' '} - {passiveMsToTransaction} -
- + {state.userType === UserType.VALIDATOR ? ( + <> +
+ Generation (by just holding) in the input period:{' '} + {passiveRewards} Mana +
+
+ Mana rewards from staking in the input period:{' '} + {manaGenerated} Mana +
+
+ Total Block Allowance granted after the input period:{' '} + + {roundMax(blockAllowance, 3)} standard blocks + +
+
+ Time it takes to accumulate enough mana for a standard block... +
+
+ ...as a holder (owning{' '} + {fromMicro(state.heldTokens)}{' '} + tokens and not staking any of them):{' '} + {passiveMsToTransaction} +
+
+ ...as a validator (owning{' '} + {fromMicro(state.heldTokens)}{' '} + tokens and staking{' '} + + {fromMicro(state.stakedOrDelegatedTokens)} + {' '} + of them): {msToTransaction} +
+ + ) : state.userType === UserType.DELEGATOR ? ( + <> +
+ Generation (by just holding) in the input period:{' '} + {passiveRewards} Mana +
+
+ Mana rewards from delegating in the input period:{' '} + {manaGenerated} Mana +
+
+ Total Block Allowance granted after the input period:{' '} + + {roundMax(blockAllowance, 3)} standard blocks + +
+
+ Time it takes to accumulate enough mana for a standard block... +
+
+ ...as a holder (owning{' '} + {fromMicro(state.heldTokens)}{' '} + tokens and not delegating any of them):{' '} + {passiveMsToTransaction} +
+
+ ...as a delegator (owning{' '} + {fromMicro(state.heldTokens)}{' '} + tokens and delegating{' '} + + {fromMicro(state.stakedOrDelegatedTokens)} + {' '} + of them): {msToTransaction} +
+ + ) : ( + <> +
+ Generation in the input period:{' '} + {passiveRewards} Mana +
+
+ Total Block Allowance granted after the input period:{' '} + + {roundMax(blockAllowance, 3)} standard blocks + +
+
+ Time it takes to accumulate enough mana for a standard block:{' '} + {passiveMsToTransaction} +
+ )}
); diff --git a/src/components/ManaCalculator/components/RoleSection.tsx b/src/components/ManaCalculator/components/RoleSection.tsx index 85cadffa2a8..f42180fb9c6 100644 --- a/src/components/ManaCalculator/components/RoleSection.tsx +++ b/src/components/ManaCalculator/components/RoleSection.tsx @@ -43,13 +43,11 @@ export function RoleSection() { onChange={(e) => handleOwnHoldChange(toMicro(Number(e.target.value)))} >
- { - state.userType === UserType.VALIDATOR ? ( + {state.userType === UserType.VALIDATOR ? ( <> - + - ) : - state.userType === UserType.DELEGATOR ? ( + ) : state.userType === UserType.DELEGATOR ? ( <> - handleOwnStakeChange(toMicro(Number(e.target.value))) - } + className='mana_calculator__compact inlined' + value={fromMicro(state.stakedOrDelegatedTokens)} + onChange={(e) => handleOwnStakeChange(toMicro(Number(e.target.value)))} >
@@ -47,7 +47,10 @@ export function ValidatorSettings() { handleAttractedNewDelegatedStakeChange(Number(e.target.value)) } diff --git a/src/components/ManaCalculator/hooks/useResults.ts b/src/components/ManaCalculator/hooks/useResults.ts index 2268bda04f5..f29b4996645 100644 --- a/src/components/ManaCalculator/hooks/useResults.ts +++ b/src/components/ManaCalculator/hooks/useResults.ts @@ -47,7 +47,6 @@ export function useResults(state: ManaState) { state.generationPerSlot, ); - const generatedRewardsInTheFirstEpoch = calculateManaRewards( state.stakedOrDelegatedTokens, state.delegator.validator, @@ -64,13 +63,16 @@ export function useResults(state: ManaState) { const yourAdditionalBlocksInPeriod = generatedRewards / state.congestionAmount; - const yourPassiveBlocksInTheFirstEpoch = passiveRewardsInTheFirstEpoch / state.congestionAmount; + const yourPassiveBlocksInTheFirstEpoch = + passiveRewardsInTheFirstEpoch / state.congestionAmount; const yourAdditionalBlocksInTheFirstEpoch = generatedRewardsInTheFirstEpoch / state.congestionAmount; - - const yourTotalBlocksInPeriod = yourPassiveBlocksInPeriod + yourAdditionalBlocksInPeriod - const yourTotalBlocksInTheFirstEpoch = yourPassiveBlocksInTheFirstEpoch + yourAdditionalBlocksInTheFirstEpoch + const yourTotalBlocksInPeriod = + yourPassiveBlocksInPeriod + yourAdditionalBlocksInPeriod; + + const yourTotalBlocksInTheFirstEpoch = + yourPassiveBlocksInTheFirstEpoch + yourAdditionalBlocksInTheFirstEpoch; const blockAllowance = yourTotalBlocksInPeriod; From 39ed71af73a2c823620dcde9e674b768939abc2d Mon Sep 17 00:00:00 2001 From: marc2332 Date: Wed, 22 Nov 2023 09:47:06 +0100 Subject: [PATCH 4/9] tweaks --- .../components/DelegatorSettings.tsx | 38 +++++++++----- .../ManaCalculator/components/RoleSection.tsx | 51 +++---------------- 2 files changed, 31 insertions(+), 58 deletions(-) diff --git a/src/components/ManaCalculator/components/DelegatorSettings.tsx b/src/components/ManaCalculator/components/DelegatorSettings.tsx index ead0fa71e41..0cb90d2fd4c 100644 --- a/src/components/ManaCalculator/components/DelegatorSettings.tsx +++ b/src/components/ManaCalculator/components/DelegatorSettings.tsx @@ -2,29 +2,39 @@ import React from 'react'; import { Details } from '@docusaurus/theme-common/Details'; import { useManaState } from '../hooks'; import { fromMicro, toMicro, roundMax } from '../utils'; +import Select from 'react-select'; export function DelegatorSettings() { - const { - state, - handleOwnPFChange, - handleOwnFCChange, - handleOwnStakeChange, - handleAttractedNewDelegatedStakeChange, - } = useManaState(); + const { state, handleOwnStakeChange, handleValidatorChange } = useManaState(); + + const validatorOptions = state.validators.map((_, i) => { + return { value: i, label: `Validator ${i + 1}` }; + }); + return (
- + + - handleOwnStakeChange(toMicro(Number(e.target.value))) - } + className='mana_calculator__compact inlined' + value={fromMicro(state.stakedOrDelegatedTokens)} + onChange={(e) => handleOwnStakeChange(toMicro(Number(e.target.value)))} > -
); } diff --git a/src/components/ManaCalculator/components/RoleSection.tsx b/src/components/ManaCalculator/components/RoleSection.tsx index 85cadffa2a8..6897fdcb869 100644 --- a/src/components/ManaCalculator/components/RoleSection.tsx +++ b/src/components/ManaCalculator/components/RoleSection.tsx @@ -7,17 +7,7 @@ import { ValidatorSettings } from './ValidatorSettings'; import { DelegatorSettings } from './DelegatorSettings'; export function RoleSection() { - const { - state, - handleOwnStakeChange, - handleUserChange, - handleValidatorChange, - handleOwnHoldChange, - } = useManaState(); - const validatorOptions = state.validators.map((_, i) => { - return { value: i, label: `Validator ${i + 1}` }; - }); - + const { state, handleUserChange, handleOwnHoldChange } = useManaState(); return (

Role configuration

@@ -43,40 +33,13 @@ export function RoleSection() { onChange={(e) => handleOwnHoldChange(toMicro(Number(e.target.value)))} >
- { - state.userType === UserType.VALIDATOR ? ( - <> + {state.userType === UserType.VALIDATOR ? ( - - ) : - state.userType === UserType.DELEGATOR ? ( - <> - - - handleOwnStakeChange(toMicro(Number(e.target.value))) - } - > - - ): ( - <> - - )} + ) : state.userType === UserType.DELEGATOR ? ( + + ) : ( + <> + )}
); } From 521d092578110987a8b6c42676b116a91a9d2f61 Mon Sep 17 00:00:00 2001 From: oliviasaa Date: Wed, 22 Nov 2023 09:11:32 +0000 Subject: [PATCH 5/9] update text --- .../iota2.0/core-concepts/mana-calculator.md | 41 +++++++++++-------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/docs/learn/protocols/iota2.0/core-concepts/mana-calculator.md b/docs/learn/protocols/iota2.0/core-concepts/mana-calculator.md index 441d8987aea..7c491e4f85a 100644 --- a/docs/learn/protocols/iota2.0/core-concepts/mana-calculator.md +++ b/docs/learn/protocols/iota2.0/core-concepts/mana-calculator.md @@ -6,35 +6,42 @@ Mana is a reward resource generated by holding IOTA tokens. It is utilized for b Here, we introduce the Mana calculator: a tool to help you make decisions about the type of participation that will suit you best, to help you predict the Mana generation you’ll be granted, and to decide the number of IOTA tokens you should hold to guarantee your desired level of access in the future. -## How to use the Calculator: Step-by-step instructions +## How to use the Calculator: Simplified Step-by-step instructions -- **Choose your network:** This calculator works for both Shimmer and the future IOTA 2.0 network. Both networks will have their own type of Mana (IOTA Mana and Shimmer Mana), with their own parameters and, consequently, their own behavior. Be sure you select the correct scenario you want to simulate! +- **Network Configuration:** This calculator works for both Shimmer and the future IOTA 2.0 network. Both networks will have their own type of Mana (IOTA Mana and Shimmer Mana), with their own parameters and, consequently, their own behavior. Be sure you select the correct scenario you want to simulate! -- **Choose your role:** Will you delegate to a validator, become a validator yourself, or just hold tokens? To be a validator, you must run a node and lock your tokens while performing validation services, which will give you higher rewards. If you want to delegate to a validator, your tokens will not be locked and you won’t need to run a node, but this will give you fewer rewards than validating. Finally, just holding tokens grants you a certain amount of Mana, which will be less than by validating or delegating. +- **Role Configuration:** Will you delegate to a validator, become a validator yourself, or just hold tokens? To be a validator, you must run a node and lock your tokens while performing validation services, which will give you higher rewards. If you want to delegate to a validator, your tokens will not be locked and you won’t need to run a node, but this will give you fewer rewards than validating. Finally, just holding tokens grants you a certain amount of Mana, which will be less than by validating or delegating. Additionally, no matter which network and role you choose, your Mana generation will depend on how many available tokens you have. Pay attention to the units! The input should be done in IOTA or Shimmer (not microIota or Glow). -- **Input the number of tokens you own:** No matter which network and role you choose, your Mana generation will depend on how many available tokens you have. Pay attention to the units! The input should be done in IOTA or Shimmer (not microIota or Glow). +With the inputs above, you can already estimate how much Mana you’ll be granted per epoch. But what does it mean in BPS? How many blocks per second does your Mana grant you? The answer depends on the size of your block and the network congestion levels. However, we can use a default block size, which will be enough for most applications, and assume certain levels of congestion. This takes us to the last essential configuration step in this calculator: -With the inputs above, you can already estimate how much Mana you’ll be granted per epoch. But what does it mean in BPS? How many blocks per second does your Mana grant you? The answer depends on the size of your block and the network congestion levels. However, we can use a default block size, which will be enough for most applications, and assume certain levels of congestion. This takes us to the last step in this calculator: +- **Choose a congestion level:** Given a certain Mana generation per epoch, this can be translated into a number of blocks issued per second that depends on the congestion level. Choose one of the given congestion levels (low, stable, or extreme) to estimate the time until block issuance, which tells you in which periodicity you’ll be able to issue a block. + +By default, this calculator shows you the acquired Mana and Block Allowance you have granded by participating between epochs 1 and 10. +But you can also play with these values! +Inputting different values for `Initial Epoch` and `Final Epoch` allows to visualize results for any time period desired. +Additionally, you can edit several other default parameters used in this tool in the advanced settings tabs. +In case you want more details, see the description of these parameters [here](/learn/protocols/iota2.0/core-concepts/mana-calculator/#advanced-settings) -- **Choose a congestion level:** Given a certain Mana generation per epoch, this can be translated into a number of blocks issued per second that depends on the congestion level. Choose one of the given congestion levels (low, stable, or extreme) to estimate how many blocks per second your tokens and participation grant you! This metric is also shown in another way: time until block issuance, which tells you in which periodicity you’ll be able to issue a block. ## Advanced settings -The steps outlined above can give you a rough estimate of your Mana generation and granted BPS. However, playing with the advanced settings will give you more precise results. +The steps outlined above can give you a rough estimate of your Mana generation and granted blocks allowance. However, playing with the advanced settings will give you more precise results. -- **Change the state of the system:** The calculator's default settings assume a certain level of participation in the consensus (i.e., locked stake, delegated stake, and performance factor of validators). Those settings can be changed under the “Advanced Settings - State of the System” tab. You can also add or delete validators and change their fixed costs. +- **Change the state of the system:** The calculator's default settings assume a certain level of participation in the consensus (i.e., locked stake, delegated stake, and performance factor of validators). Those settings can be changed under the “Advanced Settings - Validators” tab. You can also add or delete validators and change their fixed costs. -- If you choose to delegate: - - **Change the validator you delegate to:** Under the default settings, you'll delegate to Validator 1 (which is pool that, technically speaking, is under the "equilibrium state", see the WP for more details). However, you can change this setting and know your rewards if you participate in other pools, with different share of delegated to locked stake, and different performance factors. +- If you choose to delegate, you can change two default values under the "Delegator Settings" tab in "Role Configuration": + - **Change the validator you delegate to:** Under the default settings, you'll delegate to Validator 1 (which is pool that, technically speaking, is under the "equilibrium state", see the Whitepaper for more details). However, you can change this setting and know your rewards if you participate in other pools, with different share of delegated to locked stake, and different performance factors. + - **Change the number of delegated tokens:** By default, you will delegate all your tokens to the pool selected above. + However, you can also simulate a scenario where you only delegate part of your tokens, with the rest remaining undelegated. + As usual, pay attention to the units! The input should be done in IOTA or Shimmer (not microIota or Glow). - If you choose to validate: - - **Change the amount of stake delegated to you:** The calculator's default settings automatically assign you a certain share of the delegated stake when you start validating. However, you can change this setting to know your rewards should you manage to attract more (or less) delegated stake than the default setting. - - **Change your performance factor:** Your performance factor under the calculator's default settings is 0.95. However, you can change this to simulate larger or smaller shares of online time. - - **Change your fixed costs:** By the default settings of the calculator, your fixed costs are zero. This setting can be changed so you spare part of the pool rowards just for yourself. However, notice that the fixed cost is a public parameter, that you define during registration. This means that the delegator knows how you set this value and might consider it when choosing a validator to delegate. Furthermore, if you set this value too high, you'll be punished and won't get any rewards. - -- **Simulate your Mana accumulation**: the default setting of the calculator assumes a stationary regime and calculates the block creation rate you guarantee depending on your stake and level of participation. However, especially in the early stages of the network, you might want to save your Mana to sell later. This tab simulates how much Mana you'll accumulate in a certain time period. For that (besides the other already defined inputs), you just need to choose an initial and final epoch, and the tool will plot a graph of your accumulation during that period. In the same graph, you can also have an idea of how many blocks can be issued with this accumulated amount of Mana, for the different congestion levels (already defined in the non-advanced settings). - - + - **Change the number of staked tokens:** As in the case of delegators, by default, you will stake all your tokens. + However, you can also simulate a scenario where you only stake part of your tokens, with the rest remaining unstaked. + As usual, pay attention to the units! The input should be done in IOTA or Shimmer (not microIota or Glow). + - **Change your performance factor:** Your performance factor under the calculator's default settings is 1.0. However, you can change this to simulate smaller shares of online time. + - **Change your fixed costs:** By the default settings of the calculator, your fixed costs are zero. This setting can be changed so you spare part of the pool rewards just for yourself. However, notice that the fixed cost is a public parameter, that you define during registration. This means that the delegator knows how you set this value and might consider it when choosing a validator to delegate. Furthermore, if you set this value too high, you'll be punished and won't get any rewards. + - **Change the amount of stake delegated to you:** The calculator's default settings automatically assign you a certain share of the delegated stake when you start validating, based on a certain "equilibrium state" (see the Whitepaper for more details). However, you can change this setting to know your rewards should you manage to attract more (or less) delegated stake than in the default setting. From 3bbdbc2e2dfdd3e3259e130a52c0192a8ef6e937 Mon Sep 17 00:00:00 2001 From: marc2332 Date: Wed, 22 Nov 2023 10:32:26 +0100 Subject: [PATCH 6/9] unused import --- src/components/ManaCalculator/actions/calculateBPS.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/components/ManaCalculator/actions/calculateBPS.ts b/src/components/ManaCalculator/actions/calculateBPS.ts index 8b454fb5180..869be2b1e4b 100644 --- a/src/components/ManaCalculator/actions/calculateBPS.ts +++ b/src/components/ManaCalculator/actions/calculateBPS.ts @@ -1,5 +1,3 @@ -import { EPOCH_DURATION } from '../constants'; - export function calculateBPS(mana: number, congestion: number): number { return mana / congestion; } From 064d553fd4673051e70448aa41954c3732e0b8ac Mon Sep 17 00:00:00 2001 From: marc2332 Date: Wed, 22 Nov 2023 10:35:13 +0100 Subject: [PATCH 7/9] clean up --- .../ManaCalculator/components/DelegatorSettings.tsx | 2 +- src/components/ManaCalculator/components/OutputForm.tsx | 1 - src/components/ManaCalculator/hooks/useResults.ts | 6 +----- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/components/ManaCalculator/components/DelegatorSettings.tsx b/src/components/ManaCalculator/components/DelegatorSettings.tsx index 0cb90d2fd4c..37c8f0f3f10 100644 --- a/src/components/ManaCalculator/components/DelegatorSettings.tsx +++ b/src/components/ManaCalculator/components/DelegatorSettings.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { Details } from '@docusaurus/theme-common/Details'; import { useManaState } from '../hooks'; -import { fromMicro, toMicro, roundMax } from '../utils'; +import { fromMicro, toMicro } from '../utils'; import Select from 'react-select'; export function DelegatorSettings() { diff --git a/src/components/ManaCalculator/components/OutputForm.tsx b/src/components/ManaCalculator/components/OutputForm.tsx index bf9ae37b349..711a873930c 100644 --- a/src/components/ManaCalculator/components/OutputForm.tsx +++ b/src/components/ManaCalculator/components/OutputForm.tsx @@ -10,7 +10,6 @@ export function OutputForm() { const passiveRewards = roundMax(fromMicro(results.passiveRewards), 6); const manaGenerated = roundMax(fromMicro(results.generatedRewards), 6); const blockAllowance = roundMax(results.blockAllowance, 2); - const totalBPS = roundMax(results.totalBPS, 20); const humanizer = humanizeDuration.humanizer({ units: ['y', 'mo', 'w', 'd', 'h', 'm', 's', 'ms'], maxDecimalPoints: 3, diff --git a/src/components/ManaCalculator/hooks/useResults.ts b/src/components/ManaCalculator/hooks/useResults.ts index f29b4996645..0750edaa79a 100644 --- a/src/components/ManaCalculator/hooks/useResults.ts +++ b/src/components/ManaCalculator/hooks/useResults.ts @@ -1,8 +1,4 @@ -import { - calculateManaRewards, - calculatePassiveRewards, - calculateBPS, -} from '../actions'; +import { calculateManaRewards, calculatePassiveRewards } from '../actions'; import { EPOCH_DURATION } from '../constants'; import { UserType } from '../enums'; import { ManaState, ValidatorParameters } from '../types'; From d53ad46764d337f9ae524b9ba059125df2ed99da Mon Sep 17 00:00:00 2001 From: Dr-Electron Date: Wed, 22 Nov 2023 12:14:22 +0100 Subject: [PATCH 8/9] Apply suggestions from code review --- .../iota2.0/core-concepts/mana-calculator.md | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/learn/protocols/iota2.0/core-concepts/mana-calculator.md b/docs/learn/protocols/iota2.0/core-concepts/mana-calculator.md index 7c491e4f85a..d90f0908ac9 100644 --- a/docs/learn/protocols/iota2.0/core-concepts/mana-calculator.md +++ b/docs/learn/protocols/iota2.0/core-concepts/mana-calculator.md @@ -8,17 +8,17 @@ Here, we introduce the Mana calculator: a tool to help you make decisions about ## How to use the Calculator: Simplified Step-by-step instructions -- **Network Configuration:** This calculator works for both Shimmer and the future IOTA 2.0 network. Both networks will have their own type of Mana (IOTA Mana and Shimmer Mana), with their own parameters and, consequently, their own behavior. Be sure you select the correct scenario you want to simulate! +- **Network Configuration:** This calculator works for Shimmer and the future IOTA 2.0 network. Both networks will have their own type of Mana (IOTA Mana and Shimmer Mana), with their own parameters and, consequently, their own behavior. Be sure you select the correct scenario you want to simulate! -- **Role Configuration:** Will you delegate to a validator, become a validator yourself, or just hold tokens? To be a validator, you must run a node and lock your tokens while performing validation services, which will give you higher rewards. If you want to delegate to a validator, your tokens will not be locked and you won’t need to run a node, but this will give you fewer rewards than validating. Finally, just holding tokens grants you a certain amount of Mana, which will be less than by validating or delegating. Additionally, no matter which network and role you choose, your Mana generation will depend on how many available tokens you have. Pay attention to the units! The input should be done in IOTA or Shimmer (not microIota or Glow). +- **Role Configuration:** Will you delegate to a validator, become a validator yourself, or just hold tokens? To be a validator, you must run a node and lock your tokens while performing validation services, giving you higher rewards. If you want to delegate to a validator, your tokens will not be locked and you won’t need to run a node, but this will give you fewer rewards than validating. Finally, just holding tokens grants you a certain amount of Mana, which will be less than by validating or delegating. Additionally, no matter which network and role you choose, your Mana generation will depend on how many available tokens you have. Pay attention to the units! The input should be done in IOTA or Shimmer (not microIota or Glow). -With the inputs above, you can already estimate how much Mana you’ll be granted per epoch. But what does it mean in BPS? How many blocks per second does your Mana grant you? The answer depends on the size of your block and the network congestion levels. However, we can use a default block size, which will be enough for most applications, and assume certain levels of congestion. This takes us to the last essential configuration step in this calculator: +With above inputs, you can already estimate how much Mana you’ll be granted per epoch. But what does it mean in BPS? How many blocks per second does your Mana grant you? The answer depends on the size of your block and the network congestion levels. However, we can use a default block size, which will be enough for most applications, and assume particular congestion levels. This takes us to the last essential configuration step in this calculator: -- **Choose a congestion level:** Given a certain Mana generation per epoch, this can be translated into a number of blocks issued per second that depends on the congestion level. Choose one of the given congestion levels (low, stable, or extreme) to estimate the time until block issuance, which tells you in which periodicity you’ll be able to issue a block. +- **Choose a congestion level:** Given a particular Mana generation per epoch, this can be translated into a number of blocks issued per second that depend on the congestion level. Choose one of the given congestion levels (low, stable, or extreme) to estimate the time until block issuance, which tells you in which periodicity you’ll be able to issue a block. -By default, this calculator shows you the acquired Mana and Block Allowance you have granded by participating between epochs 1 and 10. +By default, this calculator shows you the acquired Mana and Block Allowance you have granted by participating between epochs 1 and 10. But you can also play with these values! -Inputting different values for `Initial Epoch` and `Final Epoch` allows to visualize results for any time period desired. +Inputting different values for `Initial Epoch` and `Final Epoch` allows you to visualize results for any period desired. Additionally, you can edit several other default parameters used in this tool in the advanced settings tabs. In case you want more details, see the description of these parameters [here](/learn/protocols/iota2.0/core-concepts/mana-calculator/#advanced-settings) @@ -30,10 +30,10 @@ In case you want more details, see the description of these parameters [here](/l The steps outlined above can give you a rough estimate of your Mana generation and granted blocks allowance. However, playing with the advanced settings will give you more precise results. -- **Change the state of the system:** The calculator's default settings assume a certain level of participation in the consensus (i.e., locked stake, delegated stake, and performance factor of validators). Those settings can be changed under the “Advanced Settings - Validators” tab. You can also add or delete validators and change their fixed costs. +- **Change the system’s state:** The calculator’s default settings assume a certain level of participation in the consensus (i.e., locked stake, delegated stake, and the performance factor of validators). Those settings can be changed under the “Advanced Settings - Validators” tab. You can also add or delete validators and change their fixed costs. - If you choose to delegate, you can change two default values under the "Delegator Settings" tab in "Role Configuration": - - **Change the validator you delegate to:** Under the default settings, you'll delegate to Validator 1 (which is pool that, technically speaking, is under the "equilibrium state", see the Whitepaper for more details). However, you can change this setting and know your rewards if you participate in other pools, with different share of delegated to locked stake, and different performance factors. + - **Change the validator you delegate to:** Under the default settings, you'll delegate to Validator 1 (which is a pool that, technically speaking, is under the "equilibrium state"; see the Whitepaper for more details). However, you can change this setting and know your rewards if you participate in other pools, with different shares of delegated to locked stakes and different performance factors. - **Change the number of delegated tokens:** By default, you will delegate all your tokens to the pool selected above. However, you can also simulate a scenario where you only delegate part of your tokens, with the rest remaining undelegated. As usual, pay attention to the units! The input should be done in IOTA or Shimmer (not microIota or Glow). @@ -42,6 +42,6 @@ The steps outlined above can give you a rough estimate of your Mana generation a - **Change the number of staked tokens:** As in the case of delegators, by default, you will stake all your tokens. However, you can also simulate a scenario where you only stake part of your tokens, with the rest remaining unstaked. As usual, pay attention to the units! The input should be done in IOTA or Shimmer (not microIota or Glow). - - **Change your performance factor:** Your performance factor under the calculator's default settings is 1.0. However, you can change this to simulate smaller shares of online time. - - **Change your fixed costs:** By the default settings of the calculator, your fixed costs are zero. This setting can be changed so you spare part of the pool rewards just for yourself. However, notice that the fixed cost is a public parameter, that you define during registration. This means that the delegator knows how you set this value and might consider it when choosing a validator to delegate. Furthermore, if you set this value too high, you'll be punished and won't get any rewards. - - **Change the amount of stake delegated to you:** The calculator's default settings automatically assign you a certain share of the delegated stake when you start validating, based on a certain "equilibrium state" (see the Whitepaper for more details). However, you can change this setting to know your rewards should you manage to attract more (or less) delegated stake than in the default setting. + - **Change your performance factor:** Under the calculator's default settings, your performance factor is 1.0. However, you can change this to simulate smaller shares of online time. + - **Change your fixed costs:** By the calculator's default settings, your fixed costs are zero. This setting can be changed so you can spare part of the pool rewards for yourself. However, notice that the fixed cost is a public parameter you define during registration. This means that the delegator knows how you set this value and might consider it when choosing a validator to delegate. Furthermore, if you select this value too high, you'll be punished and won't get any rewards. + - **Change the amount of stake delegated to you:** The calculator's default settings automatically assign you a particular share of the delegated stake when you start validating, based on a specific "equilibrium state" (see the Whitepaper for more details). However, you can change this setting to know your rewards should you attract more (or less) delegated stakes than in the default setting. From 2e84d31cf6d79b48ea8fea72df63f13d0a48c118 Mon Sep 17 00:00:00 2001 From: Dr-Electron Date: Wed, 22 Nov 2023 16:41:09 +0100 Subject: [PATCH 9/9] Update docs/learn/protocols/iota2.0/core-concepts/mana-calculator.md --- docs/learn/protocols/iota2.0/core-concepts/mana-calculator.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/learn/protocols/iota2.0/core-concepts/mana-calculator.md b/docs/learn/protocols/iota2.0/core-concepts/mana-calculator.md index d90f0908ac9..c47b57c4940 100644 --- a/docs/learn/protocols/iota2.0/core-concepts/mana-calculator.md +++ b/docs/learn/protocols/iota2.0/core-concepts/mana-calculator.md @@ -44,4 +44,4 @@ The steps outlined above can give you a rough estimate of your Mana generation a As usual, pay attention to the units! The input should be done in IOTA or Shimmer (not microIota or Glow). - **Change your performance factor:** Under the calculator's default settings, your performance factor is 1.0. However, you can change this to simulate smaller shares of online time. - **Change your fixed costs:** By the calculator's default settings, your fixed costs are zero. This setting can be changed so you can spare part of the pool rewards for yourself. However, notice that the fixed cost is a public parameter you define during registration. This means that the delegator knows how you set this value and might consider it when choosing a validator to delegate. Furthermore, if you select this value too high, you'll be punished and won't get any rewards. - - **Change the amount of stake delegated to you:** The calculator's default settings automatically assign you a particular share of the delegated stake when you start validating, based on a specific "equilibrium state" (see the Whitepaper for more details). However, you can change this setting to know your rewards should you attract more (or less) delegated stakes than in the default setting. + - **Change the amount of stake delegated to you:** The calculator's default settings automatically assign you a particular share of the delegated stake when you start validating, based on a specific "equilibrium state" (see the [Whitepaper](https://files.iota.org/papers/IOTA_2.0_Incentives_And_Tokenomics_Whitepaper.pdf) for more details). However, you can change this setting to know your rewards should you attract more (or less) delegated stakes than in the default setting.