mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 23:18:17 +01:00
Replace SQU with BSQ
This commit is contained in:
parent
f5d05f0940
commit
134b0a1220
16 changed files with 47 additions and 47 deletions
|
@ -122,22 +122,22 @@ public class BtcWalletService extends WalletService {
|
|||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Add fee input to prepared SQU send tx
|
||||
// Add fee input to prepared BSQ send tx
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
public Transaction completePreparedSendSquTx(Transaction preparedSquTx, boolean isSendTx) throws
|
||||
TransactionVerificationException, WalletException, InsufficientFundsException, InsufficientMoneyException {
|
||||
// preparedSquTx has following structure:
|
||||
// inputs [1-n] SQU inputs
|
||||
// outputs [0-1] SQU receivers output
|
||||
// outputs [0-1] SQU change output
|
||||
// inputs [1-n] BSQ inputs
|
||||
// outputs [0-1] BSQ receivers output
|
||||
// outputs [0-1] BSQ change output
|
||||
|
||||
// We add BTC mining fee. Result tx looks like:
|
||||
// inputs [1-n] SQU inputs
|
||||
// inputs [1-n] BSQ inputs
|
||||
// inputs [1-n] BTC inputs
|
||||
// outputs [0-1] SQU receivers output
|
||||
// outputs [0-1] SQU change output
|
||||
// outputs [0-1] BSQ receivers output
|
||||
// outputs [0-1] BSQ change output
|
||||
// outputs [0-1] BTC change output
|
||||
// mining fee: BTC mining fee
|
||||
return completePreparedSquTx(preparedSquTx, isSendTx, null);
|
||||
|
@ -147,21 +147,21 @@ public class BtcWalletService extends WalletService {
|
|||
TransactionVerificationException, WalletException, InsufficientFundsException, InsufficientMoneyException {
|
||||
|
||||
// preparedSquTx has following structure:
|
||||
// inputs [1-n] SQU inputs
|
||||
// outputs [0-1] SQU receivers output
|
||||
// outputs [0-1] SQU change output
|
||||
// mining fee: optional burned SQU fee (only if opReturnData != null)
|
||||
// inputs [1-n] BSQ inputs
|
||||
// outputs [0-1] BSQ receivers output
|
||||
// outputs [0-1] BSQ change output
|
||||
// mining fee: optional burned BSQ fee (only if opReturnData != null)
|
||||
|
||||
// We add BTC mining fee. Result tx looks like:
|
||||
// inputs [1-n] SQU inputs
|
||||
// inputs [1-n] BSQ inputs
|
||||
// inputs [1-n] BTC inputs
|
||||
// outputs [0-1] SQU receivers output
|
||||
// outputs [0-1] SQU change output
|
||||
// outputs [0-1] BSQ receivers output
|
||||
// outputs [0-1] BSQ change output
|
||||
// outputs [0-1] BTC change output
|
||||
// outputs [0-1] OP_RETURN with opReturnData (only if opReturnData != null)
|
||||
// mining fee: BTC mining fee + optional burned SQU fee (only if opReturnData != null)
|
||||
// mining fee: BTC mining fee + optional burned BSQ fee (only if opReturnData != null)
|
||||
|
||||
// In case of txs for burned SQU fees we have no receiver output and it might be that there is no change outputs
|
||||
// In case of txs for burned BSQ fees we have no receiver output and it might be that there is no change outputs
|
||||
// We need to guarantee that min. 1 valid output is added (OP_RETURN does not count). So we use a higher input
|
||||
// for BTC to force an additional change output.
|
||||
|
||||
|
@ -208,7 +208,7 @@ public class BtcWalletService extends WalletService {
|
|||
Wallet.SendRequest sendRequest = Wallet.SendRequest.forTx(tx);
|
||||
sendRequest.shuffleOutputs = false;
|
||||
sendRequest.aesKey = aesKey;
|
||||
// signInputs needs to be false as it would try to sign all inputs (SQU inputs are not in this wallet)
|
||||
// signInputs needs to be false as it would try to sign all inputs (BSQ inputs are not in this wallet)
|
||||
sendRequest.signInputs = false;
|
||||
sendRequest.ensureMinRequiredFee = false;
|
||||
sendRequest.feePerKb = Coin.ZERO;
|
||||
|
|
|
@ -33,7 +33,7 @@ class SquDeterministicKeyChain extends DeterministicKeyChain {
|
|||
|
||||
// See https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki
|
||||
// https://github.com/satoshilabs/slips/blob/master/slip-0044.md
|
||||
// We use 139 (0x80000000) as coin_type for SQU
|
||||
// We use 139 (0x80000000) as coin_type for BSQ
|
||||
// TODO register once the token name is fix
|
||||
public static final ImmutableList<ChildNumber> BIP44_SQU_ACCOUNT_PATH = ImmutableList.of(
|
||||
new ChildNumber(44, true),
|
||||
|
|
|
@ -185,7 +185,7 @@ public class SquWalletService extends WalletService {
|
|||
|
||||
checkWalletConsistency();
|
||||
verifyTransaction(tx);
|
||||
// printTx("SQU wallet: Signed Tx", tx);
|
||||
// printTx("BSQ wallet: Signed Tx", tx);
|
||||
return tx;
|
||||
}
|
||||
|
||||
|
@ -196,7 +196,7 @@ public class SquWalletService extends WalletService {
|
|||
|
||||
public void commitTx(Transaction tx) {
|
||||
wallet.commitTx(tx);
|
||||
//printTx("SQU commit Tx", tx);
|
||||
//printTx("BSQ commit Tx", tx);
|
||||
}
|
||||
|
||||
|
||||
|
@ -206,12 +206,12 @@ public class SquWalletService extends WalletService {
|
|||
|
||||
public void broadcastTx(Transaction tx, FutureCallback<Transaction> callback) throws WalletException, TransactionVerificationException {
|
||||
Futures.addCallback(walletsSetup.getPeerGroup().broadcastTransaction(tx).future(), callback);
|
||||
printTx("SQU broadcast Tx", tx);
|
||||
printTx("BSQ broadcast Tx", tx);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Send SQU with BTC fee
|
||||
// Send BSQ with BTC fee
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public Transaction getPreparedSendTx(String receiverAddress,
|
||||
|
|
|
@ -380,7 +380,7 @@ public class WalletConfig extends AbstractIdleService {
|
|||
keyChainGroup = new BitsquareKeyChainGroup(params, true, btcWalletLookaheadSize);
|
||||
vBtcWallet = createOrLoadWallet(vBtcWalletFile, shouldReplayWallet, seed, keyChainGroup, false);
|
||||
|
||||
// SQU walelt
|
||||
// BSQ walelt
|
||||
vSquWalletFile = new File(directory, squWalletFilePrefix + ".wallet");
|
||||
if (seed != null)
|
||||
keyChainGroup = new BitsquareKeyChainGroup(params, new SquDeterministicKeyChain(seed), false, squWalletLookaheadSize);
|
||||
|
|
|
@ -68,7 +68,7 @@ public class WalletsManager {
|
|||
public String getWalletsAsString(boolean includePrivKeys) {
|
||||
return "BTC Wallet:\n" +
|
||||
btcWalletService.getWalletAsString(includePrivKeys) +
|
||||
"\n\nSQU Wallet:\n" +
|
||||
"\n\nBSQ Wallet:\n" +
|
||||
squWalletService.getWalletAsString(includePrivKeys);
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ public class WalletsSetup {
|
|||
private Wallet btcWallet;
|
||||
private Wallet squWallet;
|
||||
private final String walletFileName = "Bitsquare";
|
||||
private final String tokenWalletFileName = "SQU";
|
||||
private final String tokenWalletFileName = "BSQ";
|
||||
private final Long bloomFilterTweak;
|
||||
private KeyParameter aesKey;
|
||||
private final Storage<Long> storage;
|
||||
|
@ -244,7 +244,7 @@ public class WalletsSetup {
|
|||
// the threshold. To avoid reaching the threshold we create much more keys which are unlikely to cause update of the
|
||||
// filter for most users. With lookaheadSize of 500 we get 1333 keys (500*1.3=666 666 external and 666 internal keys) which should be enough for most users to
|
||||
// never need to update a bloom filter, which would weaken privacy.
|
||||
// As we use 2 wallets (BTC, SQU) we generate 1333 + 266 keys in total.
|
||||
// As we use 2 wallets (BTC, BSQ) we generate 1333 + 266 keys in total.
|
||||
walletConfig.setBtcWalletLookaheadSize(500);
|
||||
walletConfig.setSquWalletLookaheadSize(100);
|
||||
|
||||
|
|
|
@ -153,7 +153,7 @@ abstract public class SquBlockchainService {
|
|||
connectedTxs.add(transaction);
|
||||
}
|
||||
|
||||
// Now we check if our connected txs are valid SQU transactions
|
||||
// Now we check if our connected txs are valid BSQ transactions
|
||||
for (SquTransaction transaction : connectedTxs) {
|
||||
verifyTransaction(transaction, blockHeight, utxoByTxIdMap);
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ abstract public class SquBlockchainService {
|
|||
SquTxOutput squOutput = outputs.get(i);
|
||||
List<String> addresses = squOutput.addresses;
|
||||
// Only at raw MS outputs addresses have more then 1 entry
|
||||
// We do not support raw MS for SQU
|
||||
// We do not support raw MS for BSQ
|
||||
if (addresses.size() == 1) {
|
||||
String address = addresses.get(0);
|
||||
availableValue = availableValue.subtract(squOutput.value);
|
||||
|
@ -225,7 +225,7 @@ abstract public class SquBlockchainService {
|
|||
address);
|
||||
utxoByIndexMap.put(i, utxo);
|
||||
} else {
|
||||
log.warn("We tried to spend more SQU as we have in our inputs");
|
||||
log.warn("We tried to spend more BSQ as we have in our inputs");
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
|
@ -235,7 +235,7 @@ abstract public class SquBlockchainService {
|
|||
|
||||
//TODO write that warning to a handler
|
||||
if (availableValue.isPositive()) {
|
||||
log.warn("SQU have been left which was not spent. Burned SQU amount={}, tx={}",
|
||||
log.warn("BSQ have been left which was not spent. Burned BSQ amount={}, tx={}",
|
||||
availableValue.value,
|
||||
squTransaction.toString());
|
||||
}
|
||||
|
@ -252,13 +252,13 @@ abstract public class SquBlockchainService {
|
|||
String txId = squTransaction.txId;
|
||||
List<SquTxOutput> outputs = squTransaction.outputs;
|
||||
|
||||
// Genesis tx uses all outputs as SQU outputs
|
||||
// Genesis tx uses all outputs as BSQ outputs
|
||||
Map<Integer, SquUTXO> utxoByIndexMap = new HashMap<>();
|
||||
for (int i = 0; i < outputs.size(); i++) {
|
||||
SquTxOutput output = outputs.get(i);
|
||||
List<String> addresses = output.addresses;
|
||||
// Only at raw MS outputs addresses have more then 1 entry
|
||||
// We do not support raw MS for SQU
|
||||
// We do not support raw MS for BSQ
|
||||
if (addresses.size() == 1) {
|
||||
String address = addresses.get(0);
|
||||
//TODO set coinbase to true after testing
|
||||
|
|
|
@ -41,10 +41,10 @@ public final class VoteItemsList extends ArrayList<VoteItem> implements Persista
|
|||
public VoteItemsList(VotingDefaultValues votingDefaultValues) {
|
||||
add(new VoteItem(CREATE_OFFER_FEE_IN_BTC, "Create offer fee (in BTC Satoshi)", votingDefaultValues));
|
||||
add(new VoteItem(TAKE_OFFER_FEE_IN_BTC, "Take offer fee (in BTC Satoshi)", votingDefaultValues));
|
||||
add(new VoteItem(CREATE_OFFER_FEE_IN_SQU, "Create offer fee (in SQU)", votingDefaultValues));
|
||||
add(new VoteItem(TAKE_OFFER_FEE_IN_SQU, "Take offer fee (in SQU)", votingDefaultValues));
|
||||
add(new VoteItem(CREATE_COMPENSATION_REQUEST_FEE_IN_SQU, "Compensation request fee (in SQU)", votingDefaultValues));
|
||||
add(new VoteItem(VOTING_FEE_IN_SQU, "Voting fee (in SQU)", votingDefaultValues));
|
||||
add(new VoteItem(CREATE_OFFER_FEE_IN_SQU, "Create offer fee (in BSQ)", votingDefaultValues));
|
||||
add(new VoteItem(TAKE_OFFER_FEE_IN_SQU, "Take offer fee (in BSQ)", votingDefaultValues));
|
||||
add(new VoteItem(CREATE_COMPENSATION_REQUEST_FEE_IN_SQU, "Compensation request fee (in BSQ)", votingDefaultValues));
|
||||
add(new VoteItem(VOTING_FEE_IN_SQU, "Voting fee (in BSQ)", votingDefaultValues));
|
||||
|
||||
add(new VoteItem(COMPENSATION_REQUEST_PERIOD_IN_BLOCKS, "Compensation request period (in blocks)", votingDefaultValues));
|
||||
add(new VoteItem(VOTING_PERIOD_IN_BLOCKS, "Voting period (in blocks)", votingDefaultValues));
|
||||
|
@ -57,7 +57,7 @@ public final class VoteItemsList extends ArrayList<VoteItem> implements Persista
|
|||
add(new VoteItem(MIN_BTC_AMOUNT_COMPENSATION_REQUEST, "Min. amount for compensation request (in BTC)", votingDefaultValues));
|
||||
add(new VoteItem(MAX_BTC_AMOUNT_COMPENSATION_REQUEST, "Max. amount for compensation request (in BTC)", votingDefaultValues));
|
||||
|
||||
add(new VoteItem(CONVERSION_RATE, "SQU/BTC conversion rate", votingDefaultValues));
|
||||
add(new VoteItem(CONVERSION_RATE, "BSQ/BTC conversion rate", votingDefaultValues));
|
||||
|
||||
compensationRequest = new CompensationRequestVoteItemCollection(COMP_REQUEST_MAPS);
|
||||
add(compensationRequest);
|
||||
|
|
|
@ -40,7 +40,7 @@ public enum VotingType {
|
|||
|
||||
COMP_REQUEST_MAPS((byte) 0x50);
|
||||
|
||||
// TODO max growth rate of SQU
|
||||
// TODO max growth rate of BSQ
|
||||
|
||||
public final Byte code;
|
||||
|
||||
|
|
|
@ -204,7 +204,7 @@ public class BitsquareApp extends Application {
|
|||
} else if (new KeyCodeCombination(KeyCode.E, KeyCombination.SHORTCUT_DOWN).match(keyEvent) || new KeyCodeCombination(KeyCode.E, KeyCombination.CONTROL_DOWN).match(keyEvent)) {
|
||||
showEmptyWalletPopup(injector.getInstance(BtcWalletService.class));
|
||||
} else if (DevFlags.DEV_MODE && new KeyCodeCombination(KeyCode.B, KeyCombination.SHORTCUT_DOWN).match(keyEvent) || new KeyCodeCombination(KeyCode.E, KeyCombination.CONTROL_DOWN).match(keyEvent)) {
|
||||
// SQU empty wallet not public yet
|
||||
// BSQ empty wallet not public yet
|
||||
showEmptyWalletPopup(injector.getInstance(SquWalletService.class));
|
||||
} else if (new KeyCodeCombination(KeyCode.M, KeyCombination.ALT_DOWN).match(keyEvent)) {
|
||||
showSendAlertMessagePopup();
|
||||
|
|
|
@ -106,7 +106,7 @@ public class SeedWordsView extends ActivatableView<GridPane, Void> {
|
|||
addTitledGroupBg(root, ++gridRow, 1, "Information", Layout.GROUP_DISTANCE);
|
||||
addMultilineLabel(root, gridRow, "Please write down both wallet seed words and the date! " +
|
||||
"You can recover your wallet any time with those seed words and the date.\n" +
|
||||
"The seed words are used for both the bitcoin and teh SQU wallet.",
|
||||
"The seed words are used for both the bitcoin and teh BSQ wallet.",
|
||||
Layout.FIRST_ROW_AND_GROUP_DISTANCE);
|
||||
|
||||
seedWordsValidChangeListener = (observable, oldValue, newValue) -> {
|
||||
|
|
|
@ -131,7 +131,7 @@ public class CreateCompensationRequestView extends ActivatableView<GridPane, Voi
|
|||
|
||||
checkArgument(!preparedSendTx.getInputs().isEmpty(), "preparedSendTx inputs must not be empty");
|
||||
|
||||
// We use the key of the first SQU input for signing the data
|
||||
// We use the key of the first BSQ input for signing the data
|
||||
TransactionOutput connectedOutput = preparedSendTx.getInputs().get(0).getConnectedOutput();
|
||||
checkNotNull(connectedOutput, "connectedOutput must not be null");
|
||||
DeterministicKey squKeyPair = squWalletService.findKeyFromPubKeyHash(connectedOutput.getScriptPubKey().getPubKeyHash());
|
||||
|
|
|
@ -57,7 +57,7 @@ public class TokenDashboardView extends ActivatableView<GridPane, Void> {
|
|||
@Override
|
||||
public void initialize() {
|
||||
addTitledGroupBg(root, gridRow, 1, "Balance");
|
||||
balanceTextField = addLabelTextField(root, gridRow, "SQU balance:", Layout.FIRST_ROW_DISTANCE).second;
|
||||
balanceTextField = addLabelTextField(root, gridRow, "BSQ balance:", Layout.FIRST_ROW_DISTANCE).second;
|
||||
balanceUtil.setBalanceTextField(balanceTextField);
|
||||
balanceUtil.initialize();
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ public class TokenReceiveView extends ActivatableView<GridPane, Void> {
|
|||
@Override
|
||||
public void initialize() {
|
||||
addTitledGroupBg(root, gridRow, 1, "Balance");
|
||||
balanceTextField = addLabelTextField(root, gridRow, "SQU balance:", Layout.FIRST_ROW_DISTANCE).second;
|
||||
balanceTextField = addLabelTextField(root, gridRow, "BSQ balance:", Layout.FIRST_ROW_DISTANCE).second;
|
||||
balanceUtil.setBalanceTextField(balanceTextField);
|
||||
balanceUtil.initialize();
|
||||
|
||||
|
|
|
@ -84,18 +84,18 @@ public class TokenSendView extends ActivatableView<GridPane, Void> {
|
|||
@Override
|
||||
public void initialize() {
|
||||
addTitledGroupBg(root, gridRow, 1, "Balance");
|
||||
balanceTextField = addLabelTextField(root, gridRow, "SQU balance:", Layout.FIRST_ROW_DISTANCE).second;
|
||||
balanceTextField = addLabelTextField(root, gridRow, "BSQ balance:", Layout.FIRST_ROW_DISTANCE).second;
|
||||
balanceUtil.setBalanceTextField(balanceTextField);
|
||||
balanceUtil.initialize();
|
||||
|
||||
addTitledGroupBg(root, ++gridRow, 3, "Send funds", Layout.GROUP_DISTANCE);
|
||||
amountInputTextField = addLabelInputTextField(root, gridRow, "Amount in SQU:", Layout.FIRST_ROW_AND_GROUP_DISTANCE).second;
|
||||
amountInputTextField = addLabelInputTextField(root, gridRow, "Amount in BSQ:", Layout.FIRST_ROW_AND_GROUP_DISTANCE).second;
|
||||
amountInputTextField.setPromptText("Set amount to withdraw (min. amount is 547");
|
||||
|
||||
receiversAddressInputTextField = addLabelInputTextField(root, ++gridRow, "Receiver's address:").second;
|
||||
receiversAddressInputTextField.setPromptText("Fill in your destination address");
|
||||
|
||||
sendButton = addButtonAfterGroup(root, ++gridRow, "Send SQU funds");
|
||||
sendButton = addButtonAfterGroup(root, ++gridRow, "Send BSQ funds");
|
||||
|
||||
if (DevFlags.DEV_MODE) {
|
||||
amountInputTextField.setText("0.546"); // 546 is dust limit
|
||||
|
|
|
@ -29,7 +29,7 @@ public class SQUFormatter extends BSFormatter {
|
|||
@Inject
|
||||
private SQUFormatter() {
|
||||
super();
|
||||
coinFormat = new MonetaryFormat().shift(5).minDecimals(0).code(5, "SQU").minDecimals(3);
|
||||
coinFormat = new MonetaryFormat().shift(5).minDecimals(0).code(5, "BSQ").minDecimals(3);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue