Problem: contracts/deployments.json exists but its current format is unknown. For production deployments, the file should record: the deployed contract ID, the WASM hash, the network, the deployment ledger, the deployer address, and a git commit SHA. Without this, it is impossible to verify that the deployed contract matches the source code.
Scope: Define a schema for deployments.json and update the deployment script to populate it.
Implementation guidance:
Define the JSON schema:
{ "testnet": { "contractId": "C...", "wasmHash": "hex...", "deployedLedger": 123456, "deployerAddress": "G...", "gitSha": "abc123", "deployedAt": "2025-01-01T00:00:00Z" }, "mainnet": { ... }}
Update dx_tooling/src/deployer.rs to write this JSON after a successful deployment.
Add a validate-deployment script that reads deployments.json and calls stellar contract info to verify the on-chain WASM hash matches.
Acceptance criteria: deployments.json contains all required fields after a deployment; the validate script confirms the on-chain contract matches the JSON.
Validation: Manual deploy to testnet and confirm deployments.json is populated.
Files to modify: contracts/deployments.json, contracts/dx_tooling/src/deployer.rs
Files to create: contracts/scripts/validate-deployment.mjs
Problem: contracts/deployments.json exists but its current format is unknown. For production deployments, the file should record: the deployed contract ID, the WASM hash, the network, the deployment ledger, the deployer address, and a git commit SHA. Without this, it is impossible to verify that the deployed contract matches the source code.
Scope: Define a schema for deployments.json and update the deployment script to populate it.
Implementation guidance:
Define the JSON schema:
{ "testnet": { "contractId": "C...", "wasmHash": "hex...", "deployedLedger": 123456, "deployerAddress": "G...", "gitSha": "abc123", "deployedAt": "2025-01-01T00:00:00Z" }, "mainnet": { ... }}
Update dx_tooling/src/deployer.rs to write this JSON after a successful deployment.
Add a validate-deployment script that reads deployments.json and calls stellar contract info to verify the on-chain WASM hash matches.
Acceptance criteria: deployments.json contains all required fields after a deployment; the validate script confirms the on-chain contract matches the JSON.
Validation: Manual deploy to testnet and confirm deployments.json is populated.
Files to modify: contracts/deployments.json, contracts/dx_tooling/src/deployer.rs
Files to create: contracts/scripts/validate-deployment.mjs