Skip to content

Commit

Permalink
Update operations API models
Browse files Browse the repository at this point in the history
  • Loading branch information
Groxan committed Feb 1, 2024
1 parent 57a2a7c commit bb60634
Show file tree
Hide file tree
Showing 18 changed files with 919 additions and 209 deletions.
2 changes: 1 addition & 1 deletion Tzkt.Api/Controllers/OperationsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5038,7 +5038,7 @@ public async Task<ActionResult<int>> GetSmartRollupRefuteOpsCount([FromQuery] Sr
/// Returns a list of migration operations (synthetic type).
/// </remarks>
/// <param name="account">Filters migration operations by account. Allowed fields for `.eqx` mode: none.</param>
/// <param name="kind">Filters migration operations by kind (`bootstrap`, `activate_delegate`, `airdrop`, `proposal_invoice`, `origination`, `subsidy`).</param>
/// <param name="kind">Filters migration operations by kind (`bootstrap`, `activate_delegate`, `airdrop`, `proposal_invoice`, `origination`, `subsidy`, `remove_bigmap_key`).</param>
/// <param name="balanceChange">Filters migration operations by amount.</param>
/// <param name="id">Filters migration operations by internal TzKT id.</param>
/// <param name="level">Filters migration operations by level.</param>
Expand Down
15 changes: 15 additions & 0 deletions Tzkt.Api/Models/Operations/DelegationOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,21 @@ public class DelegationOperation : Operation
/// </summary>
public long Amount { get; set; }

/// <summary>
/// Amount of pseudotokens unstaked due to re-delegating.
/// </summary>
public long? UnstakedPseudotokens { get; set; }

/// <summary>
/// Amount staked balance unstaked due to re-delegating.
/// </summary>
public long? UnstakedBalance { get; set; }

/// <summary>
/// Amount of pending rewards unstaked due to re-delegating.
/// </summary>
public long? UnstakedRewards { get; set; }

/// <summary>
/// Information about the previous delegate of the account. `null` if there is no previous delegate
/// </summary>
Expand Down
41 changes: 38 additions & 3 deletions Tzkt.Api/Models/Operations/DoubleBakingOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ public class DoubleBakingOperation : Operation
/// </summary>
public int AccusedLevel { get; set; }

/// <summary>
/// Height of the block from the genesis, at which the offender was slashed
/// </summary>
public int SlashedLevel { get; set; }

/// <summary>
/// Information about the baker, produced the block, in which the accusation was included
/// </summary>
Expand All @@ -48,17 +53,37 @@ public class DoubleBakingOperation : Operation
/// <summary>
/// Reward of the baker, produced the block, in which the accusation was included
/// </summary>
public long AccuserReward { get; set; }
public long Reward { get; set; }

/// <summary>
/// Information about the baker, accused for producing two different blocks at the same level
/// </summary>
public Alias Offender { get; set; }

/// <summary>
/// Amount of frozen deposits lost by accused baker
/// Amount slashed from baker's own staked balance
/// </summary>
public long LostStaked { get; set; }

/// <summary>
/// Amount slashed from baker's own unstaked balance
/// </summary>
public long LostUnstaked { get; set; }

/// <summary>
/// Amount slashed from baker's external staked balance
/// </summary>
public long LostExternalStaked { get; set; }

/// <summary>
/// Amount slashed from baker's external unstaked balance
/// </summary>
public long OffenderLoss { get; set; }
public long LostExternalUnstaked { get; set; }

/// <summary>
/// Amount lost due to inaccuracy of the economic protocol introduced in Oxford.
/// </summary>
public long RoundingLoss { get; set; }

#region injecting
/// <summary>
Expand All @@ -68,6 +93,16 @@ public class DoubleBakingOperation : Operation
#endregion

#region deprecated
/// <summary>
/// [DEPRECATED]
/// </summary>
public long OffenderLoss => LostStaked + LostUnstaked + LostExternalStaked + LostExternalUnstaked + RoundingLoss;

/// <summary>
/// [DEPRECATED]
/// </summary>
public long AccuserReward => Reward;

/// <summary>
/// [DEPRECATED]
/// </summary>
Expand Down
41 changes: 38 additions & 3 deletions Tzkt.Api/Models/Operations/DoubleEndorsingOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ public class DoubleEndorsingOperation : Operation
/// </summary>
public int AccusedLevel { get; set; }

/// <summary>
/// Height of the block from the genesis, at which the offender was slashed
/// </summary>
public int SlashedLevel { get; set; }

/// <summary>
/// Information about the baker, produced the block, in which the accusation was included
/// </summary>
Expand All @@ -48,17 +53,37 @@ public class DoubleEndorsingOperation : Operation
/// <summary>
/// Reward of the baker, produced the block, in which the accusation was included
/// </summary>
public long AccuserReward { get; set; }
public long Reward { get; set; }

/// <summary>
/// Information about the baker, accused for producing two different endorsements at the same level
/// </summary>
public Alias Offender { get; set; }

/// <summary>
/// Amount of frozen deposits lost by accused baker
/// Amount slashed from baker's own staked balance
/// </summary>
public long LostStaked { get; set; }

/// <summary>
/// Amount slashed from baker's own unstaked balance
/// </summary>
public long LostUnstaked { get; set; }

/// <summary>
/// Amount slashed from baker's external staked balance
/// </summary>
public long LostExternalStaked { get; set; }

/// <summary>
/// Amount slashed from baker's external unstaked balance
/// </summary>
public long OffenderLoss { get; set; }
public long LostExternalUnstaked { get; set; }

/// <summary>
/// Amount lost due to inaccuracy of the economic protocol introduced in Oxford.
/// </summary>
public long RoundingLoss { get; set; }

#region injecting
/// <summary>
Expand All @@ -68,6 +93,16 @@ public class DoubleEndorsingOperation : Operation
#endregion

#region deprecated
/// <summary>
/// [DEPRECATED]
/// </summary>
public long OffenderLoss => LostStaked + LostUnstaked + LostExternalStaked + LostExternalUnstaked + RoundingLoss;

/// <summary>
/// [DEPRECATED]
/// </summary>
public long AccuserReward => Reward;

/// <summary>
/// [DEPRECATED]
/// </summary>
Expand Down
43 changes: 40 additions & 3 deletions Tzkt.Api/Models/Operations/DoublePreendorsingOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ public class DoublePreendorsingOperation : Operation
/// </summary>
public int AccusedLevel { get; set; }

/// <summary>
/// Height of the block from the genesis, at which the offender was slashed
/// </summary>
public int SlashedLevel { get; set; }

/// <summary>
/// Information about the baker, produced the block, in which the accusation was included
/// </summary>
Expand All @@ -47,23 +52,55 @@ public class DoublePreendorsingOperation : Operation
/// <summary>
/// Reward of the baker, produced the block, in which the accusation was included
/// </summary>
public long AccuserReward { get; set; }
public long Reward { get; set; }

/// <summary>
/// Information about the baker, accused for producing two different preendorsements at the same level
/// </summary>
public Alias Offender { get; set; }

/// <summary>
/// Amount of frozen deposits lost by accused baker
/// Amount slashed from baker's own staked balance
/// </summary>
public long LostStaked { get; set; }

/// <summary>
/// Amount slashed from baker's own unstaked balance
/// </summary>
public long LostUnstaked { get; set; }

/// <summary>
/// Amount slashed from baker's external staked balance
/// </summary>
public long LostExternalStaked { get; set; }

/// <summary>
/// Amount slashed from baker's external unstaked balance
/// </summary>
public long LostExternalUnstaked { get; set; }

/// <summary>
/// Amount lost due to inaccuracy of the economic protocol introduced in Oxford.
/// </summary>
public long OffenderLoss { get; set; }
public long RoundingLoss { get; set; }

#region injecting
/// <summary>
/// Injected historical quote at the time of operation
/// </summary>
public QuoteShort Quote { get; set; }
#endregion

#region deprecated
/// <summary>
/// [DEPRECATED]
/// </summary>
public long OffenderLoss => LostStaked + LostUnstaked + LostExternalStaked + LostExternalUnstaked + RoundingLoss;

/// <summary>
/// [DEPRECATED]
/// </summary>
public long AccuserReward => Reward;
#endregion
}
}
25 changes: 20 additions & 5 deletions Tzkt.Api/Models/Operations/EndorsingRewardOperation.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;

