/** * Adds an account to storage * THROWS when `msg.sender` doesn't have permission * THROWS when the account already exists * @param addr The address of the account * @param kind The kind of account * @param isFrozen The frozen status of the account * @param parent The account parent/owner */ function addAccount(address addr, uint8 kind, bool isFrozen, address parent) isUnlocked isAllowed(kind) external { require(accounts.append(addr, kind, isFrozen, parent), "Account already exists"); } /** * Sets an account's frozen status * THROWS when the account doesn't exist * @param addr The address of the account * @param frozen The frozen status of the account */ function setAccountFrozen(address addr, bool frozen) isUnlocked isAllowed(accounts.get(addr).kind) external { // NOTE: Not bounds checking `index` here, as `isAllowed` ensures the address exists. // Indices are one-based internally, so we need to add one to compensate. int256 index = accounts.indexOf(addr) + 1; accounts.items[index].frozen = frozen; }
0.4.18