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

Adding requiresSignature to the AtBat started event. #143

Merged
merged 1 commit into from
Feb 7, 2024
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
5 changes: 3 additions & 2 deletions src/Fullcount.sol
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ contract Fullcount is EIP712 {
address indexed nftAddress,
uint256 indexed tokenID,
uint256 firstSessionID,
PlayerType role
PlayerType role,
bool requiresSignature
);

event AtBatJoined(
Expand Down Expand Up @@ -374,7 +375,7 @@ contract Fullcount is EIP712 {
AtBatSessions[NumAtBats] = [firstSessionID];
SessionAtBat[firstSessionID] = NumAtBats;

emit AtBatStarted(NumAtBats, nftAddress, tokenID, firstSessionID, role);
emit AtBatStarted(NumAtBats, nftAddress, tokenID, firstSessionID, role, requireSignature);

return NumAtBats;
}
Expand Down
27 changes: 15 additions & 12 deletions test/AtBats.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ contract FullcountAtBatTest is FullcountTestBase {
address indexed nftAddress,
uint256 indexed tokenID,
uint256 firstSessionID,
PlayerType role
PlayerType role,
bool requiresSignature
);
event AtBatJoined(
uint256 indexed atBatID,
Expand Down Expand Up @@ -57,9 +58,8 @@ contract FullcountTest_startAtBat is FullcountAtBatTest {
vm.startPrank(player1);

vm.expectEmit(address(game));
emit SessionStarted(initialNumSessions + 1, address(characterNFTs), tokenID, PlayerType.Pitcher);
emit AtBatStarted(
initialNumAtBats + 1, address(characterNFTs), tokenID, initialNumSessions + 1, PlayerType.Pitcher
initialNumAtBats + 1, address(characterNFTs), tokenID, initialNumSessions + 1, PlayerType.Pitcher, false
);
uint256 atBatID = game.startAtBat(address(characterNFTs), tokenID, PlayerType.Pitcher, false);

Expand Down Expand Up @@ -92,9 +92,8 @@ contract FullcountTest_startAtBat is FullcountAtBatTest {
vm.startPrank(player1);

vm.expectEmit(address(game));
emit SessionStarted(initialNumSessions + 1, address(characterNFTs), tokenID, PlayerType.Batter);
emit AtBatStarted(
initialNumAtBats + 1, address(characterNFTs), tokenID, initialNumSessions + 1, PlayerType.Batter
initialNumAtBats + 1, address(characterNFTs), tokenID, initialNumSessions + 1, PlayerType.Batter, false
);
uint256 atBatID = game.startAtBat(address(characterNFTs), tokenID, PlayerType.Batter, false);

Expand Down Expand Up @@ -134,9 +133,8 @@ contract FullcountTest_joinAtBatSession is FullcountAtBatTest {
vm.startPrank(player1);

vm.expectEmit(address(game));
emit SessionStarted(initialNumSessions + 1, address(characterNFTs), tokenID, PlayerType.Pitcher);
emit AtBatStarted(
initialNumAtBats + 1, address(characterNFTs), tokenID, initialNumSessions + 1, PlayerType.Pitcher
initialNumAtBats + 1, address(characterNFTs), tokenID, initialNumSessions + 1, PlayerType.Pitcher, false
);
uint256 atBatID = game.startAtBat(address(characterNFTs), tokenID, PlayerType.Pitcher, false);

Expand All @@ -152,7 +150,6 @@ contract FullcountTest_joinAtBatSession is FullcountAtBatTest {
vm.startPrank(player2);

vm.expectEmit(address(game));
emit SessionJoined(firstSessionID, address(otherCharacterNFTs), otherTokenID, PlayerType.Batter);
emit AtBatJoined(atBatID, address(otherCharacterNFTs), otherTokenID, firstSessionID, PlayerType.Batter);
game.joinSession(firstSessionID, address(otherCharacterNFTs), otherTokenID, "");

Expand Down Expand Up @@ -184,9 +181,8 @@ contract FullcountTest_joinAtBatSession is FullcountAtBatTest {
vm.startPrank(player1);

vm.expectEmit(address(game));
emit SessionStarted(initialNumSessions + 1, address(characterNFTs), tokenID, PlayerType.Batter);
emit AtBatStarted(
initialNumAtBats + 1, address(characterNFTs), tokenID, initialNumSessions + 1, PlayerType.Batter
initialNumAtBats + 1, address(characterNFTs), tokenID, initialNumSessions + 1, PlayerType.Batter, false
);
uint256 atBatID = game.startAtBat(address(characterNFTs), tokenID, PlayerType.Batter, false);

Expand All @@ -202,7 +198,6 @@ contract FullcountTest_joinAtBatSession is FullcountAtBatTest {
vm.startPrank(player2);

vm.expectEmit(address(game));
emit SessionJoined(firstSessionID, address(otherCharacterNFTs), otherTokenID, PlayerType.Pitcher);
emit AtBatJoined(atBatID, address(otherCharacterNFTs), otherTokenID, firstSessionID, PlayerType.Pitcher);
game.joinSession(firstSessionID, address(otherCharacterNFTs), otherTokenID, "");

Expand Down Expand Up @@ -1067,7 +1062,7 @@ contract FullcountTest_ballsAndStrikes is FullcountAtBatTest {
}
}

contract FullcountTest_atBatInviteOnly is FullcountTestBase {
contract FullcountTest_atBatInviteOnly is FullcountAtBatTest {
function test_as_batter() public {
charactersMinted++;
uint256 tokenID = charactersMinted;
Expand All @@ -1083,6 +1078,10 @@ contract FullcountTest_atBatInviteOnly is FullcountTestBase {

vm.startPrank(player1);

vm.expectEmit(address(game));
emit AtBatStarted(
initialNumAtBats + 1, address(characterNFTs), tokenID, initialNumSessions + 1, PlayerType.Batter, true
);
uint256 atBatID = game.startAtBat(address(characterNFTs), tokenID, PlayerType.Batter, true);

vm.stopPrank();
Expand Down Expand Up @@ -1125,6 +1124,10 @@ contract FullcountTest_atBatInviteOnly is FullcountTestBase {

vm.startPrank(player1);

vm.expectEmit(address(game));
emit AtBatStarted(
initialNumAtBats + 1, address(characterNFTs), tokenID, initialNumSessions + 1, PlayerType.Pitcher, true
);
uint256 atBatID = game.startAtBat(address(characterNFTs), tokenID, PlayerType.Pitcher, true);

vm.stopPrank();
Expand Down
Loading