All packages
shield_evm_behavioral_memory

shield_evm_behavioral_memory

Oliverknowledge
v0.1.0/1 downloads/Repository

Package ref

shield-evm-behavioral-memory@v0.1.0

Run package

CLI

Run map_behavioral_profiles from the command line.

substreams run shield-evm-behavioral-memory@v0.1.0 map_behavioral_profiles -e hyper-evm
Authenticate by running substreams auth or directly on thegraph.market (see docs).

README

Shield behavioural memory — EVM Substreams

The same five-module pipeline as ../substreams (Solana), for ShieldVault.sol on HyperEVM or any EVM chain, composed on The Graph's foundational ethereum-common@v0.3.3 package: its index_events block index filters both maps by evt_addr: (the vault contract and native USDC) so blocks with no relevant log are skipped before decoding.

map_shield_events       Block ⨯ index_events(params) -> ShieldEvents      typed ShieldVault events (Abigen)
store_vault_registry    set   exec:<vault>:<owner> -> 1|0                   which addresses are trading wallets
map_vault_flows         Block ⨯ events ⨯ registry -> VaultFlows            boundary crossings incl. USDC returns
store_flow_totals       add   sent/returned/deposited/topups/returns per vault
map_behavioral_profiles deltas -> BehavioralProfiles

Build: substreams build (Rust + wasm32 target; Foundry's ABI is copied to abi/ShieldVault.json). Run against The Graph Market with the shared JWT in .env (SUBSTREAMS_API_TOKEN; endpoint SUBSTREAMS_HYPEREVM_ENDPOINT, default hyperevm.substreams.pinax.network:443, HyperEVM mainnet only):

bun run substreams:hyperevm                  # last 20 blocks, proves auth + package load
bun run substreams:hyperevm <deploy block> +200   # with EVM_CHAIN_ID=999, SHIELD_VAULT_ADDRESS, USDC_ADDRESS set
# equivalent raw CLI:
SUBSTREAMS_API_TOKEN=<jwt> substreams run substreams.yaml map_vault_flows \
  -e hyperevm.substreams.pinax.network:443 -s <vault deploy block> -t +200 \
  -p map_shield_events="evt_addr:<vault>" \
  -p map_vault_flows="evt_addr:<vault> || evt_addr:<native usdc>"

The package passes substreams registry verify; publishing it as a reusable module on substreams.dev is substreams registry login && substreams registry publish from this directory (a human step: it needs a substreams.dev account).

server/evm-index.ts consumes the same module through @substreams/core when EVM_CHAIN_ID=999 and the JWT is set (/api/healthsource.mode: "substreams").

Output Flow messages carry the same fields the Solana package emits, so server/behaviour.ts, server/policy.ts and the Chainlink CRE workflow consume either chain's stream unchanged: one pipeline shape, reused across chains.

Modules

Execution graph

7 modules
store

store_flow_totals

from #45260000

Store value

int64

Update policy

add

store

store_vault_registry

from #45260000

Store value

string

Update policy

set

Show 2 dependencies
map

ethereum_common:all_events

`all_events` gives you all the events in a block (from successful transactions), with basic block hash/number/timestamp and transaction hash

Output

sf.substreams.ethereum.v1.Events

blockIndex

ethereum_common:index_events

`index_events` sets the following keys on the block: * Event signatures evt_sig:0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef (signature in hex, prefixed by 0x) * Event address evt_addr:0x0123456789abcdef0123456789abcdef01234567 (address in hex, prefixed by 0x)

Output

sf.substreams.index.v1.Keys