Create a decoder for all events defined in an abi. It returns a function which is called on an array of log entries such as received from getLogs or getTransactionReceipt and parses any matching log entries
function logDecoder(abi, useNumberedParams = true) {
  const eventMap = {}
  abi.filter(item => item.type === 'event').map(item => {
    eventMap[eventSignature(item)] = item
  })
  return function(logItems) {
    return logItems.map(log => decodeLogItem(eventMap[log.topics[0]], log, useNumberedParams)).filter(i => i)
  }
}