Contract state

Know what changed in any Stacks contract, when, and who changed it.

One ALEX swap names a single call. Index shows the calls that ran inside it, as which contract, and every entry they changed.

Contract state plan

The transaction

Block 1,508,068, June 6, 2025. 0xe8b2ac70…9daf

Callamm-pool-v2-01::swap-x-for-y
Signed bySP2VC…6A1M
Result(ok (tuple (dx u100000000) (dy u4997501249)))

What ran inside it

Four transfers out of the vault, called by a token contract the signer deployed.

#CallSenderCaller
14token-abtc::transfer-fixedamm-vault-v2-01ssl-labubu-672d3
16sbtc-token::transferamm-vault-v2-01ssl-labubu-672d3
18token-alex::transfer-fixedamm-vault-v2-01ssl-labubu-672d3
20token-susdt::transfer-fixedamm-vault-v2-01ssl-labubu-672d3
21ssl-labubu-672d3::transfer-fixedamm-vault-v2-01amm-vault-v2-01

What changed

pools-data-map for pool 170 in amm-registry-v2-01.

FieldBlock 1,508,061Block 1,508,068
balance-x200000000000200100000000
balance-y100000000000009995002498751

What left the vault

Five token transfers to the signer, in base units.

TokenAmount
ssl-labubu-672d34997501249
token-abtc5073942482
sbtc-token1276470894
token-alex11941965600464880
token-susdt174832697784601

Every row is an Index read, and the block's writes check against Bitcoin. Check the block →

Read it yourself

A block's proven writes need no key. Add a key for the calls inside a transaction and the entries it wrote, decoded.

1$curl -s https://api.secondlayer.tools/v1/proofs/writes/1508068 \
2 | jq '[.state_writes[].key | select(contains(".amm-")) | split("::")[0:4] | join("::")]'
1[
2 "vm-account::SP102V8P0F7JX67ARQ77WEA3D3CFB5XW39REDT0AM.amm-vault-v2-01::19",
3 "vm-account::SP102V8P0F7JX67ARQ77WEA3D3CFB5XW39REDT0AM.amm-vault-v2-01::19",
4 "vm::SP102V8P0F7JX67ARQ77WEA3D3CFB5XW39REDT0AM.amm-vault-v2-01::0::reserve",
5 "vm::SP102V8P0F7JX67ARQ77WEA3D3CFB5XW39REDT0AM.amm-registry-v2-01::0::pools-data-map"
6]
Webhooks· push

Get pushed instead

Get a POST when the vault makes a call or writes a map entry. Try the same triggers on past blocks first with secondlayer webhooks simulate.

webhook.tsts
1import { trigger } from "@secondlayer/sdk";
2
3const vault = "SP102V8P0F7JX67ARQ77WEA3D3CFB5XW39REDT0AM.amm-vault-v2-01";
4
5await sl.webhooks.create({
6 name: "vault-watch",
7 url: "https://my-app.com/webhook",
8 triggers: [
9 trigger.nestedContractCall({ sender: vault }),
10 trigger.mapSet({ contractId: vault }),
11 ],
12});