Skip to content

Commit

Permalink
refactor: use Ownable2Step instead of Ownable
Browse files Browse the repository at this point in the history
This has been discussed in #7 and be further explored in OpenZeppelin/openzeppelin-contracts#3620

Closes #7
  • Loading branch information
0x-r4bbit committed Sep 13, 2023
1 parent 0602ce4 commit c036ff1
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
36 changes: 18 additions & 18 deletions .gas-snapshot
@@ -1,7 +1,7 @@
AddEntryTest:test_AddEntry() (gas: 44369)
AddEntryTest:test_RevertWhen_EntryAlreadyExists() (gas: 42598)
AddEntryTest:test_RevertWhen_InvalidAddress() (gas: 25087)
AddEntryTest:test_RevertWhen_SenderIsNotTokenDeployer() (gas: 14804)
AddEntryTest:test_AddEntry() (gas: 44392)
AddEntryTest:test_RevertWhen_EntryAlreadyExists() (gas: 42644)
AddEntryTest:test_RevertWhen_InvalidAddress() (gas: 25133)
AddEntryTest:test_RevertWhen_SenderIsNotTokenDeployer() (gas: 14827)
CollectibleV1Test:test_Deployment() (gas: 38626)
CommunityERC20Test:test_Deployment() (gas: 29720)
CommunityTokenDeployerTest:test_Deployment() (gas: 14805)
Expand All @@ -16,18 +16,18 @@ CreateTest:test_RevertWhen_SenderIsNotTokenDeployer() (gas: 16421)
CreateTest:test_RevertWhen_SenderIsNotTokenDeployer() (gas: 16524)
DeployContracts:test() (gas: 120)
DeployOwnerAndMasterToken:test() (gas: 120)
DeployTest:test_Deploy() (gas: 4840232)
DeployTest:test_Deploy() (gas: 4840322)
DeployTest:test_Deployment() (gas: 14925)
DeployTest:test_RevertWhen_AlreadyDeployed() (gas: 4836115)
DeployTest:test_RevertWhen_DeploymentSignatureExpired() (gas: 53642)
DeployTest:test_RevertWhen_InvalidCommunityAddress() (gas: 51341)
DeployTest:test_RevertWhen_InvalidDeployerAddress() (gas: 55329)
DeployTest:test_RevertWhen_InvalidDeploymentSignature() (gas: 65663)
DeployTest:test_RevertWhen_InvalidSignerPublicKey() (gas: 53435)
DeployTest:test_RevertWhen_InvalidTokenMetadata() (gas: 2639807)
DeployTest:test_RevertWhen_AlreadyDeployed() (gas: 4836205)
DeployTest:test_RevertWhen_DeploymentSignatureExpired() (gas: 53709)
DeployTest:test_RevertWhen_InvalidCommunityAddress() (gas: 51408)
DeployTest:test_RevertWhen_InvalidDeployerAddress() (gas: 55396)
DeployTest:test_RevertWhen_InvalidDeploymentSignature() (gas: 65730)
DeployTest:test_RevertWhen_InvalidSignerPublicKey() (gas: 53502)
DeployTest:test_RevertWhen_InvalidTokenMetadata() (gas: 2639874)
DeploymentTest:test_Deployment() (gas: 14671)
DeploymentTest:test_Deployment() (gas: 14671)
DeploymentTest:test_Deployment() (gas: 17250)
DeploymentTest:test_Deployment() (gas: 17295)
GetEntryTest:test_ReturnZeroAddressIfEntryDoesNotExist() (gas: 11906)
MintToTest:test_Deployment() (gas: 29742)
MintToTest:test_Deployment() (gas: 38626)
Expand All @@ -44,17 +44,17 @@ RemoteBurnTest:test_Deployment() (gas: 85482)
RemoteBurnTest:test_RemoteBurn() (gas: 455285)
RemoteBurnTest:test_RevertWhen_RemoteBurn() (gas: 19499)
RemoteBurnTest:test_RevertWhen_SenderIsNotOwner() (gas: 25211)
SetCommunityTokenDeployerAddressTest:test_RevertWhen_InvalidTokenDeployerAddress() (gas: 12963)
SetCommunityTokenDeployerAddressTest:test_RevertWhen_SenderIsNotOwner() (gas: 12504)
SetCommunityTokenDeployerAddressTest:test_SetCommunityTokenDeployerAddress() (gas: 22807)
SetCommunityTokenDeployerAddressTest:test_RevertWhen_InvalidTokenDeployerAddress() (gas: 12941)
SetCommunityTokenDeployerAddressTest:test_RevertWhen_SenderIsNotOwner() (gas: 12482)
SetCommunityTokenDeployerAddressTest:test_SetCommunityTokenDeployerAddress() (gas: 22808)
SetDeploymentRegistryAddressTest:test_Deployment() (gas: 14827)
SetDeploymentRegistryAddressTest:test_RevertWhen_InvalidDeploymentRegistryAddress() (gas: 13014)
SetDeploymentRegistryAddressTest:test_RevertWhen_SenderIsNotOwner() (gas: 12508)
SetDeploymentRegistryAddressTest:test_SetDeploymentRegistryAddress() (gas: 22903)
SetDeploymentRegistryAddressTest:test_SetDeploymentRegistryAddress() (gas: 22881)
SetMasterTokenFactoryAddressTest:test_Deployment() (gas: 14805)
SetMasterTokenFactoryAddressTest:test_RevertWhen_InvalidTokenFactoryAddress() (gas: 13014)
SetMasterTokenFactoryAddressTest:test_RevertWhen_SenderIsNotOwner() (gas: 12487)
SetMasterTokenFactoryAddressTest:test_SetOwnerTokenFactoryAddress() (gas: 22861)
SetMasterTokenFactoryAddressTest:test_SetOwnerTokenFactoryAddress() (gas: 22883)
SetMaxSupplyTest:test_Deployment() (gas: 29720)
SetMaxSupplyTest:test_Deployment() (gas: 85482)
SetMaxSupplyTest:test_RevertWhen_CalledBecauseMaxSupplyIsLocked() (gas: 16521)
Expand Down
4 changes: 2 additions & 2 deletions contracts/CommunityOwnerTokenRegistry.sol
Expand Up @@ -2,7 +2,7 @@

pragma solidity ^0.8.17;

import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { Ownable2Step } from "@openzeppelin/contracts/access/Ownable2Step.sol";
import { IAddressRegistry } from "./interfaces/IAddressRegistry.sol";
import { OwnerToken } from "./tokens/OwnerToken.sol";

Expand All @@ -24,7 +24,7 @@ import { OwnerToken } from "./tokens/OwnerToken.sol";
* registry contract.
* @dev Only `tokenDeployer` can add entries to the registry.
*/
contract CommunityOwnerTokenRegistry is IAddressRegistry, Ownable {
contract CommunityOwnerTokenRegistry is IAddressRegistry, Ownable2Step {
error CommunityOwnerTokenRegistry_NotAuthorized();
error CommunityOwnerTokenRegistry_EntryAlreadyExists();
error CommunityOwnerTokenRegistry_InvalidAddress();
Expand Down
4 changes: 2 additions & 2 deletions contracts/CommunityTokenDeployer.sol
Expand Up @@ -2,7 +2,7 @@

pragma solidity ^0.8.17;

import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { Ownable2Step } from "@openzeppelin/contracts/access/Ownable2Step.sol";
import { ECDSA } from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import { EIP712 } from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";
import { ITokenFactory } from "./interfaces/ITokenFactory.sol";
Expand Down Expand Up @@ -39,7 +39,7 @@ import { IAddressRegistry } from "./interfaces/IAddressRegistry.sol";
* @dev The `CommunityOwnerTokenFactory` address can be changed by the owner of this contract.
* @dev The `CommunityMasterTokenFactory` address can be changed by the owner of this contract.
*/
contract CommunityTokenDeployer is EIP712("CommunityTokenDeployer", "1"), Ownable {
contract CommunityTokenDeployer is EIP712("CommunityTokenDeployer", "1"), Ownable2Step {
using ECDSA for bytes32;

error CommunityTokenDeployer_InvalidDeploymentRegistryAddress();
Expand Down
4 changes: 2 additions & 2 deletions contracts/factories/BaseTokenFactory.sol
Expand Up @@ -2,7 +2,7 @@
pragma solidity ^0.8.17;

import { ITokenFactory } from "../interfaces/ITokenFactory.sol";
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { Ownable2Step } from "@openzeppelin/contracts/access/Ownable2Step.sol";

/**
* @title BaseTokenFactory contract
Expand All @@ -15,7 +15,7 @@ import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
*
* @dev Other factory contract inherit from this contract.
*/
abstract contract BaseTokenFactory is ITokenFactory, Ownable {
abstract contract BaseTokenFactory is ITokenFactory, Ownable2Step {
error BaseTokenFactory_InvalidTokenDeployerAddress();
error BaseTokenFactory_NotAuthorized();
error BaseTokenFactory_InvalidTokenMetadata();
Expand Down

0 comments on commit c036ff1

Please sign in to comment.