I want to check that the Boolean variable "active" in the Account struck is true, for a modifier requirement.
Any logic on how to do this would be fantastic.
struct Account {
address id;
string company;
string country;
string industry;
bool active;
}
mapping (address => Account) public Accounts;
modifier validAccount(address _accountId) {
require (Account(msg.sender.active = true))
_;
}
Best Answer
It is not exactly clear what you want to do since there is input parameter in your modifier.
If you want to check if address calling function is valid then modify your modifier like this:
If you want to make sure that you are calling your function on Account which is valid then modify like this:
Here you can see full code which implements two types of modifiers.
GetCompany will only return value when _id Account is active.
GetCountry will return value only when account asking for it is valid.