specVersion: v0.1.0
package:
  name: "ethereum_template"
  version: v0.1.0

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

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

network: mainnet
networks:
  mainnet:
    initialBlock:
      map_protocol_components: 1
      store_protocol_components: 1
      map_relative_component_balance: 1
      store_balances: 1
      map_protocol_changes: 1
    params:
      map_protocol_components: "vault_address=0000"
      map_relative_component_balance: "vault_address=0000"
      map_protocol_changes: "vault_address=0000"

params:
  map_protocol_components: "vault_address=0000"
  map_relative_component_balance: "vault_address=0000"
  map_protocol_changes: "vault_address=0000"

modules:
  - name: map_protocol_components
    kind: map
    inputs:
      - params: string
      - source: sf.ethereum.type.v2.Block
    output:
      type: proto:tycho.evm.v1.BlockTransactionProtocolComponents

  - name: store_protocol_tokens
    kind: store
    updatePolicy: set
    valueType: string
    inputs:
      - map: map_protocol_components

  - name: map_relative_component_balance
    kind: map
    inputs:
      - params: string
      - source: sf.ethereum.type.v2.Block
      - store: store_protocol_tokens
    output:
      type: proto:tycho.evm.v1.BlockBalanceDeltas

  - name: store_component_balances
    kind: store
    updatePolicy: add
    valueType: bigint
    inputs:
      - map: map_relative_component_balance

  - name: map_protocol_changes
    kind: map
    inputs:
      - params: string
      - source: sf.ethereum.type.v2.Block
      - map: map_protocol_components
      - map: map_relative_component_balance
      - store: store_component_balances
        mode: deltas
    output:
      type: proto:tycho.evm.v1.BlockChanges
