blocklytics / spells-subgraph

Graph protocol subgraph for Spells.fyi
MIT License
6 stars 2 forks source link

Add delay field to `Platform` entity #5

Open calebsheridan opened 4 years ago

calebsheridan commented 4 years ago

Abstract

Each protocol has a different delay. This information should be available at a Platform level.

Delay variants

In some cases, the delay is hardcoded. In others, it is set at a protocol level. In others, it is set at on a per-parameter basis.

Schema update

type Platform @entity {
  id: ID!
  delay: BigInt! # This is the new field; delay is defined in seconds
  target: [Target]! @derivedFrom(field: "platform")
  timelock: [Timelock]! @derivedFrom(field: "platform")
}

Existing functions affected

For each platform mapping, the createPlatform function must be updated. Where applicable, the data should be taken from events or smartContracts.

New function

A new function such as updatePlatformDelay is required for some platforms. This will update the platform delay and should be triggered based on the relevant event(s).