Skip to content

Commit

Permalink
functional raffle test
Browse files Browse the repository at this point in the history
  • Loading branch information
joe-p committed Nov 23, 2023
1 parent 6f417d6 commit 3860364
Show file tree
Hide file tree
Showing 14 changed files with 3,509 additions and 1,069 deletions.
448 changes: 448 additions & 0 deletions examples/raffle/MockVRFBeaconClient.ts

Large diffs are not rendered by default.

962 changes: 962 additions & 0 deletions examples/raffle/NFTRaffleClient.ts

Large diffs are not rendered by default.

76 changes: 76 additions & 0 deletions examples/raffle/artifacts/MockVRFBeacon.approval.teal
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#pragma version 9

// This TEAL was generated by TEALScript v0.63.0
// https://github.com/algorandfoundation/TEALScript

// This contract is compliant with and/or implements the following ARCs: [ ARC4 ]

// The following ten lines of TEAL handle initial program flow
// This pattern is used to make it easy for anyone to parse the start of the program and determine if a specific action is allowed
// Here, action refers to the OnComplete in combination with whether the app is being created or called
// Every possible action for this contract is represented in the switch statement
// If the action is not implmented in the contract, its repsective branch will be "NOT_IMPLMENTED" which just contains "err"
txn ApplicationID
int 0
>
int 6
*
txn OnCompletion
+
switch create_NoOp NOT_IMPLEMENTED NOT_IMPLEMENTED NOT_IMPLEMENTED NOT_IMPLEMENTED NOT_IMPLEMENTED call_NoOp

NOT_IMPLEMENTED:
err

// must_get(bytes,uint64)byte[]
abi_route_must_get:
// data: byte[]
txna ApplicationArgs 2
extract 2 0

// _round: uint64
txna ApplicationArgs 1
btoi

// execute must_get(bytes,uint64)byte[]
callsub must_get
int 1
return

must_get:
proto 2 0

// examples/raffle/raffle.algo.ts:200
// return sha256(data + itob(globals.round)) as bytes;
frame_dig -2 // data: bytes
global Round
itob
concat
sha256
dup
len
itob
extract 6 2
swap
concat
byte 0x151f7c75
swap
concat
log
retsub

abi_route_createApplication:
int 1
return

create_NoOp:
method "createApplication()void"
txna ApplicationArgs 0
match abi_route_createApplication
err

call_NoOp:
method "must_get(uint64,byte[])byte[]"
txna ApplicationArgs 0
match abi_route_must_get
err
80 changes: 80 additions & 0 deletions examples/raffle/artifacts/MockVRFBeacon.arc32.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"hints": {
"must_get(uint64,byte[])byte[]": {
"call_config": {
"no_op": "CALL"
}
},
"createApplication()void": {
"call_config": {
"no_op": "CREATE"
}
}
},
"bare_call_config": {
"no_op": "NEVER",
"opt_in": "NEVER",
"close_out": "NEVER",
"update_application": "NEVER",
"delete_application": "NEVER"
},
"schema": {
"local": {
"declared": {},
"reserved": {}
},
"global": {
"declared": {},
"reserved": {}
}
},
"state": {
"global": {
"num_byte_slices": 0,
"num_uints": 0
},
"local": {
"num_byte_slices": 0,
"num_uints": 0
}
},
"source": {
"approval": "I3ByYWdtYSB2ZXJzaW9uIDkKCi8vIFRoaXMgVEVBTCB3YXMgZ2VuZXJhdGVkIGJ5IFRFQUxTY3JpcHQgdjAuNjMuMAovLyBodHRwczovL2dpdGh1Yi5jb20vYWxnb3JhbmRmb3VuZGF0aW9uL1RFQUxTY3JpcHQKCi8vIFRoaXMgY29udHJhY3QgaXMgY29tcGxpYW50IHdpdGggYW5kL29yIGltcGxlbWVudHMgdGhlIGZvbGxvd2luZyBBUkNzOiBbIEFSQzQgXQoKLy8gVGhlIGZvbGxvd2luZyB0ZW4gbGluZXMgb2YgVEVBTCBoYW5kbGUgaW5pdGlhbCBwcm9ncmFtIGZsb3cKLy8gVGhpcyBwYXR0ZXJuIGlzIHVzZWQgdG8gbWFrZSBpdCBlYXN5IGZvciBhbnlvbmUgdG8gcGFyc2UgdGhlIHN0YXJ0IG9mIHRoZSBwcm9ncmFtIGFuZCBkZXRlcm1pbmUgaWYgYSBzcGVjaWZpYyBhY3Rpb24gaXMgYWxsb3dlZAovLyBIZXJlLCBhY3Rpb24gcmVmZXJzIHRvIHRoZSBPbkNvbXBsZXRlIGluIGNvbWJpbmF0aW9uIHdpdGggd2hldGhlciB0aGUgYXBwIGlzIGJlaW5nIGNyZWF0ZWQgb3IgY2FsbGVkCi8vIEV2ZX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XAKCWxlbgoJaXRvYgoJZXh0cmFjdCA2IDIKCXN3YXAKCWNvbmNhdAoJYnl0ZSAweDE1MWY3Yzc1Cglzd2FwCgljb25jYXQKCWxvZwoJcmV0c3ViCgphYmlfcm91dGVfY3JlYXRlQXBwbGljYXRpb246CglpbnQgMQoJcmV0dXJuCgpjcmVhdGVfTm9PcDoKCW1ldGhvZCAiY3JlYXRlQXBwbGljYXRpb24oKXZvaWQiCgl0eG5hIEFwcGxpY2F0aW9uQXJncyAwCgltYXRjaCBhYmlfcm91dGVfY3JlYXRlQXBwbGljYXRpb24KCWVycgoKY2FsbF9Ob09wOgoJbWV0aG9kICJtdXN0X2dldCh1aW50NjQsYnl0ZVtdKWJ5dGVbXSIKCXR4bmEgQXBwbGljYXRpb25BcmdzIDAKCW1hdGNoIGFiaV9yb3V0ZV9tdXN0X2dldAoJZXJy",
"clear": "I3ByYWdtYSB2ZXJzaW9uIDk="
},
"contract": {
"name": "MockVRFBeacon",
"desc": "",
"methods": [
{
"name": "must_get",
"args": [
{
"name": "_round",
"type": "uint64",
"desc": ""
},
{
"name": "data",
"type": "byte[]",
"desc": ""
}
],
"desc": "",
"returns": {
"type": "byte[]",
"desc": ""
}
},
{
"name": "createApplication",
"desc": "",
"returns": {
"type": "void",
"desc": ""
},
"args": []
}
]
}
}
35 changes: 35 additions & 0 deletions examples/raffle/artifacts/MockVRFBeacon.arc4.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "MockVRFBeacon",
"desc": "",
"methods": [
{
"name": "must_get",
"args": [
{
"name": "_round",
"type": "uint64",
"desc": ""
},
{
"name": "data",
"type": "byte[]",
"desc": ""
}
],
"desc": "",
"returns": {
"type": "byte[]",
"desc": ""
}
},
{
"name": "createApplication",
"desc": "",
"returns": {
"type": "void",
"desc": ""
},
"args": []
}
]
}
1 change: 1 addition & 0 deletions examples/raffle/artifacts/MockVRFBeacon.clear.teal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#pragma version 9
Loading

0 comments on commit 3860364

Please sign in to comment.