Skip to content

Commit e0dad16

Browse files
authored
Merge pull request #341 from rsksmart/feature/GBI-2805
feature/GBI-2805 - RSKIP-305 support
2 parents 782aaaf + d9a0634 commit e0dad16

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

contracts/LiquidityBridgeContractV2.sol

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import "./Bridge.sol";
66
import "./QuotesV2.sol";
77
import "./SignatureValidator.sol";
88
import "@rsksmart/btc-transaction-solidity-helper/contracts/BtcUtils.sol";
9+
import "@rsksmart/btc-transaction-solidity-helper/contracts/OpCodes.sol";
910
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
1011
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
1112

@@ -35,6 +36,7 @@ contract LiquidityBridgeContractV2 is Initializable, OwnableUpgradeable, Reentra
3536
uint constant public QUOTE_HASH_OUTPUT = 1;
3637
uint constant public SAT_TO_WEI_CONVERSION = 10**10;
3738

39+
3840
struct Registry {
3941
uint32 timestamp;
4042
bool success;
@@ -766,13 +768,16 @@ contract LiquidityBridgeContractV2 is Initializable, OwnableUpgradeable, Reentra
766768
quote.liquidityProviderBtcAddress
767769
)
768770
);
771+
bytes1 OP_DROP = 0x75;
772+
bytes1 OP_PUSHBYTES_32 = 0x20;
769773
bytes memory flyoverRedeemScript = bytes.concat(
770-
hex"20",
774+
OP_PUSHBYTES_32,
771775
derivationValue,
772-
hex"75",
776+
OP_DROP,
773777
bridge.getActivePowpegRedeemScript()
774778
);
775-
return BtcUtils.validateP2SHAdress(depositAddress, flyoverRedeemScript, mainnet);
779+
bytes memory segwitScript = bytes.concat(OpCodes.OP_0, OP_PUSHBYTES_32, sha256(flyoverRedeemScript));
780+
return BtcUtils.validateP2SHAdress(depositAddress, segwitScript, mainnet);
776781
}
777782

778783
/**

test/pegin.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ describe("LiquidityBridgeContractV2 pegin process should", () => {
547547
productFeeAmount: BigInt("6000000000000000"),
548548
gasFee: BigInt("3000000000000000"),
549549
},
550-
address: "2NAXHKYRnTme4oDCk9mSPfdf4ga2tZ1xM5B",
550+
address: "2MxoZvDm7QeVmKDjFumt7esg5ZH91Mc8aBE",
551551
},
552552
{
553553
quote: {
@@ -579,7 +579,7 @@ describe("LiquidityBridgeContractV2 pegin process should", () => {
579579
productFeeAmount: BigInt("7000000000000000"),
580580
gasFee: BigInt("4000000000000000"),
581581
},
582-
address: "2NCDJzPze5eosHN5Tx4pf5GF2zXtaKDUHzX",
582+
address: "2N6Tr7iYL3QrE31ZBnY1VRZRdjYoYhBuTfU",
583583
},
584584
{
585585
quote: {
@@ -611,7 +611,7 @@ describe("LiquidityBridgeContractV2 pegin process should", () => {
611611
productFeeAmount: BigInt("8000000000000000"),
612612
gasFee: BigInt("5000000000000000"),
613613
},
614-
address: "2N7rxjtHjbxr8W3U3HVncyHJhEhBQ3tBa9w",
614+
address: "2N3q4cy9k3y8srvJaW8HFT4125r1KQjfuj2",
615615
},
616616
];
617617

0 commit comments

Comments
 (0)