namespace Tzkt.Api.Models
namespace Tzkt.Api.Models
{
public class EndorsingRewardOperation : Operation
{
Expand Down Expand Up @@ -40,15 +38,32 @@ public class EndorsingRewardOperation : Operation
public long Expected { get; set; }

/// <summary>
/// Actually received endorsing reward (micro tez)
/// Reward received on baker's liquid balance (micro tez)
/// </summary>
public long RewardLiquid { get; set; }

/// <summary>
/// Reward received on baker's staked balance (micro tez)
/// </summary>
public long Received { get; set; }
public long RewardStakedOwn { get; set; }

/// <summary>
/// Reward received on baker's external staked balance (micro tez)
/// </summary>
public long RewardStakedShared { get; set; }

#region injecting
/// <summary>
/// Injected historical quote at the time of operation
/// </summary>
public QuoteShort Quote { get; set; }
#endregion

#region deprecated
/// <summary>
/// [DEPRECATED]
/// </summary>
public long Received => RewardLiquid + RewardStakedOwn + RewardStakedShared;
#endregion
}
}
1 change: 1 addition & 0 deletions Tzkt.Api/Models/Operations/MigrationOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class MigrationOperation : Operation
/// `code_change` - changing contract scripts during Babylon protocol upgrade
/// `origination` - implicit (hardcoded in the protocol) origination of liquidity baking contracts
/// `subsidy` - liquidity baking subsidy
/// `remove_bigmap_key` - removing the key from the bigmap
/// </summary>
public string Kind { get; set; }

