Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,237 changes: 616 additions & 621 deletions bill_payments/src/lib.rs

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions data_migration/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Data Migration

Utility library for exporting and importing contract state snapshots for RemitWise.

## Features

- **Multi-format Support**: JSON, Binary (Bincode), CSV, and Encrypted.
- **Integrity Checks**: SHA-256 checksum validation for all snapshots.
- **Version Compatibility**: Enforces semantic versioning rules for snapshots (`MIN_SUPPORTED_VERSION`).
- **Replay Protection**: The `MigrationTracker` prevents duplicate/repeated imports of the same snapshot by tracking checksum/version pairs.

## Replay Protection

To prevent accidental double-restores or replaying of old data, all import functions (`import_from_json`, `import_from_binary`) require a `MigrationTracker`.

```rust
use data_migration::{MigrationTracker, import_from_json};

let mut tracker = MigrationTracker::new();
let result = import_from_json(&mut tracker, json_data);

if let Err(MigrationError::DuplicateImport) = result {
println!("This snapshot has already been processed!");
}
```

The tracker should be persisted or maintained throughout the lifecycle of the migration process to ensure consistent protection.
7 changes: 5 additions & 2 deletions insurance/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ edition = "2021"
crate-type = ["cdylib", "rlib"]

[dependencies]
soroban-sdk = "21.0.0"
soroban-sdk = "=21.7.7"
remitwise-common = { path = "../remitwise-common" }

[dev-dependencies]
soroban-sdk = { version = "21.0.0", features = ["testutils"] }
proptest = "1.10.0"
soroban-sdk = { version = "=21.7.7", features = ["testutils"] }
testutils = { path = "../testutils" }

[profile.release]
opt-level = "z"
Expand Down
2 changes: 1 addition & 1 deletion insurance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ Owner-only. Updates or clears the `external_ref` field of a policy.

Owner-only. Marks a policy as inactive and removes it from the active-policy list.

**Emits**: `PolicyDeactivatedEvent`
This function is **idempotent**: if the policy is already inactive, it returns `false` without emitting duplicate events or updating storage.

---

Expand Down
Loading
Loading