Skip to content

Commit a4cddf9

Browse files
committed
revert: test 04
1 parent 01f0cd0 commit a4cddf9

2 files changed

+4
-17
lines changed

staker/__TEST_more_04_positions_with_different_liquidity_and_in_range_chane_by_swap_test.gno

+3-2
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,8 @@ func testStakeTokenPos02ToWarmUp70_Pos03ToWarmUp50_Pos04ToWarmUp30_Pos05(t *test
253253
CollectReward(4, false) // toUser 0 (out of range)
254254
CollectReward(5, false) // toUser 0 (out of range)
255255

256-
// FIXED: staker.gno CollectReward (L405~L419)
257-
CollectReward(3, false)
256+
// CollectReward(3, false) // toUser 331211442847 // FIXME: insufficient balance
257+
// 테스트 실행하면 3번 포지션에 대해 유저한테 리워드 주는거까지는 통과
258+
// 그러나 페널티를 커뮤니티 풀에 줄 때 스테이커의 GNS 잔액보다 더 높게 계산되어 있는 페널티를 전송할 때 잔액 부족 발생 중
258259
})
259260
}

staker/staker.gno

+1-15
Original file line numberDiff line numberDiff line change
@@ -402,21 +402,7 @@ func CollectReward(tokenId uint64, unwrapResult bool) (string, string) {
402402
toUser := handleUnstakingFee(consts.GNS_PATH, reward.Internal, true, tokenId, deposit.targetPoolPath)
403403
println("toUser", toUser)
404404
if toUser > 0 {
405-
stakerBalance := gns.BalanceOf(pusers.AddressOrName(consts.STAKER_ADDR))
406-
println("gns balance (staker) : ", stakerBalance)
407-
408-
// calculate total required GNS amount
409-
totalRequired := toUser + reward.InternalPenalty
410-
411-
// if total required amount exceeeds staker's balance,
412-
// adjust both user reward and penalty proportionally
413-
if totalRequired > stakerBalance {
414-
// adjustment ratio based on available balance
415-
// and apply ratio to both user reward and penalty
416-
ratio := float64(stakerBalance) / float64(totalRequired)
417-
toUser = uint64(float64(toUser) * ratio)
418-
reward.InternalPenalty = uint64(float64(reward.InternalPenalty) * ratio)
419-
}
405+
println("gns balance (staker) : ", gns.BalanceOf(pusers.AddressOrName(consts.STAKER_ADDR)))
420406

421407
println("sending reward", toUser, "to", deposit.owner, "// gns balance (staker) :", gns.BalanceOf(pusers.AddressOrName(consts.STAKER_ADDR)))
422408
gns.Transfer(a2u(deposit.owner), toUser)

0 commit comments

Comments
 (0)