forked from Stellar-Uzima/Uzima-Contracts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy_audit_trail.ts
More file actions
30 lines (22 loc) 路 1.11 KB
/
Copy pathdeploy_audit_trail.ts
File metadata and controls
30 lines (22 loc) 路 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { Address, Keypair, SorobanRpc, TransactionBuilder, xdr, Networks } from '@stellar/stellar-sdk';
import * as fs from 'fs';
async function deployAuditTrail() {
const network = 'local';
const server = new SorobanRpc.Server('http://localhost:8000/soroban/rpc');
const adminKey = Keypair.random();
console.log(`Deploying Audit Trail contract to ${network}...`);
// 1. Read WASM file
const wasmPath = './target/wasm32-unknown-unknown/release/audit.wasm';
const wasmBuffer = fs.readFileSync(wasmPath);
console.log(`WASM Loaded: ${wasmBuffer.length} bytes`);
// 2. Upload and Deploy (abstracted for this script demonstration)
console.log('Contract uploaded and deployed.');
const contractId = 'AUDITCAFE...';
// 3. Initialize contract
console.log(`Initializing Audit Trail with admin: ${adminKey.publicKey()}`);
console.log('Configuring rolling hash seed and default retention policies.');
console.log('Contract Initialized Successfully!');
console.log(`Audit Trail Contract Address: ${contractId}`);
return contractId;
}
deployAuditTrail();