-
Notifications
You must be signed in to change notification settings - Fork 0
/
context.ak
123 lines (99 loc) · 2.23 KB
/
context.ak
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
use elude/types.{Option}
pub type ScriptContext<purpose> {
transaction: Transaction,
purpose: purpose,
}
pub type Hash<a> =
ByteArray
pub type ScriptPurpose {
Mint(PolicyId)
Spend(OutputReference)
Withdrawal(StakeCredential)
Certify(Certificate)
}
pub type Redeemer =
Data
pub type BoundValue<value> {
NegativeInfinity
Finite(value)
PositiveInfinity
}
pub type Bound<value> {
value: BoundValue<value>,
is_inclusive: Bool,
}
pub type Interval<value> {
lower_bound: Bound<value>,
upper_bound: Bound<value>,
}
pub type Transaction {
inputs: List<Input>,
reference_inputs: List<Input>,
outputs: List<Output>,
fee: Value,
mint: Value,
certificates: List<Certificate>,
withdrawals: List<#(StakeCredential, Int)>,
validity_range: Interval<Int>,
extra_signatories: List<PublicKeyHash>,
redeemers: List<#(ScriptPurpose, Redeemer)>,
datums: List<#(Hash<Data>, Data)>,
id: TransactionId,
}
pub type TransactionId {
hash: Hash<Transaction>,
}
pub type Input {
output_reference: OutputReference,
output: Output,
}
pub type OutputReference {
transction_id: TransactionId,
output_index: Int,
}
pub type PolicyId =
ByteArray
pub type StakeCredential {
StakeHash(Credential)
StakePointer(Int, Int, Int)
}
pub type Credential {
PublicKeyCredential(PublicKeyHash)
ScriptCredential(ScriptHash)
}
pub type VerificationKey =
ByteArray
pub type ScriptHash =
ByteArray
pub type PublicKeyHash =
Hash<VerificationKey>
pub type PoolId =
Hash<VerificationKey>
pub type Output {
address: Address,
value: Value,
datum: DatumOption,
reference_script: Option<ScriptHash>,
}
pub type Address {
payment_credential: Credential,
stake_credential: Option<StakeCredential>,
}
pub type DatumOption {
NoDatum
DatumHash(Hash<Data>)
Datum(Data)
}
pub type AssetName =
ByteArray
pub type Value =
List<#(PolicyId, List<#(AssetName, Int)>)>
pub type Certificate {
CredentialRegistration { delegator: StakeCredential }
CredentialDeregistration { delegator: StakeCredential }
CredentialDelegation { delegator: StakeCredential, delegatee: PoolId }
PoolRegistration { pool_id: PoolId, vrf: Hash<VerificationKey> }
PoolDeregistration { pool_id: PoolId, epoch: Int }
Governance
TreasuryMovement
}