Skip to content

Commit

Permalink
Renamed getDeck to getDeckCards. Renamed getDeckReal to getDeck.
Browse files Browse the repository at this point in the history
  • Loading branch information
eviterin committed Mar 26, 2024
1 parent 0b5d9a1 commit f812094
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/contracts/src/Game.sol
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ contract Game {
uint256[] storage cards = gdata.cards;
pdata.deckStart = uint8(cards.length);
inventory.checkDeck(msg.sender, deckID);
uint256[] memory deck = inventory.getDeck(msg.sender, deckID);
uint256[] memory deck = inventory.getDeckCards(msg.sender, deckID);

for (uint256 i = 0; i < deck.length; i++) {
cards.push(deck[i]);
Expand Down
4 changes: 2 additions & 2 deletions packages/contracts/src/Inventory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ contract Inventory is Ownable {
// ---------------------------------------------------------------------------------------------

// Returns the list of cards in the given deck of the given player.
function getDeck(address player, uint8 deckID)
function getDeckCards(address player, uint8 deckID)
external
view
exists(player, deckID)
Expand All @@ -343,7 +343,7 @@ contract Inventory is Ownable {
// ---------------------------------------------------------------------------------------------

// Returns the list of cards in the given deck of the given player.
function getDeckReal(address player, uint8 deckID)
function getDeck(address player, uint8 deckID)
external
view
exists(player, deckID)
Expand Down
4 changes: 2 additions & 2 deletions packages/contracts/src/test/Integration.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ contract Integration is Test {
game.createGame(2);

// IDs don't start at 1 because the deploy script currently airdrops some addresses, might change.
inventory.getDeck(player2, 0); // player1 has card id of 49-72 inclusive
inventory.getDeck(player2, 0); // player2 has card id of 73-96 inclusive
inventory.getDeckCards(player2, 0); // player1 has card id of 49-72 inclusive
inventory.getDeckCards(player2, 0); // player2 has card id of 73-96 inclusive

vm.startPrank(player1);
game.joinGame(gameID, DECK_ID, SALT_HASH, JOIN_DATA);
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/src/test/Inventory.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ contract InventoryTest is Test {
// expect revert if player's deck contains a card with more than `MAX_CARD_COPY` copies.
function testCheckDeckExceedsMaxCopy() public {
uint8 deckId = 0;
uint256 randomCard = inventory.getDeck(player1, deckId)[2];
uint256 randomCard = inventory.getDeckCards(player1, deckId)[2];

// increase card `randomCard` copies to 4
vm.startPrank(player1);
Expand Down
4 changes: 2 additions & 2 deletions packages/webapp/src/actions/getDeck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export async function getAllDecks(args: GetDeckArgs): Promise<any> {
}

/**
* Fetches the deck of the given player of a given ID by sending the `getDeckReal` transaction.
* Fetches the deck of the given player of a given ID by sending the `getDeck` transaction.
*
* Returns `true` iff the transaction is successful.
*/
Expand Down Expand Up @@ -105,7 +105,7 @@ async function getDeckImpl(args: GetDeckAtArgs): Promise<any> {
const result = await contractWriteThrowing({
contract: deployment.Inventory,
abi: inventoryABI,
functionName: "getDeckReal",
functionName: "getDeck",
args: [args.playerAddress, args.index],
})

Expand Down
2 changes: 1 addition & 1 deletion packages/webapp/src/store/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export async function fetchDeck(player: Address, deckID: number): Promise<readon
return readContract({
address: deployment.Inventory,
abi: inventoryABI,
functionName: "getDeck",
functionName: "getDeckCards",
args: [player, deckID],
})
}
Expand Down

0 comments on commit f812094

Please sign in to comment.