over budget
Djed Shu Stablecoin Implementation
Current Project Status
Unfunded
Amount
Received
₳0
Amount
Requested
₳200,000
Percentage
Received
0.00%
Solution

We will implement the Shu version of Djed for Cardano’s EVM sidechain. Djed Shu uses two oracle prices to be more robust against oracle issues. This allows lower base fees fro minting and redemption.

Problem

Current versions of Djed available on Cardano are stable but sensitive to oracle delays and manipulations. This requires high minting and redemption fees for drainage protection, hindering adoption.

Impact Alignment
Feasibility
Value for Money

Team

1 member

Djed Shu Stablecoin Implementation

Please describe your proposed solution

Current versions (<https://docs.stability.nexus/djed-stablecoin-protocols/versions>) of Djed available on Cardano (Minimal and Osiris) are stable but sensitive to the oracles on which they depend. In these versions of Djed, the smart contract buys and sells stablecoins for an amount of ADA that depends on the latest ADA/USD price provided by the oracle. If, for any reason, such as oracle delays or price manipulations, the price provided by the oracle is different from the real price, the smart contract will buy or sell stablecoins for a price that is different than it should. For example, suppose that the oracle's price of USD in ADA is 1% higher than the real price of USD in ADA. Then, when a user redeems a stablecoin, the Djed smart contract will be giving the user an amount of ADA that it believes to be worth 1 USD but is actually worth 1.01 USD. This harms the contract's reserve.

In part to protect against any potential oracle issue, the versions of Djed currently available on Cardano impose fixed minting and redemption fees. For instance, with a fee of 2% and an oracle discrepancy of 1%, as in the example above, the Djed contract will be giving the user an amount of ADA per stablecoin that it believes to be worth 0.98 USD but is actually worth ~0.99 USD. Thus, even though there was a discrepancy between the oracle price and the real price, the Djed smart contract managed to avoid giving back more 1 USD worth of ADA. The fees provide robustness against price discrepancies. If the fee is X%, then the smart contract can tolerate a price discrepancy of up to X%.

The challenge with this approach is that it creates a wide spread between the effective minting and redemption prices. For a fee of 2%, users would have to buy stablecoins for 1.02 USD worth of ADA and sell them for 0.98 USD worth of ADA. Naturally, high fees discourage users from minting and redeeming stablecoins, hindering adoption of the protocol.

Djed Shu addresses this problem by using an oracle that provides 2 prices, instead of just a single latest price. These two prices could be, for instance, the latest price and a moving average, or minimum and maximum prices in a 24h period. Then, for each operation of buying or selling stablecoins or reservecoins, the Djed contract chooses the price that is most favorable to the contract's reserve.

Djed Shu has already been implemented on Zephyr (a fork of Monero where Djed has been implemented natively on the ledger rules) and it has been battle-tested for more than 6 months already (cf. <https://zephyrprotocol.com/>).

Screenshot-2024-05-14-at-17.01.27-a260d5.png

This project will implement Djed Shu for Cardano. To do so, we will:

  1. Take the implementation of Djed Osiris (see: <https://github.com/DjedAlliance/Djed-Solidity> and <https://github.com/DjedAlliance/Djed-Solidity-WebDashboard>) as a starting point.
  2. Modify the oracle interface so that it serves two prices instead of just one.
  3. Implement an oracle adapter that memorizes data from the oracle and uses the historical data to produce the two prices (e.g. moving average and latest price, or max and min prices over a 24h period)
  4. Change the Djed contract to conform to the new oracle interface and, for each operation, use the most favorable price.
  5. Adapt the frontend, to make it compatible with the the new version of the Djed and oracle contracts.

Screenshot-2024-05-14-at-16.22.34-d6d4d9.png

For more information about the various versions, implementations and deployments of Djed, please visit:

Screenshot-2024-05-14-at-16.52.00-a79d20.png

Please define the positive impact your project will have on the wider Cardano community

A Djed with lower fees on Cardano will achieve higher adoption. Higher adoption will bring the following benefits and opportunities to Cardano:

  • Greater TVL for Cardano.
  • More revenue for reservecoin holders, due to more frequent trading with the contract due to lower base fees.
  • Cardani might finally get a widely adopted fully decentralized stablecoin, which is crucal for its DeFi ecosystem to flourish with a solid foundation.

What is your capability to deliver your project with high levels of trust and accountability? How do you intend to validate if your approach is feasible?

Dr. Bruno Woltzenlogel Paleo (a.k.a. Zahnentferner) is the founder of the Djed Alliance and of The Stable Order. He is the main author of the Djed paper and a member of Djed's original R&amp;D team, which implemented both Agenor (deployed as SigmaUSD on Ergo) and Belus (deployed as Milkomeda Djed Osiris on Cardano's EVM Sidechain Cardano). Therefore, he has the deep knowledge of the Djed Stablecoin Protocol that is crucial to develop a new version of Djed. Furthermore, during his academic career, he has already received and managed more than 1 million USD in research grants in several countries and always achieved the goals of the proposed projects.

Tanya Srinivas, Anshdeep Singh, Roshan Raj Singh, Yogesh Agrawal have been contributing to the Milkomeda Djed Osiris repos for several months and are therefore already familiarized with the code that will be used as a starting point for Djed Shu.

To know more about our organization as a whole, check the following links:

  • <https://docs.stability.nexus/>
  • <https://medium.com/DjedAlliance>
  • <https://news.stability.nexus/>
  • <https://x.com/DjedAlliance>
  • <https://x.com/StabilityNexus>
  • <https://linkedin.com/company/stability-nexus>
  • <https://t.me/StabilityNexus>
  • <https://discord.gg/YzDKeEfWtS>
  • <https://github.com/StabilityNexus>
  • <https://djed.one/>
  • <https://github.com/DjedAlliance>
  • <https://eprint.iacr.org/2021/1069>

What are the key milestones you need to achieve in order to complete your project successfully?

Milestone 1: Milestone outputs:

  • Implementation of 2-Price Oracle Interface contract.
  • Implementation of Djed Shu smart contract using the 2-Price Oracle Interface.

Acceptance criteria:

  • The interface should contain two function, one to read the higher price and one to read the lower price.
  • In Djed Shu, the four operations (buy/sell stablecoins/reservecoins) should be calling the correct price functions from the oracle interface.

Evidence of milestone completion:

  • Links to the source code.

Milestone 2: Milestone outputs:

  • Implementation of an oracle adapter that converts a typical 1-price oracle into a 2-price oracle.

Acceptance criteria:

  • The oracle adapter should, when reading the latest data from the 1-price oracle, memorize the data and use historical memorized data to compute the minimum and maximum prices over a period of time. The minimum and maximum prices should be made available in accordance with the 2-price oracle interface.

Evidence of milestone completion:

  • Link to the source code.

Final Milestone: Milestone outputs:

  • Implementation of the frontend.

Acceptance criteria:

  • In contrast to the frontend that we have for Djed Osiris (https://milkomeda-c1.djed.one), the frontend for Djed Shu should show distincting prices for buying and selling coins.

Evidence of milestone completion:

  • Link to a deployed frontend (not necessarily in Milkomeda's mainent, possibly in Milkomeda's testnet), open for anyone to try.

Please provide a cost breakdown of the proposed work and resources

Assumption: 1 ADA = 0.4 USD .

According to Indeed (https://www.indeed.com/career/software-engineer/salaries), the average base salary of a software engineer, excluding benefits is 22000 ADA per month. We estimate that we need 6 months to complete this project.

5 engineers for 6 months would cost, on average, 5 x 6 x 22000 ADA, which is equal to 660000 ADA. We are requesting only 200000 ADA, which is the maximum amount in the "Cardano Developers: Open" category. All requested funds will be used for technical R&amp;D tasks of the Djed Shu.

No dependencies.

We are fortunate to have the support of (though not a dependency on) Google and AOSSIE (the Australian Open Source Software Innovation and Education association) for this project through the Google Summer of Code program.

How does the cost of the project represent value for money for the Cardano ecosystem?

According to our estimates, based on average values by Indeed, we are going to complete this project for only 30% the cost that it would normally have.

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