mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-07-25 07:55:21 -04:00
Merge TradingPeer models
This commit is contained in:
parent
33bd09e82c
commit
238f36cffd
25 changed files with 101 additions and 313 deletions
|
@ -96,7 +96,6 @@ public abstract class TakerTrade extends Trade implements Serializable {
|
|||
}
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// API
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -24,12 +24,6 @@ import io.bitsquare.p2p.MessageHandler;
|
|||
import io.bitsquare.p2p.Peer;
|
||||
import io.bitsquare.trade.TakerAsBuyerTrade;
|
||||
import io.bitsquare.trade.protocol.Protocol;
|
||||
import io.bitsquare.trade.protocol.trade.messages.PayoutTxPublishedMessage;
|
||||
import io.bitsquare.trade.protocol.trade.messages.RequestPublishDepositTxMessage;
|
||||
import io.bitsquare.trade.protocol.trade.messages.TradeMessage;
|
||||
import io.bitsquare.trade.protocol.trade.taker.models.TakerProcessModel;
|
||||
import io.bitsquare.trade.protocol.trade.shared.taker.tasks.BroadcastTakeOfferFeeTx;
|
||||
import io.bitsquare.trade.protocol.trade.shared.taker.tasks.CreateTakeOfferFeeTx;
|
||||
import io.bitsquare.trade.protocol.trade.buyer.taker.tasks.TakerCommitsPayoutTx;
|
||||
import io.bitsquare.trade.protocol.trade.buyer.taker.tasks.TakerCreatesAndSignsPayoutTx;
|
||||
import io.bitsquare.trade.protocol.trade.buyer.taker.tasks.TakerCreatesDepositTxInputs;
|
||||
|
@ -40,8 +34,14 @@ import io.bitsquare.trade.protocol.trade.buyer.taker.tasks.TakerSendsFiatTransfe
|
|||
import io.bitsquare.trade.protocol.trade.buyer.taker.tasks.TakerSendsRequestPayDepositMessage;
|
||||
import io.bitsquare.trade.protocol.trade.buyer.taker.tasks.TakerSignsAndPublishDepositTx;
|
||||
import io.bitsquare.trade.protocol.trade.buyer.taker.tasks.TakerVerifiesAndSignsContract;
|
||||
import io.bitsquare.trade.protocol.trade.messages.PayoutTxPublishedMessage;
|
||||
import io.bitsquare.trade.protocol.trade.messages.RequestPublishDepositTxMessage;
|
||||
import io.bitsquare.trade.protocol.trade.messages.TradeMessage;
|
||||
import io.bitsquare.trade.protocol.trade.shared.taker.tasks.BroadcastTakeOfferFeeTx;
|
||||
import io.bitsquare.trade.protocol.trade.shared.taker.tasks.CreateTakeOfferFeeTx;
|
||||
import io.bitsquare.trade.protocol.trade.shared.taker.tasks.VerifyOfferFeePayment;
|
||||
import io.bitsquare.trade.protocol.trade.shared.taker.tasks.VerifyOffererAccount;
|
||||
import io.bitsquare.trade.protocol.trade.taker.models.TakerProcessModel;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
|
|
@ -27,6 +27,7 @@ import io.bitsquare.fiat.FiatAccount;
|
|||
import io.bitsquare.offer.Offer;
|
||||
import io.bitsquare.p2p.MessageService;
|
||||
import io.bitsquare.trade.protocol.trade.ProcessModel;
|
||||
import io.bitsquare.trade.protocol.trade.shared.models.TradingPeer;
|
||||
import io.bitsquare.user.User;
|
||||
|
||||
import org.bitcoinj.core.Coin;
|
||||
|
|
|
@ -25,25 +25,25 @@ import io.bitsquare.p2p.Peer;
|
|||
import io.bitsquare.trade.TakerAsSellerTrade;
|
||||
import io.bitsquare.trade.TakerTrade;
|
||||
import io.bitsquare.trade.protocol.Protocol;
|
||||
import io.bitsquare.trade.protocol.trade.buyer.taker.tasks.TakerSendsRequestDepositTxInputsMessage;
|
||||
import io.bitsquare.trade.protocol.trade.buyer.taker.tasks.TakerSendsRequestPublishDepositTxMessage;
|
||||
import io.bitsquare.trade.protocol.trade.messages.DepositTxPublishedMessage;
|
||||
import io.bitsquare.trade.protocol.trade.messages.FiatTransferStartedMessage;
|
||||
import io.bitsquare.trade.protocol.trade.messages.RequestPayDepositMessage;
|
||||
import io.bitsquare.trade.protocol.trade.messages.TradeMessage;
|
||||
import io.bitsquare.trade.protocol.trade.taker.models.TakerProcessModel;
|
||||
import io.bitsquare.trade.protocol.trade.shared.taker.tasks.BroadcastTakeOfferFeeTx;
|
||||
import io.bitsquare.trade.protocol.trade.seller.taker.tasks.TakerCommitDepositTx;
|
||||
import io.bitsquare.trade.protocol.trade.seller.taker.tasks.TakerCreatesAndSignContract;
|
||||
import io.bitsquare.trade.protocol.trade.seller.taker.tasks.TakerCreatesAndSignsDepositTx;
|
||||
import io.bitsquare.trade.protocol.trade.shared.taker.tasks.CreateTakeOfferFeeTx;
|
||||
import io.bitsquare.trade.protocol.trade.seller.taker.tasks.TakerProcessDepositTxPublishedMessage;
|
||||
import io.bitsquare.trade.protocol.trade.seller.taker.tasks.TakerProcessFiatTransferStartedMessage;
|
||||
import io.bitsquare.trade.protocol.trade.seller.taker.tasks.TakerProcessRequestSellerDepositPaymentMessage;
|
||||
import io.bitsquare.trade.protocol.trade.seller.taker.tasks.TakerSendsPayoutTxPublishedMessage;
|
||||
import io.bitsquare.trade.protocol.trade.buyer.taker.tasks.TakerSendsRequestDepositTxInputsMessage;
|
||||
import io.bitsquare.trade.protocol.trade.buyer.taker.tasks.TakerSendsRequestPublishDepositTxMessage;
|
||||
import io.bitsquare.trade.protocol.trade.seller.taker.tasks.TakerSignsAndPublishPayoutTx;
|
||||
import io.bitsquare.trade.protocol.trade.shared.taker.tasks.BroadcastTakeOfferFeeTx;
|
||||
import io.bitsquare.trade.protocol.trade.shared.taker.tasks.CreateTakeOfferFeeTx;
|
||||
import io.bitsquare.trade.protocol.trade.shared.taker.tasks.VerifyOfferFeePayment;
|
||||
import io.bitsquare.trade.protocol.trade.shared.taker.tasks.VerifyOffererAccount;
|
||||
import io.bitsquare.trade.protocol.trade.taker.models.TakerProcessModel;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.bitsquare.trade.protocol.trade.offerer.models;
|
||||
package io.bitsquare.trade.protocol.trade.shared.models;
|
||||
|
||||
import io.bitsquare.fiat.FiatAccount;
|
||||
|
||||
|
@ -43,18 +43,19 @@ public class TradingPeer implements Serializable {
|
|||
|
||||
// Mutable
|
||||
private String accountId;
|
||||
private FiatAccount fiatAccount;
|
||||
private PublicKey p2pSigPubKey;
|
||||
private PublicKey p2pEncryptPubKey;
|
||||
private String contractAsJson;
|
||||
private String contractSignature;
|
||||
private Coin payoutAmount;
|
||||
private byte[] tradeWalletPubKey;
|
||||
private FiatAccount fiatAccount;
|
||||
private Transaction preparedDepositTx;
|
||||
private List<TransactionOutput> connectedOutputsForAllInputs;
|
||||
private String payoutAddressString;
|
||||
private byte[] tradeWalletPubKey;
|
||||
private List<TransactionOutput> outputs;
|
||||
private Coin payoutAmount;
|
||||
private String payoutAddressString;
|
||||
private byte[] signature;
|
||||
private String contractAsJson;
|
||||
private String contractSignature;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Constructor, initialization
|
||||
|
@ -82,14 +83,6 @@ public class TradingPeer implements Serializable {
|
|||
this.accountId = accountId;
|
||||
}
|
||||
|
||||
public FiatAccount getFiatAccount() {
|
||||
return fiatAccount;
|
||||
}
|
||||
|
||||
public void setFiatAccount(FiatAccount fiatAccount) {
|
||||
this.fiatAccount = fiatAccount;
|
||||
}
|
||||
|
||||
public PublicKey getP2pSigPubKey() {
|
||||
return p2pSigPubKey;
|
||||
}
|
||||
|
@ -106,28 +99,20 @@ public class TradingPeer implements Serializable {
|
|||
this.p2pEncryptPubKey = p2pEncryptPubKey;
|
||||
}
|
||||
|
||||
public String getContractAsJson() {
|
||||
return contractAsJson;
|
||||
public byte[] getTradeWalletPubKey() {
|
||||
return tradeWalletPubKey;
|
||||
}
|
||||
|
||||
public void setContractAsJson(String contractAsJson) {
|
||||
this.contractAsJson = contractAsJson;
|
||||
public void setTradeWalletPubKey(byte[] tradeWalletPubKey) {
|
||||
this.tradeWalletPubKey = tradeWalletPubKey;
|
||||
}
|
||||
|
||||
public String getContractSignature() {
|
||||
return contractSignature;
|
||||
public FiatAccount getFiatAccount() {
|
||||
return fiatAccount;
|
||||
}
|
||||
|
||||
public void setContractSignature(String contractSignature) {
|
||||
this.contractSignature = contractSignature;
|
||||
}
|
||||
|
||||
public Coin getPayoutAmount() {
|
||||
return payoutAmount;
|
||||
}
|
||||
|
||||
public void setPayoutAmount(Coin payoutAmount) {
|
||||
this.payoutAmount = payoutAmount;
|
||||
public void setFiatAccount(FiatAccount fiatAccount) {
|
||||
this.fiatAccount = fiatAccount;
|
||||
}
|
||||
|
||||
public Transaction getPreparedDepositTx() {
|
||||
|
@ -146,22 +131,6 @@ public class TradingPeer implements Serializable {
|
|||
this.connectedOutputsForAllInputs = connectedOutputsForAllInputs;
|
||||
}
|
||||
|
||||
public String getPayoutAddressString() {
|
||||
return payoutAddressString;
|
||||
}
|
||||
|
||||
public void setPayoutAddressString(String payoutAddressString) {
|
||||
this.payoutAddressString = payoutAddressString;
|
||||
}
|
||||
|
||||
public byte[] getTradeWalletPubKey() {
|
||||
return tradeWalletPubKey;
|
||||
}
|
||||
|
||||
public void setTradeWalletPubKey(byte[] tradeWalletPubKey) {
|
||||
this.tradeWalletPubKey = tradeWalletPubKey;
|
||||
}
|
||||
|
||||
public List<TransactionOutput> getOutputs() {
|
||||
return outputs;
|
||||
}
|
||||
|
@ -170,6 +139,22 @@ public class TradingPeer implements Serializable {
|
|||
this.outputs = outputs;
|
||||
}
|
||||
|
||||
public Coin getPayoutAmount() {
|
||||
return payoutAmount;
|
||||
}
|
||||
|
||||
public void setPayoutAmount(Coin payoutAmount) {
|
||||
this.payoutAmount = payoutAmount;
|
||||
}
|
||||
|
||||
public String getPayoutAddressString() {
|
||||
return payoutAddressString;
|
||||
}
|
||||
|
||||
public void setPayoutAddressString(String payoutAddressString) {
|
||||
this.payoutAddressString = payoutAddressString;
|
||||
}
|
||||
|
||||
public byte[] getSignature() {
|
||||
return signature;
|
||||
}
|
||||
|
@ -178,22 +163,38 @@ public class TradingPeer implements Serializable {
|
|||
this.signature = signature;
|
||||
}
|
||||
|
||||
public String getContractAsJson() {
|
||||
return contractAsJson;
|
||||
}
|
||||
|
||||
public void setContractAsJson(String contractAsJson) {
|
||||
this.contractAsJson = contractAsJson;
|
||||
}
|
||||
|
||||
public String getContractSignature() {
|
||||
return contractSignature;
|
||||
}
|
||||
|
||||
public void setContractSignature(String contractSignature) {
|
||||
this.contractSignature = contractSignature;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Taker{" +
|
||||
return "TradingPeer{" +
|
||||
"accountId='" + accountId + '\'' +
|
||||
", fiatAccount=" + fiatAccount +
|
||||
", p2pSigPubKey=" + p2pSigPubKey +
|
||||
", p2pEncryptPubKey=" + p2pEncryptPubKey +
|
||||
", contractAsJson='" + contractAsJson + '\'' +
|
||||
", contractSignature='" + contractSignature + '\'' +
|
||||
", payoutAmount=" + payoutAmount +
|
||||
", tradeWalletPubKey=" + Arrays.toString(tradeWalletPubKey) +
|
||||
", fiatAccount=" + fiatAccount +
|
||||
", preparedDepositTx=" + preparedDepositTx +
|
||||
", connectedOutputsForAllInputs=" + connectedOutputsForAllInputs +
|
||||
", outputs=" + outputs +
|
||||
", payoutAmount=" + payoutAmount +
|
||||
", payoutAddressString='" + payoutAddressString + '\'' +
|
||||
", tradeWalletPubKey=" + Arrays.toString(tradeWalletPubKey) +
|
||||
", signature=" + Arrays.toString(signature) +
|
||||
", contractAsJson='" + contractAsJson + '\'' +
|
||||
", contractSignature='" + contractSignature + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -38,7 +38,8 @@ public class VerifyTakerAccount extends OffererTradeTask {
|
|||
try {
|
||||
//TODO mocked yet
|
||||
if (offererTradeProcessModel.getBlockChainService().verifyAccountRegistration()) {
|
||||
if (offererTradeProcessModel.getBlockChainService().isAccountBlackListed(offererTradeProcessModel.tradingPeer.getAccountId(), offererTradeProcessModel
|
||||
if (offererTradeProcessModel.getBlockChainService().isAccountBlackListed(offererTradeProcessModel.tradingPeer.getAccountId(),
|
||||
offererTradeProcessModel
|
||||
.tradingPeer
|
||||
.getFiatAccount())) {
|
||||
log.error("Taker is blacklisted");
|
||||
|
|
|
@ -27,6 +27,7 @@ import io.bitsquare.fiat.FiatAccount;
|
|||
import io.bitsquare.offer.Offer;
|
||||
import io.bitsquare.p2p.MessageService;
|
||||
import io.bitsquare.trade.protocol.trade.ProcessModel;
|
||||
import io.bitsquare.trade.protocol.trade.shared.models.TradingPeer;
|
||||
import io.bitsquare.user.User;
|
||||
|
||||
import org.bitcoinj.core.Coin;
|
||||
|
|
|
@ -1,215 +0,0 @@
|
|||
/*
|
||||
* This file is part of Bitsquare.
|
||||
*
|
||||
* Bitsquare is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Bitsquare is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.bitsquare.trade.protocol.trade.taker.models;
|
||||
|
||||
import io.bitsquare.fiat.FiatAccount;
|
||||
|
||||
import org.bitcoinj.core.Coin;
|
||||
import org.bitcoinj.core.Transaction;
|
||||
import org.bitcoinj.core.TransactionOutput;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.security.PublicKey;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Fully serializable, no transient fields
|
||||
*/
|
||||
public class TradingPeer implements Serializable {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
transient private static final Logger log = LoggerFactory.getLogger(TradingPeer.class);
|
||||
|
||||
// Mutable
|
||||
private byte[] tradeWalletPubKey;
|
||||
private Coin payoutAmount;
|
||||
private String payoutAddressString;
|
||||
private List<TransactionOutput> connectedOutputsForAllInputs;
|
||||
private List<TransactionOutput> outputs;
|
||||
private byte[] signature;
|
||||
private FiatAccount fiatAccount;
|
||||
private String accountId;
|
||||
private PublicKey p2pEncryptPubKey;
|
||||
private String contractAsJson;
|
||||
private String contractSignature;
|
||||
private Transaction preparedDepositTx;
|
||||
private PublicKey p2pSigPubKey;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Constructor, initialization
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public TradingPeer() {
|
||||
log.trace("Created by constructor");
|
||||
}
|
||||
|
||||
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
|
||||
in.defaultReadObject();
|
||||
log.trace("Created from serialized form.");
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Getter/Setter for Mutable objects
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Nullable
|
||||
public byte[] getTradeWalletPubKey() {
|
||||
return tradeWalletPubKey;
|
||||
}
|
||||
|
||||
public void setTradeWalletPubKey(byte[] tradeWalletPubKey) {
|
||||
this.tradeWalletPubKey = tradeWalletPubKey;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Coin getPayoutAmount() {
|
||||
return payoutAmount;
|
||||
}
|
||||
|
||||
public void setPayoutAmount(Coin payoutAmount) {
|
||||
this.payoutAmount = payoutAmount;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getPayoutAddressString() {
|
||||
return payoutAddressString;
|
||||
}
|
||||
|
||||
public void setPayoutAddressString(String payoutAddressString) {
|
||||
this.payoutAddressString = payoutAddressString;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public List<TransactionOutput> getConnectedOutputsForAllInputs() {
|
||||
return connectedOutputsForAllInputs;
|
||||
}
|
||||
|
||||
public void setConnectedOutputsForAllInputs(List<TransactionOutput> connectedOutputsForAllInputs) {
|
||||
this.connectedOutputsForAllInputs = connectedOutputsForAllInputs;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public List<TransactionOutput> getOutputs() {
|
||||
return outputs;
|
||||
}
|
||||
|
||||
public void setOutputs(List<TransactionOutput> outputs) {
|
||||
this.outputs = outputs;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public byte[] getSignature() {
|
||||
return signature;
|
||||
}
|
||||
|
||||
public void setSignature(byte[] signature) {
|
||||
this.signature = signature;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public FiatAccount getFiatAccount() {
|
||||
return fiatAccount;
|
||||
}
|
||||
|
||||
public void setFiatAccount(FiatAccount fiatAccount) {
|
||||
this.fiatAccount = fiatAccount;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getAccountId() {
|
||||
return accountId;
|
||||
}
|
||||
|
||||
public void setAccountId(String accountId) {
|
||||
this.accountId = accountId;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public PublicKey getP2pEncryptPubKey() {
|
||||
return p2pEncryptPubKey;
|
||||
}
|
||||
|
||||
public void setP2pEncryptPubKey(PublicKey p2pEncryptPubKey) {
|
||||
this.p2pEncryptPubKey = p2pEncryptPubKey;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getContractAsJson() {
|
||||
return contractAsJson;
|
||||
}
|
||||
|
||||
public void setContractAsJson(String contractAsJson) {
|
||||
this.contractAsJson = contractAsJson;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getContractSignature() {
|
||||
return contractSignature;
|
||||
}
|
||||
|
||||
public void setContractSignature(String contractSignature) {
|
||||
this.contractSignature = contractSignature;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Transaction getPreparedDepositTx() {
|
||||
return preparedDepositTx;
|
||||
}
|
||||
|
||||
public void setPreparedDepositTx(Transaction preparedDepositTx) {
|
||||
this.preparedDepositTx = preparedDepositTx;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public PublicKey getP2pSigPubKey() {
|
||||
return p2pSigPubKey;
|
||||
}
|
||||
|
||||
public void setP2pSigPubKey(PublicKey p2pSigPubKey) {
|
||||
this.p2pSigPubKey = p2pSigPubKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Offerer{" +
|
||||
"tradeWalletPubKey=" + Arrays.toString(tradeWalletPubKey) +
|
||||
", payoutAmount=" + payoutAmount +
|
||||
", payoutAddressString='" + payoutAddressString + '\'' +
|
||||
", connectedOutputsForAllInputs=" + connectedOutputsForAllInputs +
|
||||
", outputs=" + outputs +
|
||||
", signature=" + Arrays.toString(signature) +
|
||||
", fiatAccount=" + fiatAccount +
|
||||
", accountId='" + accountId + '\'' +
|
||||
", p2pSigPubKey=" + p2pSigPubKey +
|
||||
", p2pEncryptPubKey=" + p2pEncryptPubKey +
|
||||
'}';
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue