Skip to content

Upgrade OZ dependencies #251

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

Merged
merged 4 commits into from
Sep 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
22 changes: 2 additions & 20 deletions contracts/vote/VoteERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,10 @@ import "@openzeppelin/contracts-upgradeable/governance/extensions/GovernorVotesQ
// Meta transactions
import "../openzeppelin-presets/metatx/ERC2771ContextUpgradeable.sol";

// Utils
import "@openzeppelin/contracts-upgradeable/token/ERC721/utils/ERC721HolderUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC1155/utils/ERC1155HolderUpgradeable.sol";

// Helper interfaces
import "@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155ReceiverUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol";

contract VoteERC20 is
Initializable,
IThirdwebContract,
ERC2771ContextUpgradeable,
ERC721HolderUpgradeable,
ERC1155HolderUpgradeable,
GovernorUpgradeable,
GovernorSettingsUpgradeable,
GovernorCountingSimpleUpgradeable,
Expand Down Expand Up @@ -140,16 +130,8 @@ contract VoteERC20 is
return GovernorSettingsUpgradeable.proposalThreshold();
}

function supportsInterface(bytes4 interfaceId)
public
view
override(ERC1155ReceiverUpgradeable, GovernorUpgradeable)
returns (bool)
{
return
interfaceId == type(IERC1155ReceiverUpgradeable).interfaceId ||
interfaceId == type(IERC721ReceiverUpgradeable).interfaceId ||
super.supportsInterface(interfaceId);
function supportsInterface(bytes4 interfaceId) public view override returns (bool) {
return interfaceId == type(IERC721ReceiverUpgradeable).interfaceId || super.supportsInterface(interfaceId);
}

function _msgSender()
Expand Down
2 changes: 1 addition & 1 deletion lib/forge-std
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"@nomiclabs/hardhat-ethers": "^2.0.5",
"@nomiclabs/hardhat-etherscan": "^3.0.3",
"@nomiclabs/hardhat-waffle": "^2.0.3",
"@openzeppelin/contracts": "4.5.0",
"@openzeppelin/contracts-upgradeable": "4.5.1",
"@openzeppelin/contracts": "4.7.3",
"@openzeppelin/contracts-upgradeable": "4.7.3",
"@primitivefi/hardhat-dodoc": "^0.2.0",
"@thirdweb-dev/sdk": "^3.0.4",
"@typechain/ethers-v5": "^10.0.0",
Expand Down
12 changes: 6 additions & 6 deletions src/test/Multiwrap.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ contract MultiwrapTest is BaseTest {
address recipient = address(0x123);

vm.prank(address(tokenOwner));
vm.expectRevert("ERC721: transfer caller is not owner nor approved");
vm.expectRevert("ERC721: caller is not token owner nor approved");
multiwrap.wrap(wrappedContent, uriForWrappedToken, recipient);
}

Expand Down Expand Up @@ -485,7 +485,7 @@ contract MultiwrapTest is BaseTest {
address recipient = address(0x123);

vm.prank(address(tokenOwner));
vm.expectRevert("ERC721: transfer caller is not owner nor approved");
vm.expectRevert("ERC721: caller is not token owner nor approved");
multiwrap.wrap(wrappedContent, uriForWrappedToken, recipient);
}

Expand All @@ -498,7 +498,7 @@ contract MultiwrapTest is BaseTest {
address recipient = address(0x123);

vm.prank(address(tokenOwner));
vm.expectRevert("ERC1155: caller is not owner nor approved");
vm.expectRevert("ERC1155: caller is not token owner nor approved");
multiwrap.wrap(wrappedContent, uriForWrappedToken, recipient);
}

Expand Down Expand Up @@ -559,7 +559,7 @@ contract MultiwrapTest is BaseTest {
vm.prank(recipient);
multiwrap.unwrap(expectedIdForWrappedToken, recipient);

vm.expectRevert("ERC721: owner query for nonexistent token");
vm.expectRevert("ERC721: invalid token ID");
multiwrap.ownerOf(expectedIdForWrappedToken);

assertEq(uriForWrappedToken, multiwrap.tokenURI(expectedIdForWrappedToken));
Expand Down Expand Up @@ -622,7 +622,7 @@ contract MultiwrapTest is BaseTest {
vm.prank(approvedCaller);
multiwrap.unwrap(expectedIdForWrappedToken, recipient);

vm.expectRevert("ERC721: owner query for nonexistent token");
vm.expectRevert("ERC721: invalid token ID");
multiwrap.ownerOf(expectedIdForWrappedToken);

assertEq(uriForWrappedToken, multiwrap.tokenURI(expectedIdForWrappedToken));
Expand Down Expand Up @@ -854,7 +854,7 @@ contract MultiwrapTest is BaseTest {
vm.prank(recipient);
multiwrap.unwrap(expectedIdForWrappedToken, recipient);

vm.expectRevert("ERC721: owner query for nonexistent token");
vm.expectRevert("ERC721: invalid token ID");
multiwrap.ownerOf(expectedIdForWrappedToken);

assertEq(uriForWrappedToken, multiwrap.tokenURI(expectedIdForWrappedToken));
Expand Down
6 changes: 3 additions & 3 deletions src/test/Pack.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ contract PackTest is BaseTest {
address recipient = address(0x123);

vm.startPrank(address(tokenOwner));
vm.expectRevert("ERC721: transfer caller is not owner nor approved");
vm.expectRevert("ERC721: caller is not token owner nor approved");
pack.createPack(packContents, numOfRewardUnits, packUri, 0, 1, recipient);
}

Expand Down Expand Up @@ -514,7 +514,7 @@ contract PackTest is BaseTest {
address recipient = address(0x123);

vm.startPrank(address(tokenOwner));
vm.expectRevert("ERC721: transfer caller is not owner nor approved");
vm.expectRevert("ERC721: caller is not token owner nor approved");
pack.createPack(packContents, numOfRewardUnits, packUri, 0, 1, recipient);
}

Expand All @@ -527,7 +527,7 @@ contract PackTest is BaseTest {
address recipient = address(0x123);

vm.startPrank(address(tokenOwner));
vm.expectRevert("ERC1155: caller is not owner nor approved");
vm.expectRevert("ERC1155: caller is not token owner nor approved");
pack.createPack(packContents, numOfRewardUnits, packUri, 0, 1, recipient);
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/airdrop/AirdropERC1155.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ contract AirdropERC1155Test is BaseTest {

vm.startPrank(deployer);
drop.addAirdropRecipients(_contents);
vm.expectRevert("ERC1155: caller is not owner nor approved");
vm.expectRevert("ERC1155: caller is not token owner nor approved");
drop.airdrop(_contents.length);
vm.stopPrank();
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/airdrop/AirdropERC721.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ contract AirdropERC721Test is BaseTest {

vm.startPrank(deployer);
drop.addAirdropRecipients(_contents);
vm.expectRevert("ERC721: transfer caller is not owner nor approved");
vm.expectRevert("ERC721: caller is not token owner nor approved");
drop.airdrop(_contents.length);
vm.stopPrank();
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/token/TokenERC721.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ contract TokenERC721Test is BaseTest {
assertEq(tokenContract.totalSupply(), currentTotalSupply);
assertEq(tokenContract.balanceOf(recipient), currentBalanceOfRecipient);

vm.expectRevert("ERC721: owner query for nonexistent token");
vm.expectRevert("ERC721: invalid token ID");
assertEq(tokenContract.ownerOf(nextTokenId), address(0));
}

Expand All @@ -374,7 +374,7 @@ contract TokenERC721Test is BaseTest {
assertEq(tokenContract.totalSupply(), currentTotalSupply);
assertEq(tokenContract.balanceOf(recipient), currentBalanceOfRecipient);

vm.expectRevert("ERC721: owner query for nonexistent token");
vm.expectRevert("ERC721: invalid token ID");
assertEq(tokenContract.ownerOf(nextTokenId), address(0));
}

Expand Down
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -640,20 +640,20 @@
"@types/sinon-chai" "^3.2.3"
"@types/web3" "1.0.19"

"@openzeppelin/contracts-upgradeable@4.5.1":
version "4.5.1"
resolved "https://registry.npmjs.org/@openzeppelin/contracts-upgradeable/-/contracts-upgradeable-4.5.1.tgz"
integrity sha512-xcKycsSyFauIGMhSeeTJW/Jzz9jZUJdiFNP9Wo/9VhMhw8t5X0M92RY6x176VfcIWsxURMHFWOJVTlFA78HI/w==
"@openzeppelin/contracts-upgradeable@4.7.3":
version "4.7.3"
resolved "https://registry.yarnpkg.com/@openzeppelin/contracts-upgradeable/-/contracts-upgradeable-4.7.3.tgz#f1d606e2827d409053f3e908ba4eb8adb1dd6995"
integrity sha512-+wuegAMaLcZnLCJIvrVUDzA9z/Wp93f0Dla/4jJvIhijRrPabjQbZe6fWiECLaJyfn5ci9fqf9vTw3xpQOad2A==

"@openzeppelin/contracts-upgradeable@^4.4.2":
version "4.6.0"
resolved "https://registry.npmjs.org/@openzeppelin/contracts-upgradeable/-/contracts-upgradeable-4.6.0.tgz"
integrity sha512-5OnVuO4HlkjSCJO165a4i2Pu1zQGzMs//o54LPrwUgxvEO2P3ax1QuaSI0cEHHTveA77guS0PnNugpR2JMsPfA==

"@openzeppelin/contracts@4.5.0":
version "4.5.0"
resolved "https://registry.npmjs.org/@openzeppelin/contracts/-/contracts-4.5.0.tgz"
integrity sha512-fdkzKPYMjrRiPK6K4y64e6GzULR7R7RwxSigHS8DDp7aWDeoReqsQI+cxHV1UuhAqX69L1lAaWDxenfP+xiqzA==
"@openzeppelin/contracts@4.7.3":
version "4.7.3"
resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-4.7.3.tgz#939534757a81f8d69cc854c7692805684ff3111e"
integrity sha512-dGRS0agJzu8ybo44pCIf3xBaPQN/65AIXNgK8+4gzKd5kbvlqyxryUYVLJv7fK98Seyd2hDZzVEHSWAh0Bt1Yw==

"@openzeppelin/contracts@^4.4.2":
version "4.7.0"
Expand Down