Guest User

Untitled

a guest
Mar 24th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. contract InvoiceManager {
  2. struct INVOICE {
  3. bool valid;
  4. ...
  5. }
  6.  
  7. mapping (uint => INVOICE) invoices;
  8.  
  9. event InvoiceCreated(uint id, ...);
  10. event InvoicePaid(uint id, ...)
  11. ...
  12.  
  13. function createInvoice(uint id, uint sum, ...) {
  14. ...
  15. INVOICE storage invoice = invoices[id];
  16. require(!invoice.valid);
  17. ...
  18. emit InvoiceCreated(invoice, ...)
  19. }
  20.  
  21. function payInvoice(uint id) public payable {
  22. ... process payment ...
  23. emit InvoicePaid(id, ...)
  24. }
  25. }
Add Comment
Please, Sign In to add comment