Liquidity-as-a-Service on Algorand.
- Contracts are implemented in PyTEAL.
- Contracts have reference specification in pure Python.
- Scripts are implemented using Algo Builder
This repo uses Pipenv. So run pipenv shell first.
Also, it uses Yarn 4, so do yarn install.
Now, you probably want to write tests and modify contracts if tests fail.
Tests are in test/ dir and they use mocha + chai. To run them do yarn test.
Contracts are in assets/ dir (this name might be confusing but it is a standard one).
There are two contracts currently:
- Vault -- the main thing, implements LaaS.
- AMM -- toy DEXes to use in our tests etc.
Auction is implemented in vault contract too because it is simpler.
AMM currently comes in two flavors: with ABI and without. Currently we do NOT use ABI but plan do support it later.
assets/has smart-contracts which are functionally complete (expect real DEXes support).digital_twin/has reference implementation which is mostly complete but may be slightly out of date.scripts/run/common/contain "api" txs for contracts, they are ready.scripts/setup.tsandscripts/deploy.tscontain useful boilerplate but are not ready and probably broken.scripts/test/contain a few basic end-to-end tests. They are good but we need much more testing.
If you will look at test script in package.json, you will see that it compiles PyTEAL and stores it in assets/teal dir. It is NOT needed for test run, because tests compile what they need on demand. We do it only to faciliate debug.
Debug is very simple (but very limited):
- Find the context method which fails.
- Add second argument
3tothis.runtime.executeTx. - Rerun tests.
This magic argument says how many lines of stacktrace will be shown for each line of TEAL. Now, look at the line where it fails and navigate to assets/teal/filename to see what is wrong.
Be aware that we use contract-to-contract calls, and debuger just seamlessly jumps among a few files.
At this moment this repo is broken because Algo Builder doesn't support some important InnerTx fields. @MetaB0y implemented it and waits until it is backported to minor release.
It is very convenient but doesn't support important new features.
- Anything related to ABI: scale-it/algo-builder#758
- Anything related to TEAL 7: scale-it/algo-builder#759
Installing xo plugin for IDE support (and possibly disabling eslint plugin) is recommended.
It is also being run with --fix argument as a presubmit hook (only for staged files).