Skip to content

v1.1.0

Compare
Choose a tag to compare
@maoueh maoueh released this 09 Jun 17:31
  • Added tables module so that you can use it as a better abstraction to build up your entity changes.

    use substreams_database_change::tables::Tables;
    
    let mut tables = Tables::new();
    
    // Create a row (<entity_name>, <id>).[set(<column>, <value>), ...]
    tables
      .create_row("Factory", id)
      .set("poolCount", &bigint0)
      .set("txCount", &bigint0)
      .set("totalVolumeUSD", &bigdecimal0)
      .set("totalVolumeETH", &bigdecimal0)
      .set("totalFeesUSD", &bigdecimal0)
      .set("totalFeesETH", &bigdecimal0)
      .set("untrackedVolumeUSD", &bigdecimal0)
      .set("totalValueLockedUSD", &bigdecimal0)
      .set("totalValueLockedETH", &bigdecimal0)
      .set("totalValueLockedUSDUntracked", &bigdecimal0)
      .set("totalValueLockedETHUntracked", &bigdecimal0)
      .set("owner", &format!("0x{}", Hex(utils::ZERO_ADDRESS).to_string()));
    
    // Update a row (<entity_name>, <id>).[set(<column>, <value>), ...]
    tables
      .update_row("Bundle", "1").set("ethPriceUSD", &delta.new_value);
  • Add composite primary keys for Protobuf with oneof and add push_change_composite() to helpers.rs.

  • Note Changed database protobuf location path from substreams/sink/database/v1 to sf/substreams/sink/database/v1, this is not a change of the Protobuf package id which is still sf.substreams.sink.database.v1. This will have an impact if you use buf gen --exclude-path as the path here is the Protobuf original path location, so add sf/ if you were excluding substreams/sink/database.

  • GitHub repository has been renamed to substreams-sink-database-changes, note the Rust crate's name is still substreams-database-change to avoid breaking change when importing the crate. We are planning a future rename of the crate, but that might come with a v2 of the data protocol.