Task: Atomic Transfers
In this task, you will trade in 5 of the DevCoins you earned in this task, for a new shiny Atomic Transfer Badge. You will do this by creating… , you named it, an Atomic Transfer between these two Assets.
We have placed the Atomic Transfer Badges into an Algorand Smart Contract Account with logic that allows you to trade in 5 DevCoins in exchange for 1 badge. It’s up to you to create this group transaction, submit it, and earn a badge!
The Smart Contract Account that has the badges is here:
Its associated LogicSig can be accessed here: https://github.com/algorand-devrel/AlgorandDeveloperTasks/blob/master/Contracts/atb.lsig
TEAL script: https://github.com/algorand-devrel/AlgorandDeveloperTasks/blob/master/Contracts/atb.teal
- Make sure you have completed the Task: Opt-in to ASAs to get 10 DevCoins.
- Opt-In to the Atomic Transfer Badge Asset. Details here.
- Create a group transaction with 2 transactions (order matters). - Transaction 1: Asset Transfer of 5 DevCoins from you to the Smart Contract account - Transaction 2: Asset Transfer of 1 AtomicTransferBadge from the Smart Contract Account to you.
- Group these transactions, i.e. calculate the group ID and assign it to each transaction before signing.
- Sign the first transaction with your secret key.
- Attach the LogicSig to the second transaction as its signature.
- Submit them together to the network.
- If done right, the badge will belong to you in less than 5 seconds!
- Read how Atomic Transfers work here.
This Atomic Transfer is enabled by a Smart Contract account, but it does not require you to author or change any contracts. We will save that for another time!
All you need to know is that in order to sign the transfer from the Smart Contract account, you must attach the program bytes, called the LogicSig. Those can be found here.
Why This Task Matters
Atomic Transfers paired with Algorand Smart Contracts mean that you can create logic that will allow anyone to trade for your asset provided they give you something in return. Once the contract is funded, this is essentially a no-touch solution for the seller and a single group transaction for the buyer. This task is very similar to a limit-order trade.
The combination of Assets, Atomic Transfers, and Layer-1 Smart Contracts can be very powerful and makes transfers like these very fast and secure. This is just one of the many different use cases that is made possible by these new features.
Post them here!