Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testNotOwnerTransferOwnershipFail #11

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion contracts/lib/solmate
Submodule solmate deleted from e802bc
79 changes: 0 additions & 79 deletions contracts/src/MerkleClaimERC20.sol

This file was deleted.

141 changes: 0 additions & 141 deletions contracts/src/test/MerkleClaimERC20.t.sol

This file was deleted.

35 changes: 35 additions & 0 deletions contracts/src/test/MerkleClaimERC721.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,21 @@ pragma solidity >=0.8.0;
/// ============ Imports ============

import { MerkleClaimERC721Test } from "./utils/MerkleClaimERC721Test.sol"; // Test scaffolding
import { MerkleClaimERC721 } from "../MerkleClaimERC721.sol"; // MerkleClaimERC721

interface CheatCodes {
function prank(address) external;
function stopPrank() external;
function expectRevert(bytes calldata msg) external;

}
/// @title Tests
/// @notice MerkleClaimERC721 tests
/// @author Anish Agnihotri <[email protected]>
contract Tests is MerkleClaimERC721Test {

CheatCodes cheat = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);

// Setup correct proof for Alice
bytes32[5] aliceProof = [
bytes32(0x0b3da53306c1495659b5cc9f744ea981c2a3f127b250e5c8caedfaa97c0e676b),
Expand Down Expand Up @@ -126,4 +136,29 @@ contract Tests is MerkleClaimERC721Test {
// Assert Alice balance before + 100 tokens = after balance
assertEq(alicePostBalance, alicePreBalance + 1);
}

function testTransferOwnershipToAddressZeroFail() public {
TOKEN = new MerkleClaimERC721(
"My Token",
"MT",
// Merkle root containing ALICE but no BOB
0xa21be505af5f5455fad4bcb3d54ccc03f269c5e06945f1dbf6c96dfcb99fcbd0
);
cheat.expectRevert(bytes("Ownable: new owner is the zero address"));
TOKEN.transferOwnership(address(0));
}

function testNotOwnerTransferOwnershipFail() public {
cheat.prank(address(10));
TOKEN = new MerkleClaimERC721(
"My Token",
"MT",
// Merkle root containing ALICE but no BOB
0xa21be505af5f5455fad4bcb3d54ccc03f269c5e06945f1dbf6c96dfcb99fcbd0
);
cheat.stopPrank();
cheat.expectRevert(bytes("Ownable: caller is not the owner"));
TOKEN.transferOwnership(address(2));
}

}
40 changes: 0 additions & 40 deletions contracts/src/test/utils/MerkleClaimERC20Test.sol

This file was deleted.

42 changes: 0 additions & 42 deletions contracts/src/test/utils/MerkleClaimERC20User.sol

This file was deleted.