Skip to content
This repository was archived by the owner on Aug 22, 2025. It is now read-only.

Comments

[forte-staking] Forte staking strategy#1754

Merged
ChaituVR merged 13 commits intosnapshot-labs:masterfrom
oscarsernarosero:forte-staking
Jun 19, 2025
Merged

[forte-staking] Forte staking strategy#1754
ChaituVR merged 13 commits intosnapshot-labs:masterfrom
oscarsernarosero:forte-staking

Conversation

@oscarsernarosero
Copy link
Contributor

No description provided.

Copy link

@cirsteve cirsteve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, 1 small comment


function calculateVotingPower(rawBatches: batch[], kycLevel: number): number {
let votingPower: bigint = 0n;
rawBatches.forEach((batch) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This forEach could be replaced with reduce and ``votingPowerbeing replaced withaccumulator` so line 61 would be `rawBatches.reduce((acc, batch) => {` and the return value would be `return acc + (stake * BigInt(4 * (daysStaked > 1 ? daysStaked - 1 : 0))) / 1461n;`

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great suggestion. Implemented.

(today - stakeDate) / (60 * 60 * 24 * 1000) // (...) / (1 day in ms)
);
const stake: bigint = BigInt(batch[stakeAmount]._hex);
return (votingPower +=

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this works however votingPower as the accumulator is assigned to whatever is returned by the called function, so votingPower does not need to be updated and the called function can return votingPower + (stake * BigInt(4 * (daysStaked > 1 ? daysStaked - 1 : 0))) / 1461n)

@oscarsernarosero oscarsernarosero marked this pull request as ready for review June 17, 2025 19:57
@ChaituVR ChaituVR changed the title Forte staking [forte-staking] Forte staking strategy Jun 18, 2025
import { Multicaller } from '../../utils';
import { formatUnits } from '@ethersproject/units';

export const author = 'forte';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be a github related to forte 😅 it will help identify you if you want to update this strategy in future

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😅 ok I wasn't aware this had the purpose of giving update privileges. I changed it to my GH user

@ChaituVR
Copy link
Member

Also, lint is failing. Could you check?

@oscarsernarosero
Copy link
Contributor Author

PR changes addressed

@ChaituVR ChaituVR merged commit 41ee558 into snapshot-labs:master Jun 19, 2025
4 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants