and cant figure out what Endpoint do (why are they in the code) and most important of all how should I code them. What are the best practices?
1 Answer
In Plutus apps, the mechanism for requesting inputs is called "endpoints".
All endpoints that an app wants to use must be declared as part of the type of the app. The set of all endpoints of an app is called the schema of the app. The schema is defined as a Haskell type. You can build a schema using the Endpoint
type family to construct individual endpoint types, and the .\/
operator to combine them.
I suggest you design your Plutus app based on the idea that endpoints are the only possible way to interact with the smart contract from a user perspective.