-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMkContract.dhall
46 lines (45 loc) · 1.4 KB
/
MkContract.dhall
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
let Env =
\(Effect : Type) ->
\(Address : Type) ->
{ callValue : Natural
, callDataSize : Natural
, codeSize : Natural
, gasPrice : Natural
, returnDataSize : Natural
, coinbase : Address
, timestamp : Natural
, number : Natural
, difficulty : Natural
, gasLimit : Natural
, chainId : Natural
, selfBalance : Natural
, baseFee : Natural
, programCounter : Natural
, mSize : Natural
, gas : Natural
, address : Address
, origin : Address
, caller : Address
, balanceOf : Address -> Natural
, mload : forall (T : Type) -> Natural -> T
, mstore : forall (T : Type) -> Natural -> T -> Effect
, callDataLoad : forall (T : Type) -> T
, sload : forall (T : Type) -> Natural -> T
, sstore : forall (T : Type) -> Natural -> T -> Effect
, return : forall (T : Type) -> T -> Effect
, sequence : List Effect -> Effect
}
in \(Store : Type) ->
\(Message : Type) ->
\(initial : Store) ->
\(handler : Store -> Message -> Store) ->
\(Effect : Type) ->
\(Address : Type) ->
\(env : Env Effect Address) ->
env.sequence
[ env.sstore Store 0 initial
, env.sstore
Store
0
(handler (env.sload Store 0) (env.callDataLoad Message))
]