Oracle - Unchecked oracle response timestamp and integer over/underflow
The external Chainlink oracle, which provides index price information to the system, introduces risk inherent to any dependency on third-party data sources. For example, the oracle could fall behind or otherwise fail to be maintained, resulting in outdated data being fed to the index price calculations of the AMM. Oracle reliance has historically resulted in crippled on-chain systems, and complications that lead to these outcomes can arise from things as simple as network congestion.\\nEnsuring that unexpected oracle return values are properly handled will reduce reliance on off-chain components and increase the resiliency of the smart contract system that depends on them.\\nThe `ChainlinkAdapter` and `InversedChainlinkAdapter` take the oracle's (int256) `latestAnswer` and convert the result using `chainlinkDecimalsAdapter`. This arithmetic operation can underflow/overflow if the Oracle provides a large enough answer:\\n```\\nint256 public constant chainlinkDecimalsAdapter = 10\\*\\*10;\\n\\nconstructor(address \\_feeder) public {\\n    feeder = IChainlinkFeeder(\\_feeder);\\n}\\n\\nfunction price() public view returns (uint256 newPrice, uint256 timestamp) {\\n    newPrice = (feeder.latestAnswer() \\* chainlinkDecimalsAdapter).toUint256();\\n    timestamp = feeder.latestTimestamp();\\n}\\n```\\n\\n```\\nint256 public constant chainlinkDecimalsAdapter = 10\\*\\*10;\\n\\nconstructor(address \\_feeder) public {\\n    feeder = IChainlinkFeeder(\\_feeder);\\n}\\n\\nfunction price() public view returns (uint256 newPrice, uint256 timestamp) {\\n    newPrice = ONE.wdiv(feeder.latestAnswer() \\* chainlinkDecimalsAdapter).toUint256();\\n    timestamp = feeder.latestTimestamp();\\n}\\n```\\n\\nThe oracle provides a timestamp for the `latestAnswer` that is not validated and may lead to old oracle timestamps being accepted (e.g. caused by congestion on the blockchain or a directed censorship attack).\\n```\\n    timestamp = feeder.latestTimestamp();\\n}\\n```\\n
Use `SafeMath` for mathematical computations\\nVerify `latestAnswer` is within valid bounds (!=0)\\nVerify `latestTimestamp` is within accepted bounds (not in the future, was updated within a reasonable amount of time)\\nDeduplicate code by combining both Adapters into one as the only difference is that the `InversedChainlinkAdapter` returns `ONE.wdiv(price)`.
```\\nint256 public constant chainlinkDecimalsAdapter = 10\\*\\*10;\\n\\nconstructor(address \\_feeder) public {\\n    feeder = IChainlinkFeeder(\\_feeder);\\n}\\n\\nfunction price() public view returns (uint256 newPrice, uint256 timestamp) {\\n    newPrice = (feeder.latestAnswer() \\* chainlinkDecimalsAdapter).toUint256();\\n    timestamp = feeder.latestTimestamp();\\n}\\n```\\n