To incorporate multiple inheritance using OpenZeppelin upgradeable contracts, you can follow the below steps:
Here's an example:
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
contract MyNewContract is Initializable, OwnableUpgradeable, AccessControlUpgradeable {
bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE");
function initialize() initializer public {
__Ownable_init();
__AccessControl_init();
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
_setupRole(ADMIN_ROLE, msg.sender);
}
}
In the example above, "MyNewContract" is inheriting from "OwnableUpgradeable", "AccessControlUpgradeable", and "Initializable". The constant "ADMIN_ROLE" is also declared using the keccak256 hashing algorithm. Finally, the constructor "initialize()" is created using the "initializer" modifier from OpenZeppelin.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2021-07-21 11:00:00 +0000
Seen: 8 times
Last updated: Jan 16 '22
Can the SequentialChain of Langchain handle multiple inputs?
What is the method to test multiple values that are returned using Jest?
How can a data-frame with multiple indices be created?
How can a single writer and multiple readers achieve concurrency with only one write?
On occasion, when executing a test suite for multiple classes, the act of mocking is omitted.
How can I search multiple databases on the local host?
How to connect or associate multiple files in Visual Studio Code on Ubuntu OS?
What is the method to combine multiple rows of a dataframe into a single value?
Can you whitelist multiple domains using command prompt for CORS Anywhere?