Install Tealish and start building with a brand new language designed for the AVM.
pip install tealish
A simple example demonstrating the use of assertions, state, if statements, and inner transactions:
#pragma version 8 # ApplicationID will be 0 when the app is being created if Txn.ApplicationID == 0: # Initialise the counter state to 0 app_global_put("counter", 0) exit(1) end if Txn.OnCompletion == UpdateApplication: # Only allow the Creator to update the app assert(Txn.Sender == Global.CreatorAddress) exit(1) end # Ensure that this is a NoOp application call. Don't allow optin, delete, etc assert(Txn.OnCompletion == NoOp) # Read the counter value from state and increment it int counter = app_global_get("counter") counter = counter + 1 app_global_put("counter", counter) if counter == 10: # If the counter is 10 make a Payment transaction inner_txn: TypeEnum: Pay Receiver: Txn.Sender Amount: 10000000 end elif counter > 10: # If the counter is past 10 fail the program exit(0) end # Exit the program with approval exit(1)
Tealish transpiles code to Teal, rather than directly compiling to AVM bytecode. The produced Teal is as close to handwritten idiomatic Teal as possible. The original Tealish source code, including comments, is included as comments in the generated Teal code. The generated Teal code is designed to be easily readable and auditable, and should not contain any surprises - Tealish writers should be able to easily understand the generated Teal code.
You can view the generated Teal code for the example above here.
Tealish is not intended to be a general-purpose programming language. Instead, it is specifically designed for writing contracts for the AVM, with a focus on optimizing common patterns.
The Tealish language is built and maintained by the Tinyman core team for the benefit of the entire Algorand ecosystem.