'Why not using events instead of state variables, for requests to oracles?

Why not just emit events instead of using state variables, for requests to oracles? For example:

contract OracleConsumer {
  address oracle = 0x123...; // known account of oracle service
  
  modifier onlyBy(address account) { 
    require(msg.sender == account);  _; 
  }

  event OracleRequest(..., abi encoding of callback function )
  
  function updateExchangeRate() {
    event OracleRequest("USD", ..., "oracleResponse(bytes)" )
  }
    
  function oracleResponse(bytes response) onlyBy(oracle) { 
    // use the data
  }
}

Instead of ones like in here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source