Advertisement
Guest User

Untitled

a guest
Nov 12th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. /**
  2. * Track the trade of a commodity from one trader to another
  3. * @param {org.master.token.CreaMaster} cm - la transazione effettuata dalla banca
  4. * @transaction
  5. */
  6. async function creaMaster(cm) {
  7.  
  8. /**
  9. * cm ha tre Attributi:
  10. * BANCA
  11. * QUANTITA
  12. * KPUBPROPRIETARIO
  13. */
  14. let regProp = await getParticipantRegistry('org.master.token.Individuo');
  15. let esisteProp = await regProp.exists(cm.kpubProprietario);
  16. if (!esisteProp) {
  17. throw new Error("il proprietario " + cm.kpubProprietario + " non esiste");
  18. }
  19.  
  20. let prop = await regProp.get(cm.kpubProprietario);
  21. prop.borsellino.quantity = prop.borsellino.quantity + cm.quantity;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement