Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update new testcases for codehash, chainid and timestamp features of blockchain #62

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions testsuite/contracts/ChainId/chainid.scilla
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
scilla_version 0

(***************************************************)
(* The contract definition *)
(***************************************************)

contract ChainId()

transition EventChainID ()
cid <-& CHAINID;
e = { _eventname : "ChainID"; chain_id : cid };
event e
end
7 changes: 7 additions & 0 deletions testsuite/contracts/ChainId/init.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[
{
"vname": "_scilla_version",
"type": "Uint32",
"value": "0"
}
]
34 changes: 34 additions & 0 deletions testsuite/contracts/CodeHash/codehash.scilla
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
scilla_version 0

contract Codehash()

transition foo(addr : ByStr20 with _codehash end)
bar <- &addr._codehash;
e = { _eventname : "Success"; bar : bar };
event e
end

transition foo2(addr : ByStr20)
addr_ <- &addr as ByStr20 with _codehash end;
match addr_ with
| Some addr__ =>
bar <- &addr__._codehash;
e = { _eventname : "Success"; bar : bar };
event e
| None =>
e = { _eventname : "Failure" };
event e
end
end

transition foo3(addr : ByStr20 with library end)
bar <- &addr._codehash;
e = { _eventname : "Success"; bar : bar };
event e
end

transition foo4(addr : ByStr20 with contract end)
bar <- &addr._codehash;
e = { _eventname : "Success"; bar : bar };
event e
end
7 changes: 7 additions & 0 deletions testsuite/contracts/CodeHash/init.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[
{
"vname": "_scilla_version",
"type": "Uint32",
"value": "0"
}
]
7 changes: 7 additions & 0 deletions testsuite/contracts/Timestamp/init.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[
{
"vname": "_scilla_version",
"type": "Uint32",
"value": "0"
}
]
14 changes: 14 additions & 0 deletions testsuite/contracts/Timestamp/timestamp.scilla
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
scilla_version 0

(***************************************************)
(* The contract definition *)
(***************************************************)

contract Timestamp()

transition EventTimestamp ()
bnum = BNum 4;
ts <- &TIMESTAMP(bnum);
e = { _eventname : "TS"; timestamp : ts };
event e
end