Skip to content
This repository has been archived by the owner on May 28, 2021. It is now read-only.

Pre-Collateralization #1405

Closed
kilrau opened this issue Aug 27, 2020 · 1 comment · Fixed by #1406
Closed

Pre-Collateralization #1405

kilrau opened this issue Aug 27, 2020 · 1 comment · Fixed by #1406
Labels
Enhancement New feature or request p1 Bugs/Tests/Blockers Bugs that break things but no loss of funds + Test improvements + PRIORITY blockers for customers.

Comments

@kilrau
Copy link

kilrau commented Aug 27, 2020

Is your feature request related to a problem? Please describe.
Mainnet usage has shown, that "on-the-fly" collateralization is not a great long-term approach since it relies on getting a transaction into the next block. Not only is accurate gas estimation for the next block difficult, but also very expensive. In practice we are experiencing confirmation times of several minutes and timeouts as a result. Further, we'd need to be able to set the desired amount for the collateralization since the current default of e.g. 20 USDT triggers a live collateralization (and hence a swap timeout) for all trades of greater 20 USDT

Describe the solution you'd like
We think pre-collateralizing a channel with an estimated amount is the better way. Since the indra node doesn't know anything about trades/estimated amounts as of now, we think it makes sense for the client to provide this information and pass it in the collateralization request.

  • add amount field collateralization call ( export type PostRequestCollateralRequestParams = MultiClientRequestParams & { assetId: string };), this allows xud to request collateral for the required amount via the client before/when an order is entering the order book based on the order amount
  • to avoid draining node funds, we would need to be able to set a fixed upper limit per currency per client for the collateralization in the node
  • the client would need to get notified with the collateralization tx hash from the node the same way currently deposits do, collateralization status or simply the remote balance needs to be exposed via the rest-api
@kilrau kilrau added the Needs Triage Needs to be looked at and prioritized. label Aug 27, 2020
@rhlsthrm rhlsthrm added Enhancement New feature or request p1 Bugs/Tests/Blockers Bugs that break things but no loss of funds + Test improvements + PRIORITY blockers for customers. and removed Needs Triage Needs to be looked at and prioritized. labels Aug 27, 2020
@ArjunBhuptani
Copy link
Member

Updating based on our discussion:

Request collateral and collateralization profiles already largely cover the needs here. All we need to do is:

  1. Expose collateral profile setup via config
  2. Allow passing in an amount to requestCollateral. If an amount is passed in, collateralize up to amount so long as currBal + amount <= upperBound

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Enhancement New feature or request p1 Bugs/Tests/Blockers Bugs that break things but no loss of funds + Test improvements + PRIORITY blockers for customers.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants