Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hack Idea: Debt Tracker #320

Open
kaiynne opened this issue Nov 9, 2019 · 3 comments
Open

Hack Idea: Debt Tracker #320

kaiynne opened this issue Nov 9, 2019 · 3 comments

Comments

@kaiynne
Copy link
Contributor

kaiynne commented Nov 9, 2019

Build a dashboard to track the debt of a wallet over time vs the synth balance over time to see net performance of each wallet.

@Qaaj
Copy link

Qaaj commented Nov 19, 2019

I can pick this up - tagging for later

@Qaaj
Copy link

Qaaj commented Dec 4, 2019

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 :)

@jjgonecrypto
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants