Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .Lib9c.Tests/Action/DPoS/Control/RedelegateCtrlTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace Lib9c.Tests.Action.DPoS.Control
using Nekoyume.Action.DPoS.Exception;
using Nekoyume.Action.DPoS.Misc;
using Nekoyume.Action.DPoS.Model;
using Nekoyume.Action.DPoS.Util;
using Nekoyume.Module;
using Xunit;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
using Nekoyume.Action.DPoS.Control;
using Nekoyume.Action.DPoS.Misc;
using Nekoyume.Action.DPoS.Model;
using Nekoyume.Action.DPoS.Sys;
using Nekoyume.Action.DPoS.Util;

namespace Nekoyume.Action.DPoS.Sys
namespace Nekoyume.Action.DPoS
{
/// <summary>
/// A system action for DPoS that cancel <see cref="Undelegate"/> specified
Expand Down
1 change: 1 addition & 0 deletions Lib9c/Action/DPoS/Control/Bond.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Nekoyume.Action.DPoS.Exception;
using Nekoyume.Action.DPoS.Misc;
using Nekoyume.Action.DPoS.Model;
using Nekoyume.Action.DPoS.Util;
using Nekoyume.Module;

namespace Nekoyume.Action.DPoS.Control
Expand Down
1 change: 1 addition & 0 deletions Lib9c/Action/DPoS/Control/DelegateCtrl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Nekoyume.Action.DPoS.Exception;
using Nekoyume.Action.DPoS.Misc;
using Nekoyume.Action.DPoS.Model;
using Nekoyume.Action.DPoS.Util;
using Nekoyume.Module;

namespace Nekoyume.Action.DPoS.Control
Expand Down
1 change: 1 addition & 0 deletions Lib9c/Action/DPoS/Control/RedelegateCtrl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Nekoyume.Action.DPoS.Exception;
using Nekoyume.Action.DPoS.Misc;
using Nekoyume.Action.DPoS.Model;
using Nekoyume.Action.DPoS.Util;
using Nekoyume.Module;

namespace Nekoyume.Action.DPoS.Control
Expand Down
1 change: 1 addition & 0 deletions Lib9c/Action/DPoS/Control/UnbondingSetCtrl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Libplanet.Crypto;
using Nekoyume.Action.DPoS.Misc;
using Nekoyume.Action.DPoS.Model;
using Nekoyume.Action.DPoS.Util;

namespace Nekoyume.Action.DPoS.Control
{
Expand Down
1 change: 1 addition & 0 deletions Lib9c/Action/DPoS/Control/UndelegateCtrl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Nekoyume.Action.DPoS.Exception;
using Nekoyume.Action.DPoS.Misc;
using Nekoyume.Action.DPoS.Model;
using Nekoyume.Action.DPoS.Util;
using Nekoyume.Module;

namespace Nekoyume.Action.DPoS.Control
Expand Down
1 change: 1 addition & 0 deletions Lib9c/Action/DPoS/Control/ValidatorCtrl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Nekoyume.Action.DPoS.Exception;
using Nekoyume.Action.DPoS.Misc;
using Nekoyume.Action.DPoS.Model;
using Nekoyume.Action.DPoS.Util;
using Nekoyume.Module;

namespace Nekoyume.Action.DPoS.Control
Expand Down
2 changes: 2 additions & 0 deletions Lib9c/Action/DPoS/Control/ValidatorDelegationSetCtrl.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#nullable enable
using Libplanet.Action.State;
using Libplanet.Crypto;
using Nekoyume.Action.DPoS.Misc;
using Nekoyume.Action.DPoS.Model;
using Nekoyume.Action.DPoS.Util;

namespace Nekoyume.Action.DPoS.Control
{
Expand Down
1 change: 1 addition & 0 deletions Lib9c/Action/DPoS/Control/ValidatorPowerIndexCtrl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Nekoyume.Action.DPoS.Exception;
using Nekoyume.Action.DPoS.Misc;
using Nekoyume.Action.DPoS.Model;
using Nekoyume.Action.DPoS.Util;
using Nekoyume.Module;

namespace Nekoyume.Action.DPoS.Control
Expand Down
2 changes: 2 additions & 0 deletions Lib9c/Action/DPoS/Control/ValidatorRewardsCtrl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
using Libplanet.Action.State;
using Libplanet.Crypto;
using Libplanet.Types.Assets;
using Nekoyume.Action.DPoS.Misc;
using Nekoyume.Action.DPoS.Model;
using Nekoyume.Action.DPoS.Util;

namespace Nekoyume.Action.DPoS.Control
{
Expand Down
1 change: 1 addition & 0 deletions Lib9c/Action/DPoS/Control/ValidatorSetCtrl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Nekoyume.Action.DPoS.Exception;
using Nekoyume.Action.DPoS.Misc;
using Nekoyume.Action.DPoS.Model;
using Nekoyume.Action.DPoS.Util;
using Nekoyume.Module;

namespace Nekoyume.Action.DPoS.Control
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using Nekoyume.Action.DPoS.Misc;
using Nekoyume.Action.DPoS.Util;

namespace Nekoyume.Action.DPoS.Sys
namespace Nekoyume.Action.DPoS
{
/// <summary>
/// A system action for DPoS that <see cref="Delegate"/> specified <see cref="Amount"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using Nekoyume.Action.DPoS.Misc;
using Nekoyume.Action.DPoS.Util;

namespace Nekoyume.Action.DPoS.Sys
namespace Nekoyume.Action.DPoS
{
/// <summary>
/// A system action for DPoS that promotes non-validator node to a validator.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using Nekoyume.Action.DPoS.Misc;
using Nekoyume.Action.DPoS.Util;

namespace Nekoyume.Action.DPoS.Sys
namespace Nekoyume.Action.DPoS
{
/// <summary>
/// A system action for DPoS that <see cref="Redelegate"/> specified <see cref="ShareAmount"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,20 @@
using Bencodex.Types;
using Libplanet.Action;
using Libplanet.Action.State;
using Nekoyume.Action.DPoS.Control;
using Nekoyume.Action.DPoS.Misc;
using Nekoyume.Action.DPoS.Model;
using Nekoyume.Module;

namespace Nekoyume.Action.DPoS
namespace Nekoyume.Action.DPoS.Sys
{
/// <summary>
/// A BeginBlock action for DPoS that updates <see cref="ValidatorSet"/>.
/// An action for allocate reward to validators and delegators in previous block.
/// Should be executed at the beginning of the block.
/// </summary>
public sealed class DPoSBeginBlockAction : ActionBase
public sealed class AllocateReward : ActionBase
{
/// <summary>
/// Creates a new instance of <see cref="DPoSBeginBlockAction"/>.
/// Creates a new instance of <see cref="AllocateReward"/>.
/// </summary>
public DPoSBeginBlockAction()
public AllocateReward()
{
}

Expand All @@ -34,11 +32,9 @@ public override void LoadPlainValue(IValue plainValue)
public override IWorld Execute(IActionContext context)
{
var states = context.PreviousState;

// Allocate reward
var nativeTokens = ImmutableHashSet.Create(
Asset.GovernanceToken, Asset.ConsensusToken, Asset.Share);
states = AllocateReward.Execute(
states = Control.AllocateReward.Execute(
states,
context,
nativeTokens,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
using System.Collections.Immutable;
using Bencodex.Types;
using Libplanet.Action;
using Libplanet.Action.State;
using Nekoyume.Action.DPoS.Control;
using Nekoyume.Action.DPoS.Misc;
using Nekoyume.Action.DPoS.Model;
using Nekoyume.Module;

namespace Nekoyume.Action.DPoS
namespace Nekoyume.Action.DPoS.Sys
{
/// <summary>
/// A EndBlock action for DPoS that updates <see cref="ValidatorSet"/>.
/// An action for update validators.
/// Should be executed at the end of the block.
/// </summary>
public sealed class DPoSEndBlockAction : ActionBase
public sealed class UpdateValidators : ActionBase
{
/// <summary>
/// Creates a new instance of <see cref="DPoSBeginBlockAction"/>.
/// Creates a new instance of <see cref="AllocateReward"/>.
/// </summary>
public DPoSEndBlockAction()
public UpdateValidators()
{
}

Expand All @@ -34,8 +33,6 @@ public override void LoadPlainValue(IValue plainValue)
public override IWorld Execute(IActionContext context)
{
var states = context.PreviousState;

// Update ValidatorSet
states = ValidatorSetCtrl.Update(states, context);
ValidatorSet bondedSet;
(states, bondedSet) = ValidatorSetCtrl.FetchBondedValidatorSet(states);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using Nekoyume.Action.DPoS.Misc;
using Nekoyume.Action.DPoS.Util;

namespace Nekoyume.Action.DPoS.Sys
namespace Nekoyume.Action.DPoS
{
/// <summary>
/// A system action for DPoS that cancels <see cref="Delegate"/> specified
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Libplanet.Crypto;
using Nekoyume.Action.DPoS.Misc;

namespace Nekoyume.Action.DPoS
namespace Nekoyume.Action.DPoS.Util
{
public static class DPoSModule
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
using Nekoyume.Action.DPoS.Util;
using Nekoyume.Module;

namespace Nekoyume.Action.DPoS.Sys
namespace Nekoyume.Action.DPoS
{
/// <summary>
/// A system action for DPoS that withdraws reward tokens from given <see cref="Validator"/>.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using Nekoyume.Action.DPoS.Model;
using Nekoyume.Module;

namespace Nekoyume.Action.DPoS.Sys
namespace Nekoyume.Action.DPoS
{
/// <summary>
/// A system action for DPoS that withdraws commission tokens from <see cref="Validator"/>.
Expand Down