forked from planetarium/NineChronicles.Headless
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
651 additions
and
505 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using System.Collections.Generic; | ||
using Libplanet.Action; | ||
using Libplanet.Action.State; | ||
using Libplanet.Crypto; | ||
using Libplanet.Extensions.ActionEvaluatorCommonComponents; | ||
using Libplanet.Types.Evidence; | ||
using Libplanet.Types.Tx; | ||
|
||
namespace NineChronicles.Headless.Tests.Action; | ||
|
||
public class ActionContext : IActionContext | ||
{ | ||
private long UsedGas { get; set; } | ||
|
||
public Address Signer { get; init; } | ||
public TxId? TxId { get; init; } | ||
public Address Miner { get; init; } | ||
public long BlockIndex { get; init; } | ||
public int BlockProtocolVersion { get; init; } | ||
public IWorld PreviousState { get; init; } | ||
public int RandomSeed { get; init; } | ||
public bool IsPolicyAction { get; init; } | ||
public IReadOnlyList<ITransaction> Txs { get; init; } | ||
public IReadOnlyList<EvidenceBase> Evidence { get; init; } | ||
public void UseGas(long gas) | ||
{ | ||
UsedGas += gas; | ||
} | ||
|
||
public IRandom GetRandom() | ||
{ | ||
return new Random(RandomSeed); | ||
} | ||
|
||
public long GasUsed() | ||
{ | ||
return UsedGas; | ||
} | ||
|
||
public long GasLimit() | ||
{ | ||
return 0L; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.