diff --git a/docs/family-wallet-design.md b/docs/family-wallet-design.md index 2bfb90de..1846047f 100644 --- a/docs/family-wallet-design.md +++ b/docs/family-wallet-design.md @@ -35,37 +35,37 @@ Lower numeric value is higher privilege. ## Permissions Matrix -| Operation | Methods | Allowed caller | Key guards | -|---|---|---|---| -| Initialize wallet | `init` | Owner address passed to `init` | One-time only (`"Wallet already initialized"` panic) | -| Add member (strict) | `add_member` | Owner or Admin | Role cannot be `Owner`; rejects duplicates; spending limit must be `>= 0`; returns `Result` | -| Add member (legacy overwrite path) | `add_family_member` | Owner or Admin | Role cannot be `Owner`; overwrites existing member record; limit forced to `0` | -| Remove member | `remove_family_member` | Owner only | Cannot remove owner | -| Update per-member spending limit | `update_spending_limit` | Owner or Admin | Member must exist; new limit must be `>= 0`; returns `Result` | -| Configure multisig | `configure_multisig` | Owner or Admin | `Result` return; validates: `signers.len() > 0`; `MIN_THRESHOLD <= threshold <= MAX_THRESHOLD`; `threshold <= signers.len()`; all signers must be family members; spending limit must be `>= 0`; blocked when paused | -| Propose transaction | `propose_transaction` and wrappers (`withdraw`, `propose_*`) | `Member` or higher | Caller must be family member; blocked when paused | -| Sign transaction | `sign_transaction` | `Member` or higher | Must be in configured signer list for tx type; no duplicate signature; not expired | -| Emergency config and mode | `configure_emergency`, `set_emergency_mode` | Owner or Admin | Emergency max amount `> 0`; min balance `>= 0` | -| Pause controls | `pause`, `unpause`, `set_pause_admin` | Pause admin (pause/unpause), Owner (`set_pause_admin`) | Default pause admin is owner unless overridden | -| Upgrade controls | `set_upgrade_admin`, `set_version` | Owner (`set_upgrade_admin`), upgrade admin (`set_version`) | Emits upgrade event on version change | -| Batch member operations | `batch_add_family_members`, `batch_remove_family_members` | Admin+ for add, Owner for remove | Max batch size enforced; cannot add/remove owner | -| Storage cleanup | `archive_old_transactions`, `cleanup_expired_pending` | Owner or Admin | Blocked when paused | -| Reads | `get_*`, `is_*` | Any caller | Read-only | +| Operation | Methods | Allowed caller | Key guards | +| ---------------------------------- | ------------------------------------------------------------ | ---------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Initialize wallet | `init` | Owner address passed to `init` | One-time only (`"Wallet already initialized"` panic) | +| Add member (strict) | `add_member` | Owner or Admin | Role cannot be `Owner`; rejects duplicates; spending limit must be `>= 0`; returns `Result` | +| Add member (legacy overwrite path) | `add_family_member` | Owner or Admin | Role cannot be `Owner`; overwrites existing member record; limit forced to `0` | +| Remove member | `remove_family_member` | Owner only | Cannot remove owner | +| Update per-member spending limit | `update_spending_limit` | Owner or Admin | Member must exist; new limit must be `>= 0`; returns `Result` | +| Configure multisig | `configure_multisig` | Owner or Admin | `Result` return; validates: `signers.len() > 0`; `MIN_THRESHOLD <= threshold <= MAX_THRESHOLD`; `threshold <= signers.len()`; all signers must be family members; spending limit must be `>= 0`; blocked when paused | +| Propose transaction | `propose_transaction` and wrappers (`withdraw`, `propose_*`) | `Member` or higher | Caller must be family member; blocked when paused | +| Sign transaction | `sign_transaction` | `Member` or higher | Must be in configured signer list for tx type; no duplicate signature; not expired | +| Emergency config and mode | `configure_emergency`, `set_emergency_mode` | Owner or Admin | Emergency max amount `> 0`; min balance `>= 0`; all mode changes are audited | +| Pause controls | `pause`, `unpause`, `set_pause_admin` | Pause admin (pause/unpause), Owner (`set_pause_admin`) | Default pause admin is owner unless overridden | +| Upgrade controls | `set_upgrade_admin`, `set_version` | Owner (`set_upgrade_admin`), upgrade admin (`set_version`) | Emits upgrade event on version change | +| Batch member operations | `batch_add_family_members`, `batch_remove_family_members` | Admin+ for add, Owner for remove | Max batch size enforced; cannot add/remove owner | +| Storage cleanup | `archive_old_transactions`, `cleanup_expired_pending` | Owner or Admin | Blocked when paused | +| Reads | `get_*`, `is_*` | Any caller | Read-only | ## Limits and Policy Rules ### Constants -| Name | Value | Meaning | -|---|---|---| -| `SIGNATURE_EXPIRATION` | `86400` seconds | Pending multisig transaction expiry (24h) | -| `MAX_BATCH_MEMBERS` | `30` | Maximum add/remove batch size | -| `MAX_ACCESS_AUDIT_ENTRIES` | `100` | Access audit ring size (last 100 retained) | -| `MAX_SIGNERS` | `100` | Maximum number of authorized signers per multisig config | -| `MIN_THRESHOLD` | `1` | Minimum valid threshold value | -| `MAX_THRESHOLD` | `100` | Maximum valid threshold value | -| `INSTANCE_BUMP_AMOUNT` | `518400` ledgers | Active-instance TTL extension target | -| `ARCHIVE_BUMP_AMOUNT` | `2592000` ledgers | Archive TTL extension target | +| Name | Value | Meaning | +| -------------------------- | ----------------- | -------------------------------------------------------- | +| `SIGNATURE_EXPIRATION` | `86400` seconds | Pending multisig transaction expiry (24h) | +| `MAX_BATCH_MEMBERS` | `30` | Maximum add/remove batch size | +| `MAX_ACCESS_AUDIT_ENTRIES` | `100` | Access audit ring size (last 100 retained) | +| `MAX_SIGNERS` | `100` | Maximum number of authorized signers per multisig config | +| `MIN_THRESHOLD` | `1` | Minimum valid threshold value | +| `MAX_THRESHOLD` | `100` | Maximum valid threshold value | +| `INSTANCE_BUMP_AMOUNT` | `518400` ledgers | Active-instance TTL extension target | +| `ARCHIVE_BUMP_AMOUNT` | `2592000` ledgers | Archive TTL extension target | ### Default Configs Set During `init` @@ -120,6 +120,7 @@ sequenceDiagram ``` **Key Security Features:** + - **Dust Attack Prevention**: `min_precision` prevents micro-transactions that could bypass limits - **Single Transaction Limits**: `max_single_tx` prevents large withdrawals even within period limits - **Overflow Protection**: All arithmetic uses `saturating_add()` to prevent overflow @@ -142,6 +143,7 @@ pub struct SpendingPeriod { ``` **Rollover Security:** + - **UTC Alignment**: Periods align to 00:00 UTC to prevent timezone manipulation - **Boundary Validation**: Inclusive boundary checks prevent edge case timing attacks - **Legitimate Rollover**: Validates rollover conditions to prevent time manipulation @@ -163,6 +165,7 @@ pub struct SpendingTracker { ``` **Tracking Features:** + - **Period Persistence**: Spending accumulates across transactions within the same period - **Automatic Reset**: Counters reset to zero on legitimate period rollover - **Audit Trail**: Transaction count and timestamps for monitoring @@ -173,6 +176,7 @@ pub struct SpendingTracker { ### Configuration Functions #### `set_precision_spending_limit` + ```rust pub fn set_precision_spending_limit( env: Env, @@ -189,6 +193,7 @@ pub fn set_precision_spending_limit( ### Validation Functions #### `validate_precision_spending` + ```rust pub fn validate_precision_spending( env: Env, @@ -199,6 +204,7 @@ pub fn validate_precision_spending( **Purpose**: Comprehensive spending validation with precision and rollover checks **Flow**: + 1. Basic validation (positive amount, valid member, role not expired) 2. Role-based bypass (Owner/Admin unlimited) 3. Precision validation (min_precision, max_single_tx) @@ -207,6 +213,7 @@ pub fn validate_precision_spending( ### Monitoring Functions #### `get_spending_tracker` + ```rust pub fn get_spending_tracker(env: Env, member_address: Address) -> Option ``` @@ -218,10 +225,12 @@ pub fn get_spending_tracker(env: Env, member_address: Address) -> Option 0` prevents micro-transactions - Recommended minimum: 1 XLM (10^7 stroops) for meaningful amounts **Overflow Protection:** + - All arithmetic uses `saturating_add()` and `saturating_sub()` - Configuration validation prevents overflow conditions - Boundary checks handle edge cases gracefully @@ -229,23 +238,25 @@ pub fn get_spending_tracker(env: Env, member_address: Address) -> Option Result { let new_period = Self::get_current_period(current_time); - + // Validate rollover is legitimate (prevent manipulation) if current_time < old_tracker.period.period_start.saturating_add(old_tracker.period.period_duration) { return Err(Error::RolloverValidationFailed); } - + // Reset counters for new period Ok(SpendingTracker { current_spent: 0, @@ -259,6 +270,7 @@ fn rollover_spending_period( ### 3. Boundary Validation **Edge Case Handling:** + - Zero and negative amounts explicitly rejected - Maximum single transaction enforced before cumulative checks - Period boundary calculations handle timestamp overflow @@ -268,17 +280,18 @@ fn rollover_spending_period( ### New Error Types -| Error | Description | Prevention | -|-------|-------------|------------| -| `AmountBelowPrecision` | Amount below minimum precision threshold | Set appropriate `min_precision` | -| `ExceedsMaxSingleTx` | Single transaction exceeds maximum | Configure reasonable `max_single_tx` | -| `ExceedsPeriodLimit` | Cumulative spending exceeds period limit | Monitor via `get_spending_tracker` | -| `RolloverValidationFailed` | Period rollover validation failed | System prevents time manipulation | -| `InvalidPrecisionConfig` | Invalid precision configuration | Validate parameters before setting | +| Error | Description | Prevention | +| -------------------------- | ---------------------------------------- | ------------------------------------ | +| `AmountBelowPrecision` | Amount below minimum precision threshold | Set appropriate `min_precision` | +| `ExceedsMaxSingleTx` | Single transaction exceeds maximum | Configure reasonable `max_single_tx` | +| `ExceedsPeriodLimit` | Cumulative spending exceeds period limit | Monitor via `get_spending_tracker` | +| `RolloverValidationFailed` | Period rollover validation failed | System prevents time manipulation | +| `InvalidPrecisionConfig` | Invalid precision configuration | Validate parameters before setting | ### Error Prevention Strategies **Configuration Validation:** + ```rust // Validate precision configuration if precision_limit.limit < 0 { @@ -297,11 +310,13 @@ if precision_limit.max_single_tx <= 0 || precision_limit.max_single_tx > precisi ### Backward Compatibility **Legacy Support:** + - Existing members without `precision_limit` use legacy validation - Legacy `spending_limit` field preserved - New features are opt-in per member **Migration Path:** + 1. Deploy enhanced contract 2. Existing members continue with legacy limits 3. Gradually migrate via `set_precision_spending_limit` @@ -310,6 +325,7 @@ if precision_limit.max_single_tx <= 0 || precision_limit.max_single_tx > precisi ### Configuration Examples **Production Configuration:** + ```rust PrecisionSpendingLimit { limit: 10000_0000000, // 10,000 XLM per day @@ -320,6 +336,7 @@ PrecisionSpendingLimit { ``` **Conservative Configuration:** + ```rust PrecisionSpendingLimit { limit: 1000_0000000, // 1,000 XLM per day @@ -391,8 +408,9 @@ cargo test -p family_wallet -- --nocapture The enhanced spending limit system provides robust protection against precision attacks and rollover edge cases while maintaining backward compatibility. The implementation follows security best practices with comprehensive validation, overflow protection, and audit trails. Key benefits: + - **Prevents over-withdrawal** through precision and cumulative validation -- **Secure rollover behavior** with time manipulation resistance +- **Secure rollover behavior** with time manipulation resistance - **Comprehensive testing** covering security edge cases - **Backward compatible** with existing configurations - **Well-documented** security assumptions and validation logic @@ -439,25 +457,25 @@ Key benefits: The contract uses a comprehensive error code system for validation failures: -| Code | Value | Condition | -|---|---|---| -| `Unauthorized` | 1 | Caller lacks required role/permission | -| `InvalidThreshold` | 2 | Threshold exceeds number of signers | -| `InvalidSigner` | 3 | Signer validation failure | -| `TransactionNotFound` | 4 | Pending transaction not found | -| `TransactionExpired` | 5 | Pending transaction has expired | -| `InsufficientSignatures` | 6 | Not enough signatures collected | -| `DuplicateSignature` | 7 | Signer already signed this transaction | -| `InvalidTransactionType` | 8 | Unknown transaction type | -| `InvalidAmount` | 9 | Amount validation failure | -| `InvalidRole` | 10 | Role validation failure | -| `MemberNotFound` | 11 | Family member not found | -| `TransactionAlreadyExecuted` | 12 | Transaction was already executed | -| `InvalidSpendingLimit` | 13 | Spending limit must be >= 0 | -| `ThresholdBelowMinimum` | 14 | Threshold < MIN_THRESHOLD (1) | -| `ThresholdAboveMaximum` | 15 | Threshold > MAX_THRESHOLD (100) | -| `SignersListEmpty` | 16 | Signers list is empty | -| `SignerNotMember` | 17 | Signer is not a family member | +| Code | Value | Condition | +| ---------------------------- | ----- | -------------------------------------- | +| `Unauthorized` | 1 | Caller lacks required role/permission | +| `InvalidThreshold` | 2 | Threshold exceeds number of signers | +| `InvalidSigner` | 3 | Signer validation failure | +| `TransactionNotFound` | 4 | Pending transaction not found | +| `TransactionExpired` | 5 | Pending transaction has expired | +| `InsufficientSignatures` | 6 | Not enough signatures collected | +| `DuplicateSignature` | 7 | Signer already signed this transaction | +| `InvalidTransactionType` | 8 | Unknown transaction type | +| `InvalidAmount` | 9 | Amount validation failure | +| `InvalidRole` | 10 | Role validation failure | +| `MemberNotFound` | 11 | Family member not found | +| `TransactionAlreadyExecuted` | 12 | Transaction was already executed | +| `InvalidSpendingLimit` | 13 | Spending limit must be >= 0 | +| `ThresholdBelowMinimum` | 14 | Threshold < MIN_THRESHOLD (1) | +| `ThresholdAboveMaximum` | 15 | Threshold > MAX_THRESHOLD (100) | +| `SignersListEmpty` | 16 | Signers list is empty | +| `SignerNotMember` | 17 | Signer is not a family member | ### Multisig Threshold Bounds Security diff --git a/family_wallet/src/lib.rs b/family_wallet/src/lib.rs index 288e73e4..d8cbdfff 100644 --- a/family_wallet/src/lib.rs +++ b/family_wallet/src/lib.rs @@ -568,6 +568,22 @@ impl FamilyWallet { amount <= member.spending_limit } + pub fn validate_precision_spending( + env: Env, + caller: Address, + amount: i128, + ) -> Result<(), Error> { + if amount <= 0 { + return Err(Error::InvalidAmount); + } + + if !Self::check_spending_limit(env.clone(), caller.clone(), amount) { + return Err(Error::Unauthorized); + } + + Ok(()) + } + /// @notice Configure multisig parameters for a given transaction type. /// @dev Validates threshold bounds, signer membership, and uniqueness. /// Returns `Result` instead of panicking on invalid input. @@ -956,12 +972,22 @@ impl FamilyWallet { panic!("Maximum pending emergency proposals reached"); } - Self::propose_transaction( - env, - proposer, + let tx_id = Self::propose_transaction( + env.clone(), + proposer.clone(), TransactionType::EmergencyTransfer, - TransactionData::EmergencyTransfer(token, recipient, amount), - ) + TransactionData::EmergencyTransfer(token.clone(), recipient.clone(), amount), + ); + + Self::append_access_audit( + &env, + symbol_short!("em_prop"), + &proposer, + Some(recipient.clone()), + true, + ); + + tx_id } pub fn propose_policy_cancellation(env: Env, proposer: Address, policy_id: u32) -> u64 { @@ -973,6 +999,10 @@ impl FamilyWallet { ) } + /// Configure emergency transfer guardrails. + /// + /// Only `Owner` or `Admin` may update emergency settings. + /// Successful configuration is recorded in the access audit trail. pub fn configure_emergency( env: Env, caller: Address, @@ -1006,9 +1036,14 @@ impl FamilyWallet { }, ); + Self::append_access_audit(&env, symbol_short!("em_conf"), &caller, None, true); + true } + /// Enable or disable emergency mode. + /// + /// This operation is restricted to `Owner` or `Admin` and is recorded in the access audit trail. pub fn set_emergency_mode(env: Env, caller: Address, enabled: bool) -> bool { caller.require_auth(); Self::require_not_paused(&env); @@ -1036,6 +1071,8 @@ impl FamilyWallet { event, ); + Self::append_access_audit(&env, symbol_short!("em_mode"), &caller, None, true); + true } @@ -2024,7 +2061,15 @@ impl FamilyWallet { env.events().publish( (symbol_short!("emerg"), EmergencyEvent::TransferExec), - (proposer, recipient, amount), + (proposer.clone(), recipient.clone(), amount), + ); + + Self::append_access_audit( + &env, + symbol_short!("em_exec"), + &proposer, + Some(recipient.clone()), + true, ); 0 diff --git a/family_wallet/src/test.rs b/family_wallet/src/test.rs index 5ad7eb78..753a83fe 100644 --- a/family_wallet/src/test.rs +++ b/family_wallet/src/test.rs @@ -601,6 +601,92 @@ fn test_emergency_mode_direct_transfer_within_limits() { let last_ts = client.get_last_emergency_at(); assert!(last_ts.is_some()); + + let audit = client.get_access_audit(&2); + assert_eq!(audit.len(), 2); + let em_exec = audit.get(1).unwrap(); + assert_eq!(em_exec.operation, symbol_short!("em_exec")); + assert_eq!(em_exec.caller, owner); + assert_eq!(em_exec.target, Some(recipient)); + assert!(em_exec.success); +} + +#[test] +fn test_set_emergency_mode_appends_access_audit() { + let env = Env::default(); + env.mock_all_auths(); + let contract_id = env.register_contract(None, FamilyWallet); + let client = FamilyWalletClient::new(&env, &contract_id); + + let owner = Address::generate(&env); + let initial_members = Vec::new(&env); + client.init(&owner, &initial_members); + + assert!(client.set_emergency_mode(&owner, &true)); + + let audit = client.get_access_audit(&1); + assert_eq!(audit.len(), 1); + let entry = audit.get(0).unwrap(); + assert_eq!(entry.operation, symbol_short!("em_mode")); + assert_eq!(entry.caller, owner); + assert!(entry.target.is_none()); + assert!(entry.success); +} + +#[test] +fn test_configure_emergency_appends_access_audit() { + let env = Env::default(); + env.mock_all_auths(); + let contract_id = env.register_contract(None, FamilyWallet); + let client = FamilyWalletClient::new(&env, &contract_id); + + let owner = Address::generate(&env); + let initial_members = Vec::new(&env); + client.init(&owner, &initial_members); + + assert!(client.configure_emergency(&owner, &2000_0000000, &3600u64, &500_0000000, &10000_0000000)); + + let audit = client.get_access_audit(&1); + assert_eq!(audit.len(), 1); + let entry = audit.get(0).unwrap(); + assert_eq!(entry.operation, symbol_short!("em_conf")); + assert_eq!(entry.caller, owner); + assert!(entry.target.is_none()); + assert!(entry.success); +} + +#[test] +fn test_propose_emergency_transfer_appends_access_audit() { + let env = Env::default(); + env.mock_all_auths(); + let contract_id = env.register_contract(None, FamilyWallet); + let client = FamilyWalletClient::new(&env, &contract_id); + + let owner = Address::generate(&env); + let initial_members = Vec::new(&env); + client.init(&owner, &initial_members); + + let token_admin = Address::generate(&env); + let token_contract = env.register_stellar_asset_contract_v2(token_admin.clone()); + let recipient = Address::generate(&env); + let amount = 3000_0000000; + + let tx_id = client.propose_emergency_transfer( + &owner, + &token_contract.address(), + &recipient, + &amount, + ); + + assert!(tx_id > 0); + + let audit = client.get_access_audit(&1); + assert_eq!(audit.len(), 1); + let entry = audit.get(0).unwrap(); + assert_eq!(entry.operation, symbol_short!("em_prop")); + assert_eq!(entry.caller, owner); + assert_eq!(entry.target, Some(recipient)); + assert!(entry.success); } #[test] diff --git a/insurance/README.md b/insurance/README.md index 1700593d..78bfda53 100644 --- a/insurance/README.md +++ b/insurance/README.md @@ -216,7 +216,10 @@ 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` +**Hardening Features**: +- **Idempotent**: If the policy is already inactive, returns `false` without duplicate events. +- **Schedule Cleanup**: Automatically deactivates any associated `PremiumSchedule` if present. +- **Standardized Events**: Emits `InsuranceEvent::PolicyDeactivated` and (if applicable) `InsuranceEvent::ScheduleCancelled`. --- diff --git a/insurance/test_snapshots/test/test_create_policy_emits_event.1.json b/insurance/test_snapshots/test/test_create_policy_emits_event.1.json index 0514df87..b6f5c6d5 100644 --- a/insurance/test_snapshots/test/test_create_policy_emits_event.1.json +++ b/insurance/test_snapshots/test/test_create_policy_emits_event.1.json @@ -17,10 +17,10 @@ "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" }, { - "string": "Health Policy" + "string": "Health Insurance" }, { - "string": "Health" + "u32": 1 }, { "i128": { @@ -31,7 +31,7 @@ { "i128": { "hi": 0, - "lo": 10000 + "lo": 50000 } } ] @@ -110,7 +110,7 @@ "val": { "i128": { "hi": 0, - "lo": 10000 + "lo": 50000 } } }, @@ -119,7 +119,7 @@ "symbol": "coverage_type" }, "val": { - "string": "Health" + "u32": 1 } }, { @@ -146,7 +146,7 @@ "symbol": "name" }, "val": { - "string": "Health Policy" + "string": "Health Insurance" } }, { @@ -176,26 +176,6 @@ } ] } - }, - { - "key": { - "symbol": "PRM_TOT" - }, - "val": { - "map": [ - { - "key": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - }, - "val": { - "i128": { - "hi": 0, - "lo": 100 - } - } - } - ] - } } ] } @@ -288,10 +268,10 @@ "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" }, { - "string": "Health Policy" + "string": "Health Insurance" }, { - "string": "Health" + "u32": 1 }, { "i128": { @@ -302,7 +282,7 @@ { "i128": { "hi": 0, - "lo": 10000 + "lo": 50000 } } ] @@ -333,7 +313,7 @@ "val": { "i128": { "hi": 0, - "lo": 10000 + "lo": 50000 } } }, @@ -342,7 +322,7 @@ "symbol": "coverage_type" }, "val": { - "string": "Health" + "u32": 1 } }, { @@ -361,7 +341,7 @@ "symbol": "name" }, "val": { - "string": "Health Policy" + "string": "Health Insurance" } }, { diff --git a/insurance/test_snapshots/test/test_get_active_policies_excludes_inactive.1.json b/insurance/test_snapshots/test/test_get_active_policies_excludes_inactive.1.json index 867aa8c3..cf379a8f 100644 --- a/insurance/test_snapshots/test/test_get_active_policies_excludes_inactive.1.json +++ b/insurance/test_snapshots/test/test_get_active_policies_excludes_inactive.1.json @@ -20,7 +20,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -57,7 +57,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -94,7 +94,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -131,7 +131,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -253,7 +253,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -338,7 +338,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -423,7 +423,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -508,7 +508,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -565,26 +565,6 @@ } ] } - }, - { - "key": { - "symbol": "PRM_TOT" - }, - "val": { - "map": [ - { - "key": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - }, - "val": { - "i128": { - "hi": 0, - "lo": 400 - } - } - } - ] - } } ] } @@ -812,7 +792,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -863,7 +843,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -992,7 +972,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1043,7 +1023,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -1172,7 +1152,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1223,7 +1203,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -1352,7 +1332,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1403,7 +1383,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -1592,7 +1572,7 @@ "v0": { "topics": [ { - "symbol": "insure" + "symbol": "insuranc" }, { "vec": [ @@ -1733,7 +1713,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -1813,7 +1793,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -1893,7 +1873,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { diff --git a/insurance/test_snapshots/test/test_get_active_policies_multi_owner_isolation.1.json b/insurance/test_snapshots/test/test_get_active_policies_multi_owner_isolation.1.json index 6198a00f..dc473bab 100644 --- a/insurance/test_snapshots/test/test_get_active_policies_multi_owner_isolation.1.json +++ b/insurance/test_snapshots/test/test_get_active_policies_multi_owner_isolation.1.json @@ -20,7 +20,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -57,7 +57,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -94,7 +94,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -131,7 +131,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -168,7 +168,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -205,7 +205,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -242,7 +242,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -279,7 +279,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -379,7 +379,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -464,7 +464,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -549,7 +549,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -634,7 +634,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -719,7 +719,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -804,7 +804,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -889,7 +889,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -974,7 +974,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -1031,37 +1031,6 @@ } ] } - }, - { - "key": { - "symbol": "PRM_TOT" - }, - "val": { - "map": [ - { - "key": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - }, - "val": { - "i128": { - "hi": 0, - "lo": 300 - } - } - }, - { - "key": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - }, - "val": { - "i128": { - "hi": 0, - "lo": 750 - } - } - } - ] - } } ] } @@ -1388,7 +1357,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1439,7 +1408,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -1568,7 +1537,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1619,7 +1588,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -1748,7 +1717,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1799,7 +1768,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -1928,7 +1897,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1979,7 +1948,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -2108,7 +2077,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -2159,7 +2128,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -2288,7 +2257,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -2339,7 +2308,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -2468,7 +2437,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -2519,7 +2488,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -2648,7 +2617,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -2699,7 +2668,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -2894,7 +2863,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -2974,7 +2943,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -3054,7 +3023,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { diff --git a/insurance/test_snapshots/test/test_get_active_policies_multiple_pages.1.json b/insurance/test_snapshots/test/test_get_active_policies_multiple_pages.1.json index 7635fb27..2bb64ccf 100644 --- a/insurance/test_snapshots/test/test_get_active_policies_multiple_pages.1.json +++ b/insurance/test_snapshots/test/test_get_active_policies_multiple_pages.1.json @@ -20,7 +20,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -57,7 +57,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -94,7 +94,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -131,7 +131,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -168,7 +168,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -205,7 +205,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -242,7 +242,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -344,7 +344,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -429,7 +429,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -514,7 +514,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -599,7 +599,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -684,7 +684,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -769,7 +769,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -854,7 +854,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -1204,7 +1204,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1255,7 +1255,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -1384,7 +1384,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1435,7 +1435,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -1564,7 +1564,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1615,7 +1615,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -1744,7 +1744,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1795,7 +1795,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -1924,7 +1924,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1975,7 +1975,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -2104,7 +2104,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -2155,7 +2155,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -2284,7 +2284,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -2335,7 +2335,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -2530,7 +2530,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -2610,7 +2610,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -2690,7 +2690,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -2855,7 +2855,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -2935,7 +2935,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -3015,7 +3015,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -3180,7 +3180,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { diff --git a/insurance/test_snapshots/test/test_get_active_policies_single_page.1.json b/insurance/test_snapshots/test/test_get_active_policies_single_page.1.json index d94677b1..ded8012e 100644 --- a/insurance/test_snapshots/test/test_get_active_policies_single_page.1.json +++ b/insurance/test_snapshots/test/test_get_active_policies_single_page.1.json @@ -20,7 +20,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -57,7 +57,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -94,7 +94,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -131,7 +131,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -168,7 +168,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -268,7 +268,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -353,7 +353,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -438,7 +438,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -523,7 +523,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -608,7 +608,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -665,26 +665,6 @@ } ] } - }, - { - "key": { - "symbol": "PRM_TOT" - }, - "val": { - "map": [ - { - "key": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - }, - "val": { - "i128": { - "hi": 0, - "lo": 750 - } - } - } - ] - } } ] } @@ -912,7 +892,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -963,7 +943,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -1092,7 +1072,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1143,7 +1123,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -1272,7 +1252,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1323,7 +1303,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -1452,7 +1432,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1503,7 +1483,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -1632,7 +1612,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1683,7 +1663,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -1878,7 +1858,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -1958,7 +1938,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -2038,7 +2018,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -2118,7 +2098,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -2198,7 +2178,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { diff --git a/insurance/test_snapshots/test/test_get_all_policies_for_owner_includes_inactive.1.json b/insurance/test_snapshots/test/test_get_all_policies_for_owner_includes_inactive.1.json index e6331976..fabdca4f 100644 --- a/insurance/test_snapshots/test/test_get_all_policies_for_owner_includes_inactive.1.json +++ b/insurance/test_snapshots/test/test_get_all_policies_for_owner_includes_inactive.1.json @@ -20,7 +20,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -57,7 +57,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -94,7 +94,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -131,7 +131,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -299,7 +299,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -384,7 +384,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -469,7 +469,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -554,7 +554,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -611,26 +611,6 @@ } ] } - }, - { - "key": { - "symbol": "PRM_TOT" - }, - "val": { - "map": [ - { - "key": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - }, - "val": { - "i128": { - "hi": 0, - "lo": 300 - } - } - } - ] - } } ] } @@ -924,7 +904,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -975,7 +955,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -1104,7 +1084,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1155,7 +1135,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -1284,7 +1264,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1335,7 +1315,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -1464,7 +1444,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1515,7 +1495,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -1704,7 +1684,7 @@ "v0": { "topics": [ { - "symbol": "insure" + "symbol": "insuranc" }, { "vec": [ @@ -1839,7 +1819,7 @@ "v0": { "topics": [ { - "symbol": "insure" + "symbol": "insuranc" }, { "vec": [ @@ -1980,7 +1960,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -2060,7 +2040,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -2140,7 +2120,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -2220,7 +2200,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { diff --git a/insurance/test_snapshots/test/test_instance_ttl_extended_on_create_policy.1.json b/insurance/test_snapshots/test/test_instance_ttl_extended_on_create_policy.1.json index 63bbe397..5fae9cb1 100644 --- a/insurance/test_snapshots/test/test_instance_ttl_extended_on_create_policy.1.json +++ b/insurance/test_snapshots/test/test_instance_ttl_extended_on_create_policy.1.json @@ -20,7 +20,7 @@ "string": "Health Insurance" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -120,7 +120,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -177,26 +177,6 @@ } ] } - }, - { - "key": { - "symbol": "PRM_TOT" - }, - "val": { - "map": [ - { - "key": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - }, - "val": { - "i128": { - "hi": 0, - "lo": 100 - } - } - } - ] - } } ] } @@ -292,7 +272,7 @@ "string": "Health Insurance" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -343,7 +323,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { diff --git a/insurance/test_snapshots/test/test_instance_ttl_extended_on_deactivate_policy.1.json b/insurance/test_snapshots/test/test_instance_ttl_extended_on_deactivate_policy.1.json index 9bae42c5..06f73f8b 100644 --- a/insurance/test_snapshots/test/test_instance_ttl_extended_on_deactivate_policy.1.json +++ b/insurance/test_snapshots/test/test_instance_ttl_extended_on_deactivate_policy.1.json @@ -20,7 +20,7 @@ "string": "Dental" }, { - "string": "dental" + "u32": 8 }, { "i128": { @@ -142,7 +142,7 @@ "symbol": "coverage_type" }, "val": { - "string": "dental" + "u32": 8 } }, { @@ -199,26 +199,6 @@ } ] } - }, - { - "key": { - "symbol": "PRM_TOT" - }, - "val": { - "map": [ - { - "key": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - }, - "val": { - "i128": { - "hi": 0, - "lo": 0 - } - } - } - ] - } } ] } @@ -347,7 +327,7 @@ "string": "Dental" }, { - "string": "dental" + "u32": 8 }, { "i128": { @@ -398,7 +378,7 @@ "symbol": "coverage_type" }, "val": { - "string": "dental" + "u32": 8 } }, { @@ -587,7 +567,7 @@ "v0": { "topics": [ { - "symbol": "insure" + "symbol": "insuranc" }, { "vec": [ diff --git a/insurance/test_snapshots/test/test_instance_ttl_refreshed_on_pay_premium.1.json b/insurance/test_snapshots/test/test_instance_ttl_refreshed_on_pay_premium.1.json index b94935a0..ee19a328 100644 --- a/insurance/test_snapshots/test/test_instance_ttl_refreshed_on_pay_premium.1.json +++ b/insurance/test_snapshots/test/test_instance_ttl_refreshed_on_pay_premium.1.json @@ -20,7 +20,7 @@ "string": "Life Insurance" }, { - "string": "life" + "u32": 2 }, { "i128": { @@ -142,7 +142,7 @@ "symbol": "coverage_type" }, "val": { - "string": "life" + "u32": 2 } }, { @@ -199,26 +199,6 @@ } ] } - }, - { - "key": { - "symbol": "PRM_TOT" - }, - "val": { - "map": [ - { - "key": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - }, - "val": { - "i128": { - "hi": 0, - "lo": 200 - } - } - } - ] - } } ] } @@ -347,7 +327,7 @@ "string": "Life Insurance" }, { - "string": "life" + "u32": 2 }, { "i128": { @@ -398,7 +378,7 @@ "symbol": "coverage_type" }, "val": { - "string": "life" + "u32": 2 } }, { @@ -646,7 +626,9 @@ "symbol": "pay_premium" } ], - "data": "void" + "data": { + "bool": true + } } } }, diff --git a/insurance/test_snapshots/test/test_limit_clamped_to_max.1.json b/insurance/test_snapshots/test/test_limit_clamped_to_max.1.json index e6f74734..303a0df3 100644 --- a/insurance/test_snapshots/test/test_limit_clamped_to_max.1.json +++ b/insurance/test_snapshots/test/test_limit_clamped_to_max.1.json @@ -20,7 +20,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -57,7 +57,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -94,7 +94,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -131,7 +131,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -168,7 +168,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -205,7 +205,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -242,7 +242,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -279,7 +279,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -316,7 +316,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -353,7 +353,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -390,7 +390,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -427,7 +427,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -464,7 +464,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -501,7 +501,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -538,7 +538,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -575,7 +575,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -612,7 +612,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -649,7 +649,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -686,7 +686,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -723,7 +723,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -760,7 +760,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -797,7 +797,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -834,7 +834,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -871,7 +871,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -908,7 +908,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -945,7 +945,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -982,7 +982,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1019,7 +1019,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1056,7 +1056,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1093,7 +1093,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1130,7 +1130,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1167,7 +1167,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1204,7 +1204,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1241,7 +1241,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1278,7 +1278,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1315,7 +1315,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1352,7 +1352,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1389,7 +1389,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1426,7 +1426,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1463,7 +1463,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1500,7 +1500,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1537,7 +1537,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1574,7 +1574,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1611,7 +1611,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1648,7 +1648,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1685,7 +1685,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1722,7 +1722,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1759,7 +1759,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1796,7 +1796,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1833,7 +1833,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1870,7 +1870,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1907,7 +1907,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1944,7 +1944,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1981,7 +1981,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -2018,7 +2018,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -2118,7 +2118,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -2203,7 +2203,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -2288,7 +2288,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -2373,7 +2373,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -2458,7 +2458,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -2543,7 +2543,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -2628,7 +2628,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -2713,7 +2713,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -2798,7 +2798,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -2883,7 +2883,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -2968,7 +2968,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -3053,7 +3053,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -3138,7 +3138,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -3223,7 +3223,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -3308,7 +3308,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -3393,7 +3393,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -3478,7 +3478,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -3563,7 +3563,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -3648,7 +3648,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -3733,7 +3733,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -3818,7 +3818,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -3903,7 +3903,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -3988,7 +3988,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -4073,7 +4073,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -4158,7 +4158,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -4243,7 +4243,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -4328,7 +4328,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -4413,7 +4413,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -4498,7 +4498,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -4583,7 +4583,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -4668,7 +4668,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -4753,7 +4753,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -4838,7 +4838,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -4923,7 +4923,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -5008,7 +5008,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -5093,7 +5093,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -5178,7 +5178,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -5263,7 +5263,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -5348,7 +5348,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -5433,7 +5433,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -5518,7 +5518,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -5603,7 +5603,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -5688,7 +5688,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -5773,7 +5773,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -5858,7 +5858,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -5943,7 +5943,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -6028,7 +6028,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -6113,7 +6113,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -6198,7 +6198,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -6283,7 +6283,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -6368,7 +6368,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -6453,7 +6453,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -6538,7 +6538,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -6623,7 +6623,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -6708,7 +6708,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -6765,26 +6765,6 @@ } ] } - }, - { - "key": { - "symbol": "PRM_TOT" - }, - "val": { - "map": [ - { - "key": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - }, - "val": { - "i128": { - "hi": 0, - "lo": 77000 - } - } - } - ] - } } ] } @@ -8662,7 +8642,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -8713,7 +8693,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -8842,7 +8822,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -8893,7 +8873,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -9022,7 +9002,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -9073,7 +9053,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -9202,7 +9182,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -9253,7 +9233,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -9382,7 +9362,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -9433,7 +9413,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -9562,7 +9542,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -9613,7 +9593,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -9742,7 +9722,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -9793,7 +9773,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -9922,7 +9902,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -9973,7 +9953,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -10102,7 +10082,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -10153,7 +10133,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -10282,7 +10262,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -10333,7 +10313,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -10462,7 +10442,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -10513,7 +10493,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -10642,7 +10622,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -10693,7 +10673,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -10822,7 +10802,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -10873,7 +10853,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -11002,7 +10982,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -11053,7 +11033,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -11182,7 +11162,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -11233,7 +11213,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -11362,7 +11342,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -11413,7 +11393,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -11542,7 +11522,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -11593,7 +11573,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -11722,7 +11702,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -11773,7 +11753,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -11902,7 +11882,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -11953,7 +11933,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -12082,7 +12062,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -12133,7 +12113,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -12262,7 +12242,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -12313,7 +12293,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -12442,7 +12422,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -12493,7 +12473,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -12622,7 +12602,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -12673,7 +12653,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -12802,7 +12782,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -12853,7 +12833,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -12982,7 +12962,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -13033,7 +13013,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -13162,7 +13142,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -13213,7 +13193,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -13342,7 +13322,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -13393,7 +13373,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -13522,7 +13502,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -13573,7 +13553,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -13702,7 +13682,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -13753,7 +13733,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -13882,7 +13862,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -13933,7 +13913,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -14062,7 +14042,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -14113,7 +14093,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -14242,7 +14222,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -14293,7 +14273,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -14422,7 +14402,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -14473,7 +14453,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -14602,7 +14582,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -14653,7 +14633,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -14782,7 +14762,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -14833,7 +14813,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -14962,7 +14942,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -15013,7 +14993,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -15142,7 +15122,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -15193,7 +15173,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -15322,7 +15302,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -15373,7 +15353,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -15502,7 +15482,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -15553,7 +15533,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -15682,7 +15662,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -15733,7 +15713,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -15862,7 +15842,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -15913,7 +15893,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -16042,7 +16022,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -16093,7 +16073,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -16222,7 +16202,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -16273,7 +16253,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -16402,7 +16382,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -16453,7 +16433,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -16582,7 +16562,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -16633,7 +16613,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -16762,7 +16742,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -16813,7 +16793,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -16942,7 +16922,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -16993,7 +16973,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -17122,7 +17102,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -17173,7 +17153,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -17302,7 +17282,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -17353,7 +17333,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -17482,7 +17462,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -17533,7 +17513,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -17662,7 +17642,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -17713,7 +17693,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -17842,7 +17822,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -17893,7 +17873,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -18022,7 +18002,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -18073,7 +18053,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -18202,7 +18182,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -18253,7 +18233,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -18382,7 +18362,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -18433,7 +18413,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -18628,7 +18608,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -18708,7 +18688,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -18788,7 +18768,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -18868,7 +18848,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -18948,7 +18928,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -19028,7 +19008,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -19108,7 +19088,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -19188,7 +19168,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -19268,7 +19248,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -19348,7 +19328,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -19428,7 +19408,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -19508,7 +19488,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -19588,7 +19568,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -19668,7 +19648,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -19748,7 +19728,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -19828,7 +19808,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -19908,7 +19888,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -19988,7 +19968,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -20068,7 +20048,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -20148,7 +20128,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -20228,7 +20208,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -20308,7 +20288,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -20388,7 +20368,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -20468,7 +20448,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -20548,7 +20528,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -20628,7 +20608,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -20708,7 +20688,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -20788,7 +20768,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -20868,7 +20848,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -20948,7 +20928,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -21028,7 +21008,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -21108,7 +21088,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -21188,7 +21168,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -21268,7 +21248,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -21348,7 +21328,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -21428,7 +21408,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -21508,7 +21488,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -21588,7 +21568,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -21668,7 +21648,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -21748,7 +21728,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -21828,7 +21808,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -21908,7 +21888,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -21988,7 +21968,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -22068,7 +22048,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -22148,7 +22128,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -22228,7 +22208,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -22308,7 +22288,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -22388,7 +22368,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -22468,7 +22448,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -22548,7 +22528,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { diff --git a/insurance/test_snapshots/test/test_limit_zero_uses_default.1.json b/insurance/test_snapshots/test/test_limit_zero_uses_default.1.json index 548c8b34..867582f7 100644 --- a/insurance/test_snapshots/test/test_limit_zero_uses_default.1.json +++ b/insurance/test_snapshots/test/test_limit_zero_uses_default.1.json @@ -20,7 +20,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -57,7 +57,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -94,7 +94,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -194,7 +194,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -279,7 +279,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -364,7 +364,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -421,26 +421,6 @@ } ] } - }, - { - "key": { - "symbol": "PRM_TOT" - }, - "val": { - "map": [ - { - "key": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - }, - "val": { - "i128": { - "hi": 0, - "lo": 300 - } - } - } - ] - } } ] } @@ -602,7 +582,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -653,7 +633,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -782,7 +762,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -833,7 +813,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -962,7 +942,7 @@ "string": "Policy" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -1013,7 +993,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -1208,7 +1188,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -1288,7 +1268,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -1368,7 +1348,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { diff --git a/insurance/test_snapshots/test/test_pay_premium_after_deactivate.1.json b/insurance/test_snapshots/test/test_pay_premium_after_deactivate.1.json index 70c1d8a9..6c65b353 100644 --- a/insurance/test_snapshots/test/test_pay_premium_after_deactivate.1.json +++ b/insurance/test_snapshots/test/test_pay_premium_after_deactivate.1.json @@ -20,7 +20,7 @@ "string": "Health Plan" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -144,7 +144,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -201,26 +201,6 @@ } ] } - }, - { - "key": { - "symbol": "PRM_TOT" - }, - "val": { - "map": [ - { - "key": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - }, - "val": { - "i128": { - "hi": 0, - "lo": 0 - } - } - } - ] - } } ] } @@ -349,7 +329,7 @@ "string": "Health Plan" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -400,7 +380,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -569,7 +549,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -715,7 +695,7 @@ "v0": { "topics": [ { - "symbol": "insure" + "symbol": "insuranc" }, { "vec": [ @@ -830,7 +810,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -931,16 +911,21 @@ "v0": { "topics": [ { - "symbol": "fn_return" - }, - { - "symbol": "pay_premium" + "symbol": "log" } ], "data": { - "error": { - "contract": 6 - } + "vec": [ + { + "string": "caught panic 'Policy is not active' from contract function 'Symbol(obj#187)'" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + }, + { + "u32": 1 + } + ] } } } @@ -960,12 +945,12 @@ }, { "error": { - "contract": 6 + "wasm_vm": "invalid_action" } } ], "data": { - "string": "escalating Ok(ScErrorType::Contract) frame-exit to Err" + "string": "caught error from function" } } } @@ -985,14 +970,14 @@ }, { "error": { - "contract": 6 + "wasm_vm": "invalid_action" } } ], "data": { "vec": [ { - "string": "contract try_call failed" + "string": "contract call failed" }, { "symbol": "pay_premium" @@ -1013,6 +998,31 @@ } }, "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "wasm_vm": "invalid_action" + } + } + ], + "data": { + "string": "escalating error to panic" + } + } + } + }, + "failed_call": false } ] } \ No newline at end of file diff --git a/insurance/test_snapshots/test/test_pay_premium_emits_event.1.json b/insurance/test_snapshots/test/test_pay_premium_emits_event.1.json index 78dbe178..92b86759 100644 --- a/insurance/test_snapshots/test/test_pay_premium_emits_event.1.json +++ b/insurance/test_snapshots/test/test_pay_premium_emits_event.1.json @@ -17,21 +17,21 @@ "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" }, { - "string": "Health Policy" + "string": "Emergency Coverage" }, { - "string": "Health" + "u32": 6 }, { "i128": { "hi": 0, - "lo": 100 + "lo": 75 } }, { "i128": { "hi": 0, - "lo": 10000 + "lo": 25000 } } ] @@ -132,7 +132,7 @@ "val": { "i128": { "hi": 0, - "lo": 10000 + "lo": 25000 } } }, @@ -141,7 +141,7 @@ "symbol": "coverage_type" }, "val": { - "string": "Health" + "u32": 6 } }, { @@ -159,7 +159,7 @@ "val": { "i128": { "hi": 0, - "lo": 100 + "lo": 75 } } }, @@ -168,7 +168,7 @@ "symbol": "name" }, "val": { - "string": "Health Policy" + "string": "Emergency Coverage" } }, { @@ -198,26 +198,6 @@ } ] } - }, - { - "key": { - "symbol": "PRM_TOT" - }, - "val": { - "map": [ - { - "key": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - }, - "val": { - "i128": { - "hi": 0, - "lo": 100 - } - } - } - ] - } } ] } @@ -343,21 +323,21 @@ "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" }, { - "string": "Health Policy" + "string": "Emergency Coverage" }, { - "string": "Health" + "u32": 6 }, { "i128": { "hi": 0, - "lo": 100 + "lo": 75 } }, { "i128": { "hi": 0, - "lo": 10000 + "lo": 25000 } } ] @@ -388,7 +368,7 @@ "val": { "i128": { "hi": 0, - "lo": 10000 + "lo": 25000 } } }, @@ -397,7 +377,7 @@ "symbol": "coverage_type" }, "val": { - "string": "Health" + "u32": 6 } }, { @@ -407,7 +387,7 @@ "val": { "i128": { "hi": 0, - "lo": 100 + "lo": 75 } } }, @@ -416,7 +396,7 @@ "symbol": "name" }, "val": { - "string": "Health Policy" + "string": "Emergency Coverage" } }, { @@ -553,7 +533,7 @@ "val": { "i128": { "hi": 0, - "lo": 100 + "lo": 75 } } }, @@ -562,7 +542,7 @@ "symbol": "name" }, "val": { - "string": "Health Policy" + "string": "Emergency Coverage" } }, { @@ -645,7 +625,9 @@ "symbol": "pay_premium" } ], - "data": "void" + "data": { + "bool": true + } } } }, diff --git a/insurance/test_snapshots/test/test_pay_premium_policy_not_found.1.json b/insurance/test_snapshots/test/test_pay_premium_policy_not_found.1.json index 14950723..5832f3d1 100644 --- a/insurance/test_snapshots/test/test_pay_premium_policy_not_found.1.json +++ b/insurance/test_snapshots/test/test_pay_premium_policy_not_found.1.json @@ -114,16 +114,21 @@ "v0": { "topics": [ { - "symbol": "fn_return" - }, - { - "symbol": "pay_premium" + "symbol": "log" } ], "data": { - "error": { - "contract": 3 - } + "vec": [ + { + "string": "caught panic 'Policy not found' from contract function 'Symbol(obj#7)'" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + }, + { + "u32": 999 + } + ] } } } @@ -143,12 +148,12 @@ }, { "error": { - "contract": 3 + "wasm_vm": "invalid_action" } } ], "data": { - "string": "escalating Ok(ScErrorType::Contract) frame-exit to Err" + "string": "caught error from function" } } } @@ -168,7 +173,7 @@ }, { "error": { - "contract": 3 + "wasm_vm": "invalid_action" } } ], diff --git a/insurance/test_snapshots/test/test_policy_data_persists_across_ledger_advancements.1.json b/insurance/test_snapshots/test/test_policy_data_persists_across_ledger_advancements.1.json index 04e0f4e3..9a5fed34 100644 --- a/insurance/test_snapshots/test/test_policy_data_persists_across_ledger_advancements.1.json +++ b/insurance/test_snapshots/test/test_policy_data_persists_across_ledger_advancements.1.json @@ -20,7 +20,7 @@ "string": "Auto Insurance" }, { - "string": "auto" + "u32": 4 }, { "i128": { @@ -79,7 +79,7 @@ "string": "Travel Insurance" }, { - "string": "travel" + "u32": 7 }, { "i128": { @@ -181,7 +181,7 @@ "symbol": "coverage_type" }, "val": { - "string": "auto" + "u32": 4 } }, { @@ -266,7 +266,7 @@ "symbol": "coverage_type" }, "val": { - "string": "travel" + "u32": 7 } }, { @@ -323,26 +323,6 @@ } ] } - }, - { - "key": { - "symbol": "PRM_TOT" - }, - "val": { - "map": [ - { - "key": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - }, - "val": { - "i128": { - "hi": 0, - "lo": 200 - } - } - } - ] - } } ] } @@ -504,7 +484,7 @@ "string": "Auto Insurance" }, { - "string": "auto" + "u32": 4 }, { "i128": { @@ -555,7 +535,7 @@ "symbol": "coverage_type" }, "val": { - "string": "auto" + "u32": 4 } }, { @@ -803,7 +783,9 @@ "symbol": "pay_premium" } ], - "data": "void" + "data": { + "bool": true + } } } }, @@ -836,7 +818,7 @@ "string": "Travel Insurance" }, { - "string": "travel" + "u32": 7 }, { "i128": { @@ -887,7 +869,7 @@ "symbol": "coverage_type" }, "val": { - "string": "travel" + "u32": 7 } }, { @@ -1056,7 +1038,7 @@ "symbol": "coverage_type" }, "val": { - "string": "auto" + "u32": 4 } }, { @@ -1182,7 +1164,7 @@ "symbol": "coverage_type" }, "val": { - "string": "travel" + "u32": 7 } }, { diff --git a/insurance/test_snapshots/test/test_policy_lifecycle_emits_all_events.1.json b/insurance/test_snapshots/test/test_policy_lifecycle_emits_all_events.1.json index a6ebad9f..6b1b95df 100644 --- a/insurance/test_snapshots/test/test_policy_lifecycle_emits_all_events.1.json +++ b/insurance/test_snapshots/test/test_policy_lifecycle_emits_all_events.1.json @@ -20,7 +20,7 @@ "string": "Complete Lifecycle" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -163,7 +163,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -220,26 +220,6 @@ } ] } - }, - { - "key": { - "symbol": "PRM_TOT" - }, - "val": { - "map": [ - { - "key": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - }, - "val": { - "i128": { - "hi": 0, - "lo": 0 - } - } - } - ] - } } ] } @@ -401,7 +381,7 @@ "string": "Complete Lifecycle" }, { - "string": "health" + "u32": 1 }, { "i128": { @@ -452,7 +432,7 @@ "symbol": "coverage_type" }, "val": { - "string": "health" + "u32": 1 } }, { @@ -700,7 +680,9 @@ "symbol": "pay_premium" } ], - "data": "void" + "data": { + "bool": true + } } } }, @@ -793,7 +775,7 @@ "v0": { "topics": [ { - "symbol": "insure" + "symbol": "insuranc" }, { "vec": [ diff --git a/orchestrator/src/lib.rs b/orchestrator/src/lib.rs index 84969d12..11edf67c 100644 --- a/orchestrator/src/lib.rs +++ b/orchestrator/src/lib.rs @@ -46,7 +46,7 @@ pub trait BillPaymentsTrait { #[contractclient(name = "InsuranceClient")] pub trait InsuranceTrait { - fn pay_premium(env: Env, caller: Address, policy_id: u32) -> bool; + fn pay_premium(env: Env, caller: Address, policy_id: u32) -> Result; } // ============================================================================ @@ -243,6 +243,728 @@ impl Orchestrator { // Main Entry Points // ----------------------------------------------------------------------- +<<<<<<< HEAD + /// Check family wallet permission before executing an operation + /// + /// This function validates that the caller has permission to perform the operation + /// by checking with the Family Wallet contract. This acts as a permission gate + /// for all orchestrator operations. + /// + /// # Arguments + /// * `env` - The contract environment + /// * `family_wallet_addr` - Address of the Family Wallet contract + /// * `caller` - Address requesting permission + /// * `amount` - Amount involved in the operation + /// + /// # Returns + /// Ok(true) if permission granted, Err(OrchestratorError::PermissionDenied) otherwise + /// + /// # Gas Estimation + /// ~2000 gas for cross-contract permission check + /// + /// # Cross-Contract Call Flow + /// 1. Create FamilyWalletClient instance with the provided address + /// 2. Call check_spending_limit via cross-contract call + /// 3. If the call succeeds and returns true, permission is granted + /// 4. If the call fails or returns false, permission is denied + fn check_family_wallet_permission( + env: &Env, + family_wallet_addr: &Address, + caller: &Address, + amount: i128, + ) -> Result { + // Create client for cross-contract call + let wallet_client = FamilyWalletClient::new(env, family_wallet_addr); + + // Gas estimation: ~2000 gas + // Call the family wallet to check spending limit + // This will panic if the caller doesn't have permission or exceeds limit + let has_permission = wallet_client.check_spending_limit(caller, &amount); + + if has_permission { + Ok(true) + } else { + Err(OrchestratorError::PermissionDenied) + } + } + + /// Check if operation amount exceeds caller's spending limit + /// + /// This function queries the Family Wallet contract to verify that the + /// operation amount does not exceed the caller's configured spending limit. + /// + /// # Arguments + /// * `env` - The contract environment + /// * `family_wallet_addr` - Address of the Family Wallet contract + /// * `caller` - Address to check spending limit for + /// * `amount` - Amount to validate against limit + /// + /// # Returns + /// Ok(()) if within limit, Err(OrchestratorError::SpendingLimitExceeded) otherwise + /// + /// # Gas Estimation + /// ~2000 gas for cross-contract limit check + fn check_spending_limit( + env: &Env, + family_wallet_addr: &Address, + caller: &Address, + amount: i128, + ) -> Result<(), OrchestratorError> { + // Create client for cross-contract call + let wallet_client = FamilyWalletClient::new(env, family_wallet_addr); + + // Gas estimation: ~2000 gas + // Check if amount is within spending limit + let within_limit = wallet_client.check_spending_limit(caller, &amount); + + if within_limit { + Ok(()) + } else { + Err(OrchestratorError::SpendingLimitExceeded) + } + } + + /// Validate that all remittance flow contract addresses are distinct + /// and do not reference the orchestrator itself. + /// + /// This guard protects against misconfiguration and self-referential + /// contract calls that could create invalid execution flows. + fn validate_remittance_flow_addresses( + env: &Env, + family_wallet_addr: &Address, + remittance_split_addr: &Address, + savings_addr: &Address, + bills_addr: &Address, + insurance_addr: &Address, + ) -> Result<(), OrchestratorError> { + let self_addr = env.current_contract_address(); + + let addrs = [ + family_wallet_addr, + remittance_split_addr, + savings_addr, + bills_addr, + insurance_addr, + ]; + + for addr in addrs { + if *addr == self_addr { + return Err(OrchestratorError::InvalidContractAddress); + } + } + + if family_wallet_addr == remittance_split_addr + || family_wallet_addr == savings_addr + || family_wallet_addr == bills_addr + || family_wallet_addr == insurance_addr + || remittance_split_addr == savings_addr + || remittance_split_addr == bills_addr + || remittance_split_addr == insurance_addr + || savings_addr == bills_addr + || savings_addr == insurance_addr + || bills_addr == insurance_addr + { + return Err(OrchestratorError::InvalidContractAddress); + } + + Ok(()) + } + + // ============================================================================ + // Helper Functions - Remittance Split Allocation + // ============================================================================ + + /// Extract allocation amounts from the Remittance Split contract + /// + /// This function calls the Remittance Split contract to calculate how a total + /// remittance amount should be divided across spending, savings, bills, and insurance. + /// + /// # Arguments + /// * `env` - The contract environment + /// * `remittance_split_addr` - Address of the Remittance Split contract + /// * `total_amount` - Total remittance amount to split (must be positive) + /// + /// # Returns + /// Ok(Vec) containing [spending, savings, bills, insurance] amounts + /// Err(OrchestratorError) if validation fails or cross-contract call fails + /// + /// # Gas Estimation + /// ~3000 gas for cross-contract split calculation + /// + /// # Cross-Contract Call Flow + /// 1. Validate that total_amount is positive + /// 2. Create RemittanceSplitClient instance + /// 3. Call calculate_split via cross-contract call + /// 4. Return the allocation vector + fn extract_allocations( + env: &Env, + remittance_split_addr: &Address, + total_amount: i128, + ) -> Result, OrchestratorError> { + // Validate amount is positive + if total_amount <= 0 { + return Err(OrchestratorError::InvalidAmount); + } + + // Create client for cross-contract call + let split_client = RemittanceSplitClient::new(env, remittance_split_addr); + + // Gas estimation: ~3000 gas + // Call the remittance split contract to calculate allocations + // This returns Vec with [spending, savings, bills, insurance] + let allocations = split_client.calculate_split(&total_amount); + + Ok(allocations) + } + + // ============================================================================ + // Helper Functions - Downstream Contract Operations + // ============================================================================ + + /// Deposit funds to a savings goal via cross-contract call + /// + /// This function calls the Savings Goals contract to add funds to a specific goal. + /// If the call fails (e.g., goal doesn't exist, invalid amount), the error is + /// converted to OrchestratorError::SavingsDepositFailed. + /// + /// # Arguments + /// * `env` - The contract environment + /// * `savings_addr` - Address of the Savings Goals contract + /// * `owner` - Address of the goal owner + /// * `goal_id` - ID of the target savings goal + /// * `amount` - Amount to deposit (must be positive) + /// + /// # Returns + /// Ok(()) if deposit succeeds, Err(OrchestratorError::SavingsDepositFailed) otherwise + /// + /// # Gas Estimation + /// ~4000 gas for cross-contract savings deposit + /// + /// # Cross-Contract Call Flow + /// 1. Create SavingsGoalsClient instance + /// 2. Call add_to_goal via cross-contract call + /// 3. If the call panics (goal not found, invalid amount), transaction reverts + /// 4. Return success if call completes + fn deposit_to_savings( + env: &Env, + savings_addr: &Address, + owner: &Address, + goal_id: u32, + amount: i128, + ) -> Result<(), OrchestratorError> { + // Create client for cross-contract call + let savings_client = SavingsGoalsClient::new(env, savings_addr); + + // Gas estimation: ~4000 gas + // Call add_to_goal on the savings contract + // This will panic if the goal doesn't exist or amount is invalid + // The panic will cause the entire transaction to revert (atomicity) + savings_client.add_to_goal(owner, &goal_id, &amount); + + Ok(()) + } + + /// Execute bill payment via cross-contract call + /// + /// This function calls the Bill Payments contract to mark a bill as paid. + /// If the call fails (e.g., bill not found, already paid), the error is + /// converted to OrchestratorError::BillPaymentFailed. + /// + /// # Arguments + /// * `env` - The contract environment + /// * `bills_addr` - Address of the Bill Payments contract + /// * `caller` - Address of the caller (must be bill owner) + /// * `bill_id` - ID of the bill to pay + /// + /// # Returns + /// Ok(()) if payment succeeds, Err(OrchestratorError::BillPaymentFailed) otherwise + /// + /// # Gas Estimation + /// ~4000 gas for cross-contract bill payment + /// + /// # Cross-Contract Call Flow + /// 1. Create BillPaymentsClient instance + /// 2. Call pay_bill via cross-contract call + /// 3. If the call panics (bill not found, already paid), transaction reverts + /// 4. Return success if call completes + fn execute_bill_payment_internal( + env: &Env, + bills_addr: &Address, + caller: &Address, + bill_id: u32, + ) -> Result<(), OrchestratorError> { + // Create client for cross-contract call + let bills_client = BillPaymentsClient::new(env, bills_addr); + + // Gas estimation: ~4000 gas + // Call pay_bill on the bills contract + // This will panic if the bill doesn't exist or is already paid + // The panic will cause the entire transaction to revert (atomicity) + bills_client.pay_bill(caller, &bill_id); + + Ok(()) + } + + /// Pay insurance premium via cross-contract call + /// + /// This function calls the Insurance contract to pay a monthly premium. + /// If the call fails (e.g., policy not found, inactive), the error is + /// converted to OrchestratorError::InsurancePaymentFailed. + /// + /// # Arguments + /// * `env` - The contract environment + /// * `insurance_addr` - Address of the Insurance contract + /// * `caller` - Address of the caller (must be policy owner) + /// * `policy_id` - ID of the insurance policy + /// + /// # Returns + /// Ok(()) if payment succeeds, Err(OrchestratorError::InsurancePaymentFailed) otherwise + /// + /// # Gas Estimation + /// ~4000 gas for cross-contract premium payment + /// + /// # Cross-Contract Call Flow + /// 1. Create InsuranceClient instance + /// 2. Call pay_premium via cross-contract call + /// 3. If the call panics (policy not found, inactive), transaction reverts + /// 4. Return success if call completes + fn pay_insurance_premium( + env: &Env, + insurance_addr: &Address, + caller: &Address, + policy_id: u32, + ) -> Result<(), OrchestratorError> { + // Create client for cross-contract call + let insurance_client = InsuranceClient::new(env, insurance_addr); + + // Call pay_premium on the insurance contract + // This returns Result + match insurance_client.pay_premium(caller, &policy_id) { + Ok(success) => { + if success { + Ok(()) + } else { + Err(OrchestratorError::InsurancePaymentFailed) + } + } + Err(_) => Err(OrchestratorError::InsurancePaymentFailed), + } + } + + // ============================================================================ + // Helper Functions - Event Emission + // ============================================================================ + + /// Emit success event for a completed remittance flow + /// + /// This function creates and publishes a RemittanceFlowEvent to the ledger, + /// providing an audit trail of successful operations. + /// + /// # Arguments + /// * `env` - The contract environment + /// * `caller` - Address that initiated the flow + /// * `total_amount` - Total amount processed + /// * `allocations` - Allocation amounts [spending, savings, bills, insurance] + /// * `timestamp` - Timestamp of execution + fn emit_success_event( + env: &Env, + caller: &Address, + total_amount: i128, + allocations: &Vec, + timestamp: u64, + ) { + let event = RemittanceFlowEvent { + caller: caller.clone(), + total_amount, + allocations: allocations.clone(), + timestamp, + }; + + env.events().publish((symbol_short!("flow_ok"),), event); + } + + /// Emit error event for a failed remittance flow + /// + /// This function creates and publishes a RemittanceFlowErrorEvent to the ledger, + /// providing diagnostic information about which step failed and why. + /// + /// # Arguments + /// * `env` - The contract environment + /// * `caller` - Address that initiated the flow + /// * `failed_step` - Symbol identifying the failed step (e.g., "perm_chk", "savings") + /// * `error_code` - Error code from OrchestratorError + /// * `timestamp` - Timestamp of failure + fn emit_error_event( + env: &Env, + caller: &Address, + failed_step: Symbol, + error_code: u32, + timestamp: u64, + ) { + let event = RemittanceFlowErrorEvent { + caller: caller.clone(), + failed_step, + error_code, + timestamp, + }; + + env.events().publish((symbol_short!("flow_err"),), event); + } + + // ============================================================================ + // Public Functions - Individual Operations + // ============================================================================ + + /// Execute a savings deposit with family wallet permission checks + /// + /// This function deposits funds to a savings goal after validating permissions + /// and spending limits via the Family Wallet contract. + /// + /// # Arguments + /// * `env` - The contract environment + /// * `caller` - Address initiating the operation (must authorize) + /// * `amount` - Amount to deposit + /// * `family_wallet_addr` - Address of the Family Wallet contract + /// * `savings_addr` - Address of the Savings Goals contract + /// * `goal_id` - Target savings goal ID + /// + /// # Returns + /// Ok(()) if successful, Err(OrchestratorError) if any step fails + /// + /// # Gas Estimation + /// - Base: ~3000 gas + /// - Family wallet check: ~2000 gas + /// - Savings deposit: ~4000 gas + /// - Total: ~9,000 gas + /// + /// # Execution Flow + /// 1. Require caller authorization + /// 2. Check family wallet permission + /// 3. Check spending limit + /// 4. Deposit to savings goal + /// 5. Emit success event + /// 6. On error, emit error event and return error + pub fn execute_savings_deposit( + env: Env, + caller: Address, + amount: i128, + family_wallet_addr: Address, + savings_addr: Address, + goal_id: u32, + ) -> Result<(), OrchestratorError> { + // Reentrancy guard: acquire execution lock + Self::acquire_execution_lock(&env)?; + + // Require caller authorization + caller.require_auth(); + + let timestamp = env.ledger().timestamp(); + + // Step 1: Check family wallet permission + let result = (|| { + Self::check_family_wallet_permission(&env, &family_wallet_addr, &caller, amount) + .map_err(|e| { + Self::emit_error_event( + &env, + &caller, + symbol_short!("perm_chk"), + e as u32, + timestamp, + ); + e + })?; + + // Step 2: Check spending limit + Self::check_spending_limit(&env, &family_wallet_addr, &caller, amount).map_err( + |e| { + Self::emit_error_event( + &env, + &caller, + symbol_short!("spend_lm"), + e as u32, + timestamp, + ); + e + }, + )?; + + // Step 3: Deposit to savings + Self::deposit_to_savings(&env, &savings_addr, &caller, goal_id, amount).map_err( + |e| { + Self::emit_error_event( + &env, + &caller, + symbol_short!("savings"), + e as u32, + timestamp, + ); + e + }, + )?; + + // Emit success event + let allocations = Vec::from_array(&env, [0, amount, 0, 0]); + Self::emit_success_event(&env, &caller, amount, &allocations, timestamp); + + Ok(()) + })(); + + // Reentrancy guard: always release lock before returning + Self::release_execution_lock(&env); + result + } + + /// Execute a bill payment with family wallet permission checks + /// + /// This function pays a bill after validating permissions and spending limits + /// via the Family Wallet contract. + /// + /// # Arguments + /// * `env` - The contract environment + /// * `caller` - Address initiating the operation (must authorize) + /// * `amount` - Amount of the bill payment + /// * `family_wallet_addr` - Address of the Family Wallet contract + /// * `bills_addr` - Address of the Bill Payments contract + /// * `bill_id` - Target bill ID + /// + /// # Returns + /// Ok(()) if successful, Err(OrchestratorError) if any step fails + /// + /// # Gas Estimation + /// - Base: ~3000 gas + /// - Family wallet check: ~2000 gas + /// - Bill payment: ~4000 gas + /// - Total: ~9,000 gas + /// + /// # Execution Flow + /// 1. Require caller authorization + /// 2. Check family wallet permission + /// 3. Check spending limit + /// 4. Execute bill payment + /// 5. Emit success event + /// 6. On error, emit error event and return error + pub fn execute_bill_payment( + env: Env, + caller: Address, + amount: i128, + family_wallet_addr: Address, + bills_addr: Address, + bill_id: u32, + ) -> Result<(), OrchestratorError> { + // Reentrancy guard: acquire execution lock + Self::acquire_execution_lock(&env)?; + + // Require caller authorization + caller.require_auth(); + + let timestamp = env.ledger().timestamp(); + + let result = (|| { + // Step 1: Check family wallet permission + Self::check_family_wallet_permission(&env, &family_wallet_addr, &caller, amount) + .map_err(|e| { + Self::emit_error_event( + &env, + &caller, + symbol_short!("perm_chk"), + e as u32, + timestamp, + ); + e + })?; + + // Step 2: Check spending limit + Self::check_spending_limit(&env, &family_wallet_addr, &caller, amount).map_err( + |e| { + Self::emit_error_event( + &env, + &caller, + symbol_short!("spend_lm"), + e as u32, + timestamp, + ); + e + }, + )?; + + // Step 3: Execute bill payment + Self::execute_bill_payment_internal(&env, &bills_addr, &caller, bill_id).map_err( + |e| { + Self::emit_error_event( + &env, + &caller, + symbol_short!("bills"), + e as u32, + timestamp, + ); + e + }, + )?; + + // Emit success event + let allocations = Vec::from_array(&env, [0, 0, amount, 0]); + Self::emit_success_event(&env, &caller, amount, &allocations, timestamp); + + Ok(()) + })(); + + // Reentrancy guard: always release lock before returning + Self::release_execution_lock(&env); + result + } + + /// Execute an insurance premium payment with family wallet permission checks + /// + /// This function pays an insurance premium after validating permissions and + /// spending limits via the Family Wallet contract. + /// + /// # Arguments + /// * `env` - The contract environment + /// * `caller` - Address initiating the operation (must authorize) + /// * `amount` - Amount of the premium payment + /// * `family_wallet_addr` - Address of the Family Wallet contract + /// * `insurance_addr` - Address of the Insurance contract + /// * `policy_id` - Target insurance policy ID + /// + /// # Returns + /// Ok(()) if successful, Err(OrchestratorError) if any step fails + /// + /// # Gas Estimation + /// - Base: ~3000 gas + /// - Family wallet check: ~2000 gas + /// - Premium payment: ~4000 gas + /// - Total: ~9,000 gas + /// + /// # Execution Flow + /// 1. Require caller authorization + /// 2. Check family wallet permission + /// 3. Check spending limit + /// 4. Pay insurance premium + /// 5. Emit success event + /// 6. On error, emit error event and return error + pub fn execute_insurance_payment( + env: Env, + caller: Address, + amount: i128, + family_wallet_addr: Address, + insurance_addr: Address, + policy_id: u32, + ) -> Result<(), OrchestratorError> { + // Reentrancy guard: acquire execution lock + Self::acquire_execution_lock(&env)?; + + // Require caller authorization + caller.require_auth(); + + let timestamp = env.ledger().timestamp(); + + let result = (|| { + // Step 1: Check family wallet permission + Self::check_family_wallet_permission(&env, &family_wallet_addr, &caller, amount) + .map_err(|e| { + Self::emit_error_event( + &env, + &caller, + symbol_short!("perm_chk"), + e as u32, + timestamp, + ); + e + })?; + + // Step 2: Check spending limit + Self::check_spending_limit(&env, &family_wallet_addr, &caller, amount).map_err( + |e| { + Self::emit_error_event( + &env, + &caller, + symbol_short!("spend_lm"), + e as u32, + timestamp, + ); + e + }, + )?; + + // Step 3: Pay insurance premium + Self::pay_insurance_premium(&env, &insurance_addr, &caller, policy_id).map_err( + |e| { + Self::emit_error_event( + &env, + &caller, + symbol_short!("insuranc"), + e as u32, + timestamp, + ); + e + }, + )?; + + // Emit success event + let allocations = Vec::from_array(&env, [0, 0, 0, amount]); + Self::emit_success_event(&env, &caller, amount, &allocations, timestamp); + + Ok(()) + })(); + + // Reentrancy guard: always release lock before returning + Self::release_execution_lock(&env); + result + } + + // ============================================================================ + // Public Functions - Complete Remittance Flow + // ============================================================================ + + /// Execute a complete remittance flow with automated allocation + /// + /// This is the main orchestrator function that coordinates a full remittance + /// split across all downstream contracts (savings, bills, insurance) with + /// family wallet permission enforcement. + /// + /// # Arguments + /// * `env` - The contract environment + /// * `caller` - Address initiating the operation (must authorize) + /// * `total_amount` - Total remittance amount to split + /// * `family_wallet_addr` - Address of the Family Wallet contract + /// * `remittance_split_addr` - Address of the Remittance Split contract + /// * `savings_addr` - Address of the Savings Goals contract + /// * `bills_addr` - Address of the Bill Payments contract + /// * `insurance_addr` - Address of the Insurance contract + /// * `goal_id` - Target savings goal ID + /// * `bill_id` - Target bill ID + /// * `policy_id` - Target insurance policy ID + /// + /// # Returns + /// Ok(RemittanceFlowResult) with execution details if successful + /// Err(OrchestratorError) if any step fails + /// + /// # Gas Estimation + /// - Base: ~5000 gas + /// - Family wallet check: ~2000 gas + /// - Remittance split calc: ~3000 gas + /// - Savings deposit: ~4000 gas + /// - Bill payment: ~4000 gas + /// - Insurance payment: ~4000 gas + /// - Total: ~22,000 gas for full flow + /// + /// # Atomicity Guarantee + /// All operations execute atomically via Soroban's panic/revert mechanism. + /// If any step fails, all prior state changes are automatically reverted. + /// + /// # Execution Flow + /// 1. Require caller authorization + /// 2. Validate total_amount is positive + /// 3. Check family wallet permission + /// 4. Check spending limit + /// 5. Extract allocations from remittance split + /// 6. Deposit to savings goal + /// 7. Pay bill + /// 8. Pay insurance premium + /// 9. Build and return result + /// 10. On error, emit error event and return error +======= +>>>>>>> main #[allow(clippy::too_many_arguments)] pub fn execute_remittance_flow( env: Env, diff --git a/remitwise-common/src/lib.rs b/remitwise-common/src/lib.rs index d1f46dc6..40cec114 100644 --- a/remitwise-common/src/lib.rs +++ b/remitwise-common/src/lib.rs @@ -84,45 +84,6 @@ pub const CONTRACT_VERSION: u32 = 1; pub const MAX_BATCH_SIZE: u32 = 50; /// Helper function to clamp limit -/// -/// # Behavior Contract -/// -/// `clamp_limit` normalises a caller-supplied page-size value so that every -/// pagination call in the workspace uses a consistent, bounded limit. -/// -/// ## Rules (in evaluation order) -/// -/// | Input condition | Returned value | Rationale | -/// |--------------------------|----------------------|------------------------------------------------| -/// | `limit == 0` | `DEFAULT_PAGE_LIMIT` | Zero is treated as "use the default". | -/// | `limit > MAX_PAGE_LIMIT` | `MAX_PAGE_LIMIT` | Cap to prevent unbounded storage reads. | -/// | otherwise | `limit` | Caller value is within the valid range. | -/// -/// ## Invariants -/// -/// - The return value is always in the range `[1, MAX_PAGE_LIMIT]`. -/// - `clamp_limit(0) == DEFAULT_PAGE_LIMIT` (default substitution). -/// - `clamp_limit(MAX_PAGE_LIMIT) == MAX_PAGE_LIMIT` (boundary is inclusive). -/// - `clamp_limit(MAX_PAGE_LIMIT + 1) == MAX_PAGE_LIMIT` (cap is enforced). -/// - The function is pure and has no side effects. -/// -/// ## Security Assumptions -/// -/// - Callers must not rely on receiving a value larger than `MAX_PAGE_LIMIT`. -/// - A zero input is **not** an error; it is silently replaced with the default. -/// Contracts that need to distinguish "no limit requested" from "default limit" -/// should inspect the raw input before calling this function. -/// -/// ## Usage -/// -/// ```rust -/// use remitwise_common::{clamp_limit, DEFAULT_PAGE_LIMIT, MAX_PAGE_LIMIT}; -/// -/// assert_eq!(clamp_limit(0), DEFAULT_PAGE_LIMIT); -/// assert_eq!(clamp_limit(10), 10); -/// assert_eq!(clamp_limit(MAX_PAGE_LIMIT), MAX_PAGE_LIMIT); -/// assert_eq!(clamp_limit(MAX_PAGE_LIMIT + 1), MAX_PAGE_LIMIT); -/// ``` pub fn clamp_limit(limit: u32) -> u32 { if limit == 0 { DEFAULT_PAGE_LIMIT @@ -134,31 +95,9 @@ pub fn clamp_limit(limit: u32) -> u32 { } /// Event emission helper -/// -/// # Deterministic topic naming -/// -/// All events emitted via `RemitwiseEvents` follow a deterministic topic schema: -/// -/// 1. A fixed namespace symbol: `"Remitwise"`. -/// 2. An event category as `u32` (see `EventCategory`). -/// 3. An event priority as `u32` (see `EventPriority`). -/// 4. An action `Symbol` describing the specific event or a subtype (e.g. `"created"`). -/// -/// This ordering allows consumers to index and filter events reliably across contracts. pub struct RemitwiseEvents; impl RemitwiseEvents { - /// Emit a single event with deterministic topics. - /// - /// # Parameters - /// - `env`: Soroban environment used to publish the event. - /// - `category`: Logical event category (`EventCategory`). - /// - `priority`: Event priority (`EventPriority`). - /// - `action`: A `Symbol` identifying the action or event name. - /// - `data`: The serializable payload for the event. - /// - /// # Security - /// Do not include sensitive personal data in `data` because events are publicly visible on-chain. pub fn emit( env: &soroban_sdk::Env, category: EventCategory, @@ -177,10 +116,6 @@ impl RemitwiseEvents { env.events().publish(topics, data); } - /// Emit a small batch-style event indicating bulk operations. - /// - /// The `action` parameter is included in the payload rather than as the final topic - /// to make the topic schema consistent for batch analytics. pub fn emit_batch(env: &soroban_sdk::Env, category: EventCategory, action: Symbol, count: u32) { let topics = ( symbol_short!("Remitwise"),