Skip to content
New issue

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

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

Already on GitHub? # to your account

Sourcemap templates #696

Merged
merged 6 commits into from
Mar 23, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
22 changes: 20 additions & 2 deletions examples/signature/dutch_auction.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# This example is provided for informational purposes only and has not been audited for security.
from pathlib import Path

from pyteal import *
from feature_gates import FeatureGates

FeatureGates.set_sourcemap_enabled(True)


from pyteal import * # noqa: E402


""" Template for layer 1 dutch auction (from Fabrice and Shai)
Expand Down Expand Up @@ -136,4 +142,16 @@ def dutch_auction(


if __name__ == "__main__":
print(compileTeal(dutch_auction(), mode=Mode.Signature, version=2))
# to recreate files, run this script from the root of the repo
EXAMPLES = Path.cwd() / "examples" / "signature"
results = Compilation(dutch_auction(), mode=Mode.Signature, version=2).compile(
with_sourcemap=True,
annotate_teal=True,
annotate_teal_headers=True,
annotate_teal_concise=False,
)
with open(EXAMPLES / "dutch_auction.teal", "w") as f:
f.write(results.teal)

with open(EXAMPLES / "dutch_auction_annotated.teal", "w") as f:
f.write(results.sourcemap.annotated_teal)
2 changes: 1 addition & 1 deletion examples/signature/dutch_auction.teal
Original file line number Diff line number Diff line change
Expand Up @@ -298,4 +298,4 @@ gtxn 4 Receiver
==
&&
main_l7:
return
return
Loading