Note that the option to withdraw everything from the pool is only available on the interface once the end has lapsed. During development I’d often create it with the beginning 5 minutes in the future, and have it end 1 hour later. The begin and end fields are required to be formatted as unix times and should be set to somewhen in the future, as you cannot deploy a pool that has already begun or ended. Typically 100% or 1000% has been used when developing this frontend. Whilst testing I would recommend using a large fixed rate percentage for the staking pool, so you can see numbers incrementing rapidly without needing to check back after a few hours. Use the asset IDs to indicate which asset is the staking one and which is the reward one. Once you’ve created your two assets, you’re ready to create a new staking pool. ![]() Note: The majority of testing has been done using 6 decimals and 1,000,000,000,000 total supply, so if you notice any issues using other values please feel free to identify, fix, and issue a PR to the github repository. The full supply of the reward asset will be sent to the staking pool when deploying the pool. For this article go ahead and create 1 “staking asset” and 1 “reward asset”. You can find instructions on how to add a new network in the AlgoSigner docs.Īs part of the demo, a simple asset creation page has been created to help you quickly create different test assets to play around with the staking pools. It’s coded to look for and use a “sandnet-v1” ledger, so make sure your AlgoSigner is configured to communicate with your sandbox environment. Note that AlgoSigner will likely popup asking you to grant access. Here you will see the “View Pools” page, which will be blank the first time you view it. ![]() Once you launch the django server ( python3 manage.py runserver), you can visit the website at. Extensive use of the py-algorand-sdk has been used to construct transactions and interact with an algod node. Front Endįor this demo the popular Python web framework Django has been used to create a frontend for users to interact with the staking pool smart contracts. If you just want to use the smart contracts you can always use the provided instructions at the bottom, or use the deploy.sh bash script which runs through a full use of the contract. Whilst it’s entirely possible to replace the wallet with MyAlgo or Pera Wallet, this demo has been created with AlgoSigner, so please bear in mind that you will need to use a Chrome browser with the AlgoSigner extension installed to interact with the front end. ![]() The value of these assets are assumed to be valued 1:1, so you would need to implement an oracle price lookup if you intend for rewards to be given at a different ratio. The staking asset and the reward asset can be the same asset if desired, but throughout this article we make a clear distinction between them by setting them as two separate assets. You’re encouraged to extend the capabilities of the smart contracts to continue learning how it impacts the user experience. The staking pools have been designed to be as simple as possible, removing any need for an external oracle or using any complex mathematics. If you’d like to see a video demonstration of the staking demo first, checkout the YouTube video below.īefore we jump into using the front end or learning about the smart contract functionality, let me explain a little more about what this demo offers. It is purely for educational purposes to help show how a platform can be constructed from end-to-end. ![]() Please note that this example has not been audited and should not be considered ready for production. This article introduces you to an example staking platform that’s available on github, to demonstrate how such a service can be created on Algorand.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |