Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Viacheslav Zhygulin authored and Viacheslav Zhygulin committed Jun 25, 2024
1 parent 6de2786 commit 78d9023
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 44 deletions.
20 changes: 0 additions & 20 deletions src/BTCDepositAddressDeriver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -60,26 +60,6 @@ contract BTCDepositAddressDeriver {
emit SeedChanged(_btcAddr1, _btcAddr2, _hrp);
}

// get address prefix from network type
//function getNetworkPrefix(
// uint8 _network
//) public pure returns (string memory) {

// string memory _hrp;

// if (_network == 0) {
// _hrp = 'tb';
// } else if (_network == 1) {
// _hrp = 'bc';
// } else if (_network == 2) {
// _hrp = 'brct';
// } else {
// _hrp = 'unknown';
// }

// return _hrp;
//}

// Derive pubkey's (x,y) coordinates from taproot address
function parseBTCTaprootAddress(
string memory _hrp,
Expand Down
2 changes: 1 addition & 1 deletion src/BitcoinNetworkEncoder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ library BitcoinNetworkEncoder {
bytes constant BTC_BECH32_MAINNET_BYTES = hex"626331"; // prefix = bc1
bytes constant BTC_BECH32_TESTNET_BYTES = hex"746231"; // prefix = tb1
bytes constant BTC_BECH32_REGTEST_BYTES = hex"6263727431"; // prefix = bcrt1

string constant BTC_BECH32_MAINNET = 'bc';
string constant BTC_BECH32_TESTNET = 'tb';
string constant BTC_BECH32_REGTEST = 'brct';
Expand Down
23 changes: 0 additions & 23 deletions src/BitcoinUtils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,6 @@ contract BitcoinUtils {
// P2SH type starting with the number 2, eg: 2MzQwSSnBHWHqSAqtTVQ6v47XtaisrJa1Vc
// Bech32 type starting with bcrt1, eg: bcrt1qw508d6qejxtdg4y5r3zarvary0c5xw7kxpjzsx

//NB: don't forget to update `lnbtc_ext.go` when changing this enum!
//enum Network {
// Mainnet,
// Testnet,
// Regtest
//}

string constant BECH32_ALPHABET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l";

function BECH32_ALPHABET_MAP(bytes1 char) public view returns (uint8) {
Expand Down Expand Up @@ -92,10 +85,6 @@ contract BitcoinUtils {
bytes constant BTC_P2PKH_REGTEST = hex"32"; // prefix = 2
bytes constant BTC_P2SH_REGTEST = hex"6d"; // prefix = m

//bytes constant BTC_BECH32_MAINNET = hex"626331"; // prefix = bc1
//bytes constant BTC_BECH32_REGTEST = hex"6263727431"; // prefix = bcrt1
//bytes constant BTC_BECH32_TESTNET = hex"746231"; // prefix = tb1

function getBtcBase58_P2PKH(BitcoinNetworkEncoder.Network network) public pure returns (bytes memory) {
if (network == BitcoinNetworkEncoder.Network.Mainnet) {
return BTC_P2PKH_MAINNET;
Expand All @@ -120,18 +109,6 @@ contract BitcoinUtils {
}
}

//function getBtcBech32Prefix(Network network) public pure returns (bytes memory) {
// if (network == Network.Mainnet) {
// return BTC_BECH32_MAINNET;
// } else if (network == Network.Regtest) {
// return BTC_BECH32_REGTEST;
// } else if (network == Network.Testnet) {
// return BTC_BECH32_TESTNET;
// } else {
// revert("Unknown network type");
// }
//}

function validateBitcoinAddress(
BitcoinNetworkEncoder.Network network,
string calldata BTCAddress
Expand Down

0 comments on commit 78d9023

Please sign in to comment.