Skip to content

Commit

Permalink
test: Fix reward calculation test method
Browse files Browse the repository at this point in the history
  • Loading branch information
OnedgeLee committed Dec 12, 2024
1 parent d60a473 commit 86b8103
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ namespace Lib9c.Tests.Action.ValidatorDelegation;
using Nekoyume.ValidatorDelegation;
using Xunit;
using Nekoyume.Action.Guild.Migration.LegacyModels;
using Nekoyume.Delegation;

public class ValidatorDelegationTestBase
{
Expand Down Expand Up @@ -592,7 +593,10 @@ protected static FungibleAssetValue CalculateBonusPropserReward(
}

protected static FungibleAssetValue CalculateClaim(BigInteger share, BigInteger totalShare, FungibleAssetValue totalClaim)
=> (totalClaim * share).DivRem(totalShare).Quotient;
{
var multiplier = BigInteger.Pow(10, (int)Math.Floor(BigInteger.Log10(totalShare)) + RewardBase.Margin);
return ((totalClaim * multiplier).DivRem(totalShare).Quotient * share).DivRem(multiplier).Quotient;
}

protected static FungibleAssetValue CalculateCommunityFund(ImmutableArray<Vote> votes, FungibleAssetValue reward)
{
Expand Down

0 comments on commit 86b8103

Please sign in to comment.