diff --git a/.Lib9c.Tests/Action/Guild/MoveGuildTest.cs b/.Lib9c.Tests/Action/Guild/MoveGuildTest.cs index 2186138914..3a707c2df4 100644 --- a/.Lib9c.Tests/Action/Guild/MoveGuildTest.cs +++ b/.Lib9c.Tests/Action/Guild/MoveGuildTest.cs @@ -36,6 +36,7 @@ public void Execute() var guildAddress2 = AddressUtil.CreateGuildAddress(); world = EnsureToCreateValidator(world, validatorKey1.PublicKey); world = EnsureToCreateValidator(world, validatorKey2.PublicKey); + world = EnsureToPrepareGuildGold(world, guildMasterAddress1, GG * 100); world = EnsureToMakeGuild(world, guildAddress1, guildMasterAddress1, validatorKey1.Address); world = EnsureToMakeGuild(world, guildAddress2, guildMasterAddress2, validatorKey2.Address); world = EnsureToPrepareGuildGold(world, agentAddress, GG * 100); @@ -62,8 +63,8 @@ public void Execute() var guildParticipant = guildRepository.GetGuildParticipant(agentAddress); Assert.Equal(guildAddress2, guildParticipant.GuildAddress); - Assert.Equal(0, guildDelegatee1.TotalShares); - Assert.Equal(0, validatorDelegatee1.TotalShares); + Assert.Equal(100 * SharePerGG, guildDelegatee1.TotalShares); + Assert.Equal(100 * SharePerGG, validatorDelegatee1.TotalShares); Assert.Equal(100 * SharePerGG, guildDelegatee2.TotalShares); Assert.Equal(100 * SharePerGG, validatorDelegatee2.TotalShares); } diff --git a/Lib9c/Module/Guild/GuildParticipantModule.cs b/Lib9c/Module/Guild/GuildParticipantModule.cs index 8b234a6b4d..085b5bec56 100644 --- a/Lib9c/Module/Guild/GuildParticipantModule.cs +++ b/Lib9c/Module/Guild/GuildParticipantModule.cs @@ -71,8 +71,8 @@ public static GuildRepository MoveGuild( var guildParticipant1 = repository.GetGuildParticipant(guildParticipantAddress); var srcGuild = repository.GetGuild(guildParticipant1.GuildAddress); var dstGuild = repository.GetGuild(dstGuildAddress); + var srcGuildDelegatee = repository.GetDelegatee(srcGuild.ValidatorAddress); var validatorRepository = new ValidatorRepository(repository.World, repository.ActionContext); - var srcValidatorDelegatee = validatorRepository.GetDelegatee(srcGuild.ValidatorAddress); var dstValidatorDelegatee = validatorRepository.GetDelegatee(dstGuild.ValidatorAddress); if (dstValidatorDelegatee.Tombstoned) { @@ -80,7 +80,7 @@ public static GuildRepository MoveGuild( } var guildParticipant2 = new GuildParticipant(guildParticipantAddress, dstGuildAddress, repository); - var bond = validatorRepository.GetBond(srcValidatorDelegatee, srcGuild.Address); + var bond = repository.GetBond(srcGuildDelegatee, guildParticipantAddress); var share = bond.Share; repository.RemoveGuildParticipant(guildParticipantAddress); repository.DecreaseGuildMemberCount(guildParticipant1.GuildAddress);