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

Liquidated contracts on UI #57

Closed
easter-monolith opened this issue Aug 11, 2022 · 2 comments
Closed

Liquidated contracts on UI #57

easter-monolith opened this issue Aug 11, 2022 · 2 comments

Comments

@easter-monolith
Copy link
Collaborator

The problem:

The app needs to know about liquidated contracts, in order to show them on the UI as liquidated.

Different approaches:

  1. The app could detect which contracts are below the minimum ratio level and mark them as Liquidated. But if the contract was liquidated in the past, but now has a ratio above that limit, the app will show it as Critical or even Safe, and will have the Redeem and Topup buttons enabled, which is wrong.

  2. When the app gets each contract from local storage, cross reference its txid with available coins, and if the contract was not redeemed, it will mark it as liquidated if no coin is found. Theoretically I think this solution works, what do you think?

cc @miyo-fuji @FlyingMonkey0

@miyo-fuji
Copy link
Contributor

When the app gets each contract from local storage, cross reference its txid with available coins, and if the contract was not redeemed, it will mark it as liquidated if no coin is found.

for contract already in storage, App should check the txid:vout onchain and go look if is spent and WHAT scriptHex is passed in witness (last two elements of witness are control block and script hex)

@miyo-fuji
Copy link
Contributor

Watcher will also will also have the duty to notify frontends about this happening, but this logic of checking spent outpoint can be duplicated in frontend as extra check

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

No branches or pull requests

2 participants