Skip to content

Commit

Permalink
feat: upgrade solc version, use only one OZ version
Browse files Browse the repository at this point in the history
  • Loading branch information
Andres Adjimann committed Aug 7, 2024
1 parent b0b9438 commit f371d35
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT
// solhint-disable-next-line compiler-version
pragma solidity 0.8.15;
pragma solidity 0.8.26;

/// @dev minimal ERC2771 handler to keep bytecode-size down
/// based on: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.6.0/contracts/metatx/ERC2771Context.sol
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.8.15;
pragma solidity 0.8.26;

import {ERC721Upgradeable} from "@openzeppelin/contracts-upgradeable-0.8.13/token/ERC721/ERC721Upgradeable.sol";

Expand Down
18 changes: 7 additions & 11 deletions packages/avatar/contracts/nft-collection/NFTCollection.sol
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.8.15;
pragma solidity 0.8.26;

import {ReentrancyGuardUpgradeable} from "@openzeppelin/contracts-upgradeable-0.8.13/security/ReentrancyGuardUpgradeable.sol";
import {Ownable2StepUpgradeable} from "@openzeppelin/contracts-upgradeable-0.8.13/access/Ownable2StepUpgradeable.sol";
import {ContextUpgradeable} from "@openzeppelin/contracts-upgradeable-0.8.13/utils/ContextUpgradeable.sol";
import {PausableUpgradeable} from "@openzeppelin/contracts-upgradeable-0.8.13/security/PausableUpgradeable.sol";
import {ECDSA} from "@openzeppelin/contracts-0.8.15/utils/cryptography/ECDSA.sol";
import {IERC20} from "@openzeppelin/contracts-0.8.15/token/ERC20/IERC20.sol";
import {IERC20Metadata} from "@openzeppelin/contracts-0.8.15/token/ERC20/extensions/IERC20Metadata.sol";
import {SafeERC20} from "@openzeppelin/contracts-0.8.15/token/ERC20/utils/SafeERC20.sol";
import {ERC2981Upgradeable} from "@openzeppelin/contracts-upgradeable-0.8.13/token/common/ERC2981Upgradeable.sol";
import {ERC721Upgradeable} from "@openzeppelin/contracts-upgradeable-0.8.13/token/ERC721/ERC721Upgradeable.sol";
import {ECDSA} from "@openzeppelin/contracts-0.8.13/utils/cryptography/ECDSA.sol";
import {IERC20} from "@openzeppelin/contracts-0.8.13/token/ERC20/IERC20.sol";
import {IERC20Metadata} from "@openzeppelin/contracts-0.8.13/token/ERC20/extensions/IERC20Metadata.sol";
import {SafeERC20} from "@openzeppelin/contracts-0.8.13/token/ERC20/utils/SafeERC20.sol";
import {IERC4906} from "../common/IERC4906.sol";
import {UpdatableOperatorFiltererUpgradeable} from "./UpdatableOperatorFiltererUpgradeable.sol";
import {ERC2771HandlerUpgradeable} from "./ERC2771HandlerUpgradeable.sol";
Expand Down Expand Up @@ -493,11 +493,9 @@ IERC4906
SafeERC20.safeTransferFrom(IERC20(_msgSender()), _wallet, mintTreasury, _price);
}

