This repository forms part of a introduction to development in TEAL and PYTEAL explained also in these Slides.
Resources:
- Simple Teal (From Algorand).
- AMM Repo (Mio).
- Explorer
- All of Algorand
This Repository is still under construction 👷
Next weeks it will be upgrated to explain how to create your own AMM in PyTeal 😋
Below there are the steps to follow and test by yourself a smart signature.
Before start, you need to have instaled WSL (only if you are in Windows), Docker (Windows, Mac) and the Sandbox.
In a folder:
git clone https://github.com/algorand/sandbox
git clone https://github.com/gpylypchuk/workshop-intro-teal
This command will init the containers.
./sandbox/sandbox up
Posisionated inside the multisig sample folder:
../sandbox/sandbox copyTo simple.teal
Now you have copied the contract. To interact with it in the development environment you have to start the Algorand Develoment console.
../sandbox/sandbox enter algod
When you're inside Algorand Develomnet environment, the next step is compile it. Here it comes the delegated signature!
# The '-o' indicates output
# The '-a' indicates address
# The '-d' indicates directory
goal clerk compile simple.teal -o mydelegatedsig.lsig -s -a YOUR_DELEGATED_ADDRESS -d .
Now, you have compiled the code. The next step is test it 🧐 Send a transaction from your delegated address.
# The '-f' indicates from (sender)
# The '-a' indicates amount in microalgos
# The '-t' indicates to (receiver)
# The '-L' indicates load
goal clerk send -f YOUR_DELEGATED_ADDRESS -a 100000 -t ANOTHER_ADDRESS -L mydelegatedsig.lsig -d .
You have sent a transaction by another delegated address!
Here we will compile a contract in PyTeal
Initialize your virtual environment (go to pyteal-contracts)
python3 -m venv venv
source ./venv/bin/activate
To do this type:
pip install -r requirements.txt
Easy!, now you can compile the sample contract typing
./build.sh contracts.counter.step_01
You have compiled it.
So, you should have the approval.teal and clear.teal inside the folder build
Now, you can use the steps we discuss before to interact with the Teal contract transpiled.