Skip to content

Commit

Permalink
Revert "MERGE PR: updated the Stats data of QEarn SC (#243)"
Browse files Browse the repository at this point in the history
This reverts commit 9889ac2.
  • Loading branch information
Franziska-Mueller committed Dec 21, 2024
1 parent 944dfa7 commit b3adf62
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions src/contracts/Qearn.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,7 @@ struct QEARN : public ContractBase
output.totalLockedAmount = 0;
output.averageAPY = 0;
locals.cnt = 0;

for(locals._t = qpi.epoch() - 1U; locals._t >= qpi.epoch() - 52U; locals._t--)
for(locals._t = qpi.epoch(); locals._t >= qpi.epoch() - 52U; locals._t--)
{
if(locals._t < QEARN_INITIAL_EPOCH)
{
Expand Down Expand Up @@ -771,13 +770,14 @@ struct QEARN : public ContractBase
/*
the initial total locked amount should exclude the amount that locked on initial epoch but it didn't exclude that amount before.
so now it is updated.
I recorded the initial total locked amount of epoch 139 with 1834842583179.
this line will be deleted at epoch 141 at least.
I recorded the initial total locked amount of epoch 138 with 6924939374040.
once the epoch 139 is finished, I will also update the initial total locked amount of epoch 139.
this line will be deleted at epoch 140 or 141 at least.
*/
locals.INITIALIZE_ROUNDINFO._epochBonusAmount = state._initialRoundInfo.get(139)._epochBonusAmount;
locals.INITIALIZE_ROUNDINFO._totalLockedAmount = 1834842583179;
locals.INITIALIZE_ROUNDINFO._epochBonusAmount = state._initialRoundInfo.get(138)._epochBonusAmount;
locals.INITIALIZE_ROUNDINFO._totalLockedAmount = 6924939374040;

state._initialRoundInfo.set(139, locals.INITIALIZE_ROUNDINFO);
state._initialRoundInfo.set(138, locals.INITIALIZE_ROUNDINFO);
_

struct END_EPOCH_locals
Expand Down
6 changes: 3 additions & 3 deletions test/contract_qearn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,10 +376,10 @@ class ContractTestingQearn : protected ContractTesting

const auto scStatsInfo = getStatsPerEpoch(epoch);
/*
we can't test at epoch 139 because the value of state in QEarn SC was assigned by hardcoding.
To test the epoch 139, please remove the line 776~779 in QEarn SC.
we can't test at epoch 138 because the value of state in QEarn SC was assigned by hardcoding.
To test the epoch 138, please remove the line 777~780 in QEarn SC.
*/
if(epoch != 139)
if(epoch != 138)
{
EXPECT_EQ(scStatsInfo.earlyUnlockedAmount, ed.initialTotalLockedAmount - ed.amountCurrentlyLocked);
EXPECT_EQ(scStatsInfo.earlyUnlockedPercent, QPI::div((ed.initialTotalLockedAmount - ed.amountCurrentlyLocked) * 10000, ed.initialTotalLockedAmount));
Expand Down

0 comments on commit b3adf62

Please sign in to comment.