for (uint256 i; i < _amount;) {
for (uint256 i; i < _amount; i++) {
// @dev start with tokenId = 1
_safeMint(_wallet, totalSupply + i + 1);

unchecked {++i;}
}
waveOwnerToClaimedCounts[_wallet][indexWave - 1] += _amount;
waveTotalMinted += _amount;
Expand All @@ -518,15 +516,13 @@ IERC4906

require(_checkWaveNotComplete(_amount), "NFTCollection: wave completed");

for (uint256 i; i < _amount;) {
for (uint256 i; i < _amount; i++) {
address _wallet = _wallets[i];
require(_checkLimitNotReached(_wallet, 1), "NFTCollection: max allowed");
// @dev safeMint already checks the destination address
// @dev start with tokenId = 1
_safeMint(_wallet, totalSupply + i + 1);
waveOwnerToClaimedCounts[_wallet][indexWave - 1] += 1;

unchecked {++i;}
}
waveTotalMinted += _amount;
totalSupply += _amount;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT
// solhint-disable one-contract-per-file
pragma solidity 0.8.15;
pragma solidity 0.8.26;

import {ContextUpgradeable} from "@openzeppelin/contracts-upgradeable-0.8.13/utils/ContextUpgradeable.sol";

Expand Down
9 changes: 9 additions & 0 deletions packages/avatar/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ const config: HardhatUserConfig = {
},
solidity: {
compilers: [
{
version: '0.8.26',
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
{
version: '0.8.18',
settings: {
Expand Down
1 change: 1 addition & 0 deletions packages/deploy/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ const networks = {
};

const compilers = [
'0.8.26',
'0.8.23',
'0.8.21',
'0.8.19',
Expand Down

1 comment on commit f371d35

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage for this commit

77.98%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
packages/avatar/contracts/avatar
   AvatarCollection.sol74.25%56.56%73.81%90.37%285, 329–337, 339–340, 345, 403–407, 425, 442, 459, 483–487, 491–492, 495, 526, 537, 545, 545–546, 565, 599, 621, 631, 712, 732, 745, 745, 745, 763, 763, 765, 774, 774, 776, 786, 786–787, 797, 797–798, 809, 809–810, 823, 832, 861–862, 992–993, 996, 999
   CollectionAccessControl.sol60.87%53.33%63.64%67.86%120, 130–131, 140, 150–151, 161–162, 162, 162, 164–165, 167, 173, 173–174, 185, 192, 192–194, 98–99
   ERC721BurnMemoryEnumerableUpgradeable.sol93.33%75%100%100%62, 75
packages/avatar/contracts/common
   IERC4906.sol100%100%100%100%
   IERC5313.sol100%100%100%100%
packages/avatar/contracts/common/BaseWithStorage/ERC2771
   ERC2771HandlerUpgradeable.sol44.44%25%60%44.44%23, 27, 30, 39, 39, 39–40, 42
packages/avatar/contracts/common/OperatorFilterer
   IOperatorFilterRegistry.sol100%100%100%100%
   UpdatableOperatorFiltererUpgradeable.sol11.11%10%25%9.52%18, 23–24, 24, 24–25, 27, 27, 27–28, 30, 38, 38, 38, 42, 42, 42–44, 46, 46, 46–47, 50, 55, 55, 55–56, 56, 56–57, 60, 68, 68, 68–69, 71
packages/avatar/contracts/nft-collection
   ERC2771HandlerUpgradeable.sol46.15%25%57.14%46.67%22, 29, 40–41, 53–55, 55, 55–56, 58
   ERC721BurnMemoryUpgradeable.sol93.55%75%100%100%63, 76
   NFTCollection.sol60.40%44.67%61.70%75.32%281, 325–333, 335–336, 341, 400–404, 422, 439, 456, 480–484, 488–489, 492, 512, 512, 512, 512, 512, 512–513, 513, 513–515, 515, 515, 517, 517, 517, 519–521, 521, 521, 524–525, 527–528, 547, 558, 566, 566–567, 586, 616, 618, 640, 650, 685, 726, 726–731, 731, 731–732, 745, 745–750, 750, 750–751, 760, 760–761, 767, 767–768, 780, 780–781, 787, 787–788, 808, 828, 841, 841, 841, 851, 851, 853, 862, 862, 864, 874, 874–875, 885, 885–886, 897, 897–898, 911, 920, 949–950
   UpdatableOperatorFiltererUpgradeable.sol19.51%7.14%40%22.73%100, 100, 100–101, 103, 114–115, 115, 115–116, 116, 116–117, 119, 119, 119–120, 122, 146–147, 147, 147, 149–150, 150, 150–151, 155, 88–89
packages/avatar/contracts/proxy
   CollectionFactory.sol86.59%89.06%75%87.50%149, 230, 293, 362–366, 368, 385, 402, 410, 410–411, 423, 423–424
   CollectionProxy.sol88.24%50%100%100%55, 70
packages/avatar/contracts/raffle
   DanceFight.sol75%50%100%100%20
   FistOfTheNorthStar.sol75%50%100%100%20
   GenericRaffle.sol67.92%52.22%62.07%84.95%178, 189–195, 225–229, 252–259, 266–267, 270, 288, 288–289, 289, 289–290, 308, 381, 390, 409, 409–410, 419, 419, 421, 430, 430, 432, 442, 442–443, 453, 453–454, 465, 465–466, 566, 575, 626–627, 630, 633
   HellsKitchen.sol75%50%100%100%20
   MadBalls.sol75%50%100%100%20
   ParisHilton.sol75%50%100%100%20
   Rabbids.sol75%50%100%100%20

Please sign in to comment.