-
Notifications
You must be signed in to change notification settings - Fork 38
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
Implement redemptions with a proxy for redemption integrations #814
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nkuba
added a commit
to thesis/acre
that referenced
this pull request
Jun 7, 2024
This branch expects two dependencies changes that are not yet merged: - @keep-network/tbtc-v2.ts: keep-network/tbtc-v2#814 - @orangekit/sdk: mezo-org/passport#83
nkuba
added a commit
to thesis/acre
that referenced
this pull request
Jun 7, 2024
This branch expects two dependencies changes that are not yet merged: - @keep-network/tbtc-v2.ts: keep-network/tbtc-v2#814 - @orangekit/sdk: mezo-org/passport#83
nkuba
added a commit
to thesis/acre
that referenced
this pull request
Jun 7, 2024
This branch expects two dependencies changes that are not yet merged: - @keep-network/tbtc-v2.ts: keep-network/tbtc-v2#814 - @orangekit/sdk: mezo-org/passport#83
This was referenced Jun 10, 2024
nkuba
changed the title
Expose function to build redemption data
Implement redemptions with a proxy for redemption integrations
Jun 11, 2024
lukasz-zimnoch
approved these changes
Jun 11, 2024
In this PR we expose a function to build redemption data in the raw bytes format as expected by the tBTC Bridge. This function can be used by the custom integrator contracts to build the redemption data required to request tBTC redemption. Example of the integrator is Acre's [BitcoinRedeemer contract](https://github.com/thesis/acre/blob/main/solidity/contracts/BitcoinRedeemer.sol) that requires the redemption data to handle stBTC -> tBTC -> Bitcoin conversion in one transaction.
This commit introduces a new redemption flow that uses a proxy implementation to request the redemption of tBTC. It gives flexibility to the external integrators to use the redemption data required by the tBTC protocol to request the redemption of tBTC in their contracts. It can also be used to relay the transaction submission with external relayer (e.g. Gelato).
The function was unintentionally changed to public in the previous commit. Here we revert the change back.
Added tests to cover requestRedemptionWithProxy function in redemptions service. Extracted common setup to a function shared by two tests.
nkuba
force-pushed
the
expose-redemption-data-build
branch
from
June 11, 2024 14:50
ebc76fb
to
548332d
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In this PR we introduce a RedeemerProxy interface that can be used by integrators to route tBTC redemption through the tBTC Bridge.
An example of the integrator is Acre's BitcoinRedeemer contract that requires the redemption data to handle stBTC -> tBTC -> Bitcoin conversion in one transaction.
When redeeming tBTC the challenge is to assemble redemption data to contain valid wallet UTXO and other data in the format expected by the Bridge.
It is expected that the integrator will implement
RedeemerProxy
interface by exposing two functions:redeemerAddress(): ChainIdentifier
- that will return the Ethereum address to which the tBTC balance will be assigned in case of problems with redemption,requestRedemption(redemptionData: Hex): Promise<Hex>
- a callback function that will be called with assembledredemptionData
to proceed with a custom integrator's logic.The integrator should use the
requestRedemptionWithProxy
function to execute the redemption.