-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Code changes to prep for new documentation (#22)
- Loading branch information
1 parent
169b34e
commit 7865220
Showing
39 changed files
with
624 additions
and
203 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# This example is provided for informational purposes only and has not been audited for security. | ||
|
||
from pyteal import * | ||
|
||
"""Basic Bank""" | ||
|
||
def bank_for_account(receiver): | ||
"""Only allow receiver to withdraw funds from this contract account. | ||
Args: | ||
receiver (str): Base 32 Algorand address of the receiver. | ||
""" | ||
|
||
is_payment = Txn.type_enum() == TxnType.Payment | ||
is_single_tx = Global.group_size() == Int(1) | ||
is_correct_receiver = Txn.receiver() == Addr(receiver) | ||
no_close_out_addr = Txn.close_remainder_to() == Global.zero_address() | ||
no_rekey_addr = Txn.rekey_to() == Global.zero_address() | ||
acceptable_fee = Txn.fee() <= Int(1000) | ||
|
||
return And( | ||
is_payment, | ||
is_single_tx, | ||
is_correct_receiver, | ||
no_close_out_addr, | ||
no_rekey_addr, | ||
acceptable_fee | ||
) | ||
|
||
if __name__ == "__main__": | ||
program = bank_for_account("ZZAF5ARA4MEC5PVDOP64JM5O5MQST63Q2KOY2FLYFLXXD3PFSNJJBYAFZM") | ||
print(compileTeal(program, Mode.Signature)) |
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,24 @@ | ||
#pragma version 2 | ||
txn TypeEnum | ||
int pay | ||
== | ||
global GroupSize | ||
int 1 | ||
== | ||
&& | ||
txn Receiver | ||
addr ZZAF5ARA4MEC5PVDOP64JM5O5MQST63Q2KOY2FLYFLXXD3PFSNJJBYAFZM | ||
== | ||
&& | ||
txn CloseRemainderTo | ||
global ZeroAddress | ||
== | ||
&& | ||
txn RekeyTo | ||
global ZeroAddress | ||
== | ||
&& | ||
txn Fee | ||
int 1000 | ||
<= | ||
&& |
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
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
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 |
---|---|---|
|
@@ -22,3 +22,5 @@ def __str__(self): | |
|
||
def type_of(self): | ||
return TealType.bytes | ||
|
||
Addr.__module__ = "pyteal" |
Oops, something went wrong.