/
IActionContext.cs
57 lines (52 loc) · 2.28 KB
/
IActionContext.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
namespace Libplanet.Action
{
/// <summary>
/// Contextual data determined by a transaction and a block.
/// Passed to <see cref="IAction.Execute(IActionContext)"/> method.
/// </summary>
public interface IActionContext
{
/// <summary>
/// <see cref="Address"/> of an account who made and signed
/// a transaction that an executed <see cref="IAction"/> belongs to.
/// </summary>
Address Signer { get; }
/// <summary>
/// <see cref="Address"/> of a block miner account.
/// </summary>
Address Miner { get; }
/// <summary>
/// Block index of a transaction that an executed <see cref="IAction"/>
/// belongs to.
/// </summary>
long BlockIndex { get; }
/// <summary>
/// Whether an <see cref="IAction"/> is being executed during
/// “rehearsal mode”, that there is nothing
/// in <see cref="PreviousStates"/>.
/// </summary>
/// <seealso cref="Libplanet.Tx.Transaction{T}.Create"/>
bool Rehearsal { get; }
/// <summary>
/// A null delta of states, which means it represents the states
/// before <see cref="IAction"/> executes.
/// <para>Although a <see cref="IAccountStateDelta"/> instance is
/// immutable, it has several manipulative methods that returns
/// new <see cref="IAccountStateDelta"/> instances with some "dirty"
/// states. These kinds of dirty <see cref="IAccountStateDelta"/>
/// instances can be returned by <see
/// cref="IAction.Execute(IActionContext)"/> method.</para>
/// </summary>
IAccountStateDelta PreviousStates { get; }
/// <summary>
/// An initialized pseudorandom number generator. Its seed (state)
/// is determined by a block and a transaction, which is
/// deterministic so that every node can replay the same action and
/// then reproduce the same result, while neither a single block miner
/// nor a single transaction signer can predict the result and cheat.
/// </summary>
/// <returns>A random object that shares interface mostly equivalent
/// to <see cref="System.Random"/>.</returns>
IRandom Random { get; }
}
}