Skip to content

uhudo/staking-pools-autocompounder-with-beaker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Staking Pools Autocompounder with Beaker and Box Storage

This project includes an alternative implementation of a smart contract of an autocompounder for distribution pools from the Staking Pools Autocompounder project. The smart contract supports autocompounding of distribution pools of Cometa platform. Since both projects implement the same functionality, refer to README.md of Staking Pools Autocompounder project for a detailed description.

The implementation takes advantage of Algorand's new functionality introduced with AVM8 - the box storage. Box storage is elegantly used to keep track of how much interest has each user earned between two autocompounding instances. Since the autocompounding can be done arbitrarily frequently, there is a need for an arbitrary amount of storage, which cannot be achieved using global or local storage (especially since autocompounding can be triggered by any user but the recorded data needs to be accessible by all other users as well). However, this can easily be achieved with box storage.

The difference in the implementation of this project and the Staking Pools Autocompounder project, is that this project uses the Beaker framework instead of pure PyTEAL. Comparing the smart contracts of the former and the latter shows that Beaker framework facilitates the development by simplifying contract's state management and code organization as well as providing methods for easier interactions. Nevertheless, comparing the smart contracts directly on the compiled TEAL code level (e.g. examples of the former vs. the latter) shows certain differences (ca. 20%). However, studying the TEAL code, it is possible to see that these come simply from different memory organizations. This was confirmed by verifying that both provide the same functionality.

Demo Interactions

The project includes a script for a sample interaction with autocompounding smart contracts through a simple command-line interface. The script implements the state machine shown in figure below.

Image of demo script state machine

An example scenario of interactions with the platform through the provided interaction script has been recorded and the video excerpts documented.

To test the platform with the provided script, the following is required:

For testing, clone the repository and run the provided script.

Notice

The project was developed during Algorand Greenhouse Hack #3 and submitted to Learning Challenge: Box Storage with Beaker category.

The smart contracts were written using the Beaker framework, which uses PyTEAL. The contracts are ABI compliant. The command-line interface is written in Python and uses the py-algorand-sdk.

The software is not meant for production deployment - the smart contracts have not been audited and the provided test user interface does not follow the recommended security guidelines regarding handling of mnemonics.

Author: Uroš Hudomalj - https://github.com/uhudo

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages