refactor: use `Ownable2Step` instead of `Ownable` (#10)
This has been discussed in #7 and be further explored in https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3620 Closes #7
This commit is contained in:
parent
16121a4f72
commit
8f633ee442
|
@ -1,7 +1,7 @@
|
||||||
AddEntryTest:test_AddEntry() (gas: 44369)
|
AddEntryTest:test_AddEntry() (gas: 44392)
|
||||||
AddEntryTest:test_RevertWhen_EntryAlreadyExists() (gas: 42598)
|
AddEntryTest:test_RevertWhen_EntryAlreadyExists() (gas: 42644)
|
||||||
AddEntryTest:test_RevertWhen_InvalidAddress() (gas: 25087)
|
AddEntryTest:test_RevertWhen_InvalidAddress() (gas: 25133)
|
||||||
AddEntryTest:test_RevertWhen_SenderIsNotTokenDeployer() (gas: 14804)
|
AddEntryTest:test_RevertWhen_SenderIsNotTokenDeployer() (gas: 14827)
|
||||||
CollectibleV1Test:test_Deployment() (gas: 38626)
|
CollectibleV1Test:test_Deployment() (gas: 38626)
|
||||||
CommunityERC20Test:test_Deployment() (gas: 29720)
|
CommunityERC20Test:test_Deployment() (gas: 29720)
|
||||||
CommunityTokenDeployerTest:test_Deployment() (gas: 14805)
|
CommunityTokenDeployerTest:test_Deployment() (gas: 14805)
|
||||||
|
@ -16,17 +16,17 @@ CreateTest:test_RevertWhen_SenderIsNotTokenDeployer() (gas: 16421)
|
||||||
CreateTest:test_RevertWhen_SenderIsNotTokenDeployer() (gas: 16524)
|
CreateTest:test_RevertWhen_SenderIsNotTokenDeployer() (gas: 16524)
|
||||||
DeployContracts:test() (gas: 120)
|
DeployContracts:test() (gas: 120)
|
||||||
DeployOwnerAndMasterToken:test() (gas: 120)
|
DeployOwnerAndMasterToken:test() (gas: 120)
|
||||||
DeployTest:test_Deploy() (gas: 4778686)
|
DeployTest:test_Deploy() (gas: 4778776)
|
||||||
DeployTest:test_Deployment() (gas: 14947)
|
DeployTest:test_Deployment() (gas: 14947)
|
||||||
DeployTest:test_RevertWhen_AlreadyDeployed() (gas: 4774488)
|
DeployTest:test_RevertWhen_AlreadyDeployed() (gas: 4774645)
|
||||||
DeployTest:test_RevertWhen_InvalidCommunityAddress() (gas: 51318)
|
DeployTest:test_RevertWhen_InvalidCommunityAddress() (gas: 51385)
|
||||||
DeployTest:test_RevertWhen_InvalidDeployerAddress() (gas: 55205)
|
DeployTest:test_RevertWhen_InvalidDeployerAddress() (gas: 55272)
|
||||||
DeployTest:test_RevertWhen_InvalidDeploymentSignature() (gas: 65550)
|
DeployTest:test_RevertWhen_InvalidDeploymentSignature() (gas: 65617)
|
||||||
DeployTest:test_RevertWhen_InvalidSignerPublicKey() (gas: 53366)
|
DeployTest:test_RevertWhen_InvalidSignerPublicKey() (gas: 53433)
|
||||||
DeployTest:test_RevertWhen_InvalidTokenMetadata() (gas: 2612983)
|
DeployTest:test_RevertWhen_InvalidTokenMetadata() (gas: 2613184)
|
||||||
DeploymentTest:test_Deployment() (gas: 14671)
|
DeploymentTest:test_Deployment() (gas: 14671)
|
||||||
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)
|
GetEntryTest:test_ReturnZeroAddressIfEntryDoesNotExist() (gas: 11906)
|
||||||
MintToTest:test_Deployment() (gas: 29742)
|
MintToTest:test_Deployment() (gas: 29742)
|
||||||
MintToTest:test_Deployment() (gas: 38626)
|
MintToTest:test_Deployment() (gas: 38626)
|
||||||
|
@ -43,17 +43,17 @@ RemoteBurnTest:test_Deployment() (gas: 85482)
|
||||||
RemoteBurnTest:test_RemoteBurn() (gas: 455309)
|
RemoteBurnTest:test_RemoteBurn() (gas: 455309)
|
||||||
RemoteBurnTest:test_RevertWhen_RemoteBurn() (gas: 19091)
|
RemoteBurnTest:test_RevertWhen_RemoteBurn() (gas: 19091)
|
||||||
RemoteBurnTest:test_RevertWhen_SenderIsNotOwner() (gas: 24791)
|
RemoteBurnTest:test_RevertWhen_SenderIsNotOwner() (gas: 24791)
|
||||||
SetCommunityTokenDeployerAddressTest:test_RevertWhen_InvalidTokenDeployerAddress() (gas: 12963)
|
SetCommunityTokenDeployerAddressTest:test_RevertWhen_InvalidTokenDeployerAddress() (gas: 12941)
|
||||||
SetCommunityTokenDeployerAddressTest:test_RevertWhen_SenderIsNotOwner() (gas: 12504)
|
SetCommunityTokenDeployerAddressTest:test_RevertWhen_SenderIsNotOwner() (gas: 12482)
|
||||||
SetCommunityTokenDeployerAddressTest:test_SetCommunityTokenDeployerAddress() (gas: 22807)
|
SetCommunityTokenDeployerAddressTest:test_SetCommunityTokenDeployerAddress() (gas: 22808)
|
||||||
SetDeploymentRegistryAddressTest:test_Deployment() (gas: 14827)
|
SetDeploymentRegistryAddressTest:test_Deployment() (gas: 14827)
|
||||||
SetDeploymentRegistryAddressTest:test_RevertWhen_InvalidDeploymentRegistryAddress() (gas: 13014)
|
SetDeploymentRegistryAddressTest:test_RevertWhen_InvalidDeploymentRegistryAddress() (gas: 13014)
|
||||||
SetDeploymentRegistryAddressTest:test_RevertWhen_SenderIsNotOwner() (gas: 12508)
|
SetDeploymentRegistryAddressTest:test_RevertWhen_SenderIsNotOwner() (gas: 12508)
|
||||||
SetDeploymentRegistryAddressTest:test_SetDeploymentRegistryAddress() (gas: 22903)
|
SetDeploymentRegistryAddressTest:test_SetDeploymentRegistryAddress() (gas: 22881)
|
||||||
SetMasterTokenFactoryAddressTest:test_Deployment() (gas: 14805)
|
SetMasterTokenFactoryAddressTest:test_Deployment() (gas: 14805)
|
||||||
SetMasterTokenFactoryAddressTest:test_RevertWhen_InvalidTokenFactoryAddress() (gas: 12992)
|
SetMasterTokenFactoryAddressTest:test_RevertWhen_InvalidTokenFactoryAddress() (gas: 12992)
|
||||||
SetMasterTokenFactoryAddressTest:test_RevertWhen_SenderIsNotOwner() (gas: 12465)
|
SetMasterTokenFactoryAddressTest:test_RevertWhen_SenderIsNotOwner() (gas: 12465)
|
||||||
SetMasterTokenFactoryAddressTest:test_SetOwnerTokenFactoryAddress() (gas: 22839)
|
SetMasterTokenFactoryAddressTest:test_SetOwnerTokenFactoryAddress() (gas: 22861)
|
||||||
SetMaxSupplyTest:test_Deployment() (gas: 29720)
|
SetMaxSupplyTest:test_Deployment() (gas: 29720)
|
||||||
SetMaxSupplyTest:test_Deployment() (gas: 85482)
|
SetMaxSupplyTest:test_Deployment() (gas: 85482)
|
||||||
SetMaxSupplyTest:test_RevertWhen_CalledBecauseMaxSupplyIsLocked() (gas: 16533)
|
SetMaxSupplyTest:test_RevertWhen_CalledBecauseMaxSupplyIsLocked() (gas: 16533)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
pragma solidity ^0.8.17;
|
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 { IAddressRegistry } from "./interfaces/IAddressRegistry.sol";
|
||||||
import { OwnerToken } from "./tokens/OwnerToken.sol";
|
import { OwnerToken } from "./tokens/OwnerToken.sol";
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ import { OwnerToken } from "./tokens/OwnerToken.sol";
|
||||||
* registry contract.
|
* registry contract.
|
||||||
* @dev Only `tokenDeployer` can add entries to the registry.
|
* @dev Only `tokenDeployer` can add entries to the registry.
|
||||||
*/
|
*/
|
||||||
contract CommunityOwnerTokenRegistry is IAddressRegistry, Ownable {
|
contract CommunityOwnerTokenRegistry is IAddressRegistry, Ownable2Step {
|
||||||
error CommunityOwnerTokenRegistry_NotAuthorized();
|
error CommunityOwnerTokenRegistry_NotAuthorized();
|
||||||
error CommunityOwnerTokenRegistry_EntryAlreadyExists();
|
error CommunityOwnerTokenRegistry_EntryAlreadyExists();
|
||||||
error CommunityOwnerTokenRegistry_InvalidAddress();
|
error CommunityOwnerTokenRegistry_InvalidAddress();
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
pragma solidity ^0.8.17;
|
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 { ECDSA } from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
|
||||||
import { EIP712 } from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";
|
import { EIP712 } from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";
|
||||||
import { ITokenFactory } from "./interfaces/ITokenFactory.sol";
|
import { ITokenFactory } from "./interfaces/ITokenFactory.sol";
|
||||||
|
@ -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 `CommunityOwnerTokenFactory` address can be changed by the owner of this contract.
|
||||||
* @dev The `CommunityMasterTokenFactory` 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;
|
using ECDSA for bytes32;
|
||||||
|
|
||||||
error CommunityTokenDeployer_InvalidDeploymentRegistryAddress();
|
error CommunityTokenDeployer_InvalidDeploymentRegistryAddress();
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
pragma solidity ^0.8.17;
|
pragma solidity ^0.8.17;
|
||||||
|
|
||||||
import { ITokenFactory } from "../interfaces/ITokenFactory.sol";
|
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
|
* @title BaseTokenFactory contract
|
||||||
|
@ -15,7 +15,7 @@ import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
|
||||||
*
|
*
|
||||||
* @dev Other factory contract inherit from this contract.
|
* @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_InvalidTokenDeployerAddress();
|
||||||
error BaseTokenFactory_NotAuthorized();
|
error BaseTokenFactory_NotAuthorized();
|
||||||
error BaseTokenFactory_InvalidTokenMetadata();
|
error BaseTokenFactory_InvalidTokenMetadata();
|
||||||
|
|
Loading…
Reference in New Issue