completed
Haskell DeFi SDK for Plutus Devs
Current Project Status
Complete
Amount
Received
$56,500
Amount
Requested
$56,500
Percentage
Received
100.00%
Solution

Plutus DeFi SDK is an open-source set of smart contracts designed for DeFi portfolio accounting; the on-chain balanceOf for DeFi protocols.

Problem

Cardano DeFi developers need an open-source standardized method for querying several DeFi protocols in parallel to build composable L2 dApps

Liqwid

2 members

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:

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:

  • Number of Plutus smart contracts deployed on testnet/mainnet in comparison to planned amount.
  • Lines of written source code
  • Development team velocity: the "amount" of software the team produces each sprint
  • Code integrity (qa, devops, testing related metrics)
  • Documentation clarity

Function-related metrics:

  • SDK smart contract functionality developed each sprint.
  • 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

close

Playlist

  • EP2: epoch_length

    Authored by: Darlington Kofa

    3m 24s
    Darlington Kofa
  • EP1: 'd' parameter

    Authored by: Darlington Kofa

    4m 3s
    Darlington Kofa
  • EP3: key_deposit

    Authored by: Darlington Kofa

    3m 48s
    Darlington Kofa
  • EP4: epoch_no

    Authored by: Darlington Kofa

    2m 16s
    Darlington Kofa
  • EP5: max_block_size

    Authored by: Darlington Kofa

    3m 14s
    Darlington Kofa
  • EP6: pool_deposit

    Authored by: Darlington Kofa

    3m 19s
    Darlington Kofa
  • EP7: max_tx_size

    Authored by: Darlington Kofa

    4m 59s
    Darlington Kofa
0:00
/
~0:00