Open hickscorp opened 2 years ago
I found an intermediate way - protecting the initialization methods with a modifier such as diamondOwner()
:
/// @dev Ensures that a method can only be called by another facet of the same diamond.
modifier diamondInternal() {
require(msg.sender == address(this), 'Cannot be called directly');
_;
}
/// @dev Ensures that a method can only be called by the owner of this diamond.
modifier diamondOwner() {
require(msg.sender == IERC173(address(this)).owner(), 'Requires ownership');
_;
}
I'll report back here once I find a bit more.
I'm trying to understand something related to initializing a diamond and I can't seem to find a way.
Consider the following code:
In the
initialize
function of one of my facets, I've logged themsg.sender
and it's the named accountdeployer
. I'm failing to see:msg.sender
bespcOwner
instead?Also, I don't quite understand how an initializer could add supported interfaces to the diamond. Is there a way?