Business Logic
The business solution requirements are described in the Use Case page. The specific penalty calculation and payment requirements from the Smart Contract are explained here.
Penalty Calculations
The calculation of penalities by comparing the expected parameter values in the order and the actual parameter values received from sensors is the crux of the logic in the Smart Contract.
There are some assumptions made to reduce the complexity of programming in the Smart Contract. For example, it is assumed that the sensors reliably send some data values for all parameters. However, if a value for a parameter is missed the maximum penalty will be applied. The overall solution includes a process that pre-filters the data from the sensors and only forward clean data (no extreme values that have probably been received in error) to the Smart Contract.
The penalty calculations for each parameter are listed below:
1. Vehicle Penalty
This is imposed upon the Transporter for the following violations:
- If the vehicle registration number detected by the ANPR at the loading location is different from that stated in the order.
- If the vehicle registration number detected by the ANPR at the unloading location is different from that at the loaded location.
Penalty Amounts:
- Will be the same rate for both violations (so specified only once in the order).
- The penalty amount will be capped at 10% of the amount due to the Transporter.
2. Schedule Penalty
This is imposed upon the Seller and Transporter for the following violations:
- If the actual departure time from the loading location is later than the expected departure time stated in the order, both the Seller and the Transporter are fined 50% each of the total penalty applicable.
- If the actual arrival time at the unloading location is later than the expected arrival time stated in the order, the Transporter is fined 100% of the total penalty applicable.
Penalty Amounts:
- The penalty rate will be the same for all violations (so specified only once in the order) and will be per hour of delay.
- Penalty will be calculated on crossing an hour (0-59 minutes zero penalty, 60 minutes to 119 minutes 1 hour penalty and so on).
- The penalty amount for each will be capped at 20% of the amount due to them.
3. Quantity Penalty
This is imposed upon the Seller and Transporter for the following violations:
- If the loaded quantity is less than the expected quantity stated in the order, the Seller will be fined 100% of the total penalty applicable.
- If the unloaded quantity is less than the loaded quantity, the Transporter will be fined 100% of the total penalty applicable.
Penalty Amounts:
- The penalty rate will be the same for all violations (so specified only once in the order).
- The penalty rate will be derived (not required to be specified) as equal to the cost of one unit of the item ordered (total order value divided by the total units).
- The penalty amount for each will be capped at 100% of the amount due to them.
4. Transport Conditions Penalty
This is imposed upon the Transporter for the following violations:
- If the actual value of any of the parameters in transport conditions (currently temperature and humidity) is out of the expected range for the parameter as specified in the contract.
Penalty Amounts:
- The penalty rate will be the same for all violations (so specified only once in the order).
- The penalty amount for each parameter will be capped at 5% of the amount due to the Transporter.
- The arbitrary (no specific rationale) formula used is: Add up all the absolute deviations from the allowed range in the received readings and divide them out by total number of readings (and multiply that by the penalty rate).
Payment Transfers
After all the expected data has been received and the penalties have been calculated the Smart Contract will initiate the amount transfers from the contract to all participants.
All transactions with the Smart Contract (including creating a Smart Contract and submitting data) cost some ether which will be deducted from the participant's balance. The cost to each participant will be different based on the transactions they execute and this will impact the balances. This condition has not been taken care of in this version and the transaction costs are not easily determined so account balances after an order payment has been completed will be have to be validated to an approximation.