Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complete new trade protocol #3340

Merged
5 changes: 5 additions & 0 deletions core/src/main/java/bisq/core/offer/OpenOfferManager.java
Expand Up @@ -20,6 +20,7 @@
import bisq.core.btc.wallet.BsqWalletService;
import bisq.core.btc.wallet.BtcWalletService;
import bisq.core.btc.wallet.TradeWalletService;
import bisq.core.dao.DaoFacade;
import bisq.core.exceptions.TradePriceOutOfToleranceException;
import bisq.core.offer.availability.DisputeAgentSelection;
import bisq.core.offer.messages.OfferAvailabilityRequest;
Expand Down Expand Up @@ -107,6 +108,7 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
private final ArbitratorManager arbitratorManager;
private final MediatorManager mediatorManager;
private final RefundAgentManager refundAgentManager;
private final DaoFacade daoFacade;
private final Storage<TradableList<OpenOffer>> openOfferTradableListStorage;
private final Map<String, OpenOffer> offersToBeEdited = new HashMap<>();
private boolean stopped;
Expand All @@ -133,6 +135,7 @@ public OpenOfferManager(KeyRing keyRing,
ArbitratorManager arbitratorManager,
MediatorManager mediatorManager,
RefundAgentManager refundAgentManager,
DaoFacade daoFacade,
Storage<TradableList<OpenOffer>> storage) {
this.keyRing = keyRing;
this.user = user;
Expand All @@ -148,6 +151,7 @@ public OpenOfferManager(KeyRing keyRing,
this.arbitratorManager = arbitratorManager;
this.mediatorManager = mediatorManager;
this.refundAgentManager = refundAgentManager;
this.daoFacade = daoFacade;

openOfferTradableListStorage = storage;

Expand Down Expand Up @@ -344,6 +348,7 @@ public void placeOffer(Offer offer,
offerBookService,
arbitratorManager,
tradeStatisticsManager,
daoFacade,
user);
PlaceOfferProtocol placeOfferProtocol = new PlaceOfferProtocol(
model,
Expand Down
Expand Up @@ -20,6 +20,7 @@
import bisq.core.btc.wallet.BsqWalletService;
import bisq.core.btc.wallet.BtcWalletService;
import bisq.core.btc.wallet.TradeWalletService;
import bisq.core.dao.DaoFacade;
import bisq.core.offer.Offer;
import bisq.core.offer.OfferBookService;
import bisq.core.support.dispute.arbitration.arbitrator.ArbitratorManager;
Expand Down Expand Up @@ -48,6 +49,7 @@ public class PlaceOfferModel implements Model {
private final OfferBookService offerBookService;
private final ArbitratorManager arbitratorManager;
private final TradeStatisticsManager tradeStatisticsManager;
private final DaoFacade daoFacade;
private final User user;

// Mutable
Expand All @@ -65,6 +67,7 @@ public PlaceOfferModel(Offer offer,
OfferBookService offerBookService,
ArbitratorManager arbitratorManager,
TradeStatisticsManager tradeStatisticsManager,
DaoFacade daoFacade,
User user) {
this.offer = offer;
this.reservedFundsForOffer = reservedFundsForOffer;
Expand All @@ -75,6 +78,7 @@ public PlaceOfferModel(Offer offer,
this.offerBookService = offerBookService;
this.arbitratorManager = arbitratorManager;
this.tradeStatisticsManager = tradeStatisticsManager;
this.daoFacade = daoFacade;
this.user = user;
}

Expand Down
Expand Up @@ -25,6 +25,7 @@
import bisq.core.btc.wallet.TxBroadcaster;
import bisq.core.btc.wallet.WalletService;
import bisq.core.dao.exceptions.DaoDisabledException;
import bisq.core.dao.governance.param.Param;
import bisq.core.dao.state.model.blockchain.TxType;
import bisq.core.offer.Offer;
import bisq.core.offer.availability.DisputeAgentSelection;
Expand Down Expand Up @@ -69,7 +70,8 @@ protected void run() {
Address reservedForTradeAddress = walletService.getOrCreateAddressEntry(id, AddressEntry.Context.RESERVED_FOR_TRADE).getAddress();
Address changeAddress = walletService.getFreshAddressEntry().getAddress();

final TradeWalletService tradeWalletService = model.getTradeWalletService();
TradeWalletService tradeWalletService = model.getTradeWalletService();
String feeReceiver = model.getDaoFacade().getParamValue(Param.RECIPIENT_BTC_ADDRESS);

if (offer.isCurrencyForMakerFeeBtc()) {
tradeFeeTx = tradeWalletService.createBtcTradingFeeTx(
Expand All @@ -80,7 +82,7 @@ protected void run() {
model.isUseSavingsWallet(),
offer.getMakerFee(),
offer.getTxFee(),
arbitrator.getBtcAddress(),
feeReceiver,
true,
new TxBroadcaster.Callback() {
@Override
Expand Down
Expand Up @@ -22,6 +22,7 @@
import bisq.core.btc.wallet.TradeWalletService;
import bisq.core.btc.wallet.WalletService;
import bisq.core.dao.exceptions.DaoDisabledException;
import bisq.core.dao.governance.param.Param;
import bisq.core.offer.availability.DisputeAgentSelection;
import bisq.core.support.dispute.arbitration.arbitrator.Arbitrator;
import bisq.core.trade.Trade;
Expand Down Expand Up @@ -68,6 +69,7 @@ protected void run() {
Address changeAddress = changeAddressEntry.getAddress();
TradeWalletService tradeWalletService = processModel.getTradeWalletService();
Transaction transaction;
String feeReceiver = processModel.getDaoFacade().getParamValue(Param.RECIPIENT_BTC_ADDRESS);
if (trade.isCurrencyForTakerFeeBtc()) {
transaction = tradeWalletService.createBtcTradingFeeTx(
fundingAddress,
Expand All @@ -77,7 +79,7 @@ protected void run() {
processModel.isUseSavingsWallet(),
trade.getTakerFee(),
trade.getTxFee(),
arbitrator.getBtcAddress(),
feeReceiver,
false,
null);
} else {
Expand Down