| Algorithms A6. Smart Contract 6: Contamination Check |
| Input: product id, batch number, order number, product quantity, addr |
| 1. if addr is valid && addr has adding authentication |
| 2. addProduct_Contamination_Info(product id, batch number, order number, product quantity) |
| 3. x= getProduct_Contamination_Info(product id) |
| 4. if x==1 |
| 5. No contamination found in the product |
| 6. stage_sypplychain[]= getProduct_Status(product id) |
| 7. updateProduct_Info(product id, batch number, order number, stage_sypplychain.name,1) |
| 8. end |
| 9. else |
| 10. Product comprises of contamination |
| 11. y=addProduct_Nutrition_Info(product id) |
| 12. stage_sypplychain= getProduct_Status(product id) |
| 13. updateProduct_Info(product id, y, batch number, order number, stage_sypplychain.name,1) |
| 14. Initiate execution of Remove Product smart contract |
| 15. end |
| 16. end |
| 17. else |
| 18. Invalid or authorised address |
| 19. go to step 1 and enter a valid address |
| 20. end |