diff --git a/.Lib9c.Benchmarks/Actions/MigrateDelegation.cs b/.Lib9c.Benchmarks/Actions/MigrateDelegation.cs deleted file mode 100644 index 01610e9d14..0000000000 --- a/.Lib9c.Benchmarks/Actions/MigrateDelegation.cs +++ /dev/null @@ -1,128 +0,0 @@ -using BenchmarkDotNet.Attributes; -using Bencodex.Types; -using Lib9c.Tests.Action; -using Lib9c.Tests.Util; -using Libplanet.Action.State; -using Libplanet.Crypto; -using Libplanet.Mocks; -using Nekoyume; -using Nekoyume.Action.Guild; -using Nekoyume.Action.Guild.Migration; -using Nekoyume.Action.Guild.Migration.LegacyModels; -using Nekoyume.Extensions; -using Nekoyume.TypedAddress; - -namespace Lib9c.Benchmarks.Actions; - -public class MigrateDelegation -{ - private GuildAddress planetariumGuild = AddressUtil.CreateGuildAddress(); - private AgentAddress target = AddressUtil.CreateAgentAddress(); - private AgentAddress signer = AddressUtil.CreateAgentAddress(); - private IWorld worldEmpty; - private IWorld worldBeforeGuildMigration; - private IWorld worldBeforeParticipantMigration; - private IWorld worldAfterMigration; - - [GlobalSetup] - public void Setup() - { - worldEmpty = new World(MockUtil.MockModernWorldState); - var legacyPlanetariumGuild = new LegacyGuild(GuildConfig.PlanetariumGuildOwner); - var legacyPlanetariumGuildParticipant = new LegacyGuildParticipant(planetariumGuild); - worldBeforeGuildMigration = worldEmpty - .MutateAccount( - Addresses.Guild, - account => account.SetState(planetariumGuild, legacyPlanetariumGuild.Bencoded)) - .MutateAccount( - Addresses.GuildParticipant, - account => account.SetState(GuildConfig.PlanetariumGuildOwner, legacyPlanetariumGuildParticipant.Bencoded)) - .MutateAccount( - Addresses.GuildParticipant, - account => account.SetState(target, legacyPlanetariumGuildParticipant.Bencoded)) - .MutateAccount( - Addresses.GuildMemberCounter, - account => account.SetState(planetariumGuild, (Integer)2)); - worldBeforeParticipantMigration = new MigratePlanetariumGuild().Execute(new ActionContext - { - PreviousState = worldBeforeGuildMigration, - Signer = new PrivateKey().Address, - }); - } - - [Benchmark] - public void Execute_Empty() - { - var action = new Nekoyume.Action.Guild.Migration.MigrateDelegation(target); - try - { - action.Execute(new ActionContext - { - IsPolicyAction = false, - PreviousState = worldEmpty, - Signer = signer, - }); - } - catch - { - // Do nothing. - } - } - - [Benchmark] - public void Execute_Before_Guild_Migration() - { - var action = new Nekoyume.Action.Guild.Migration.MigrateDelegation(target); - try - { - action.Execute(new ActionContext - { - IsPolicyAction = false, - PreviousState = worldBeforeGuildMigration, - Signer = signer, - }); - } - catch - { - // Do nothing. - } - } - - [Benchmark] - public void Execute_Before_Participant_Migration() - { - var action = new Nekoyume.Action.Guild.Migration.MigrateDelegation(target); - try - { - action.Execute(new ActionContext - { - IsPolicyAction = false, - PreviousState = worldBeforeParticipantMigration, - Signer = signer, - }); - } - catch - { - // Do nothing. - } - } - - [Benchmark] - public void Execute_After_Migration() - { - var action = new Nekoyume.Action.Guild.Migration.MigrateDelegation(target); - try - { - action.Execute(new ActionContext - { - IsPolicyAction = false, - PreviousState = worldAfterMigration, - Signer = signer, - }); - } - catch - { - // Do nothing. - } - } -} diff --git a/.Lib9c.Tests/Action/BuyTest.cs b/.Lib9c.Tests/Action/BuyTest.cs index b2e2fa7674..282ad06ede 100644 --- a/.Lib9c.Tests/Action/BuyTest.cs +++ b/.Lib9c.Tests/Action/BuyTest.cs @@ -15,7 +15,6 @@ namespace Lib9c.Tests.Action using Libplanet.Types.Assets; using Nekoyume; using Nekoyume.Action; - using Nekoyume.Action.Guild.Migration.LegacyModels; using Nekoyume.Arena; using Nekoyume.Model; using Nekoyume.Model.Item; @@ -105,8 +104,7 @@ public BuyTest(ITestOutputHelper outputHelper) .SetAgentState(_buyerAgentAddress, buyerAgentState) .SetAvatarState(_buyerAvatarAddress, _buyerAvatarState) .SetLegacyState(Addresses.Shop, new ShopState().Serialize()) - .MintAsset(context, _buyerAgentAddress, _goldCurrencyState.Currency * 100) - .SetDelegationMigrationHeight(0); + .MintAsset(context, _buyerAgentAddress, _goldCurrencyState.Currency * 100); } public static IEnumerable GetExecuteMemberData() diff --git a/.Lib9c.Tests/Action/Guild/Migration/FixToRefundFromNonValidatorTest.cs b/.Lib9c.Tests/Action/Guild/Migration/FixToRefundFromNonValidatorTest.cs deleted file mode 100644 index bf5217d27b..0000000000 --- a/.Lib9c.Tests/Action/Guild/Migration/FixToRefundFromNonValidatorTest.cs +++ /dev/null @@ -1,81 +0,0 @@ -namespace Lib9c.Tests.Action.Guild.Migration -{ - using System; - using System.Linq; - using Libplanet.Action.State; - using Libplanet.Crypto; - using Nekoyume; - using Nekoyume.Action; - using Nekoyume.Action.Guild.Migration; - using Nekoyume.Model.Stake; - using Nekoyume.Model.State; - using Nekoyume.Module; - using Xunit; - - // TODO: Remove this test class after the migration is completed. - public class FixToRefundFromNonValidatorTest : GuildTestBase - { - private IWorld _world; - private Address _adminAddress; - - public FixToRefundFromNonValidatorTest() - { - _adminAddress = new PrivateKey().Address; - var adminState = new AdminState(_adminAddress, 100L); - _world = World - .SetLegacyState(Addresses.Admin, adminState.Serialize()) - .MintAsset(new ActionContext { }, Addresses.NonValidatorDelegatee, Currencies.GuildGold * 500); - } - - [Fact] - public void PlainValue() - { - var targets = Enumerable.Range(0, 5).Select(i => (new PrivateKey().Address, (i + 1) * 10)).ToList(); - var plainValue = new FixToRefundFromNonValidator(targets).PlainValue; - - var recon = new FixToRefundFromNonValidator(); - recon.LoadPlainValue(plainValue); - Assert.Equal(targets, recon.Targets); - } - - [Fact] - public void Execute() - { - var targets = Enumerable.Range(0, 5).Select(i => (new PrivateKey().Address, (i + 1) * 10)).ToList(); - - var world = new FixToRefundFromNonValidator(targets).Execute(new ActionContext - { - PreviousState = _world, - Signer = _adminAddress, - BlockIndex = 2L, - }); - - foreach (var item in targets) - { - Assert.Equal( - Currencies.GuildGold * item.Item2, - world.GetBalance(StakeState.DeriveAddress(item.Item1), Currencies.GuildGold)); - } - - Assert.Equal( - Currencies.GuildGold * (500 - targets.Select(t => t.Item2).Sum()), - world.GetBalance(Addresses.NonValidatorDelegatee, Currencies.GuildGold)); - } - - [Fact] - public void AssertWhenExecutedByNonAdmin() - { - var targets = Enumerable.Range(0, 5).Select(i => (new PrivateKey().Address, (i + 1) * 10)).ToList(); - - Assert.Throws(() => - { - new FixToRefundFromNonValidator(targets).Execute(new ActionContext - { - PreviousState = _world, - Signer = new PrivateKey().Address, - BlockIndex = 2L, - }); - }); - } - } -} diff --git a/.Lib9c.Tests/Action/Guild/Migration/MigrateDelegationTest.cs b/.Lib9c.Tests/Action/Guild/Migration/MigrateDelegationTest.cs deleted file mode 100644 index aa42c37100..0000000000 --- a/.Lib9c.Tests/Action/Guild/Migration/MigrateDelegationTest.cs +++ /dev/null @@ -1,122 +0,0 @@ -namespace Lib9c.Tests.Action.Guild.Migration -{ - using System; - using System.Linq; - using System.Numerics; - using Bencodex.Types; - using Lib9c.Tests.Util; - using Libplanet.Action.State; - using Libplanet.Crypto; - using Nekoyume; - using Nekoyume.Action; - using Nekoyume.Action.Guild; - using Nekoyume.Action.Guild.Migration; - using Nekoyume.Action.Guild.Migration.LegacyModels; - using Nekoyume.Extensions; - using Nekoyume.Model.Guild; - using Nekoyume.TypedAddress; - using Xunit; - - // TODO: Remove this test class after the migration is completed. - public class MigrateDelegationTest : GuildTestBase - { - [Fact] - public void Execute() - { - var guildAddress = AddressUtil.CreateGuildAddress(); - var world = EnsureLegacyPlanetariumGuild(World, guildAddress); - var guildMemberCount = 10; - var migratedGuildMemberCount = 5; - var guildMemberAddresses = Enumerable.Range(0, guildMemberCount).Select( - _ => AddressUtil.CreateAgentAddress()).ToList(); - for (var i = 0; i < guildMemberCount; i++) - { - world = EnsureJoinLegacyPlanetariumGuild(world, guildMemberAddresses[i]); - } - - world = EnsureMigratedPlanetariumGuild(world); - - for (var i = 0; i < migratedGuildMemberCount; i++) - { - var action = new MigrateDelegation(guildMemberAddresses[i]); - var actionContext = new ActionContext - { - PreviousState = world, - Signer = new PrivateKey().Address, - }; - world = action.Execute(actionContext); - } - - var repo = new GuildRepository(world, new ActionContext()); - var guild = repo.GetGuild(guildAddress); - - for (var i = 0; i < migratedGuildMemberCount; i++) - { - repo.GetGuildParticipant(guildMemberAddresses[i]); - } - - for (var i = migratedGuildMemberCount; i < guildMemberCount; i++) - { - Assert.Throws(() => repo.GetGuildParticipant(guildMemberAddresses[i])); - } - } - - private static IWorld EnsureLegacyPlanetariumGuild(IWorld world, GuildAddress guildAddress) - { - var legacyPlanetariumGuild = new LegacyGuild(GuildConfig.PlanetariumGuildOwner); - var legacyPlanetariumGuildParticipant = new LegacyGuildParticipant(guildAddress); - - return world - .MutateAccount( - Addresses.Guild, - account => account.SetState(guildAddress, legacyPlanetariumGuild.Bencoded)) - .MutateAccount( - Addresses.GuildParticipant, - account => account.SetState(GuildConfig.PlanetariumGuildOwner, legacyPlanetariumGuildParticipant.Bencoded)) - .MutateAccount( - Addresses.GuildMemberCounter, - account => - { - BigInteger count = account.GetState(guildAddress) switch - { - Integer i => i.Value, - null => 0, - _ => throw new InvalidCastException(), - }; - - return account.SetState(guildAddress, (Integer)(count + 1)); - }); - } - - private static IWorld EnsureJoinLegacyPlanetariumGuild(IWorld world, AgentAddress guildParticipantAddress) - { - var planetariumGuildAddress - = new LegacyGuildParticipant( - world.GetAccount(Addresses.GuildParticipant).GetState(GuildConfig.PlanetariumGuildOwner) as List).GuildAddress; - var legacyParticipant = new LegacyGuildParticipant(planetariumGuildAddress); - - return world - .MutateAccount(Addresses.GuildParticipant, account => account.SetState(guildParticipantAddress, legacyParticipant.Bencoded)) - .MutateAccount( - Addresses.GuildMemberCounter, - account => - { - BigInteger count = account.GetState(planetariumGuildAddress) switch - { - Integer i => i.Value, - null => 0, - _ => throw new InvalidCastException(), - }; - - return account.SetState(planetariumGuildAddress, (Integer)(count + 1)); - }); - } - - private static IWorld EnsureMigratedPlanetariumGuild(IWorld world) - => new MigratePlanetariumGuild().Execute(new ActionContext - { - PreviousState = world, - Signer = new PrivateKey().Address, - }); - } -} diff --git a/.Lib9c.Tests/Action/Guild/Migration/MigratePlanetariumGuildTest.cs b/.Lib9c.Tests/Action/Guild/Migration/MigratePlanetariumGuildTest.cs deleted file mode 100644 index 6f5686bd34..0000000000 --- a/.Lib9c.Tests/Action/Guild/Migration/MigratePlanetariumGuildTest.cs +++ /dev/null @@ -1,65 +0,0 @@ -namespace Lib9c.Tests.Action.Guild.Migration -{ - using Lib9c.Tests.Util; - using Libplanet.Action.State; - using Libplanet.Crypto; - using Nekoyume; - using Nekoyume.Action; - using Nekoyume.Action.Guild; - using Nekoyume.Action.Guild.Migration; - using Nekoyume.Action.Guild.Migration.LegacyModels; - using Nekoyume.Extensions; - using Nekoyume.Model.Guild; - using Nekoyume.TypedAddress; - using Xunit; - - // TODO: Remove this test class after the migration is completed. - public class MigratePlanetariumGuildTest : GuildTestBase - { - [Fact] - public void Execute() - { - var guildAddress = AddressUtil.CreateGuildAddress(); - var world = EnsureLegacyPlanetariumGuild(World, guildAddress); - var repo = new GuildRepository(world, new ActionContext()); - - Assert.Throws(() => repo.GetGuild(guildAddress)); - Assert.Throws(() => repo.GetGuildParticipant(GuildConfig.PlanetariumGuildOwner)); - - var action = new MigratePlanetariumGuild(); - var actionContext = new ActionContext - { - PreviousState = world, - Signer = new PrivateKey().Address, - }; - world = action.Execute(actionContext); - - repo.UpdateWorld(world); - - var guild = repo.GetGuild(guildAddress); - var guildOwner = repo.GetGuildParticipant(GuildConfig.PlanetariumGuildOwner); - } - - private static IWorld EnsureLegacyPlanetariumGuild(IWorld world, GuildAddress guildAddress) - { - var legacyPlanetariumGuild = new LegacyGuild(GuildConfig.PlanetariumGuildOwner); - var legacyPlanetariumGuildParticipant = new LegacyGuildParticipant(guildAddress); - var guildAccount = world.GetAccount(Addresses.Guild); - var guildParticipantAccount = world.GetAccount(Addresses.GuildParticipant); - return world - .MutateAccount( - Addresses.Guild, - account => account.SetState(guildAddress, legacyPlanetariumGuild.Bencoded)) - .MutateAccount( - Addresses.GuildParticipant, - account => account.SetState(GuildConfig.PlanetariumGuildOwner, legacyPlanetariumGuildParticipant.Bencoded)); - } - - private static IWorld EnsureMigratedPlanetariumGuild(IWorld world) - => new MigratePlanetariumGuild().Execute(new ActionContext - { - PreviousState = world, - Signer = new PrivateKey().Address, - }); - } -} diff --git a/.Lib9c.Tests/Action/Guild/Migration/MigratePlanetariumValidatorTest.cs b/.Lib9c.Tests/Action/Guild/Migration/MigratePlanetariumValidatorTest.cs deleted file mode 100644 index cd15015166..0000000000 --- a/.Lib9c.Tests/Action/Guild/Migration/MigratePlanetariumValidatorTest.cs +++ /dev/null @@ -1,116 +0,0 @@ -namespace Lib9c.Tests.Action.Guild.Migration -{ - using System; - using System.Collections.Generic; - using System.Numerics; - using Lib9c.Tests.Util; - using Libplanet.Action.State; - using Libplanet.Crypto; - using Libplanet.Types.Assets; - using Libplanet.Types.Consensus; - using Nekoyume.Action.Guild; - using Nekoyume.Action.Guild.Migration; - using Nekoyume.Action.Guild.Migration.LegacyModels; - using Nekoyume.Action.ValidatorDelegation; - using Nekoyume.Model.Guild; - using Nekoyume.Model.Stake; - using Nekoyume.TypedAddress; - using Nekoyume.ValidatorDelegation; - using Xunit; - - // TODO: Remove this test class after the migration is completed. - public class MigratePlanetariumValidatorTest : GuildTestBase - { - [Fact] - public void Execute() - { - var guildAddress = AddressUtil.CreateGuildAddress(); - var validatorKey = new PrivateKey().PublicKey; - var validatorAddress = validatorKey.Address; - var power = 10_000_000_000_000_000_000; - var guildGold = Currencies.GuildGold; - var delegated = FungibleAssetValue.FromRawValue(guildGold, power); - - var world = EnsureLegacyPlanetariumValidator( - World, guildAddress, validatorKey, power); - - var guildRepository = new GuildRepository(world, new ActionContext { }); - var validatorRepository = new ValidatorRepository(world, new ActionContext { }); - var guildDelegatee = guildRepository.GetGuildDelegatee(validatorAddress); - var validatorDelegatee = validatorRepository.GetValidatorDelegatee(validatorAddress); - - Assert.False(validatorDelegatee.IsActive); - Assert.Equal(ValidatorDelegatee.InactiveDelegationPoolAddress, guildDelegatee.DelegationPoolAddress); - Assert.Equal(ValidatorDelegatee.InactiveDelegationPoolAddress, validatorDelegatee.DelegationPoolAddress); - Assert.Equal(delegated, world.GetBalance(ValidatorDelegatee.InactiveDelegationPoolAddress, Currencies.GuildGold)); - Assert.Equal(guildGold * 0, world.GetBalance(ValidatorDelegatee.ActiveDelegationPoolAddress, Currencies.GuildGold)); - - var action = new MigratePlanetariumValidator(); - var actionContext = new ActionContext - { - PreviousState = world, - Signer = new PrivateKey().Address, - }; - world = action.Execute(actionContext); - - guildRepository = new GuildRepository(world, new ActionContext { }); - validatorRepository = new ValidatorRepository(world, new ActionContext { }); - guildDelegatee = guildRepository.GetGuildDelegatee(validatorAddress); - validatorDelegatee = validatorRepository.GetValidatorDelegatee(validatorAddress); - - Assert.True(validatorRepository.GetValidatorDelegatee(validatorAddress).IsActive); - Assert.Equal(ValidatorDelegatee.ActiveDelegationPoolAddress, guildDelegatee.DelegationPoolAddress); - Assert.Equal(ValidatorDelegatee.ActiveDelegationPoolAddress, validatorDelegatee.DelegationPoolAddress); - Assert.Equal(delegated, world.GetBalance(ValidatorDelegatee.ActiveDelegationPoolAddress, Currencies.GuildGold)); - Assert.Equal(guildGold * 0, world.GetBalance(ValidatorDelegatee.InactiveDelegationPoolAddress, Currencies.GuildGold)); - - Assert.Throws(() => - { - var actionContext = new ActionContext - { - PreviousState = world, - Signer = new PrivateKey().Address, - }; - - world = action.Execute(actionContext); - }); - } - - private static IWorld EnsureLegacyPlanetariumValidator( - IWorld world, GuildAddress guildAddress, PublicKey validatorKey, BigInteger power) - { - world = world.SetDelegationMigrationHeight(0L); - - var toDelegate = FungibleAssetValue.FromRawValue(Currencies.GuildGold, power); - world = world - .MintAsset( - new ActionContext { }, - StakeState.DeriveAddress(validatorKey.Address), - toDelegate) - .MintAsset( - new ActionContext { }, - validatorKey.Address, - Currencies.Mead * 1); - - world = new PromoteValidator(validatorKey, toDelegate).Execute(new ActionContext - { - PreviousState = world, - Signer = validatorKey.Address, - }); - - world = new MakeGuild(validatorKey.Address).Execute(new ActionContext - { - PreviousState = world, - Signer = GuildConfig.PlanetariumGuildOwner, - }); - - world = world.SetValidatorSet(new ValidatorSet( - new List - { - new Validator(validatorKey, power), - })); - - return world; - } - } -} diff --git a/.Lib9c.Tests/Action/ValidatorDelegation/ValidatorDelegationTestBase.cs b/.Lib9c.Tests/Action/ValidatorDelegation/ValidatorDelegationTestBase.cs index e1b05ca90c..aa286ade0c 100644 --- a/.Lib9c.Tests/Action/ValidatorDelegation/ValidatorDelegationTestBase.cs +++ b/.Lib9c.Tests/Action/ValidatorDelegation/ValidatorDelegationTestBase.cs @@ -24,7 +24,6 @@ namespace Lib9c.Tests.Action.ValidatorDelegation; using Nekoyume.TypedAddress; using Nekoyume.ValidatorDelegation; using Xunit; -using Nekoyume.Action.Guild.Migration.LegacyModels; using Nekoyume.Delegation; public class ValidatorDelegationTestBase @@ -46,8 +45,7 @@ public ValidatorDelegationTestBase() var world = new World(MockUtil.MockModernWorldState); var goldCurrencyState = new GoldCurrencyState(GoldCurrency); World = world - .SetLegacyState(Addresses.GoldCurrency, goldCurrencyState.Serialize()) - .SetDelegationMigrationHeight(0); + .SetLegacyState(Addresses.GoldCurrency, goldCurrencyState.Serialize()); } protected static BlockHash EmptyBlockHash { get; } diff --git a/Lib9c/Action/AuraSummon.cs b/Lib9c/Action/AuraSummon.cs index fb0aa96087..b529a73be2 100644 --- a/Lib9c/Action/AuraSummon.cs +++ b/Lib9c/Action/AuraSummon.cs @@ -9,7 +9,6 @@ using Libplanet.Action.State; using Libplanet.Crypto; using Nekoyume.Action.Exceptions; -using Nekoyume.Action.Guild.Migration.LegacyModels; using Nekoyume.Arena; using Nekoyume.Extensions; using Nekoyume.Helper; @@ -211,15 +210,6 @@ public override IWorld Execute(IActionContext context) if (summonRow.CostNcg > 0L) { var feeAddress = Addresses.RewardPool; - // TODO: [GuildMigration] Remove this after migration - if (states.GetDelegationMigrationHeight() is long migrationHeight - && context.BlockIndex < migrationHeight) - { - var arenaSheet = states.GetSheet(); - var arenaData = arenaSheet.GetRoundByBlockIndex(context.BlockIndex); - feeAddress = ArenaHelper.DeriveArenaAddress(arenaData.ChampionshipId, arenaData.Round); - } - states = states.TransferAsset( context, context.Signer, diff --git a/Lib9c/Action/BattleArena.cs b/Lib9c/Action/BattleArena.cs index c413843398..0e8c4655fc 100644 --- a/Lib9c/Action/BattleArena.cs +++ b/Lib9c/Action/BattleArena.cs @@ -7,7 +7,6 @@ using Libplanet.Action; using Libplanet.Action.State; using Libplanet.Crypto; -using Nekoyume.Action.Guild.Migration.LegacyModels; using Nekoyume.Arena; using Nekoyume.Battle; using Nekoyume.Exceptions; @@ -332,13 +331,6 @@ public override IWorld Execute(IActionContext context) purchasedCountDuringInterval++; var feeAddress = Addresses.RewardPool; - // TODO: [GuildMigration] Remove this after migration - if (states.GetDelegationMigrationHeight() is long migrationHeight - && context.BlockIndex < migrationHeight) - { - feeAddress = ArenaHelper.DeriveArenaAddress(roundData.ChampionshipId, roundData.Round); - } - states = states .TransferAsset(context, context.Signer, feeAddress, ticketBalance) .SetLegacyState(purchasedCountAddr, purchasedCountDuringInterval); diff --git a/Lib9c/Action/Buy.cs b/Lib9c/Action/Buy.cs index a202e16be0..020b56e991 100644 --- a/Lib9c/Action/Buy.cs +++ b/Lib9c/Action/Buy.cs @@ -10,7 +10,6 @@ using Libplanet.Action.State; using Libplanet.Crypto; using Libplanet.Types.Assets; -using Nekoyume.Action.Guild.Migration.LegacyModels; using Nekoyume.Arena; using Nekoyume.Model.EnumType; using Nekoyume.Model.Mail; @@ -252,15 +251,6 @@ public override IWorld Execute(IActionContext context) // Transfer tax. var feeAddress = Addresses.RewardPool; - // TODO: [GuildMigration] Remove this after migration - if (states.GetDelegationMigrationHeight() is long migrationHeight - && context.BlockIndex < migrationHeight) - { - var arenaSheet = states.GetSheet(); - var arenaData = arenaSheet.GetRoundByBlockIndex(context.BlockIndex); - feeAddress = ArenaHelper.DeriveArenaAddress(arenaData.ChampionshipId, arenaData.Round); - } - states = states .TransferAsset(context, context.Signer, feeAddress, tax); diff --git a/Lib9c/Action/BuyProduct.cs b/Lib9c/Action/BuyProduct.cs index 3ffe6d8fe3..23015618a4 100644 --- a/Lib9c/Action/BuyProduct.cs +++ b/Lib9c/Action/BuyProduct.cs @@ -9,7 +9,6 @@ using Libplanet.Action.State; using Libplanet.Crypto; using Libplanet.Types.Assets; -using Nekoyume.Action.Guild.Migration.LegacyModels; using Nekoyume.Arena; using Nekoyume.Battle; using Nekoyume.Model.EnumType; @@ -177,15 +176,6 @@ private IWorld Buy(IActionContext context, IProductInfo productInfo, Address sel context.BlockIndex); var feeAddress = Addresses.RewardPool; - // TODO: [GuildMigration] Remove this after migration - if (states.GetDelegationMigrationHeight() is long migrationHeight - && context.BlockIndex < migrationHeight) - { - var arenaSheet = states.GetSheet(); - var arenaData = arenaSheet.GetRoundByBlockIndex(context.BlockIndex); - feeAddress = ArenaHelper.DeriveArenaAddress(arenaData.ChampionshipId, arenaData.Round); - } - states = states .RemoveLegacyState(productAddress) .SetLegacyState(productsStateAddress, productsState.Serialize()) @@ -309,15 +299,6 @@ private static IWorld Buy_Order(PurchaseInfo purchaseInfo, IActionContext contex // Transfer tax. var feeAddress = Addresses.RewardPool; - // TODO: [GuildMigration] Remove this after migration - if (states.GetDelegationMigrationHeight() is long migrationHeight - && context.BlockIndex < migrationHeight) - { - var arenaSheet = states.GetSheet(); - var arenaData = arenaSheet.GetRoundByBlockIndex(context.BlockIndex); - feeAddress = ArenaHelper.DeriveArenaAddress(arenaData.ChampionshipId, arenaData.Round); - } - states = states.TransferAsset( context, context.Signer, diff --git a/Lib9c/Action/CombinationEquipment.cs b/Lib9c/Action/CombinationEquipment.cs index 405610e32a..14f37344c7 100644 --- a/Lib9c/Action/CombinationEquipment.cs +++ b/Lib9c/Action/CombinationEquipment.cs @@ -8,7 +8,6 @@ using Libplanet.Action; using Libplanet.Action.State; using Libplanet.Crypto; -using Nekoyume.Action.Guild.Migration.LegacyModels; using Nekoyume.Arena; using Nekoyume.Extensions; using Nekoyume.Helper; @@ -377,15 +376,6 @@ public override IWorld Execute(IActionContext context) { // Transfer tax. var feeAddress = Addresses.RewardPool; - // TODO: [GuildMigration] Remove this after migration - if (states.GetDelegationMigrationHeight() is long migrationHeight - && context.BlockIndex < migrationHeight) - { - var arenaSheet = states.GetSheet(); - var arenaData = arenaSheet.GetRoundByBlockIndex(context.BlockIndex); - feeAddress = ArenaHelper.DeriveArenaAddress(arenaData.ChampionshipId, arenaData.Round); - } - states = states.TransferAsset( context, context.Signer, diff --git a/Lib9c/Action/EventDungeonBattle.cs b/Lib9c/Action/EventDungeonBattle.cs index 4facbc1662..b85582a485 100644 --- a/Lib9c/Action/EventDungeonBattle.cs +++ b/Lib9c/Action/EventDungeonBattle.cs @@ -8,7 +8,6 @@ using Libplanet.Action; using Libplanet.Action.State; using Libplanet.Crypto; -using Nekoyume.Action.Guild.Migration.LegacyModels; using Nekoyume.Battle; using Nekoyume.Exceptions; using Nekoyume.Extensions; @@ -278,13 +277,6 @@ is Bencodex.Types.List serializedEventDungeonInfoList if (cost.Sign > 0) { var feeAddress = Addresses.RewardPool; - // TODO: [GuildMigration] Remove this after migration - if (states.GetDelegationMigrationHeight() is long migrationHeight - && context.BlockIndex < migrationHeight) - { - feeAddress = Addresses.EventDungeon; - } - states = states.TransferAsset( context, context.Signer, diff --git a/Lib9c/Action/Guild/Migration/FixToRefundFromNonValidator.cs b/Lib9c/Action/Guild/Migration/FixToRefundFromNonValidator.cs deleted file mode 100644 index 16e613d35e..0000000000 --- a/Lib9c/Action/Guild/Migration/FixToRefundFromNonValidator.cs +++ /dev/null @@ -1,98 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using Bencodex.Types; -using Lib9c; -using Libplanet.Action; -using Libplanet.Action.State; -using Libplanet.Crypto; -using Nekoyume.Model.Stake; -using Nekoyume.Model.State; - -namespace Nekoyume.Action.Guild.Migration -{ - // TODO: [GuildMigration] Remove this class when the migration is done. - /// - /// An action to fix refund from non-validator. - /// - [ActionType(TypeIdentifier)] - public class FixToRefundFromNonValidator : ActionBase - { - public const string TypeIdentifier = "fix_to_refund_from_non_validator"; - - private const string TargetsKey = "t"; - - public List<(Address Address, int Amount)> Targets { get; private set; } - - public FixToRefundFromNonValidator() - { - } - - public FixToRefundFromNonValidator( - IEnumerable<(Address, int)> targets) - { - Targets = targets.ToList(); - } - - public override IValue PlainValue => Dictionary.Empty - .Add("type_id", TypeIdentifier) - .Add("values", Dictionary.Empty - .Add( - TargetsKey, - new List(Targets.Select(t => - new List(t.Item1.Bencoded, (Integer)t.Item2))))); - - public override void LoadPlainValue(IValue plainValue) - { - if (plainValue is not Dictionary root || - !root.TryGetValue((Text)"values", out var rawValues) || - rawValues is not Dictionary values || - !values.TryGetValue((Text)TargetsKey, out var rawTarget) || - rawTarget is not List targets) - { - throw new InvalidCastException(); - } - - Targets = targets.Select( - t => ( - new Address(((List)t)[0]), - (int)(Integer)((List)t)[1])).ToList(); - } - - public override IWorld Execute(IActionContext context) - { - GasTracer.UseGas(1); - - var world = context.PreviousState; - - if (!TryGetAdminState(context, out AdminState adminState)) - { - throw new InvalidOperationException("Couldn't find admin state"); - } - - if (context.Signer != adminState.AdminAddress) - { - throw new PermissionDeniedException(adminState, context.Signer); - } - - foreach (var ta in Targets) - { - world = RefundFromNonValidator(context, world, ta); - } - - return world; - } - - private IWorld RefundFromNonValidator(IActionContext context, IWorld world, (Address, int) ta) - { - var (target, amount) = ta; - var stakeStateAddress = StakeState.DeriveAddress(target); - - return world.TransferAsset( - context, - Addresses.NonValidatorDelegatee, - stakeStateAddress, - Currencies.GuildGold * amount); - } - } -} diff --git a/Lib9c/Action/Guild/Migration/GuildMigrationFailedException.cs b/Lib9c/Action/Guild/Migration/GuildMigrationFailedException.cs deleted file mode 100644 index 118fd7e7f9..0000000000 --- a/Lib9c/Action/Guild/Migration/GuildMigrationFailedException.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; - -namespace Nekoyume.Action.Guild.Migration -{ - /// - /// An exception to be thrown when guild migration failed. - /// - public class GuildMigrationFailedException : InvalidOperationException - { - public GuildMigrationFailedException(string message) : base(message) - { - } - } -} diff --git a/Lib9c/Action/Guild/Migration/LegacyModels/LegacyGuild.cs b/Lib9c/Action/Guild/Migration/LegacyModels/LegacyGuild.cs deleted file mode 100644 index da7e83b982..0000000000 --- a/Lib9c/Action/Guild/Migration/LegacyModels/LegacyGuild.cs +++ /dev/null @@ -1,64 +0,0 @@ -using System; -using Bencodex; -using Bencodex.Types; -using Nekoyume.TypedAddress; - -namespace Nekoyume.Action.Guild.Migration.LegacyModels -{ - // TODO: [GuildMigration] Remove this class when the migration is done. - /// - /// The legacy model for Guild. - /// - public class LegacyGuild : IEquatable, IBencodable - { - private const string StateTypeName = "guild"; - private const long StateVersion = 1; - - public readonly AgentAddress GuildMasterAddress; - - public LegacyGuild(AgentAddress guildMasterAddress) - { - GuildMasterAddress = guildMasterAddress; - } - - public LegacyGuild(List list) : this(new AgentAddress(list[2])) - { - if (list[0] is not Text text || text != StateTypeName || list[1] is not Integer integer) - { - throw new InvalidCastException(); - } - - if (integer > StateVersion) - { - throw new FailedLoadStateException("Un-deserializable state."); - } - } - - public List Bencoded => List.Empty - .Add(StateTypeName) - .Add(StateVersion) - .Add(GuildMasterAddress.Bencoded); - - IValue IBencodable.Bencoded => Bencoded; - - public bool Equals(LegacyGuild other) - { - if (ReferenceEquals(null, other)) return false; - if (ReferenceEquals(this, other)) return true; - return GuildMasterAddress.Equals(other.GuildMasterAddress); - } - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) return false; - if (ReferenceEquals(this, obj)) return true; - if (obj.GetType() != GetType()) return false; - return Equals((LegacyGuild)obj); - } - - public override int GetHashCode() - { - return GuildMasterAddress.GetHashCode(); - } - } -} diff --git a/Lib9c/Action/Guild/Migration/LegacyModels/LegacyGuildParticipant.cs b/Lib9c/Action/Guild/Migration/LegacyModels/LegacyGuildParticipant.cs deleted file mode 100644 index f3724c86a6..0000000000 --- a/Lib9c/Action/Guild/Migration/LegacyModels/LegacyGuildParticipant.cs +++ /dev/null @@ -1,64 +0,0 @@ -using System; -using Bencodex; -using Bencodex.Types; -using Nekoyume.TypedAddress; - -namespace Nekoyume.Action.Guild.Migration.LegacyModels -{ - // TODO: [GuildMigration] Remove this class when the migration is done. - /// - /// The legacy model for GuildParticipant. - /// - public class LegacyGuildParticipant : IBencodable, IEquatable - { - private const string StateTypeName = "guild_participant"; - private const long StateVersion = 1; - - public readonly GuildAddress GuildAddress; - - public LegacyGuildParticipant(GuildAddress guildAddress) - { - GuildAddress = guildAddress; - } - - public LegacyGuildParticipant(List list) : this(new GuildAddress(list[2])) - { - if (list[0] is not Text text || text != StateTypeName || list[1] is not Integer integer) - { - throw new InvalidCastException(); - } - - if (integer > StateVersion) - { - throw new FailedLoadStateException("Un-deserializable state."); - } - } - - public List Bencoded => List.Empty - .Add(StateTypeName) - .Add(StateVersion) - .Add(GuildAddress.Bencoded); - - IValue IBencodable.Bencoded => Bencoded; - - public bool Equals(LegacyGuildParticipant other) - { - if (ReferenceEquals(null, other)) return false; - if (ReferenceEquals(this, other)) return true; - return GuildAddress.Equals(other.GuildAddress); - } - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) return false; - if (ReferenceEquals(this, obj)) return true; - if (obj.GetType() != this.GetType()) return false; - return Equals((LegacyGuildParticipant)obj); - } - - public override int GetHashCode() - { - return GuildAddress.GetHashCode(); - } - } -} diff --git a/Lib9c/Action/Guild/Migration/LegacyModels/MigrationModule.cs b/Lib9c/Action/Guild/Migration/LegacyModels/MigrationModule.cs deleted file mode 100644 index ce4d807185..0000000000 --- a/Lib9c/Action/Guild/Migration/LegacyModels/MigrationModule.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Bencodex.Types; -using Libplanet.Action.State; -using Libplanet.Crypto; -using Nekoyume.Extensions; - -namespace Nekoyume.Action.Guild.Migration.LegacyModels -{ - // TODO: [GuildMigration] Remove this class when the migration is done. - /// - /// The module for delegation height for migration. - /// - public static class MigrationModule - { - /// - /// An address for delegation height migration. - /// - public static readonly Address DelegationMigrationHeight - = new Address("0000000000000000000000000000000000000000"); - - public static long? GetDelegationMigrationHeight(this IWorldState worldState) - => worldState - .GetAccountState(Addresses.Migration) - .GetState(DelegationMigrationHeight) is Integer height - ? height - : null; - - public static IWorld SetDelegationMigrationHeight(this IWorld world, long height) - { - return world - .MutateAccount( - Addresses.Migration, - account => account.SetState( - DelegationMigrationHeight, - (Integer)height)); - } - } -} diff --git a/Lib9c/Action/Guild/Migration/MigrateDelegation.cs b/Lib9c/Action/Guild/Migration/MigrateDelegation.cs deleted file mode 100644 index 1f383fd908..0000000000 --- a/Lib9c/Action/Guild/Migration/MigrateDelegation.cs +++ /dev/null @@ -1,149 +0,0 @@ -using System; -using Bencodex.Types; -using Lib9c; -using Libplanet.Action.State; -using Libplanet.Action; -using Nekoyume.Model.Guild; -using Nekoyume.TypedAddress; -using Nekoyume.Action.Guild.Migration.LegacyModels; -using Nekoyume.Module.Guild; -using Nekoyume.Model.Stake; -using Nekoyume.Model.State; -using Nekoyume.Module; -using Libplanet.Crypto; - -namespace Nekoyume.Action.Guild.Migration -{ - // TODO: [GuildMigration] Remove this class when the migration is done. - /// - /// An action to migrate guild delegation. - /// After migration is done, guild participant now have delegation with - /// validator. - /// - [ActionType(TypeIdentifier)] - public class MigrateDelegation : ActionBase - { - public const string TypeIdentifier = "migrate_delegation"; - - private const string TargetKey = "t"; - - public AgentAddress Target { get; private set; } - - [Obsolete("Don't call in code.", error: false)] - public MigrateDelegation() - { - } - - public MigrateDelegation(AgentAddress target) - { - Target = target; - } - - public override IValue PlainValue => Dictionary.Empty - .Add("type_id", TypeIdentifier) - .Add("values", Dictionary.Empty - .Add(TargetKey, Target.Bencoded)); - - public override void LoadPlainValue(IValue plainValue) - { - if (plainValue is not Dictionary root || - !root.TryGetValue((Text)"values", out var rawValues) || - rawValues is not Dictionary values || - !values.TryGetValue((Text)TargetKey, out var rawTarget) || - rawTarget is not Binary target) - { - throw new InvalidCastException(); - } - - Target = new AgentAddress(target); - } - - public override IWorld Execute(IActionContext context) - { - GasTracer.UseGas(1); - - var world = context.PreviousState; - - // Migrate stake state from v2 to v3 (Mint guild gold for staking) - var stakeStateAddr = LegacyStakeState.DeriveAddress(Target); - if (world.TryGetStakeState(Target, out var stakeState) - && stakeState.StateVersion == 2) - { - if (!StakeStateUtils.TryMigrateV2ToV3( - context, - world, - StakeState.DeriveAddress(Target), - stakeState, out var result)) - { - throw new InvalidOperationException( - "Failed to migrate stake state. Unexpected situation."); - } - - world = result.Value.world; - } - - - // Migrate guild participant state from legacy to new - var value = world.GetAccountState(Addresses.GuildParticipant).GetState(Target) as List; - - var repository = new GuildRepository(world, context); - if (repository.GetJoinedGuild(GuildConfig.PlanetariumGuildOwner) is not { } planetariumGuildAddress) - { - throw new NullReferenceException("Planetarium guild is not found."); - } - - if (!repository.TryGetGuild(planetariumGuildAddress, out var planetariumGuild)) - { - throw new GuildMigrationFailedException("Planetarium guild is not found."); - } - - if (planetariumGuild.GuildMasterAddress != GuildConfig.PlanetariumGuildOwner) - { - throw new GuildMigrationFailedException("Unexpected guild master."); - } - - try - { - var legacyGuildParticipant = new LegacyGuildParticipant(value); - var guildParticipant = new GuildParticipant( - Target, - legacyGuildParticipant.GuildAddress, - repository); - repository.SetGuildParticipant(guildParticipant); - - // Migrate delegation - var guild = repository.GetGuild(guildParticipant.GuildAddress); - var guildGold = repository.GetBalance(guildParticipant.DelegationPoolAddress, Currencies.GuildGold); - if (guildGold.RawValue > 0) - { - repository.Delegate(guildParticipant.Address, guildGold); - } - - return repository.World; - } - catch (Exception e) - { - if (e is FailedLoadStateException || e is NullReferenceException) - { - var pledgeAddress = ((Address)Target).GetPledgeAddress(); - - // Patron contract structure: - // [0] = PatronAddress - // [1] = IsApproved - // [2] = Mead amount to refill. - if (!world.TryGetLegacyState(pledgeAddress, out List list) || list.Count < 3 || - list[0] is not Binary || list[0].ToAddress() != MeadConfig.PatronAddress || - list[1] is not Bencodex.Types.Boolean approved || !approved) - { - throw new GuildMigrationFailedException("Unexpected pledge structure."); - } - - repository.JoinGuild(planetariumGuildAddress, Target); - return repository.World; - } - - throw; - } - } - } -} diff --git a/Lib9c/Action/Guild/Migration/MigrateDelegationHeight.cs b/Lib9c/Action/Guild/Migration/MigrateDelegationHeight.cs deleted file mode 100644 index 2574b9e2a4..0000000000 --- a/Lib9c/Action/Guild/Migration/MigrateDelegationHeight.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System; -using Bencodex.Types; -using Libplanet.Action; -using Libplanet.Action.State; -using Nekoyume.Action.Guild.Migration.LegacyModels; -using Nekoyume.Model.State; - -namespace Nekoyume.Action.Guild.Migration -{ - // TODO: [GuildMigration] Remove this class when the migration is done. - /// - /// An action to migrate the delegation height. - /// This action triggers the migration of the delegation height. - /// - [ActionType(TypeIdentifier)] - public class MigrateDelegationHeight : ActionBase - { - public const string TypeIdentifier = "migrate_delegation_height"; - - private const string HeightKey = "h"; - - public long Height { get; private set; } - - public MigrateDelegationHeight() - { - } - - public MigrateDelegationHeight(long height) - { - Height = height; - } - - public override IValue PlainValue => Dictionary.Empty - .Add("type_id", TypeIdentifier) - .Add("values", Dictionary.Empty - .Add(HeightKey, Height)); - - public override void LoadPlainValue(IValue plainValue) - { - if (plainValue is not Dictionary root || - !root.TryGetValue((Text)"values", out var rawValues) || - rawValues is not Dictionary values || - !values.TryGetValue((Text)HeightKey, out var rawHeight) || - rawHeight is not Integer height) - { - throw new InvalidCastException(); - } - - Height = height; - } - - public override IWorld Execute(IActionContext context) - { - GasTracer.UseGas(1); - - var world = context.PreviousState; - - if (!TryGetAdminState(context, out AdminState adminState)) - { - throw new InvalidOperationException("Couldn't find admin state"); - } - - if (context.Signer != adminState.AdminAddress) - { - throw new PermissionDeniedException(adminState, context.Signer); - } - - return world.SetDelegationMigrationHeight(Height); - } - } -} diff --git a/Lib9c/Action/Guild/Migration/MigratePlanetariumGuild.cs b/Lib9c/Action/Guild/Migration/MigratePlanetariumGuild.cs deleted file mode 100644 index 57e1b72de0..0000000000 --- a/Lib9c/Action/Guild/Migration/MigratePlanetariumGuild.cs +++ /dev/null @@ -1,83 +0,0 @@ -using System; -using Bencodex.Types; -using Libplanet.Action.State; -using Libplanet.Action; -using Nekoyume.Model.Guild; -using Nekoyume.Action.Guild.Migration.LegacyModels; -using Lib9c; -using Nekoyume.Module.Guild; - -namespace Nekoyume.Action.Guild.Migration -{ - // TODO: [GuildMigration] Remove this class when the migration is done. - /// - /// An action to migrate the planetarium guild. - /// After migration, the planetarium guild now has a validator to delegate. - /// - [ActionType(TypeIdentifier)] - public class MigratePlanetariumGuild : ActionBase - { - public const string TypeIdentifier = "migrate_planetarium_guild"; - - public MigratePlanetariumGuild() - { - } - - public override IValue PlainValue => Dictionary.Empty - .Add("type_id", TypeIdentifier) - .Add("values", Null.Value); - - public override void LoadPlainValue(IValue plainValue) - { - if (plainValue is not Dictionary root || - !root.TryGetValue((Text)"values", out var rawValues) || - rawValues is not Null) - { - throw new InvalidCastException(); - } - } - - public override IWorld Execute(IActionContext context) - { - GasTracer.UseGas(1); - - var world = context.PreviousState; - var repository = new GuildRepository(world, context); - - // Get Guild address - var guildMasterValue = world - .GetAccountState(Addresses.GuildParticipant) - .GetState(GuildConfig.PlanetariumGuildOwner) as List; - var legacyGuildMaster = new LegacyGuildParticipant(guildMasterValue); - var guildAddress = legacyGuildMaster.GuildAddress; - - // MigratePlanetariumGuild - var guildValue = world - .GetAccountState(Addresses.Guild) - .GetState(guildAddress) as List; - var legacyGuild = new LegacyGuild(guildValue); - var guild = new Model.Guild.Guild( - guildAddress, - legacyGuild.GuildMasterAddress, - context.Miner, - repository); - repository.SetGuild(guild); - - // MigratePlanetariumGuildMaster - var guildParticipant = new GuildParticipant( - GuildConfig.PlanetariumGuildOwner, - guildAddress, - repository); - repository.SetGuildParticipant(guildParticipant); - - // Migrate delegation - var guildGold = repository.GetBalance(guildParticipant.DelegationPoolAddress, Currencies.GuildGold); - if (guildGold.RawValue > 0) - { - repository.Delegate(guildParticipant.Address, guildGold); - } - - return repository.World; - } - } -} diff --git a/Lib9c/Action/Guild/Migration/MigratePlanetariumValidator.cs b/Lib9c/Action/Guild/Migration/MigratePlanetariumValidator.cs deleted file mode 100644 index 98ef4ee0f4..0000000000 --- a/Lib9c/Action/Guild/Migration/MigratePlanetariumValidator.cs +++ /dev/null @@ -1,85 +0,0 @@ -using System; -using Bencodex.Types; -using Libplanet.Action; -using Libplanet.Action.State; -using Nekoyume.Model.Guild; -using Nekoyume.Module.Guild; -using Nekoyume.ValidatorDelegation; - -namespace Nekoyume.Action.Guild.Migration -{ - // TODO: [GuildMigration] Remove this class when the migration is done. - /// - /// An action to migrate the planetarium validator. - /// With this migration, planetarium validator is now active, - /// and bonded FAVs are moved to active address. - /// - [ActionType(TypeIdentifier)] - public class MigratePlanetariumValidator : ActionBase - { - public const string TypeIdentifier = "migrate_planetarium_validator"; - - public MigratePlanetariumValidator() - { - } - - public override IValue PlainValue => Dictionary.Empty - .Add("type_id", TypeIdentifier) - .Add("values", Null.Value); - - public override void LoadPlainValue(IValue plainValue) - { - if (plainValue is not Dictionary root || - !root.TryGetValue((Text)"values", out var rawValues) || - rawValues is not Null) - { - throw new InvalidCastException(); - } - } - - public override IWorld Execute(IActionContext context) - { - GasTracer.UseGas(1); - - var world = context.PreviousState; - var guildRepository = new GuildRepository(world, context); - var guildAddress = guildRepository.GetJoinedGuild(GuildConfig.PlanetariumGuildOwner); - if (guildAddress is not { } planetariumGuildAddress) - { - throw new InvalidOperationException("The planetarium guild not exists"); - } - - var planetariumGuild = guildRepository.GetGuild( - planetariumGuildAddress); - - var validatorRepository = new ValidatorRepository(guildRepository); - var validatorDelegatee = validatorRepository.GetValidatorDelegatee( - planetariumGuild.ValidatorAddress); - - var validatorSet = world.GetValidatorSet(); - - if (!validatorSet.ContainsPublicKey(validatorDelegatee.PublicKey)) - { - throw new InvalidOperationException( - "The planetarium validator is not in the validator set."); - } - - if (validatorDelegatee.IsActive) - { - throw new InvalidOperationException( - "The planetarium validator is already active."); - } - - validatorDelegatee.Activate(); - validatorRepository.SetValidatorDelegatee(validatorDelegatee); - - guildRepository.UpdateWorld(validatorRepository.World); - var guildDelegatee = guildRepository.GetGuildDelegatee( - planetariumGuild.ValidatorAddress); - guildDelegatee.Activate(); - guildRepository.SetGuildDelgatee(guildDelegatee); - - return guildRepository.World; - } - } -} diff --git a/Lib9c/Action/InitializeStates.cs b/Lib9c/Action/InitializeStates.cs index c49a1671e5..f60f467983 100644 --- a/Lib9c/Action/InitializeStates.cs +++ b/Lib9c/Action/InitializeStates.cs @@ -16,7 +16,6 @@ using Nekoyume.Module.Guild; using Nekoyume.Module.ValidatorDelegation; using Nekoyume.ValidatorDelegation; -using Nekoyume.Action.Guild.Migration.LegacyModels; namespace Nekoyume.Action { @@ -157,8 +156,7 @@ public override IWorld Execute(IActionContext context) .SetLegacyState(RedeemCodeState.Address, RedeemCode) .SetLegacyState(ActivatedAccountsState.Address, ActivatedAccounts) .SetLegacyState(GoldCurrencyState.Address, GoldCurrency) - .SetLegacyState(Addresses.GoldDistribution, GoldDistributions) - .SetDelegationMigrationHeight(0); + .SetLegacyState(Addresses.GoldDistribution, GoldDistributions); if (!(AdminAddressState is null)) { diff --git a/Lib9c/Action/ItemEnhancement.cs b/Lib9c/Action/ItemEnhancement.cs index 773c4b3783..0e6cc89100 100644 --- a/Lib9c/Action/ItemEnhancement.cs +++ b/Lib9c/Action/ItemEnhancement.cs @@ -9,7 +9,6 @@ using Libplanet.Action; using Libplanet.Action.State; using Libplanet.Crypto; -using Nekoyume.Action.Guild.Migration.LegacyModels; using Nekoyume.Arena; using Nekoyume.Extensions; using Nekoyume.Helper; @@ -374,15 +373,6 @@ public override IWorld Execute(IActionContext context) if (requiredNcg > 0) { var feeAddress = Addresses.RewardPool; - // TODO: [GuildMigration] Remove this after migration - if (states.GetDelegationMigrationHeight() is long migrationHeight - && context.BlockIndex < migrationHeight) - { - var arenaSheet = states.GetSheet(); - var arenaData = arenaSheet.GetRoundByBlockIndex(context.BlockIndex); - feeAddress = ArenaHelper.DeriveArenaAddress(arenaData.ChampionshipId, arenaData.Round); - } - states = states.TransferAsset(ctx, ctx.Signer, feeAddress, states.GetGoldCurrency() * requiredNcg); } diff --git a/Lib9c/Action/ItemEnhancement11.cs b/Lib9c/Action/ItemEnhancement11.cs index 23fd47b565..0ba2856bc5 100644 --- a/Lib9c/Action/ItemEnhancement11.cs +++ b/Lib9c/Action/ItemEnhancement11.cs @@ -11,7 +11,6 @@ using Libplanet.Action.State; using Libplanet.Crypto; using Libplanet.Types.Assets; -using Nekoyume.Action.Guild.Migration.LegacyModels; using Nekoyume.Arena; using Nekoyume.Extensions; using Nekoyume.Helper; @@ -292,15 +291,6 @@ public override IWorld Execute(IActionContext context) if (requiredNcg > 0) { var feeAddress = Addresses.RewardPool; - // TODO: [GuildMigration] Remove this after migration - if (states.GetDelegationMigrationHeight() is long migrationHeight - && context.BlockIndex < migrationHeight) - { - var arenaSheet = states.GetSheet(); - var arenaData = arenaSheet.GetRoundByBlockIndex(context.BlockIndex); - feeAddress = ArenaHelper.DeriveArenaAddress(arenaData.ChampionshipId, arenaData.Round); - } - states = states.TransferAsset(ctx, ctx.Signer, feeAddress, states.GetGoldCurrency() * requiredNcg); } diff --git a/Lib9c/Action/ItemEnhancement12.cs b/Lib9c/Action/ItemEnhancement12.cs index 10fc68c4e2..3ba287b18a 100644 --- a/Lib9c/Action/ItemEnhancement12.cs +++ b/Lib9c/Action/ItemEnhancement12.cs @@ -11,7 +11,6 @@ using Libplanet.Action.State; using Libplanet.Crypto; using Libplanet.Types.Assets; -using Nekoyume.Action.Guild.Migration.LegacyModels; using Nekoyume.Arena; using Nekoyume.Extensions; using Nekoyume.Helper; @@ -364,15 +363,6 @@ public override IWorld Execute(IActionContext context) if (requiredNcg > 0) { var feeAddress = Addresses.RewardPool; - // TODO: [GuildMigration] Remove this after migration - if (states.GetDelegationMigrationHeight() is long migrationHeight - && context.BlockIndex < migrationHeight) - { - var arenaSheet = states.GetSheet(); - var arenaData = arenaSheet.GetRoundByBlockIndex(context.BlockIndex); - feeAddress = ArenaHelper.DeriveArenaAddress(arenaData.ChampionshipId, arenaData.Round); - } - states = states.TransferAsset(ctx, ctx.Signer, feeAddress, states.GetGoldCurrency() * requiredNcg); } diff --git a/Lib9c/Action/ItemEnhancement13.cs b/Lib9c/Action/ItemEnhancement13.cs index 2f866d1578..962e10d3e1 100644 --- a/Lib9c/Action/ItemEnhancement13.cs +++ b/Lib9c/Action/ItemEnhancement13.cs @@ -11,7 +11,6 @@ using Libplanet.Action.State; using Libplanet.Crypto; using Libplanet.Types.Assets; -using Nekoyume.Action.Guild.Migration.LegacyModels; using Nekoyume.Arena; using Nekoyume.Extensions; using Nekoyume.Helper; @@ -367,15 +366,6 @@ public override IWorld Execute(IActionContext context) if (requiredNcg > 0) { var feeAddress = Addresses.RewardPool; - // TODO: [GuildMigration] Remove this after migration - if (states.GetDelegationMigrationHeight() is long migrationHeight - && context.BlockIndex < migrationHeight) - { - var arenaSheet = states.GetSheet(); - var arenaData = arenaSheet.GetRoundByBlockIndex(context.BlockIndex); - feeAddress = ArenaHelper.DeriveArenaAddress(arenaData.ChampionshipId, arenaData.Round); - } - states = states.TransferAsset(ctx, ctx.Signer, feeAddress, states.GetGoldCurrency() * requiredNcg); } diff --git a/Lib9c/Action/JoinArena.cs b/Lib9c/Action/JoinArena.cs index 0de20477d8..b438eb3ac6 100644 --- a/Lib9c/Action/JoinArena.cs +++ b/Lib9c/Action/JoinArena.cs @@ -8,7 +8,6 @@ using Libplanet.Action.State; using Libplanet.Crypto; using Nekoyume.Action.Exceptions.Arena; -using Nekoyume.Action.Guild.Migration.LegacyModels; using Nekoyume.Arena; using Nekoyume.Battle; using Nekoyume.Extensions; @@ -92,7 +91,7 @@ public override IWorld Execute(IActionContext context) $"[{nameof(JoinArena)}] Aborted as the avatar state of the signer was failed to load."); } - // check the avatar already joined the arena. + // check the avatar already joined the arena. if (states.GetArenaParticipant(championshipId, round, avatarAddress) is not null) { throw new AlreadyJoinedArenaException(championshipId, round, avatarAddress); @@ -175,13 +174,6 @@ public override IWorld Execute(IActionContext context) } var feeAddress = Addresses.RewardPool; - // TODO: [GuildMigration] Remove this after migration - if (states.GetDelegationMigrationHeight() is long migrationHeight - && context.BlockIndex < migrationHeight) - { - feeAddress = ArenaHelper.DeriveArenaAddress(roundData.ChampionshipId, roundData.Round); - } - states = states.TransferAsset(context, context.Signer, feeAddress, fee); } diff --git a/Lib9c/Action/JoinArena1.cs b/Lib9c/Action/JoinArena1.cs index 5ac087ace0..95ef18dd16 100644 --- a/Lib9c/Action/JoinArena1.cs +++ b/Lib9c/Action/JoinArena1.cs @@ -7,7 +7,6 @@ using Libplanet.Action; using Libplanet.Action.State; using Libplanet.Crypto; -using Nekoyume.Action.Guild.Migration.LegacyModels; using Nekoyume.Arena; using Nekoyume.Extensions; using Nekoyume.Helper; @@ -147,13 +146,6 @@ public override IWorld Execute(IActionContext context) } var feeAddress = Addresses.RewardPool; - // TODO: [GuildMigration] Remove this after migration - if (states.GetDelegationMigrationHeight() is long migrationHeight - && context.BlockIndex < migrationHeight) - { - feeAddress = ArenaHelper.DeriveArenaAddress(roundData.ChampionshipId, roundData.Round); - } - states = states.TransferAsset(context, context.Signer, feeAddress, fee); } diff --git a/Lib9c/Action/JoinArena3.cs b/Lib9c/Action/JoinArena3.cs index 7573de49e7..6548aa4f91 100644 --- a/Lib9c/Action/JoinArena3.cs +++ b/Lib9c/Action/JoinArena3.cs @@ -7,7 +7,6 @@ using Libplanet.Action; using Libplanet.Action.State; using Libplanet.Crypto; -using Nekoyume.Action.Guild.Migration.LegacyModels; using Nekoyume.Arena; using Nekoyume.Extensions; using Nekoyume.Helper; @@ -164,13 +163,6 @@ public override IWorld Execute(IActionContext context) } var feeAddress = Addresses.RewardPool; - // TODO: [GuildMigration] Remove this after migration - if (states.GetDelegationMigrationHeight() is long migrationHeight - && context.BlockIndex < migrationHeight) - { - feeAddress = ArenaHelper.DeriveArenaAddress(roundData.ChampionshipId, roundData.Round); - } - states = states.TransferAsset(context, context.Signer, feeAddress, fee); } diff --git a/Lib9c/Action/PetEnhancement.cs b/Lib9c/Action/PetEnhancement.cs index 31194dec54..9899190b27 100644 --- a/Lib9c/Action/PetEnhancement.cs +++ b/Lib9c/Action/PetEnhancement.cs @@ -5,7 +5,6 @@ using Libplanet.Action; using Libplanet.Action.State; using Libplanet.Crypto; -using Nekoyume.Action.Guild.Migration.LegacyModels; using Nekoyume.Arena; using Nekoyume.Exceptions; using Nekoyume.Extensions; @@ -140,15 +139,6 @@ public override IWorld Execute(IActionContext context) } var feeAddress = Addresses.RewardPool; - // TODO: [GuildMigration] Remove this after migration - if (states.GetDelegationMigrationHeight() is long migrationHeight - && context.BlockIndex < migrationHeight) - { - var arenaSheet = states.GetSheet(); - var arenaData = arenaSheet.GetRoundByBlockIndex(context.BlockIndex); - feeAddress = ArenaHelper.DeriveArenaAddress(arenaData.ChampionshipId, arenaData.Round); - } - states = states.TransferAsset(context, context.Signer, feeAddress, ncgCost); } diff --git a/Lib9c/Action/Raid.cs b/Lib9c/Action/Raid.cs index 4092627a26..ef22cdd9b6 100644 --- a/Lib9c/Action/Raid.cs +++ b/Lib9c/Action/Raid.cs @@ -8,7 +8,6 @@ using Libplanet.Action.State; using Libplanet.Crypto; using Libplanet.Types.Assets; -using Nekoyume.Action.Guild.Migration.LegacyModels; using Nekoyume.Arena; using Nekoyume.Battle; using Nekoyume.Extensions; @@ -152,15 +151,6 @@ public override IWorld Execute(IActionContext context) var goldCurrency = states.GetGoldCurrency(); var feeAddress = Addresses.RewardPool; - // TODO: [GuildMigration] Remove this after migration - if (states.GetDelegationMigrationHeight() is long migrationHeight - && context.BlockIndex < migrationHeight) - { - var arenaSheet = states.GetSheet(); - var arenaData = arenaSheet.GetRoundByBlockIndex(context.BlockIndex); - feeAddress = ArenaHelper.DeriveArenaAddress(arenaData.ChampionshipId, arenaData.Round); - } - states = states.TransferAsset(context, context.Signer, feeAddress, WorldBossHelper.CalculateTicketPrice(row, raiderState, goldCurrency)); raiderState.PurchaseCount++; diff --git a/Lib9c/Action/RuneEnhancement.cs b/Lib9c/Action/RuneEnhancement.cs index d01babfd8d..7a5bfaece5 100644 --- a/Lib9c/Action/RuneEnhancement.cs +++ b/Lib9c/Action/RuneEnhancement.cs @@ -7,7 +7,6 @@ using Libplanet.Action.State; using Libplanet.Crypto; using Libplanet.Types.Assets; -using Nekoyume.Action.Guild.Migration.LegacyModels; using Nekoyume.Arena; using Nekoyume.Extensions; using Nekoyume.Helper; @@ -154,14 +153,6 @@ public override IWorld Execute(IActionContext context) states = states.SetRuneState(AvatarAddress, allRuneState); var feeAddress = Addresses.RewardPool; - // TODO: [GuildMigration] Remove this after migration - if (states.GetDelegationMigrationHeight() is long migrationHeight - && context.BlockIndex < migrationHeight) - { - var arenaSheet = states.GetSheet(); - var arenaData = arenaSheet.GetRoundByBlockIndex(context.BlockIndex); - feeAddress = ArenaHelper.DeriveArenaAddress(arenaData.ChampionshipId, arenaData.Round); - } // Burn costs if (levelUpResult.NcgCost > 0) diff --git a/Lib9c/Action/RuneSummon.cs b/Lib9c/Action/RuneSummon.cs index 61b40cb22c..26af5356c6 100644 --- a/Lib9c/Action/RuneSummon.cs +++ b/Lib9c/Action/RuneSummon.cs @@ -11,7 +11,6 @@ using Libplanet.Crypto; using Libplanet.Types.Assets; using Nekoyume.Action.Exceptions; -using Nekoyume.Action.Guild.Migration.LegacyModels; using Nekoyume.Arena; using Nekoyume.Extensions; using Nekoyume.Helper; @@ -92,15 +91,6 @@ public override IWorld Execute(IActionContext context) if (summonRow.CostNcg > 0L) { var feeAddress = Addresses.RewardPool; - // TODO: [GuildMigration] Remove this after migration - if (states.GetDelegationMigrationHeight() is long migrationHeight - && context.BlockIndex < migrationHeight) - { - var arenaSheet = states.GetSheet(); - var arenaData = arenaSheet.GetRoundByBlockIndex(context.BlockIndex); - feeAddress = ArenaHelper.DeriveArenaAddress(arenaData.ChampionshipId, arenaData.Round); - } - states = states.TransferAsset( context, context.Signer, diff --git a/Lib9c/Action/UnlockRuneSlot.cs b/Lib9c/Action/UnlockRuneSlot.cs index a3b127cc11..a83f3559c6 100644 --- a/Lib9c/Action/UnlockRuneSlot.cs +++ b/Lib9c/Action/UnlockRuneSlot.cs @@ -9,7 +9,6 @@ using Libplanet.Action.State; using Libplanet.Crypto; using Libplanet.Types.Assets; -using Nekoyume.Action.Guild.Migration.LegacyModels; using Nekoyume.Arena; using Nekoyume.Extensions; using Nekoyume.Model.EnumType; @@ -105,15 +104,6 @@ public override IWorld Execute(IActionContext context) raidSlotState.Unlock(SlotIndex); var feeAddress = Addresses.RewardPool; - // TODO: [GuildMigration] Remove this after migration - if (states.GetDelegationMigrationHeight() is long migrationHeight - && context.BlockIndex < migrationHeight) - { - var arenaSheet = states.GetSheet(); - var arenaData = arenaSheet.GetRoundByBlockIndex(context.BlockIndex); - feeAddress = ArenaHelper.DeriveArenaAddress(arenaData.ChampionshipId, arenaData.Round); - } - return states .TransferAsset(context, context.Signer, feeAddress, cost * currency) .SetLegacyState(adventureSlotStateAddress, adventureSlotState.Serialize()) diff --git a/Lib9c/Action/ValidatorDelegation/AllocateGuildReward.cs b/Lib9c/Action/ValidatorDelegation/AllocateGuildReward.cs index 64d557e150..219fde53d0 100644 --- a/Lib9c/Action/ValidatorDelegation/AllocateGuildReward.cs +++ b/Lib9c/Action/ValidatorDelegation/AllocateGuildReward.cs @@ -10,7 +10,6 @@ using Nekoyume.Module.ValidatorDelegation; using Libplanet.Types.Blocks; using Lib9c; -using Nekoyume.Action.Guild.Migration.LegacyModels; namespace Nekoyume.Action.ValidatorDelegation { @@ -29,13 +28,6 @@ public override void LoadPlainValue(IValue plainValue) public override IWorld Execute(IActionContext context) { var world = context.PreviousState; - - if (world.GetDelegationMigrationHeight() is not { } migrationHeight - || context.BlockIndex < migrationHeight) - { - return world; - } - var repository = new ValidatorRepository(world, context); var rewardCurrency = Currencies.Mead; var proposerInfo = repository.GetProposerInfo(); diff --git a/Lib9c/Action/ValidatorDelegation/AllocateReward.cs b/Lib9c/Action/ValidatorDelegation/AllocateReward.cs index 20e6feecd4..f82721b06a 100644 --- a/Lib9c/Action/ValidatorDelegation/AllocateReward.cs +++ b/Lib9c/Action/ValidatorDelegation/AllocateReward.cs @@ -12,7 +12,6 @@ using Nekoyume.Module.Guild; using Nekoyume.ValidatorDelegation; using Nekoyume.Module.ValidatorDelegation; -using Nekoyume.Action.Guild.Migration.LegacyModels; namespace Nekoyume.Action.ValidatorDelegation { @@ -31,13 +30,6 @@ public override void LoadPlainValue(IValue plainValue) public override IWorld Execute(IActionContext context) { var world = context.PreviousState; - - if (world.GetDelegationMigrationHeight() is not { } migrationHeight - || context.BlockIndex < migrationHeight) - { - return world; - } - var rewardCurrency = world.GetGoldCurrency(); var repository = new GuildRepository(world, context); diff --git a/Lib9c/Action/ValidatorDelegation/RecordProposer.cs b/Lib9c/Action/ValidatorDelegation/RecordProposer.cs index dc1fc59089..14f833eda9 100644 --- a/Lib9c/Action/ValidatorDelegation/RecordProposer.cs +++ b/Lib9c/Action/ValidatorDelegation/RecordProposer.cs @@ -1,7 +1,6 @@ using Bencodex.Types; using Libplanet.Action; using Libplanet.Action.State; -using Nekoyume.Action.Guild.Migration.LegacyModels; using Nekoyume.Extensions; using Nekoyume.ValidatorDelegation; using static Nekoyume.Model.WorldInformation; @@ -34,11 +33,6 @@ public override IWorld Execute(IActionContext context) { var world = context.PreviousState; - if (world.GetDelegationMigrationHeight() is null) - { - return world; - } - return world.MutateAccount( Addresses.ValidatorList, account => account.SetState( diff --git a/Lib9c/Action/ValidatorDelegation/ReleaseValidatorUnbondings.cs b/Lib9c/Action/ValidatorDelegation/ReleaseValidatorUnbondings.cs index 29ca2abd83..021cef8c50 100644 --- a/Lib9c/Action/ValidatorDelegation/ReleaseValidatorUnbondings.cs +++ b/Lib9c/Action/ValidatorDelegation/ReleaseValidatorUnbondings.cs @@ -14,8 +14,6 @@ using Nekoyume.TypedAddress; using Nekoyume.Module; using Nekoyume.Model.Stake; -using Lib9c; -using Nekoyume.Action.Guild.Migration.LegacyModels; namespace Nekoyume.Action.ValidatorDelegation { @@ -36,12 +34,6 @@ public override void LoadPlainValue(IValue plainValue) public override IWorld Execute(IActionContext context) { var world = context.PreviousState; - - if (world.GetDelegationMigrationHeight() is null) - { - return world; - } - var repository = new GuildRepository(world, context); var unbondingSet = repository.GetUnbondingSet(); var unbondings = unbondingSet.UnbondingsToRelease(context.BlockIndex); diff --git a/Lib9c/Action/ValidatorDelegation/SlashValidator.cs b/Lib9c/Action/ValidatorDelegation/SlashValidator.cs index e97424efc0..e2a972efee 100644 --- a/Lib9c/Action/ValidatorDelegation/SlashValidator.cs +++ b/Lib9c/Action/ValidatorDelegation/SlashValidator.cs @@ -6,7 +6,6 @@ using Libplanet.Action.State; using Libplanet.Types.Consensus; using Libplanet.Types.Evidence; -using Nekoyume.Action.Guild.Migration.LegacyModels; using Nekoyume.Model.Guild; using Nekoyume.Module.ValidatorDelegation; using Nekoyume.ValidatorDelegation; @@ -34,12 +33,6 @@ public override void LoadPlainValue(IValue plainValue) public override IWorld Execute(IActionContext context) { var world = context.PreviousState; - - if (world.GetDelegationMigrationHeight() is null) - { - return world; - } - var repository = new ValidatorRepository(world, context); var abstainHistory = repository.GetAbstainHistory(); diff --git a/Lib9c/Action/ValidatorDelegation/UpdateValidators.cs b/Lib9c/Action/ValidatorDelegation/UpdateValidators.cs index ff6b42355d..ce12d25787 100644 --- a/Lib9c/Action/ValidatorDelegation/UpdateValidators.cs +++ b/Lib9c/Action/ValidatorDelegation/UpdateValidators.cs @@ -5,7 +5,6 @@ using Libplanet.Types.Consensus; using Nekoyume.ValidatorDelegation; using Nekoyume.Model.Guild; -using Nekoyume.Action.Guild.Migration.LegacyModels; namespace Nekoyume.Action.ValidatorDelegation { @@ -22,12 +21,6 @@ public override void LoadPlainValue(IValue plainValue) public override IWorld Execute(IActionContext context) { var world = context.PreviousState; - - if (world.GetDelegationMigrationHeight() is null) - { - return world; - } - var prevValidators = world.GetValidatorSet().Validators; var repository = new ValidatorRepository(world, context); var validators = repository.GetValidatorList().ActiveSet(); diff --git a/Lib9c/Module/Guild/GuildParticipantModule.cs b/Lib9c/Module/Guild/GuildParticipantModule.cs index 8d631e1aec..95211584d4 100644 --- a/Lib9c/Module/Guild/GuildParticipantModule.cs +++ b/Lib9c/Module/Guild/GuildParticipantModule.cs @@ -5,7 +5,6 @@ using Bencodex.Types; using Lib9c; using Libplanet.Types.Assets; -using Nekoyume.Action.Guild.Migration.LegacyModels; using Nekoyume.Model.Guild; using Nekoyume.TypedAddress; using Nekoyume.ValidatorDelegation; @@ -143,13 +142,6 @@ public static GuildRepository Delegate( FungibleAssetValue fav) { var height = repository.ActionContext.BlockIndex; - - // TODO: Remove below unnecessary height condition after migration. - if (repository.World.GetDelegationMigrationHeight() is long migrationHeight) - { - height = Math.Max(height, migrationHeight); - } - var guildParticipant = repository.GetGuildParticipant(guildParticipantAddress); var guild = repository.GetGuild(guildParticipant.GuildAddress); guildParticipant.Delegate(guild, fav, height); diff --git a/integrations/javascript/@planetarium/lib9c/src/actions/migrate_delegation.ts b/integrations/javascript/@planetarium/lib9c/src/actions/migrate_delegation.ts deleted file mode 100644 index 4eec55ee3b..0000000000 --- a/integrations/javascript/@planetarium/lib9c/src/actions/migrate_delegation.ts +++ /dev/null @@ -1,25 +0,0 @@ -import type { Address } from "@planetarium/account"; -import { BencodexDictionary, type Value } from "@planetarium/bencodex"; -import { PolymorphicAction } from "./common.js"; - -export type MigrateDelegationArgs = { - target: Address; -}; - -export class MigrateDelegation extends PolymorphicAction { - protected readonly type_id: string = "migrate_delegation"; - - private readonly target: Address; - - constructor({ target }: MigrateDelegationArgs) { - super(); - - this.target = target; - } - - protected plain_value(): Value { - const targetKey = "t" as const; - - return new BencodexDictionary([[targetKey, this.target.toBytes()]]); - } -} diff --git a/integrations/javascript/@planetarium/lib9c/src/actions/migrate_planetarium_guild.ts b/integrations/javascript/@planetarium/lib9c/src/actions/migrate_planetarium_guild.ts deleted file mode 100644 index f8a772c07e..0000000000 --- a/integrations/javascript/@planetarium/lib9c/src/actions/migrate_planetarium_guild.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type { Value } from "@planetarium/bencodex"; -import { PolymorphicAction } from "./common.js"; - -export class MigratePlanetariumGuild extends PolymorphicAction { - protected readonly type_id: string = "migrate_planetarium_guild"; - - protected plain_value(): Value { - return null; - } -} diff --git a/integrations/javascript/@planetarium/lib9c/src/index.ts b/integrations/javascript/@planetarium/lib9c/src/index.ts index b2b3cbdc85..557a195ae0 100644 --- a/integrations/javascript/@planetarium/lib9c/src/index.ts +++ b/integrations/javascript/@planetarium/lib9c/src/index.ts @@ -63,11 +63,6 @@ export { MakeGuild, type MakeGuildArgs, } from "./actions/make_guild.js"; -export { MigratePlanetariumGuild } from "./actions/migrate_planetarium_guild.js"; -export { - MigrateDelegation, - type MigrateDelegationArgs, -} from "./actions/migrate_delegation.js"; export { MintAssets, type MintAssetsArgs, diff --git a/integrations/javascript/@planetarium/lib9c/tests/actions/migrate_delegation.test.ts b/integrations/javascript/@planetarium/lib9c/tests/actions/migrate_delegation.test.ts deleted file mode 100644 index 49ab47e9bb..0000000000 --- a/integrations/javascript/@planetarium/lib9c/tests/actions/migrate_delegation.test.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { describe } from "vitest"; -import { MigrateDelegation } from "../../src/index.js"; -import { runTests } from "./common.js"; -import { agentAddress } from "./fixtures.js"; - -describe("MigrateDelegation", () => { - runTests("valid case", [ - new MigrateDelegation({ - target: agentAddress, - }), - ]); -}); diff --git a/integrations/javascript/@planetarium/lib9c/tests/actions/migrate_planetarium_guild.test.ts b/integrations/javascript/@planetarium/lib9c/tests/actions/migrate_planetarium_guild.test.ts deleted file mode 100644 index 67d0e243cb..0000000000 --- a/integrations/javascript/@planetarium/lib9c/tests/actions/migrate_planetarium_guild.test.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { describe } from "vitest"; -import { MigratePlanetariumGuild } from "../../src/index.js"; -import { runTests } from "./common.js"; - -describe("MigratePlanetariumGuild", () => { - runTests("valid case", [new MigratePlanetariumGuild()]); -});