The aim of the application and PyTeal contract is to deposit Algo or Algorant Standard Assets in a single Transaction.
User compiles a deposit app call transaction and sets the rekeyTo field to the address of the contract.
This is the building block for more complex applications on Algorand and its ecosystem.
Submission for https://gitcoin.co/issue/c3protocol/hackalgo/1/100028569
The contract takes 2 args.
The first arg is the type fo transaction: deposit or asa_deposit. The second arg is the amount deposited.
Required instalation of Python3 and NPM.
pip install virtualenv
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
One line if virtualenv is installed:
virtualenv venv && source venv/bin/activate && pip install -r requirements.txt
To convert Pyteal to teal contract:
python3 /contracts/contract.py
To install packages:
npm i
First add Mnemonic passphrase to .env
.
Next go to the testnet dispenser to obtain Algo. Create an asset using createasset.py
or obtain one from a faucet and enter its id in config.js
.
To illustrate the app run:
npm start
Such that
Illustration of the working app on AlgoExplorer:
https://testnet.algoexplorer.io/application/85314426
asa_deposit.js
deposits asa asset
config.js
contains the user instance and id of the asset to transfer
deploy.js
deploys contract ie approval and clear state teal files
deposit.js
deposits Algo
index.js
runs deploy, deposit and asa_deposit
utils.js
contains instance of Algorand Client, submitTransaction function to sign, send and wait for transaction confirmation