-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
57 changed files
with
3,139 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.github/ @algorand/dev | ||
.circleci/ @algorand/dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Algorand Java SDK Examples | ||
|
||
|
||
|
||
Running | ||
-------- | ||
Package with `mvn` | ||
```sh | ||
mvn package | ||
``` | ||
|
||
Run an example with java | ||
```sh | ||
java -cp target/sdk-extras-1.0-SNAPSHOT.jar com.algorand.examples.Example | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
#pragma version 4 | ||
// Handle each possible OnCompletion type. We don't have to worry about | ||
// handling ClearState, because the ClearStateProgram will execute in that | ||
// case, not the ApprovalProgram. | ||
txn ApplicationID | ||
int 0 | ||
== | ||
bnz handle_approve | ||
|
||
txn OnCompletion | ||
int NoOp | ||
== | ||
bnz handle_noop | ||
|
||
txn OnCompletion | ||
int OptIn | ||
== | ||
bnz handle_approve | ||
|
||
txn OnCompletion | ||
int CloseOut | ||
== | ||
bnz handle_closeout | ||
|
||
txn OnCompletion | ||
int UpdateApplication | ||
== | ||
bnz handle_updateapp | ||
|
||
txn OnCompletion | ||
int DeleteApplication | ||
== | ||
bnz handle_deleteapp | ||
|
||
// Unexpected OnCompletion value. Should be unreachable. | ||
err | ||
|
||
handle_noop: | ||
// Handle NoOp | ||
|
||
// read global state | ||
byte "counter" | ||
dup | ||
app_global_get | ||
|
||
// increment the value | ||
int 1 | ||
+ | ||
|
||
// store to scratch space | ||
dup | ||
store 0 | ||
|
||
// update global state | ||
app_global_put | ||
|
||
// read local state for sender | ||
int 0 | ||
byte "counter" | ||
app_local_get | ||
|
||
// increment the value | ||
int 1 | ||
+ | ||
store 1 | ||
|
||
// update local state for sender | ||
int 0 | ||
byte "counter" | ||
load 1 | ||
app_local_put | ||
|
||
// load return value as approval | ||
load 0 | ||
return | ||
|
||
|
||
handle_closeout: | ||
// Handle CloseOut | ||
//approval | ||
int 1 | ||
return | ||
|
||
handle_deleteapp: | ||
// Check for creator | ||
global CreatorAddress | ||
txn Sender | ||
== | ||
return | ||
|
||
handle_updateapp: | ||
// Check for creator | ||
global CreatorAddress | ||
txn Sender | ||
== | ||
return | ||
|
||
handle_approve: | ||
int 1 | ||
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
#pragma version 4 | ||
// Handle each possible OnCompletion type. We don't have to worry about | ||
// handling ClearState, because the ClearStateProgram will execute in that | ||
// case, not the ApprovalProgram. | ||
|
||
txn ApplicationID | ||
int 0 | ||
== | ||
bnz handle_approve | ||
|
||
txn OnCompletion | ||
int NoOp | ||
== | ||
bnz handle_noop | ||
|
||
txn OnCompletion | ||
int OptIn | ||
== | ||
bnz handle_approve | ||
|
||
txn OnCompletion | ||
int CloseOut | ||
== | ||
bnz handle_closeout | ||
|
||
txn OnCompletion | ||
int UpdateApplication | ||
== | ||
bnz handle_updateapp | ||
|
||
txn OnCompletion | ||
int DeleteApplication | ||
== | ||
bnz handle_deleteapp | ||
|
||
// Unexpected OnCompletion value. Should be unreachable. | ||
err | ||
|
||
handle_noop: | ||
// Handle NoOp | ||
|
||
// read global state | ||
byte "counter" | ||
dup | ||
app_global_get | ||
|
||
// increment the value | ||
int 1 | ||
+ | ||
|
||
// store to scratch space | ||
dup | ||
store 0 | ||
|
||
// update global state | ||
app_global_put | ||
|
||
// read local state for sender | ||
int 0 | ||
byte "counter" | ||
app_local_get | ||
|
||
// increment the value | ||
int 1 | ||
+ | ||
store 1 | ||
|
||
// update local state for sender | ||
// update "counter" | ||
int 0 | ||
byte "counter" | ||
load 1 | ||
app_local_put | ||
|
||
// update "timestamp" | ||
int 0 | ||
byte "timestamp" | ||
txn ApplicationArgs 0 | ||
app_local_put | ||
|
||
// load return value as approval | ||
load 0 | ||
return | ||
|
||
handle_closeout: | ||
// Handle CloseOut | ||
//approval | ||
int 1 | ||
return | ||
|
||
handle_deleteapp: | ||
// Check for creator | ||
global CreatorAddress | ||
txn Sender | ||
== | ||
return | ||
|
||
handle_updateapp: | ||
// Check for creator | ||
global CreatorAddress | ||
txn Sender | ||
== | ||
return | ||
|
||
handle_approve: | ||
int 1 | ||
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#pragma version 4 | ||
int 1 | ||
return |
Oops, something went wrong.