Expand Down
23 changes: 18 additions & 5 deletions Tzkt.Api/Models/Operations/NonceRevelationOperation.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;

namespace Tzkt.Api.Models
namespace Tzkt.Api.Models
{
public class NonceRevelationOperation : Operation
{
Expand Down Expand Up @@ -60,9 +58,19 @@ public class NonceRevelationOperation : Operation
public string Nonce { get; set; }

/// <summary>
/// Baker reward for including seed nonce revelation into a block
/// Reward received on baker's liquid balance (micro tez)
/// </summary>
public long RewardLiquid { get; set; }

/// <summary>
/// Reward received on baker's staked balance (micro tez)
/// </summary>
public long Reward { get; set; }
public long RewardStakedOwn { get; set; }

/// <summary>
/// Reward received on baker's external staked balance (micro tez)
/// </summary>
public long RewardStakedShared { get; set; }

#region injecting
/// <summary>
Expand All @@ -72,6 +80,11 @@ public class NonceRevelationOperation : Operation
#endregion

#region deprecated
/// <summary>
/// [DEPRECATED]
/// </summary>
public long Reward => RewardLiquid + RewardStakedOwn + RewardStakedShared;

/// <summary>
/// [DEPRECATED]
/// </summary>
Expand Down
25 changes: 20 additions & 5 deletions Tzkt.Api/Models/Operations/VdfRevelationOperation.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;

namespace Tzkt.Api.Models
namespace Tzkt.Api.Models
{
public class VdfRevelationOperation : Operation
{
Expand Down Expand Up @@ -55,15 +53,32 @@ public class VdfRevelationOperation : Operation
public string Proof { get; set; }

/// <summary>
/// Baker reward for including vdf revelation into a block
/// Reward received on baker's liquid balance (micro tez)
/// </summary>
public long RewardLiquid { get; set; }

/// <summary>
/// Reward received on baker's staked balance (micro tez)
/// </summary>
public long Reward { get; set; }
public long RewardStakedOwn { get; set; }

/// <summary>
/// Reward received on baker's external staked balance (micro tez)
/// </summary>
public long RewardStakedShared { get; set; }

#region injecting
/// <summary>
/// Injected historical quote at the time of operation
/// </summary>
public QuoteShort Quote { get; set; }
#endregion

#region deprecated
/// <summary>
/// [DEPRECATED]
/// </summary>
public long Reward => RewardLiquid + RewardStakedOwn + RewardStakedShared;
#endregion
}
}
2 changes: 1 addition & 1 deletion Tzkt.Api/Parameters/MigrationKindParameter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Tzkt.Api
{
[ModelBinder(BinderType = typeof(MigrationKindBinder))]
[JsonSchemaExtensionData("x-tzkt-extension", "query-parameter")]
[JsonSchemaExtensionData("x-tzkt-query-parameter", "bootstrap,activate_delegate,airdrop,proposal_invoice,code_change,origination,subsidy")]
[JsonSchemaExtensionData("x-tzkt-query-parameter", "bootstrap,activate_delegate,airdrop,proposal_invoice,code_change,origination,subsidy,remove_bigmap_key")]
public class MigrationKindParameter : INormalizable
{
/// <summary>
Expand Down
Loading

0 comments on commit bb60634

Please sign in to comment.