Claim rewards
After payments have been done to a loan, all liquidity providers earn a share of the BTC rewards. This is how to complete withdrawal.

(define-public (withdraw-rewards
(btc-version (buff 1))
(btc-hash (buff 20))
(supplier-id uint)
(lp-token <lp-token>)
(token-id uint)
(lv <lv>)
(xbtc <ft>))

btc-version: Single byte representing the address type. 0x00 for P2PKH, 0x05 for P2SH
supplier-id: supplier-id of the chosen supplier on the bridge contract
lp-token: Contract principal using the lp-token-trait trait (current deployment is .lp-token).
token-id: token ID associated to the pool that we're withdrawing from
amount: the amount of that the user wants to

Copy link
On this page
1. Call the withdraw-rewards function to lock the funds in the Bridge contract (supplier-interface.clar)
2. The backend takes care of sending the Bitcoin to the address and finalizing the transaction.