Skip to content

Commit b9a37a7

Browse files
committed
fix: 🐛 Fixed CheckedId typo, not CheckedIn
1 parent e51f1db commit b9a37a7

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

contracts/DealsRegistry.sol

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,9 @@ abstract contract DealsRegistry is
9696
Created, // Just created
9797
Claimed, // Claimed by the supplier
9898
Rejected, // Rejected by the supplier
99+
Refunded, // Refunded by the supplier
99100
Cancelled, // Cancelled by the buyer
100-
CheckedId, // Checked In
101+
CheckedIn, // Checked In
101102
CheckedOut, // Checked Out
102103
Disputed // Dispute started
103104
}
@@ -188,8 +189,10 @@ abstract contract DealsRegistry is
188189

189190
allowedStatuses["reject"] = [DealStatus.Created];
190191
allowedStatuses["cancel"] = [DealStatus.Created, DealStatus.Claimed];
192+
allowedStatuses["refund"] = [DealStatus.Claimed, DealStatus.CheckedIn];
191193
allowedStatuses["claim"] = [DealStatus.Created];
192194
allowedStatuses["checkIn"] = [DealStatus.Claimed];
195+
allowedStatuses["checkOut"] = [DealStatus.CheckedIn];
193196
}
194197

195198
/// Modifiers
@@ -784,12 +787,20 @@ abstract contract DealsRegistry is
784787
// Execute before checkIn hook
785788
_beforeCheckIn(offerId, signs);
786789

787-
storedDeal.status = DealStatus.CheckedId;
788-
emit Status(offerId, DealStatus.CheckedId, sender);
790+
storedDeal.status = DealStatus.CheckedIn;
791+
emit Status(offerId, DealStatus.CheckedIn, sender);
789792

790793
// Execute after checkIn hook
791794
_afterCheckIn(offerId, signs);
792795
}
793796

797+
function checkOut(
798+
bytes32 offerId
799+
)
800+
external
801+
dealExists(offerId)
802+
inStatuses(offerId, allowedStatuses["checkIn"])
803+
{}
804+
794805
uint256[50] private __gap;
795806
}

test/contracts/Market.test.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ enum DealStatus {
2424
Created, // Just created
2525
Claimed, // Claimed by the supplier
2626
Rejected, // Rejected by the supplier
27+
Refunded, // Refunded by the supplier
2728
Cancelled, // Cancelled by the buyer
28-
CheckedId, // Checked In
29+
CheckedIn, // Checked In
2930
CheckedOut, // Checked Out
3031
Disputed, // Dispute started
3132
}
@@ -718,9 +719,9 @@ describe('Market contract', () => {
718719
]);
719720
await expect(tx)
720721
.to.emit(buyer.market, 'Status')
721-
.withArgs(offer.payload.id, DealStatus.CheckedId, buyer.address);
722+
.withArgs(offer.payload.id, DealStatus.CheckedIn, buyer.address);
722723
const { status } = await buyer.market.deals(offer.payload.id);
723-
expect(status).to.eq(DealStatus.CheckedId);
724+
expect(status).to.eq(DealStatus.CheckedIn);
724725
});
725726
});
726727

@@ -756,9 +757,9 @@ describe('Market contract', () => {
756757
]);
757758
await expect(tx)
758759
.to.emit(supplierSigner.market, 'Status')
759-
.withArgs(offer.payload.id, DealStatus.CheckedId, supplierSigner.address);
760+
.withArgs(offer.payload.id, DealStatus.CheckedIn, supplierSigner.address);
760761
const { status } = await buyer.market.deals(offer.payload.id);
761-
expect(status).to.eq(DealStatus.CheckedId);
762+
expect(status).to.eq(DealStatus.CheckedIn);
762763
});
763764

764765
it('should check in after checkIn date', async () => {
@@ -780,9 +781,9 @@ describe('Market contract', () => {
780781
]);
781782
await expect(tx)
782783
.to.emit(supplierSigner.market, 'Status')
783-
.withArgs(offer.payload.id, DealStatus.CheckedId, supplierSigner.address);
784+
.withArgs(offer.payload.id, DealStatus.CheckedIn, supplierSigner.address);
784785
const { status } = await buyer.market.deals(offer.payload.id);
785-
expect(status).to.eq(DealStatus.CheckedId);
786+
expect(status).to.eq(DealStatus.CheckedIn);
786787
});
787788
});
788789
});

0 commit comments

Comments
 (0)