Skip to content

Commit

Permalink
Merge pull request #16 from P4-Games/feature/hasCard
Browse files Browse the repository at this point in the history
added method hasCard
  • Loading branch information
dappsar authored Nov 12, 2023
2 parents dfef5ab + 464bab0 commit 9244738
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions contracts/gamma/GammaCards.v2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,11 @@ contract NofGammaCardsV2 is ERC721, ERC721URIStorage, ERC721Burnable, Ownable {
keccak256(abi.encodePacked(
msg.sender, packNumber,
packData, '0xf1dD71895e49b1563693969de50898197cDF3481')).toEthSignedMessageHash();

require(messageHash.recover(signature) == signer, "Invalid signature");

console.log('open pack signer recovered', messageHash.recover(signature));
console.log('openPack', msg.sender, packNumber, signer);

require(address(messageHash.recover(signature)) == address(signer), "Invalid signature");


uint256 length = packData.length;
Expand Down Expand Up @@ -253,13 +256,10 @@ contract NofGammaCardsV2 is ERC721, ERC721URIStorage, ERC721Burnable, Ownable {
emit NewUris(newMainUri, newSecondaryUri);
}

// function getCardsByUser(address owner) public view returns(uint256[] memory) {
// uint8[] memory userCards;
// for(uint256 i;i<122;i++){
// userCards.push(cardsByUser[owner][i]);
// }
// }

function hasCard(uint8 cardNum) public view returns (bool has) {
return cardsByUser[msg.sender][cardNum] > 0;
}

function getCardsByUser(address user) public view returns (uint8[] memory, uint8[] memory) {
uint8[] memory cardNumbers = new uint8[](121);
uint8[] memory amounts = new uint8[](121);
Expand Down

0 comments on commit 9244738

Please sign in to comment.