From 9231a0df36a0117a4a6898ed96bb13d8853ee696 Mon Sep 17 00:00:00 2001 From: Seth Date: Wed, 28 Feb 2024 00:58:54 +0800 Subject: [PATCH] feat: add initialisable (cherry picked from commit a5a24fe43c97d00d2cb08f8755d3c0e43a2eec70) --- .../DocumentStoreInitializable.sol | 25 +++++++++++++++++++ .../OwnableDocumentStoreInitializable.sol | 13 ++++++++++ 2 files changed, 38 insertions(+) create mode 100644 src/initializables/DocumentStoreInitializable.sol create mode 100644 src/initializables/OwnableDocumentStoreInitializable.sol diff --git a/src/initializables/DocumentStoreInitializable.sol b/src/initializables/DocumentStoreInitializable.sol new file mode 100644 index 0000000..6b6c773 --- /dev/null +++ b/src/initializables/DocumentStoreInitializable.sol @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: Apache-2.0 + +pragma solidity >=0.8.23 <0.9.0; + +import "../base/BaseDocumentStore.sol"; + +/** + * @title DocumentStore + * @notice A contract for storing and revoking documents with access control + */ +contract DocumentStoreInitializable is BaseDocumentStore { + /** + * @notice Initialises the contract with a name and initial admin + */ + constructor() initializer {} + + /** + * @notice Internally initialises the contract with a name and owner + * @param _name The name of the contract + * @param initAdmin The owner of the contract + */ + function initialize(string memory _name, address initAdmin) public initializer { + __BaseDocumentStore_init(_name, initAdmin); + } +} diff --git a/src/initializables/OwnableDocumentStoreInitializable.sol b/src/initializables/OwnableDocumentStoreInitializable.sol new file mode 100644 index 0000000..8dd9b0a --- /dev/null +++ b/src/initializables/OwnableDocumentStoreInitializable.sol @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: Apache-2.0 + +pragma solidity >=0.8.23 <0.9.0; + +import "../base/BaseOwnableDocumentStore.sol"; + +contract OwnableDocumentStoreInitializable is BaseOwnableDocumentStore { + constructor() initializer {} + + function initialize(string memory name_, string memory symbol_, address initAdmin) public initializer { + __OwnableDocumentStore_init(name_, symbol_, initAdmin); + } +}