What is the correct standard way of checking Identity?
fn _check_manager() {
let sender: Identity = msg_sender().unwrap();
let owner: Identity = storage.owner.read();
let manager: Identity = storage.manager.read();
// Ensure the sender is either the owner or the manager
require(sender == owner|| sender == manager, "Not authorized");
}
Another question is, If I initialized as Address, in other functions can I write with ContractID?
storage {
owner: Identity = Identity::Address(Address::zero());,
manager: Identity = Identity::Address(Address::zero()),
}
According to Docs, it can only be one. Was wondering if there would be any issue.
Enum std::identity::Identity
pub enum Identity {
Address: Address,
ContractId: ContractId,
}
The Identity type: either an Address or a ContractId.