-
Notifications
You must be signed in to change notification settings - Fork 230
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1 parent
03f8b9a
commit 596ce4d
Showing
3 changed files
with
29 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ pragma solidity 0.8.7; | |
|
||
import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; | ||
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; | ||
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; | ||
|
||
contract ZetaXP is ERC721Upgradeable, OwnableUpgradeable { | ||
/* An ECDSA signature. */ | ||
|
@@ -47,10 +48,12 @@ contract ZetaXP is ERC721Upgradeable, OwnableUpgradeable { | |
string memory name, | ||
string memory symbol, | ||
string memory baseTokenURI_, | ||
address signerAddress_ | ||
address signerAddress_, | ||
Check notice Code scanning / Slither Missing zero address validation Low
ZetaXP.initialize(string,string,string,address,address).signerAddress_ lacks a zero-check on :
- signerAddress = signerAddress_ |
||
address owner | ||
) public initializer { | ||
__ERC721_init(name, symbol); | ||
__Ownable_init(); | ||
transferOwnership(owner); | ||
baseTokenURI = baseTokenURI_; | ||
signerAddress = signerAddress_; | ||
_currentTokenId = 1; // Start token IDs from 1 | ||
|
@@ -95,9 +98,10 @@ contract ZetaXP is ERC721Upgradeable, OwnableUpgradeable { | |
|
||
function _verify(uint256 tokenId, UpdateData memory updateData) private view { | ||
bytes32 payloadHash = _calculateHash(updateData); | ||
bytes32 messageHash = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", payloadHash)); | ||
|
||
address messageSigner = ecrecover( | ||
bytes32 messageHash = ECDSA.toEthSignedMessageHash(payloadHash); | ||
|
||
address messageSigner = ECDSA.recover( | ||
messageHash, | ||
updateData.signature.v, | ||
updateData.signature.r, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters