Skip to content

Commit

Permalink
Remove 'epoch' in TPS tab
Browse files Browse the repository at this point in the history
  • Loading branch information
Dr-Electron committed Oct 15, 2023
1 parent 1fa3160 commit 847ca77
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 20 deletions.
25 changes: 5 additions & 20 deletions src/components/ManaCalculator/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
ValidatorParameters,
} from './types';
import { Details } from '@docusaurus/theme-common/Details';
import { EPOCH } from './utils';

function ValidatorCard({
validator,
Expand Down Expand Up @@ -92,7 +93,6 @@ function ValidatorCard({

export default function ManaCalculator() {
const [state, setState] = useState({
epoch: 1154 + 1,
initialEpoch: 0,
finalEpoch: 100,
validators: [
Expand Down Expand Up @@ -242,13 +242,6 @@ export default function ManaCalculator() {
});
}

function handleEpochChange(value: number) {
setState({
...state,
epoch: value,
});
}

function handleInitialEpochChange(value: number) {
setState({
...state,
Expand Down Expand Up @@ -280,14 +273,14 @@ export default function ManaCalculator() {
state.delegator.validator,
null,
state.validators,
state.epoch,
EPOCH,
null,
'Delegator',
);
let passiveRewards = calculatePassiveRewards(
state.stake,
state.epoch,
state.epoch + 1,
EPOCH,
EPOCH + 1,
);

let grantedTPS = calculateTPS(manaGeneratedPerEpoch, state.congestion);
Expand All @@ -312,7 +305,7 @@ export default function ManaCalculator() {
state.validator.attractedDelegatedStakeFromOtherPools,
} as ValidatorParameters,
state.validators,
state.epoch,
EPOCH,
null,
'Validator',
);
Expand Down Expand Up @@ -387,14 +380,6 @@ export default function ManaCalculator() {
<Tabs>
<TabItem value='tps' label='TPS'>
<div className='table'>
<div className='row'>
<label className='col col--6'>Epoch:</label>
<input
className='col col--6 align-right'
value={state.epoch}
onChange={(e) => handleEpochChange(Number(e.target.value))}
></input>
</div>
<Details summary='Advanced Settings - Validators'>
<div className='row'>
{state.validators.map((validator, i) => (
Expand Down
1 change: 1 addition & 0 deletions src/components/ManaCalculator/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const REWARDS_MANA_SHARE_COEFFICIENT = 2;
export const RMC_LOW_CONGESTION = 100000;
export const RMC_STABLE_CONGESTION = 9000000;
export const RMC_EXTREME_CONGESTION = 500000000;
export const EPOCH = 1154 + 1;

// given t in seconds, returns the slot that time t belongs to
function time_to_slot(t: number): number {
Expand Down

0 comments on commit 847ca77

Please sign in to comment.