You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Implement batch updates, rewards, milestones, and error mapping
- Implements #120: Adds with a 10% 'Fair Increase' guardrail to prevent price spikes while simplifying provider operations.
- Implements #113: Adds and integrates discount logic into the rate calculation, turning the protocol into a demand-response tool.
- Implements #106: Introduces a milestone system where missing a deadline automatically halves the provider's rate until the user confirms completion, creating a performance-based payment model.
- Implements #109: Adds specific error enums for new logic and creates a new file to map all errors to user-friendly messages, improving UX.
This document provides a mapping of on-chain error codes to user-friendly explanations and suggested actions. When a transaction fails, the frontend can use this guide to display a helpful message instead of a raw error.
| 1 |`MeterNotFound`| The specified meter ID does not exist. | Please double-check the meter ID you entered. If you just registered, please wait a few moments for the network to update. |
8
+
| 2 |`OracleNotSet`| The price oracle has not been configured by the admin. | This is a contract configuration issue. Please contact the service provider. |
9
+
| 5 |`InvalidTokenAmount`| The amount for the transaction is invalid (e.g., zero or negative). | Please enter a positive amount for your top-up or withdrawal. |
10
+
| 10 |`PublicKeyMismatch`| The public key in the usage data does not match the one registered for the meter. | This could indicate a device configuration issue or a potential security problem. Please contact your utility provider. |
11
+
| 11 |`TimestampTooOld`| The usage data is too old and was rejected to prevent replay attacks. | Ensure your metering device's clock is synchronized. The issue should resolve itself on the next reading. |
12
+
| 15 |`MeterNotPaired`| The meter device has not been securely paired with the contract. | Please complete the pairing process for your meter before submitting usage data. |
13
+
| 19 |`AccountAlreadyClosed`| This meter account has already been closed. | You cannot perform actions on a closed account. Please register a new meter if you wish to continue service. |
14
+
| 20 |`InsufficientBalance`| Your account does not have enough funds to perform this action. | Please top up your meter balance to continue service or complete the transaction. |
15
+
| 21 |`UnauthorizedContributor`| The address used for this top-up is not authorized for this meter. | Only the meter owner or an authorized contributor (e.g., a roommate) can top up this meter. |
16
+
| 50 |`UnfairPriceIncrease`| The provider attempted to increase the rate by more than the allowed 10% in a single update. | The transaction was blocked to protect you from a sudden price spike. No action is needed on your part. |
17
+
| 51 |`BillingGroupNotFound`| The specified billing group does not exist. | Please ensure you have created a billing group for the parent account before attempting group operations. |
0 commit comments