tokenState.setState redundant checks
`tokenState.setState` is used to change the state of the token from:\\nPROPOSED to ACCEPTED (in accept())\\nDELEGATED to ENDING_DELEGATED (in `requestUndelegation()`\\nThe if/else statement in `setState` is too complicated and can be simplified, both to optimize gas usage and to increase readability.\\n```\\nfunction setState(uint delegationId, State newState) internal {\\n    TimeHelpers timeHelpers = TimeHelpers(contractManager.getContract("TimeHelpers"));\\n    DelegationController delegationController = DelegationController(contractManager.getContract("DelegationController"));\\n\\n    require(newState != State.PROPOSED, "Can't set state to proposed");\\n\\n    if (newState == State.ACCEPTED) {\\n        State currentState = getState(delegationId);\\n        require(currentState == State.PROPOSED, "Can't set state to accepted");\\n\\n        \\_state[delegationId] = State.ACCEPTED;\\n        \\_timelimit[delegationId] = timeHelpers.getNextMonthStart();\\n    } else if (newState == State.DELEGATED) {\\n        revert("Can't set state to delegated");\\n    } else if (newState == State.ENDING\\_DELEGATED) {\\n        require(getState(delegationId) == State.DELEGATED, "Can't set state to ending delegated");\\n        DelegationController.Delegation memory delegation = delegationController.getDelegation(delegationId);\\n\\n        \\_state[delegationId] = State.ENDING\\_DELEGATED;\\n        \\_timelimit[delegationId] = timeHelpers.calculateDelegationEndTime(delegation.created, delegation.delegationPeriod, 3);\\n        \\_endingDelegations[delegation.holder].push(delegationId);\\n    } else {\\n        revert("Unknown state");\\n    }\\n}\\n```\\n
Some of the changes that do not change the functionality of the `setState` function:\\nRemove `reverts()` and add the valid states to the `require()` at the beginning of the function\\nRemove multiple calls to `getState()`\\nRemove final else/revert as this is an internal function and States passed should be valid More optimization can be done which requires further understanding of the system and the state machine.\\n```\\nfunction setState(uint delegationId, State newState) internal {\\n        TimeHelpers timeHelpers = TimeHelpers(contractManager.getContract("TimeHelpers"));\\n        DelegationController delegationController = DelegationController(contractManager.getContract("DelegationController"));\\n\\n        require(newState != State.PROPOSED || newState != State.DELEGATED, "Invalid state change");\\n        State currentState = getState(delegationId);\\n\\n        if (newState == State.ACCEPTED) {\\n            require(currentState == State.PROPOSED, "Can't set state to accepted");\\n\\n            \\_state[delegationId] = State.ACCEPTED;\\n            \\_timelimit[delegationId] = timeHelpers.getNextMonthStart();\\n        } else if (newState == State.ENDING\\_DELEGATED) {\\n            require(currentState == State.DELEGATED, "Can't set state to ending delegated");\\n            DelegationController.Delegation memory delegation = delegationController.getDelegation(delegationId);\\n\\n            \\_state[delegationId] = State.ENDING\\_DELEGATED;\\n            \\_timelimit[delegationId] = timeHelpers.calculateDelegationEndTime(delegation.created, delegation.delegationPeriod, 3);\\n            \\_endingDelegations[delegation.holder].push(delegationId);\\n        }\\n    }\\n```\\n
```\\nfunction setState(uint delegationId, State newState) internal {\\n    TimeHelpers timeHelpers = TimeHelpers(contractManager.getContract("TimeHelpers"));\\n    DelegationController delegationController = DelegationController(contractManager.getContract("DelegationController"));\\n\\n    require(newState != State.PROPOSED, "Can't set state to proposed");\\n\\n    if (newState == State.ACCEPTED) {\\n        State currentState = getState(delegationId);\\n        require(currentState == State.PROPOSED, "Can't set state to accepted");\\n\\n        \\_state[delegationId] = State.ACCEPTED;\\n        \\_timelimit[delegationId] = timeHelpers.getNextMonthStart();\\n    } else if (newState == State.DELEGATED) {\\n        revert("Can't set state to delegated");\\n    } else if (newState == State.ENDING\\_DELEGATED) {\\n        require(getState(delegationId) == State.DELEGATED, "Can't set state to ending delegated");\\n        DelegationController.Delegation memory delegation = delegationController.getDelegation(delegationId);\\n\\n        \\_state[delegationId] = State.ENDING\\_DELEGATED;\\n        \\_timelimit[delegationId] = timeHelpers.calculateDelegationEndTime(delegation.created, delegation.delegationPeriod, 3);\\n        \\_endingDelegations[delegation.holder].push(delegationId);\\n    } else {\\n        revert("Unknown state");\\n    }\\n}\\n```\\n