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

Cancel dependent NSC at successful submission of trade or order candidate in DSC #417

Merged
merged 1 commit into from
Jun 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contracts/DriipSettlementDisputeByPayment.sol
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ BalanceTrackable, FraudChallengable, Servable {
payment.sender.nonce, payment.seals.operator.hash, PaymentTypesLib.PAYMENT_KIND()
);

// Cancel dependent null settlement challenge if existent
// Terminate dependent null settlement challenge proposal if existent
nullSettlementChallengeState.terminateProposal(wallet, payment.currency);

// Emit event
Expand Down
21 changes: 21 additions & 0 deletions contracts/DriipSettlementDisputeByTrade.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {NahmiiTypesLib} from "./NahmiiTypesLib.sol";
import {TradeTypesLib} from "./TradeTypesLib.sol";
import {SettlementChallengeTypesLib} from "./SettlementChallengeTypesLib.sol";
import {DriipSettlementChallengeState} from "./DriipSettlementChallengeState.sol";
import {NullSettlementChallengeState} from "./NullSettlementChallengeState.sol";

/**
* @title DriipSettlementDisputeByTrade
Expand All @@ -47,12 +48,15 @@ FraudChallengable, CancelOrdersChallengable, Servable {
// Variables
// -----------------------------------------------------------------------------------------------------------------
DriipSettlementChallengeState public driipSettlementChallengeState;
NullSettlementChallengeState public nullSettlementChallengeState;

//
// Events
// -----------------------------------------------------------------------------------------------------------------
event SetDriipSettlementChallengeStateEvent(DriipSettlementChallengeState oldDriipSettlementChallengeState,
DriipSettlementChallengeState newDriipSettlementChallengeState);
event SetNullSettlementChallengeStateEvent(NullSettlementChallengeState oldNullSettlementChallengeState,
NullSettlementChallengeState newNullSettlementChallengeState);
event ChallengeByOrderEvent(uint256 nonce, TradeTypesLib.Order order, address challenger);
event UnchallengeOrderCandidateByTradeEvent(uint256 nonce, TradeTypesLib.Order order,
TradeTypesLib.Trade trade, address unchallenger);
Expand All @@ -76,6 +80,17 @@ FraudChallengable, CancelOrdersChallengable, Servable {
emit SetDriipSettlementChallengeStateEvent(oldDriipSettlementChallengeState, driipSettlementChallengeState);
}

/// @notice Set the null settlement state contract
/// @param newNullSettlementChallengeState The (address of) NullSettlementChallengeState contract instance
function setNullSettlementChallengeState(NullSettlementChallengeState newNullSettlementChallengeState) public
onlyDeployer
notNullAddress(address(newNullSettlementChallengeState))
{
NullSettlementChallengeState oldNullSettlementChallengeState = nullSettlementChallengeState;
nullSettlementChallengeState = newNullSettlementChallengeState;
emit SetNullSettlementChallengeStateEvent(oldNullSettlementChallengeState, nullSettlementChallengeState);
}

/// @notice Challenge the driip settlement by providing order candidate
/// @param order The order candidate that challenges the challenged driip
/// @param challenger The address of the challenger
Expand Down Expand Up @@ -126,6 +141,9 @@ FraudChallengable, CancelOrdersChallengable, Servable {
order.nonce, order.seals.operator.hash, TradeTypesLib.ORDER_KIND()
);

// Terminate dependent null settlement challenge proposal if existent
nullSettlementChallengeState.terminateProposal(order.wallet, currency);

// Emit event
emit ChallengeByOrderEvent(
driipSettlementChallengeState.proposalNonce(order.wallet, currency), order, challenger
Expand Down Expand Up @@ -259,6 +277,9 @@ FraudChallengable, CancelOrdersChallengable, Servable {
nonce, trade.seal.hash, TradeTypesLib.TRADE_KIND()
);

// Terminate dependent null settlement challenge proposal if existent
nullSettlementChallengeState.terminateProposal(wallet, currency);

// Emit event
emit ChallengeByTradeEvent(
wallet, driipSettlementChallengeState.proposalNonce(wallet, currency), trade, challenger
Expand Down
Loading