Giter VIP home page Giter VIP logo

Comments (3)

Qaaj avatar Qaaj commented on June 14, 2024

I can pick this up - tagging for later

from synthetix.

Qaaj avatar Qaaj commented on June 14, 2024

Synth balance over time I have. Calculating Debt would be that person's locked SNX versus Total SNX locked and then see what % of the global debt he owns? I can dive in to the smart contracts later but some pointers would be great :)

from synthetix.

jjgonecrypto avatar jjgonecrypto commented on June 14, 2024

Well everyone has a Synthetix.debtBalanceOf which is their debt % multiplied by totalIssuedSynths: https://github.com/Synthetixio/synthetix/blob/v2.14.0/contracts/Synthetix.sol#L747-L775

So your % is your issuanceData[account].initialDebtOwnership - this only changes when you issue or burn, however the % claim you have changes with every other issue & burn - so that you have the same amount but a different % as the total size has expanded (via someone's mint) or contracted (via a burn).

However, your debtBalanceOf is totalSynths * (lastDebtEntry / your debt index entry value * your initial Debt ownership), eg:
- When User1 issues 100, ido = 1, deo = 0 (1) (ido = initial debt ownership, dei = debt entry index (value at that index))
- And User2 issues 25, ido = 0.25, Dei = 1 (1 - 25/100 = 0.75)
- Then User1 dbo = 125 * (0.75/1 * 1) = 93.75 (dbo = debt balance of)
- And User2 dbo = 125 * (0.75/0.75 * 0.25) = 31.25
- When User2 Issues 50, Ido = (50 + 31.25) / (125 + 50) = 0.464, Dei = 2 (0.75 * (1 - 50/175)) = 0.5357
- Then User1 duo = 175 * (0.5357/1*1) = 93.745
- And User2 dbo = 175 * (0.5356/0.5357 * 0.464) = 81.2

I hope that makes sense.

from synthetix.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.