Last updated a year ago
Cardano DeFi developers need an open-source standardized method for querying several DeFi protocols in parallel to build composable L2 dApps
Plutus DeFi SDK is an open-source set of smart contracts designed for DeFi portfolio accounting; the on-chain balanceOf for DeFi protocols.
This is the total amount allocated to Haskell DeFi SDK for Plutus Devs.
This proposal is focused on the development of a Plutus DeFi SDK in Haskell to enable developers, DeFi product teams and end-users to query their account balances across multiple Cardano DeFi protocols in a single call.
Haskell development firm MLabs Consulting has worked extensively in the fintech and payment space, and is now embarking on a new journey into the decentralized finance space. Their clients include Juspay and Tillit, which respectively are B2C and B2B payments companies in India and Europe.
At Juspay the MLabs team heads up the migration of the payments stack from Purescript to Haskell and the migration from Groovy to Haskell. At Tillit the MLabs team helps to build the backend systems for B2B payments, and the associated DevOps. Work on other projects includes front-end development, artificial intelligence and machine learning.
Work on Open Source:
MLabs team members have initiated and contributed to many open source projects, including static and JIT compilers (Cython, Numba), Haskell data processing systems (Streamly), build systems and frameworks for Purescript (Spago and Parcel), front-end frameworks (Halogen), Haskell schema validators (Medea), database libraries (beam, beam-mysql), Redis bindings (Hedis), the Nix and Haskell build system and packages (nixpkgs, cabal-extras), string and string parsing libraries (text-ascii, io-streams-ascii, bytestring-lexing), metrics and monitoring libraries (prometheus-haskell) and many more.
Some of the libraries they have developed are actively used as part of existing payment stacks and payment processing systems.
All of the code developed will be open sourced under the Apache 2.0 License.
Github Links:
https://github.com/mlabs-haskell/liqwid-contracts/
https://github.com/juspay/beam
https://github.com/juspay/mysql-haskell
https://github.com/juspay/hedis
https://github.com/juspay/bytestring-lexing
https://github.com/juspay/medea
https://github.com/juspay/medea-ps
https://github.com/kozross/text-ascii
https://github.com/kozross/io-streams-ascii
https://github.com/purescript/spago
https://github.com/purescript-halogen/purescript-halogen
https://github.com/NixOS/nixpkgs
https://github.com/cython/cython
https://github.com/numba/numba
Development team:
6 senior Haskell fullstack developers: 4 full-time devs, 2 part-time devs
Use Case: The composability benefits gained from combining several contract functions to read contract data (across DeFi protocols) into a single call enables developers to build efficient aggregator protocols that can quickly and at low-cost query the entire state of a user's assets & debts (across several DeFi protocols) in a unified model.
Features: Low-cost instant query of users assets and debts deposited in Cardano DeFi protocol's such as Age/SigmaUSD, Liqwid, (our team will work with the Cardano developer community to establish a decentralized method of including new DeFi protocols in the contract including full instructions on how to add a custom adapter to the AdapterRegistry contract )
Query the underlying components of more complex derivative tokens as these emerge on DeFi protocols on Cardano:
How would a Plutus DeFi developer/product team leverage this?
E.g.1. Liqwid is a lending protocol with complex derivative tokens representing underlying assets and rates, the Plutus DeFi SDK would enable devs to query the qToken smart contract and retrieve metadata such as: addresses, types and rates of underlying tokens.
E.g.2. if a DEX builds a qUSDC/ADA market where users supply both tokens to a smart contract to mint Liquidity Provider tokens (similar to Uniswap LP tokens): Devs can read how much qUSDC vs. ADA this DEX qUSDC-ADA market holds at any given time and build a dApp that executes code based off of this data (e.g. aggregator DEX)
If user demand for this product is strong the team will further explore how we can securely introduce a standardized open-source model for interacting with Cardano DeFi protocols. To be clear: this initial version of the Plutus DeFi SDK is for reading account balances across DeFi protocols (query/read-only).
Project Roadmap: Development sprints lasting 1-2 weeks in length will implement Plutus DeFi SDK contracts built according to this roadmap.
Sprint 1 - Develop initial smart contracts ProtocolAdapter for Assets (returns the amount of the account's tokens held on the protocol) and ProtocolAdapter for Debt (returns the amount of the account's debt to the protocol).
Sprint 2 - Begin testing against Plutus API's and Cardano DeFi protocols (Liqwid) locally.
Sprint 3 - Develop the TokenAdapter smart contract for token metadata/information on the underlying assets in derivative tokens
Sprint 4 - Develop AdapterRegistry smart contract that maintains the list of ProtocolAdapter & TokenAdapter and is called to fetch user balances.
Sprint 5 - Plutus Testnet deployment
Sprint 6 - Developer documentation including full instructions on how to add a custom adapter to the AdapterRegistry contract in a decentralized process that does not require our team.
Sprint 7 - QA/Testing finalization including a complete Internal security audit of all contracts
Sprint 8 - External smart contract security audit
Sprint 9 - Mainnet deployment
Metrics/KPI's:
Size-related metrics:
1. Number of Plutus smart contracts deployed on testnet/mainnet in comparison to planned amount.
2. Lines of written source code
3. Development team velocity: the "amount" of software the team produces each sprint
4. Code integrity (qa, devops, testing related metrics)
5. Documentation clarity
Function-related metrics:
1. SDK smart contract functionality developed each sprint.
2. SDK infrastructure components completed each sprint.
Budget Breakdown: 2 months of Plutus SDK development, 6 senior Haskell fullstack devs:
4 FT Senior Haskell developers (tax/transaction cost included): $42,375
2 PT Senior Haskell developers (tax/transaction cost included): $14,125
Total: $56,500
NB: Monthly reporting was deprecated from January 2024 and replaced fully by the Milestones Program framework. Learn more here
Develops payment platforms in Haskell
Open-source: github.com/juspay/euler-hs
hackage.haskell.org/package/medea
haskell-beam.github.io/beam/