Skip to content

Commit

Permalink
ensure that the authorizer only lets the caller pass
Browse files Browse the repository at this point in the history
Signed-off-by: stadolf <stefan@molecule.to>
elmariachi111 committed Oct 3, 2024
1 parent 8d76ce3 commit 06417d6
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/IPNFT.sol
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ import { IReservable } from "./IReservable.sol";
\▓▓▓▓▓▓\▓▓ \▓▓ \▓▓\▓▓ \▓▓
*/

/// @title IPNFT V2.4
/// @title IPNFT V2.5
/// @author molecule.to
/// @notice IP-NFTs capture intellectual property to be traded and synthesized
contract IPNFT is ERC721URIStorageUpgradeable, ERC721BurnableUpgradeable, IReservable, UUPSUpgradeable, OwnableUpgradeable, PausableUpgradeable {
@@ -188,7 +188,6 @@ contract IPNFT is ERC721URIStorageUpgradeable, ERC721BurnableUpgradeable, IReser
(bool success,) = _msgSender().call{ value: address(this).balance }("");
require(success, "transfer failed");
}


/// @inheritdoc UUPSUpgradeable
function _authorizeUpgrade(address /*newImplementation*/ )
5 changes: 5 additions & 0 deletions test/IPNFT.t.sol
Original file line number Diff line number Diff line change
@@ -229,6 +229,11 @@ contract IPNFTTest is IPNFTMintHelper {
(uint8 v, bytes32 r, bytes32 s) = vm.sign(deployerPk, authMessageHash);
bytes memory authorization = abi.encodePacked(r, s, v);

//the signoff only allows alice to call this
vm.startPrank(charlie);
vm.expectRevert(IPNFT.Unauthorized.selector);
ipnft.amendMetadata(1, "ipfs://QmNewUri", authorization);

vm.startPrank(alice);
vm.expectEmit(true, true, false, false);
emit MetadataUpdate(1);

0 comments on commit 06417d6

Please sign in to comment.