Inspiration
LEUSD draws inspiration from Maker DAI's design, focusing on stability through overcollateralization with a diverse basket of underlying assets chosen for their liquidity and price stability. While LEUSD currently currently employs a single underlying token as collateral, future iterations can extend this logic to include various assets, aligning with the principles of Maker DAI.
What it does
LEUSD, an algorithmic stablecoin on the Aleo blockchain, ensures a stable peg to the US Dollar by utilizing an over-collateralized basket of underlying assets. Users can mint LEUSD by collateralizing their position, adhering to a 125% collateralization threshold (health factor). The smart contract charges daily compounded interest on borrowed LEUSD, collected by the Treasury. In the event of a drop in collateral value below the health factor, there's an economic incentive for any participant, including the token owner, to repay the loan, triggering liquidation and rewarding the liquidator from the LEUSD treasury.
How I built it and the challenges faced
The project is constructed using the Leo language for the Aleo blockchain. The design relies on market efficiencies within decentralized exchanges (market makers taking advantage of arbs to ensure prices are consistent) on Aleo to accurately reflect the value of traded tokens. The value of collateral tokens is derived directly from DEXes by inferring based on AMM pool ratios. The smart contract employs a Maker DAI-inspired approach, emphasizing overcollateralization for stability.
This project was my first exploration of both Leo, Aleo and ZK optimised languages in general so I encountered a few challenged diving into the limitations ZK optimised programs and syntaxed impose. Whilst the documentation for Leo is very good there are fundimental logical building blocks and assumptions coming from web3 development that can't be applied to Leo and this required some significant time to understand. There are also challenges around logic, accessing state and being able to verify interactions between addresses. Given more time I am sure I could have solved this, but I only had a single day to both get familiar and design something that could be the foundation for a stablecoin.
Accomplishments that I'm proud of
I'm proud to have successfully implementing the foundation of an overcollateralised lending protocol which then works as a rudimentary stablecoin in the Leo language in a very short time span
What's next for LeonCoin Future work for LeonCoin includes the implementation of mechanisms to reduce deviations from the price peg, either through minting/burning LEUSD treasury tokens or utilizing treasury collateral. Improvements in ensuring assertions and checks run in transitions, not just in finalize blocks, where they might be non-functional.
Further generalization to support multi-token collateral and the integration of on-chain DEX connections for precise pricing data are essential steps for enhancing the stability and functionality of LeonCoin.
Built With
- leo
Log in or sign up for Devpost to join the conversation.