diff --git a/.openzeppelin/goerli.json b/.openzeppelin/goerli.json index 1ad29b9..869387f 100644 --- a/.openzeppelin/goerli.json +++ b/.openzeppelin/goerli.json @@ -4768,7 +4768,7 @@ "label": "creators", "offset": 0, "slot": "407", - "type": "t_mapping(t_address,t_struct(Creator)7561_storage)", + "type": "t_mapping(t_address,t_struct(Creator)7596_storage)", "contract": "TheBadgeStore", "src": "src/contracts/thebadge/TheBadgeStore.sol:86" }, @@ -4776,7 +4776,7 @@ "label": "badgeModelControllers", "offset": 0, "slot": "408", - "type": "t_mapping(t_string_memory_ptr,t_struct(BadgeModelController)7568_storage)", + "type": "t_mapping(t_string_memory_ptr,t_struct(BadgeModelController)7603_storage)", "contract": "TheBadgeStore", "src": "src/contracts/thebadge/TheBadgeStore.sol:87" }, @@ -4784,7 +4784,7 @@ "label": "badgeModels", "offset": 0, "slot": "409", - "type": "t_mapping(t_uint256,t_struct(BadgeModel)7594_storage)", + "type": "t_mapping(t_uint256,t_struct(BadgeModel)7629_storage)", "contract": "TheBadgeStore", "src": "src/contracts/thebadge/TheBadgeStore.sol:88" }, @@ -4792,7 +4792,7 @@ "label": "badges", "offset": 0, "slot": "410", - "type": "t_mapping(t_uint256,t_struct(Badge)7603_storage)", + "type": "t_mapping(t_uint256,t_struct(Badge)7638_storage)", "contract": "TheBadgeStore", "src": "src/contracts/thebadge/TheBadgeStore.sol:89" }, @@ -4850,7 +4850,7 @@ "label": "mapping(address => mapping(address => bool))", "numberOfBytes": "32" }, - "t_mapping(t_address,t_struct(Creator)7561_storage)": { + "t_mapping(t_address,t_struct(Creator)7596_storage)": { "label": "mapping(address => struct TheBadgeStore.Creator)", "numberOfBytes": "32" }, @@ -4862,7 +4862,7 @@ "label": "mapping(bytes32 => struct AccessControlUpgradeable.RoleData)", "numberOfBytes": "32" }, - "t_mapping(t_string_memory_ptr,t_struct(BadgeModelController)7568_storage)": { + "t_mapping(t_string_memory_ptr,t_struct(BadgeModelController)7603_storage)": { "label": "mapping(string => struct TheBadgeStore.BadgeModelController)", "numberOfBytes": "32" }, @@ -4878,11 +4878,11 @@ "label": "mapping(uint256 => string)", "numberOfBytes": "32" }, - "t_mapping(t_uint256,t_struct(Badge)7603_storage)": { + "t_mapping(t_uint256,t_struct(Badge)7638_storage)": { "label": "mapping(uint256 => struct TheBadgeStore.Badge)", "numberOfBytes": "32" }, - "t_mapping(t_uint256,t_struct(BadgeModel)7594_storage)": { + "t_mapping(t_uint256,t_struct(BadgeModel)7629_storage)": { "label": "mapping(uint256 => struct TheBadgeStore.BadgeModel)", "numberOfBytes": "32" }, @@ -4894,7 +4894,7 @@ "label": "string", "numberOfBytes": "32" }, - "t_struct(Badge)7603_storage": { + "t_struct(Badge)7638_storage": { "label": "struct TheBadgeStore.Badge", "members": [ { @@ -4924,7 +4924,7 @@ ], "numberOfBytes": "128" }, - "t_struct(BadgeModel)7594_storage": { + "t_struct(BadgeModel)7629_storage": { "label": "struct TheBadgeStore.BadgeModel", "members": [ { @@ -4978,7 +4978,7 @@ ], "numberOfBytes": "256" }, - "t_struct(BadgeModelController)7568_storage": { + "t_struct(BadgeModelController)7603_storage": { "label": "struct TheBadgeStore.BadgeModelController", "members": [ { @@ -5014,7 +5014,7 @@ ], "numberOfBytes": "32" }, - "t_struct(Creator)7561_storage": { + "t_struct(Creator)7596_storage": { "label": "struct TheBadgeStore.Creator", "members": [ { @@ -5094,7 +5094,7 @@ "label": "theBadge", "offset": 2, "slot": "0", - "type": "t_contract(TheBadge)6925", + "type": "t_contract(TheBadge)6949", "contract": "KlerosBadgeModelControllerStore", "src": "src/contracts/badgeModelControllers/KleroBadgeModelControllerStore.sol:9" }, @@ -5118,7 +5118,7 @@ "label": "klerosBadgeModel", "offset": 0, "slot": "3", - "type": "t_mapping(t_uint256,t_struct(KlerosBadgeModel)4723_storage)", + "type": "t_mapping(t_uint256,t_struct(KlerosBadgeModel)4724_storage)", "contract": "KlerosBadgeModelControllerStore", "src": "src/contracts/badgeModelControllers/KleroBadgeModelControllerStore.sol:79" }, @@ -5126,7 +5126,7 @@ "label": "klerosBadge", "offset": 0, "slot": "4", - "type": "t_mapping(t_uint256,t_struct(KlerosBadge)4732_storage)", + "type": "t_mapping(t_uint256,t_struct(KlerosBadge)4733_storage)", "contract": "KlerosBadgeModelControllerStore", "src": "src/contracts/badgeModelControllers/KleroBadgeModelControllerStore.sol:80" }, @@ -5204,7 +5204,7 @@ "label": "contract IArbitrator", "numberOfBytes": "20" }, - "t_contract(TheBadge)6925": { + "t_contract(TheBadge)6949": { "label": "contract TheBadge", "numberOfBytes": "20" }, @@ -5216,15 +5216,15 @@ "label": "mapping(bytes32 => struct AccessControlUpgradeable.RoleData)", "numberOfBytes": "32" }, - "t_mapping(t_uint256,t_struct(KlerosBadge)4732_storage)": { + "t_mapping(t_uint256,t_struct(KlerosBadge)4733_storage)": { "label": "mapping(uint256 => struct KlerosBadgeModelControllerStore.KlerosBadge)", "numberOfBytes": "32" }, - "t_mapping(t_uint256,t_struct(KlerosBadgeModel)4723_storage)": { + "t_mapping(t_uint256,t_struct(KlerosBadgeModel)4724_storage)": { "label": "mapping(uint256 => struct KlerosBadgeModelControllerStore.KlerosBadgeModel)", "numberOfBytes": "32" }, - "t_struct(KlerosBadge)4732_storage": { + "t_struct(KlerosBadge)4733_storage": { "label": "struct KlerosBadgeModelControllerStore.KlerosBadge", "members": [ { @@ -5254,7 +5254,7 @@ ], "numberOfBytes": "128" }, - "t_struct(KlerosBadgeModel)4723_storage": { + "t_struct(KlerosBadgeModel)4724_storage": { "label": "struct KlerosBadgeModelControllerStore.KlerosBadgeModel", "members": [ { diff --git a/lib/openzeppelin-contracts b/lib/openzeppelin-contracts index 49c0e43..b867357 160000 --- a/lib/openzeppelin-contracts +++ b/lib/openzeppelin-contracts @@ -1 +1 @@ -Subproject commit 49c0e4370d0cc50ea6090709e3835a3091e33ee2 +Subproject commit b8673572b090ae606b93426d804df9be15c03917 diff --git a/lib/openzeppelin-contracts-upgradeable b/lib/openzeppelin-contracts-upgradeable index 65420cb..49d734a 160000 --- a/lib/openzeppelin-contracts-upgradeable +++ b/lib/openzeppelin-contracts-upgradeable @@ -1 +1 @@ -Subproject commit 65420cb9c943c32eb7e8c9da60183a413d90067a +Subproject commit 49d734a07e08ac55710da8a54c50d6ee60f3fb7a diff --git a/script/01_deploy.ts b/script/01_deploy.ts index ace89ac..1599f6d 100644 --- a/script/01_deploy.ts +++ b/script/01_deploy.ts @@ -1,5 +1,5 @@ import * as dotenv from "dotenv"; -import hre, { run, upgrades } from "hardhat"; +import hre, { upgrades } from "hardhat"; import { HardhatRuntimeEnvironment } from "hardhat/types"; dotenv.config(); diff --git a/script/03_verify.ts b/script/03_verify.ts index e72a58e..6b8281c 100644 --- a/script/03_verify.ts +++ b/script/03_verify.ts @@ -1,6 +1,5 @@ import * as dotenv from "dotenv"; -import hre, { run, upgrades } from "hardhat"; -import { HardhatRuntimeEnvironment } from "hardhat/types"; +import { run } from "hardhat"; dotenv.config(); @@ -12,7 +11,7 @@ if (!GOERLI_THE_BADGE_CONTRACT_ADDRESS || !GOERLI_KLEROS_BADGE_MODEL_CONTROLLER_ const theBadgeDeployedAddress = GOERLI_THE_BADGE_CONTRACT_ADDRESS; const klerosBadgeModelControllerDeployedAddress = GOERLI_KLEROS_BADGE_MODEL_CONTROLLER_CONTRACT_ADDRESS; -async function main(hre: HardhatRuntimeEnvironment) { +async function main() { console.log("Verifying TheBadge contract on Etherscan..."); await run(`verify:verify`, { address: theBadgeDeployedAddress, @@ -28,7 +27,7 @@ async function main(hre: HardhatRuntimeEnvironment) { // We recommend this pattern to be able to use async/await everywhere // and properly handle errors. -main(hre).catch((error) => { +main().catch((error) => { console.error(error); process.exitCode = 1; }); diff --git a/src/contracts/badgeModelControllers/KleroBadgeModelControllerStore.sol b/src/contracts/badgeModelControllers/KleroBadgeModelControllerStore.sol index 5295d8d..8bf8e04 100644 --- a/src/contracts/badgeModelControllers/KleroBadgeModelControllerStore.sol +++ b/src/contracts/badgeModelControllers/KleroBadgeModelControllerStore.sol @@ -3,7 +3,7 @@ pragma solidity 0.8.17; import { IArbitrator } from "../../../lib/erc-792/contracts/IArbitrator.sol"; import { TheBadge } from "../thebadge/TheBadge.sol"; -import "../../utils/CappedMath.sol"; +import { CappedMath } from "../../utils/CappedMath.sol"; contract KlerosBadgeModelControllerStore { TheBadge public theBadge; diff --git a/src/contracts/badgeModelControllers/KlerosBadgeModelController.sol b/src/contracts/badgeModelControllers/KlerosBadgeModelController.sol index 6d21210..c2cf38c 100644 --- a/src/contracts/badgeModelControllers/KlerosBadgeModelController.sol +++ b/src/contracts/badgeModelControllers/KlerosBadgeModelController.sol @@ -4,11 +4,14 @@ pragma solidity 0.8.17; import { ILightGeneralizedTCR } from "../../interfaces/ILightGeneralizedTCR.sol"; import { ILightGTCRFactory } from "../../interfaces/ILightGTCRFactory.sol"; -import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; -import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; -import "../../interfaces/IBadgeModelController.sol"; -import "./KleroBadgeModelControllerStore.sol"; -import "../thebadge/TheBadgeRoles.sol"; +import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; +import { UUPSUpgradeable } from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; +import { IBadgeModelController } from "../../interfaces/IBadgeModelController.sol"; +import { TheBadgeRoles } from "../thebadge/TheBadgeRoles.sol"; +import { KlerosBadgeModelControllerStore } from "./KleroBadgeModelControllerStore.sol"; +import { CappedMath } from "../../utils/CappedMath.sol"; +import { IArbitrator } from "../../../lib/erc-792/contracts/IArbitrator.sol"; +import { TheBadge } from "../thebadge/TheBadge.sol"; contract KlerosBadgeModelController is Initializable, diff --git a/src/contracts/thebadge/TheBadge.sol b/src/contracts/thebadge/TheBadge.sol index 4ea39da..795d309 100644 --- a/src/contracts/thebadge/TheBadge.sol +++ b/src/contracts/thebadge/TheBadge.sol @@ -1,17 +1,17 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.17; -import "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol"; -import "@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155URIStorageUpgradeable.sol"; -import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; -import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; -import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; -import "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol"; - -import "./TheBadgeRoles.sol"; -import "./TheBadgeStore.sol"; -import "./TheBadgeModels.sol"; -import "../../interfaces/ITheBadge.sol"; +import { ERC1155Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol"; +import { ERC1155URIStorageUpgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155URIStorageUpgradeable.sol"; +import { PausableUpgradeable } from "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; +import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; +import { UUPSUpgradeable } from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; +import { CountersUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol"; +import { TheBadgeRoles } from "./TheBadgeRoles.sol"; +import { TheBadgeModels } from "./TheBadgeModels.sol"; +import { ITheBadge } from "../../interfaces/ITheBadge.sol"; +import { AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; +import { IBadgeModelController } from "../../interfaces/IBadgeModelController.sol"; /// @custom:security-contact hello@thebadge.com contract TheBadge is diff --git a/src/contracts/thebadge/TheBadgeModels.sol b/src/contracts/thebadge/TheBadgeModels.sol index 8aa5d6a..ca7a31e 100644 --- a/src/contracts/thebadge/TheBadgeModels.sol +++ b/src/contracts/thebadge/TheBadgeModels.sol @@ -6,10 +6,12 @@ pragma solidity ^0.8.17; * ========================= */ -import "../../interfaces/IBadgeModelController.sol"; -import "./TheBadgeRoles.sol"; -import "./TheBadgeStore.sol"; -import "../../interfaces/ITheBadgeModels.sol"; +import "../../interfaces/IBadgeModelController.sol" as BadgeModelController; +import { TheBadgeRoles } from "./TheBadgeRoles.sol"; +import { TheBadgeStore } from "./TheBadgeStore.sol"; +import { ITheBadgeModels } from "../../interfaces/ITheBadgeModels.sol"; +import { CountersUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol"; +import { IBadgeModelController } from "../../interfaces/IBadgeModelController.sol"; contract TheBadgeModels is TheBadgeRoles, TheBadgeStore, ITheBadgeModels { // Allows to use current() and increment() for badgeModelIds or badgeIds diff --git a/src/contracts/thebadge/TheBadgeRoles.sol b/src/contracts/thebadge/TheBadgeRoles.sol index 0254b91..0966b45 100644 --- a/src/contracts/thebadge/TheBadgeRoles.sol +++ b/src/contracts/thebadge/TheBadgeRoles.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.17; -import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; +import { AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; contract TheBadgeRoles is AccessControlUpgradeable { bytes32 public constant URI_SETTER_ROLE = keccak256("URI_SETTER_ROLE"); diff --git a/src/contracts/thebadge/TheBadgeStore.sol b/src/contracts/thebadge/TheBadgeStore.sol index 9812187..c6c977f 100644 --- a/src/contracts/thebadge/TheBadgeStore.sol +++ b/src/contracts/thebadge/TheBadgeStore.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.17; -import "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol"; -import "./TheBadgeRoles.sol"; -import "../../interfaces/IBadgeModelController.sol"; +import { CountersUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol"; +import { TheBadgeRoles } from "./TheBadgeRoles.sol"; +import { IBadgeModelController } from "../../interfaces/IBadgeModelController.sol"; // TODO: Maybe we can use abstract classes to type the store contract TheBadgeStore is TheBadgeRoles { diff --git a/src/interfaces/ITheBadge.sol b/src/interfaces/ITheBadge.sol index 3a807e9..5cf7b01 100644 --- a/src/interfaces/ITheBadge.sol +++ b/src/interfaces/ITheBadge.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.17; -import "@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155Upgradeable.sol"; +import { IERC1155Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155Upgradeable.sol"; interface ITheBadge is IERC1155Upgradeable { // Write methods diff --git a/src/interfaces/ITheBadgeModels.sol b/src/interfaces/ITheBadgeModels.sol index 8fb4a3e..af7c453 100644 --- a/src/interfaces/ITheBadgeModels.sol +++ b/src/interfaces/ITheBadgeModels.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.17; -import "../contracts/thebadge/TheBadgeStore.sol"; +import { TheBadgeStore } from "../contracts/thebadge/TheBadgeStore.sol"; interface ITheBadgeModels { // Write methods diff --git a/tasks/createCollection.ts b/tasks/createCollection.ts index b100c59..9ab20b6 100644 --- a/tasks/createCollection.ts +++ b/tasks/createCollection.ts @@ -3,8 +3,7 @@ import { HardhatRuntimeEnvironment } from "hardhat/types"; export default task("create-collection", "Create The Badge collection").setAction( async (hre: HardhatRuntimeEnvironment) => { - const { deployments, getNamedAccounts, ethers } = hre; - const { deployer } = await getNamedAccounts(); + const { ethers } = hre; const TheBadge = await ethers.getContractFactory("TheBadge"); const collection = await TheBadge.deploy();