From 19e499d21b457f78a1706b7c1f4460c2f4b3cd0c Mon Sep 17 00:00:00 2001 From: hyeon Date: Mon, 24 Jun 2024 21:33:24 +0900 Subject: [PATCH] Treat season as decimal to make address form --- .Lib9c.Tests/Helper/AdventureBossHelperTest.cs | 10 ++++++++++ Lib9c/Helper/AdventureBossHelper.cs | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.Lib9c.Tests/Helper/AdventureBossHelperTest.cs b/.Lib9c.Tests/Helper/AdventureBossHelperTest.cs index 263613cf1c..36cd74a1b7 100644 --- a/.Lib9c.Tests/Helper/AdventureBossHelperTest.cs +++ b/.Lib9c.Tests/Helper/AdventureBossHelperTest.cs @@ -17,6 +17,16 @@ public class AdventureBossHelperTest private Address _avatarAddress = new PrivateKey().Address; private string _name = "wanted"; + [Theory] + [InlineData(1, "0000000000000000000000000000000000000001")] + [InlineData(10, "0000000000000000000000000000000000000010")] + [InlineData(16, "0000000000000000000000000000000000000016")] + [InlineData(100, "0000000000000000000000000000000000000100")] + public void SeasonToAddressForm(int season, string expectedAddr) + { + Assert.Equal(expectedAddr, AdventureBossHelper.GetSeasonAsAddressForm(season)); + } + [Theory] // Raffle reward is always 0 when isReal == false [InlineData(0)] diff --git a/Lib9c/Helper/AdventureBossHelper.cs b/Lib9c/Helper/AdventureBossHelper.cs index 7af324a1d4..ab087b7ec1 100644 --- a/Lib9c/Helper/AdventureBossHelper.cs +++ b/Lib9c/Helper/AdventureBossHelper.cs @@ -23,7 +23,7 @@ public static class AdventureBossHelper { public static string GetSeasonAsAddressForm(long season) { - return $"{season:X40}"; + return $"{season:D40}"; } public const int RaffleRewardPercent = 5;