specVersion: v0.1.0
package:
  name: "ethereum_sfraxeth"
  version: v0.1.1

protobuf:
  files:
    - tycho/evm/v1/vm.proto
    - tycho/evm/v1/common.proto
    - tycho/evm/v1/utils.proto
    - contract.proto
  importPaths:
    - ../../proto
    - ./proto

binaries:
  default:
    type: wasm/rust-v1
    file: ../target/wasm32-unknown-unknown/release/ethereum_sfraxeth.wasm

modules:
  - name: map_components
    kind: map
    initialBlock: 15686046
    inputs:
      - params: string
      - source: sf.ethereum.type.v2.Block
    output:
      type: proto:tycho.evm.v1.GroupedTransactionProtocolComponents
    doc: |
      param is the address without the 0x prefix of the sfrax vault you want to track

  - name: store_components
    kind: store
    initialBlock: 15686046
    updatePolicy: add
    valueType: int64
    inputs:
      - map: map_components

  - name: map_reward_cycles
    kind: map
    initialBlock: 15686046
    inputs:
      - source: sf.ethereum.type.v2.Block
      - store: store_components
    output:
      type: proto:contract.v1.BlockRewardCycles

  - name: store_reward_cycles
    kind: store
    initialBlock: 15686046
    updatePolicy: set
    valueType: bytes
    inputs:
      - map: map_reward_cycles

  - name: map_relative_balances
    kind: map
    initialBlock: 15686046 # An arbitrary block that should change based on your requirements
    inputs:
      - source: sf.ethereum.type.v2.Block
      - store: store_components
      - store: store_reward_cycles
        mode: deltas
    output:
      type: proto:tycho.evm.v1.BalanceDeltas

  - name: store_balances
    kind: store
    initialBlock: 15686046
    updatePolicy: add
    valueType: bigint
    inputs:
      - map: map_relative_balances

  - name: map_protocol_changes
    kind: map
    initialBlock: 15686046
    inputs:
      - source: sf.ethereum.type.v2.Block
      - map: map_components
      - map: map_relative_balances
      - store: store_components
      - store: store_balances
        mode: deltas # This is the key property that simplifies `BalanceChange` handling
    output:
      type: proto:tycho.evm.v1.BlockChanges

params:
  map_components: "ac3E018457B222d93114458476f3E3416Abbe38F"
