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

BTC --> sBTC peg in, display minimum received #6070

Open
314159265359879 opened this issue Jan 17, 2025 · 4 comments
Open

BTC --> sBTC peg in, display minimum received #6070

314159265359879 opened this issue Jan 17, 2025 · 4 comments
Assignees
Labels
enhancement enhancement-p1 Critical functionality needed by many users, with no clear alternatives sbtc

Comments

@314159265359879
Copy link
Contributor

Currently when a user pegs in BTC for sBTC they do not see how much sBTC they can expect as a minimum. As they would see with swaps on an AMM
It would be better to show the minimum received to prevent surprise.

Mark said: This seems less like a problem of distinguishing swaps vs. bridges, and more like a problem of consistently guaranteeing a clear minimum received (so that the user isn't surprised by the ultimate dynamic costs involved
https://trustmachines.slack.com/archives/C05LRS7G44R/p1737112029207709?thread_ts=1737110238.019419&cid=C05LRS7G44R

Peg ins work with two transactions. The second transaction incurs a bitcoin networking fee that is variable and not known in advance. This will lower the amount of sBTC received in the wallet. The maximum fee incurred is 80000 sats. We should display this in the wallet as we do with swaps where the minimum received is coded in the contract call, if the prices changes more than expected for an AMM swap it fails. If the fee would be higher than 80000 sats the consolidation/peg is not completed and the user can reclaim their BTC to try again.

From app.stacks.co

There are two transaction fees required to mint your sBTC. The first is set by the user manually when they initiate the deposit transaction within their wallet.
The second is a fee used to consolidate the deposit UTXOs into the single signer UTXO. This separate transaction fee happens automatically and is set to a max of 80k sats. This is automatically deducted from your minted sBTC. This is not a signer fee but a regular Bitcoin transaction fee.

@314159265359879 314159265359879 added enhancement enhancement-p1 Critical functionality needed by many users, with no clear alternatives sbtc labels Jan 17, 2025
Copy link

linear bot commented Jan 17, 2025

@314159265359879
Copy link
Contributor Author

The current minimum peg in amount is 0.01 BTC, when this is lowered, users having the ability to setting lower max fees could be more important.

Talking about this with the sBTC devs it turns out that at the protocol level the user can always dictate the maximum fee for withdraws and deposits but it will depend on the bridge (or wallet) supporting such a feature (user setting a variable maximum fee).

This is not yet enabled on the current bridge. Right now the team has other priorities such as enabling withdraws, fixing bugs and integrating with more wallets.

In leather we could set the same default max fee, and then allow users to edit it, if/when it is supported by the library.

@314159265359879
Copy link
Contributor Author

Fara:
Reading back thru the thread, we can expose the default max fee to the user on our end. We pass a 80_000 default rn ...and I believe that default is also used in the lib directly. The lib exposes a maxSignerFee param we can change.

@314159265359879
Copy link
Contributor Author

Current regular swaps do not allow editing fees, so this would have to go through design first. Would be great if we can tackle both AMM swaps and sBTC peg ins at the same time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement enhancement-p1 Critical functionality needed by many users, with no clear alternatives sbtc
Projects
None yet
Development

No branches or pull requests

2 participants