GoodDollar / GoodCollective

Monorepo for GoodCollective (Segmented UBI and Direct Payments Pool)
MIT License
3 stars 1 forks source link

[BUG] Steward Wallet Page - Displaying inaccurate amount paid to Steward #128

Closed decentralauren closed 5 months ago

decentralauren commented 5 months ago

Amount received by steward is incorrect:

Screenshot 2024-01-30 at 10 18 03 AM

krisbitney commented 5 months ago

@decentralauren Could you please tell me what the correct value is?

@sirpy Could you please clarify how rewards should be calculated?

This is the current logic. What about this is incorrect?

    const totalReward = rewardPerContributor.times(eventQuantity);

    // update StewardCollective
    let stewardCollective = StewardCollective.load(stewardCollectiveId);
    if (stewardCollective === null) {
      stewardCollective = new StewardCollective(stewardCollectiveId);
      stewardCollective.actions = 0;
      stewardCollective.totalEarned = BigInt.fromI32(0);
    }
    stewardCollective.actions = stewardCollective.actions + 1;
    stewardCollective.totalEarned = stewardCollective.totalEarned.plus(totalReward);
decentralauren commented 5 months ago

cc @L03TJ3 in case you can help.

@krisbitney the "total paid out" amount in the Collective page is the summary of the value described above across all stewards who have been paid. The Total Paid Out for this pool is 24,001 G$.

decentralauren commented 5 months ago

IE the total paid out to this steward should be 24,001 less any amounts paid to other stewards.

krisbitney commented 5 months ago

cc @L03TJ3 in case you can help.

@krisbitney the "total paid out" amount in the Collective page is the summary of the value described above across all stewards who have been paid. The Total Paid Out for this pool is 24,001 G$.

Are you sure the Total Paid Out value of $24,001 is correct? is it possible that the Steward value is correct and the Total Paid Out value is not? I ask because I found a discrepancy and it actually looks like the Steward value might be correct and the Total Paid Out value might not be. I say that just based on which equation looks correct, not based on the results of the calculations.

sirpy commented 5 months ago

@krisbitney Looking at the on-chain data, the steward has received 24k G$s. There's no need to multiply by quantity that's the cause of the error. the rewardpercontributer in the event is the final amount.

krisbitney commented 5 months ago

@krisbitney Looking at the on-chain data, the steward has received 24k G$s. There's no need to multiply by quantity that's the cause of the error. the rewardpercontributer in the event is the final amount.

Thanks!

krisbitney commented 5 months ago

This is fixed in https://github.com/GoodDollar/GoodCollective/pull/144

vldkhh commented 5 months ago

verified