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

Add vaults to squid #51

Open
nud3l opened this issue Jan 10, 2023 · 11 comments
Open

Add vaults to squid #51

nud3l opened this issue Jan 10, 2023 · 11 comments
Labels
enhancement New feature or request prio:medium

Comments

@nud3l
Copy link
Member

nud3l commented Jan 10, 2023

Goal

Add a vaults endpoint where we can the data available at https://app.interlay.io/dashboard/vaults

Implementation

Vaults have:

  • AccountId
  • Identity
  • Locked collateral (updated on registration, deposit and withdraw collateral)
  • Locked BTC (added by Jacob lmk if this is not needed)
  • Pending BTC
  • Collateralization (based on current collateral and exchange rate)
  • Status issuing (enabled disabled)
  • Status collateral (see https://docs.interlay.io/#/vault/overview?id=collateral-thresholds)

Replaces

image

@nud3l nud3l added enhancement New feature or request prio:medium labels Jan 10, 2023
@jtfirek jtfirek self-assigned this Jan 24, 2023
@jtfirek
Copy link
Contributor

jtfirek commented Jan 24, 2023

Would you like me to add onto the existing vault object in squid or is should this be an entirely new object?

type Vault @entity {
id: ID!
accountId: String! @index
collateralToken: Currency!
wrappedToken: Currency!
registrationBlock: Height!
registrationTimestamp: DateTime!
lastActivity: Height
}

If adding to this existing is this what you are looking for?

type Vault @entity {
    id: ID!
    accountId: String! @index
    collateralToken: Currency!
    collateralAmount: BigInt!
    wrappedToken: Currency!
    pendingBtcAmount: BigInt!
    collateralization: String!
    statusIssuing: Bool!
    statusCollateral: Bool!
    registrationBlock: Height!
    registrationTimestamp: DateTime!
    lastActivity: Height
}

@nud3l
Copy link
Member Author

nud3l commented Jan 26, 2023

Adding it to the existing vault object is the right approach. Thank you!

@jtfirek
Copy link
Contributor

jtfirek commented Jan 26, 2023

Sounds good!

@jtfirek
Copy link
Contributor

jtfirek commented Feb 9, 2023

@nud3l The locked collateral in the dashboard displays the collateral as DOT. Is the collateral in the multi-collateral system all converted to DOT equivalent value for displaying here?

@nud3l
Copy link
Member Author

nud3l commented Feb 11, 2023

No, there are individual dashboards for each collateral asset. The DOT is just due to Interlay only having DOT as collateral right now. See Kintsugi as an example: https://kintsugi.interlay.io/dashboard/vaults

There's then a summary dashboard that converts all collateral assets to USD but that would be an add on and I'd consider it out of scope for this PR.

@jtfirek
Copy link
Contributor

jtfirek commented Feb 11, 2023

Ok thanks that clears up all my confusion.

@jtfirek
Copy link
Contributor

jtfirek commented Feb 11, 2023

Looks like the proposed goal does not included locked btc amount just the a pending btc amount. I feel that we need locked btc to calculation the collateratlization:
collateralization = colleratalAmount (converted to btc value) / locked btc
I have added this to the schema, but lmk if this is not needed/wanted.

@nud3l
Copy link
Member Author

nud3l commented Feb 13, 2023

great catch, I forgot to add it.

@jtfirek
Copy link
Contributor

jtfirek commented Mar 7, 2023

@nud3l For the status issuing, Is this referring to
status | VaultStatus | Current status of the vault (Active, Liquidated, CommittedTheft)
from the iBTC spec?

@nud3l
Copy link
Member Author

nud3l commented Mar 7, 2023

Almost:

StatusIssuing - Active or Inactive (just that part basically: https://github.com/interlay/interbtc/blob/master/crates/vault-registry/src/types.rs#L132)

StatusCollateral - AboveSecureThreshold, BelowSecureThreshold, BelowPremiumRedeemThreshold, Liquidated. The parachain just tracks if a vault is liquidated but the UI/frontend would also track if a vault is above or below certain collateral thresholds as determined by the ones here: https://docs.interlay.io/#/vault/overview?id=collateral-thresholds

@jtfirek
Copy link
Contributor

jtfirek commented Mar 7, 2023

Ok I see Active is a bool within the VaultStatus struct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request prio:medium
Projects
Status: Todo
Development

No branches or pull requests

2 participants