Skip to content

Commit 1d1b932

Browse files
Krishang NadgaudaKrishang Nadgauda
authored andcommitted
pull from origin
2 parents 9086f17 + e84d977 commit 1d1b932

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

contracts/signature-drop/SignatureDrop.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ contract SignatureDrop is
142142
uint256 _amount,
143143
string calldata _baseURIForTokens,
144144
bytes calldata _data
145-
) public override onlyRole(minterRole) returns (uint256 batchId) {
145+
) public override returns (uint256 batchId) {
146146
if (_data.length > 0) {
147147
(bytes memory encryptedURI, bytes32 provenanceHash) = abi.decode(_data, (bytes, bytes32));
148148
if (encryptedURI.length != 0 && provenanceHash != "") {
@@ -306,7 +306,7 @@ contract SignatureDrop is
306306

307307
/// @dev Returns whether lazy minting can be done in the given execution context.
308308
function _canLazyMint() internal view virtual override returns (bool) {
309-
return hasRole(DEFAULT_ADMIN_ROLE, _msgSender());
309+
return hasRole(minterRole, _msgSender());
310310
}
311311

312312
/*///////////////////////////////////////////////////////////////

src/test/SignatureDrop.t.sol

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -462,14 +462,16 @@ contract SignatureDropTest is BaseTest {
462462
* note: Testing revert condition; an address without MINTER_ROLE calls lazyMint function.
463463
*/
464464
function test_revert_lazyMint_MINTER_ROLE() public {
465-
bytes memory errorMessage = abi.encodePacked(
466-
"Permissions: account ",
467-
Strings.toHexString(uint160(address(this)), 20),
468-
" is missing role ",
469-
Strings.toHexString(uint256(keccak256("MINTER_ROLE")), 32)
470-
);
465+
bytes32 _minterRole = keccak256("MINTER_ROLE");
471466

472-
vm.expectRevert(errorMessage);
467+
vm.prank(deployerSigner);
468+
sigdrop.grantRole(_minterRole, address(0x345));
469+
470+
vm.prank(address(0x345));
471+
sigdrop.lazyMint(100, "ipfs://", emptyEncodedBytes);
472+
473+
vm.prank(address(0x567));
474+
vm.expectRevert("Not authorized");
473475
sigdrop.lazyMint(100, "ipfs://", emptyEncodedBytes);
474476
}
475477

0 commit comments

Comments
 (0)