MAYZ - Whitepaper V2
  • INTRODUCTION
    • What is MAYZ?
    • Why MAYZ?
    • How Does MAYZ Work?
      • Types of Members
      • Fund Creation Process
      • Escrow Service
    • Protocol Path
      • MVP
      • Release 1: Full Cardano
      • Release 2: Cross-Chain Goal
    • Token Types
      • MAYZ Utility & Governance Token
      • Fund Token
    • Tokenomics
      • Total Distribution
      • Vesting Schedule
  • MAYZ PROTOCOL
    • Technical Document
      • General Aspects
        • Mutual Funds
        • Liquidity Pools
      • Purpose of MAYZ Protocol
      • MAYZ Holders Community
      • Protocol Contract
        • Definition
        • Functioning
      • Fund Contract
        • Definition
        • Functioning
      • ADA/LP Swap Contract
        • Definition
        • Operation
      • Escrow Agreement
        • Definition
        • Operation
      • Investment Unit, LP and uLP Token
        • Definition
        • Decimals and fractions
        • Recommendations
        • ADA in the Investment Unit
        • Investment Unit, LP Token and uLP Token Value
      • Deposits in the Fund
      • Withdrawals from the Fund
      • Fund Re-Indexing
      • Commissions
        • Payment of Commissions
        • Charging Commissions
        • Recovering Fees
      • UTxOs of Deposits in the Fund
      • Oracle Contract
  • Cardano Fund
    • What is Cardano Fund?
      • Cardano Fund
      • Passive Investment Strategy
    • Why Cardano Fund?
      • Cardano Fund Vision
    • How Does the Cardano Fund Work?
      • Spects
      • Where to Start
  • MAYZ
    • Development Roadmap
    • Meet the Team
    • Funding Strategy
    • ISPO
    • Knowledge Base
      • Why Cardano?
      • What is a smart contract?
      • What is an Index?
      • What Is a Blockchain Oracle?
      • What is a Cross-Chain Bridge?
  • Links
    • Website
    • Twitter
    • Discord
    • Medium
  • BRAND KIT
Powered by GitBook
On this page
  1. MAYZ PROTOCOL
  2. Technical Document

Oracle Contract

//TODO: update//

To perform/validate the conversions between TOKENS, the Swap Contract, and the Fund Contract need to know the price of each Token in ADA. An Oracle will be used for this purpose.

A project wallet has permissions to mine an NFT (NFT ORACLE), create an UTxO at the contract address with that NFT and a DATUM (DATUM ORACLE) and consume that UTxO.

The DATUM contains a date and the price list on that date. The price list is a table of TOKEN / ADA pairs.

That DATUM remains INLINE in the UTxO in the contract and is accessible by reference in future transactions. When one of the contracts needs to validate conversions it will receive this DATUM and will verify that the NFT is present in that UTxO and that the date of the DATUM is not old (validity window).

When prices need to be updated that wallet is the only one that can consume the DATUM and create a new one with the updated values. This update must happen once per hour, to show on the site / front end an updated and on-demand price, before each transaction, with a validity window of 15 minutes.

If it is done 24 times a day, in cardan Fees will go about 0.5 ADA per transaction x 24 transactions = 12 ADA. Per month gives us: 12 * 31 = 372 ADA. That is our minimum value per month. But if there are many transactions, as the validity window is 15 minutes, we will have a maximum of 4 times per hour, per 24 hours = 4 * 24 * 0.5 = 48 ADA, which makes a month: 1488 ADA.

The oracle has two important points to take care of:

Price source:

A reliable source of prices. The community must consider those values as real.

That source must not be possible to alter and give us incorrect prices. This danger can be minimized if we have more than one price source and compare the prices that each one delivers. If they all agree, I can consider that price as valid.

A communication channel with that source that cannot be tampered with. If the channel is compromised it can cause us to store incorrect prices in our DATUM.

A first alternative is MinSwap BlockFrost Adapter (https://github.com/minswap/blockfrost-adapter).

Pricing sources to evaluate as an alternative:

Build our own "DEX Aggregator". Researching some of the most popular DEXs most of them have an API:

MinSwap: https://api-mainnet-prod.minswap.org/coinmarketcap/v2/pairs or the MinSwap BlockFrost Adapter. Source: https://forum.minswap.org/t/minswap-api-for-developers/738/3

MuesliSwap: https://docs.muesliswap.com/cardano/api/api-v1 and also https://twitter.com/cardanostra/status/1488522351985799173

SundaeSwap: https://stats.sundaeswap.finance/api/ example: curl --request GET --url https://stats.sundaeswap.finance/api/ticks/0029cb7c88c7567b63d1a512c0ed626aa169688ec980730c0473b913.70202d01/2022/09/02

WingRiders does not seem to have this service yet.

We would then have to create a service that pulls all that info from the different APIs, performs an aggregation to weight the price and post it on the blockchain as an inline datum according to what I commented in the previous point.

PreviousUTxOs of Deposits in the FundNextWhat is Cardano Fund?

Last updated 2 years ago