Skip to content

Commit

Permalink
updated registry contract & refactored tests
Browse files Browse the repository at this point in the history
  • Loading branch information
setzeus committed Nov 7, 2024
1 parent 873329b commit 3b09578
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion contracts/contracts/sbtc-deposit.clar
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
(try! (contract-call? .sbtc-token protocol-mint amount recipient))

;; Complete the deposit
(ok (contract-call? .sbtc-registry complete-deposit txid vout-index amount recipient burn-hash burn-height))
(ok (contract-call? .sbtc-registry complete-deposit txid vout-index amount recipient burn-hash burn-height sweep-txid))
)
)

Expand Down
4 changes: 4 additions & 0 deletions contracts/contracts/sbtc-registry.clar
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@
(fee uint)
(burn-hash (buff 32))
(burn-height uint)
(sweep-txid (buff 32))
)
(begin
(try! (is-protocol-caller))
Expand All @@ -186,6 +187,7 @@
fee: fee,
burn-hash: burn-hash,
burn-height: burn-height,
sweep-txid: sweep-txid,
})
(ok true)
)
Expand Down Expand Up @@ -229,6 +231,7 @@
(recipient principal)
(burn-hash (buff 32))
(burn-height uint)
(sweep-txid (buff 32))
)
(begin
(try! (is-protocol-caller))
Expand All @@ -243,6 +246,7 @@
amount: amount,
burn-hash: burn-hash,
burn-height: burn-height,
sweep-txid: sweep-txid,
})
(ok true)
)
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/sbtc-withdrawal.clar
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@
)

;; Call into registry to confirm accepted withdrawal
(try! (contract-call? .sbtc-registry complete-withdrawal-accept request-id bitcoin-txid output-index signer-bitmap fee burn-hash burn-height))
(try! (contract-call? .sbtc-registry complete-withdrawal-accept request-id bitcoin-txid output-index signer-bitmap fee burn-hash burn-height sweep-txid))

(ok true)
)
Expand Down
1 change: 1 addition & 0 deletions contracts/tests/sbtc-deposit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ describe("sBTC deposit contract", () => {
amount: 1000n,
burnHash,
burnHeight: BigInt(burnHeight),
sweepTxid: new Uint8Array(32).fill(1),
});
});

Expand Down
6 changes: 4 additions & 2 deletions contracts/tests/sbtc-token.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe("sBTC token contract", () => {
recipient: alice,
burnHash,
burnHeight,
sweepTxid: new Uint8Array(32).fill(0),
sweepTxid: new Uint8Array(32).fill(1),
}),
deployer
);
Expand All @@ -37,6 +37,7 @@ describe("sBTC token contract", () => {
amount: 1000n,
burnHash,
burnHeight: BigInt(burnHeight),
sweepTxid: new Uint8Array(32).fill(1),
});
const receipt1 = rov(
token.getBalance({
Expand Down Expand Up @@ -78,7 +79,8 @@ describe("sBTC token contract", () => {
outputIndex: 0n,
amount: 1000n,
burnHash,
burnHeight: BigInt(burnHeight)
burnHeight: BigInt(burnHeight),
sweepTxid: new Uint8Array(32).fill(1),
});
const receipt1 = txOk(
token.transfer({
Expand Down
1 change: 1 addition & 0 deletions contracts/tests/sbtc-withdrawal.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@ describe("Accepting a withdrawal request", () => {
fee: defaultMaxFee + 10n,
burnHash,
burnHeight: BigInt(burnHeight),
sweepTxid: new Uint8Array(32).fill(1),
});
});
test("accept withdrawal sets withdrawal-status to true", () => {
Expand Down

0 comments on commit 3b09578

Please sign in to comment.