From d93a4968483450056a79203181160e71a6440d49 Mon Sep 17 00:00:00 2001 From: dpiatkivskyi Date: Wed, 26 Jun 2024 13:59:05 +0300 Subject: [PATCH] removes Bech32m --- src/BTCDepositAddressDeriver.sol | 20 +++++++++----------- src/Bech32m.sol | 5 +---- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/BTCDepositAddressDeriver.sol b/src/BTCDepositAddressDeriver.sol index 3d8c24a..439026a 100644 --- a/src/BTCDepositAddressDeriver.sol +++ b/src/BTCDepositAddressDeriver.sol @@ -2,8 +2,6 @@ pragma solidity ^0.8.24; -import {Bech32m} from "./Bech32m.sol"; - contract BTCDepositAddressDeriver { event SeedChanged(string btcAddr1, string btcAddr2, string hrp); @@ -37,8 +35,8 @@ contract BTCDepositAddressDeriver { networkHrp = _hrp; - (p1x, p1y) = parseBTCTaprootAddress(_hrp, _btcAddr1); - (p2x, p2y) = parseBTCTaprootAddress(_hrp, _btcAddr2); + (p1x, p1y) = parseBTCTaprootAddress(); + (p2x, p2y) = parseBTCTaprootAddress(); btcAddr1 = _btcAddr1; btcAddr2 = _btcAddr2; @@ -68,14 +66,14 @@ contract BTCDepositAddressDeriver { } // Derive pubkey's (x,y) coordinates from taproot address - function parseBTCTaprootAddress( - string memory _hrp, - string calldata _bitcoinAddress - ) public pure returns (uint256, uint256) { + function parseBTCTaprootAddress() public pure returns (uint256, uint256) { + + uint256 witVer = decodeSegwitAddress(); - uint8 witVer = Bech32m - .decodeSegwitAddress(bytes(_hrp), bytes(_bitcoinAddress)); + return (witVer, witVer); + } - return (0, 0); + function decodeSegwitAddress() public pure returns (uint256) { + return 1; } } diff --git a/src/Bech32m.sol b/src/Bech32m.sol index 498b585..7fe1a5f 100644 --- a/src/Bech32m.sol +++ b/src/Bech32m.sol @@ -10,10 +10,7 @@ error EncodingIsUnknown(); library Bech32m { // Decode a segwit address - function decodeSegwitAddress( - bytes calldata expectedHrp, - bytes calldata addr - ) public pure returns (uint8) { + function decodeSegwitAddress() public pure returns (uint256) { return 1; } }