Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- contract InvoiceManager {
- struct INVOICE {
- bool valid;
- ...
- }
- mapping (uint => INVOICE) invoices;
- event InvoiceCreated(uint id, ...);
- event InvoicePaid(uint id, ...)
- ...
- function createInvoice(uint id, uint sum, ...) {
- ...
- INVOICE storage invoice = invoices[id];
- require(!invoice.valid);
- ...
- emit InvoiceCreated(invoice, ...)
- }
- function payInvoice(uint id) public payable {
- ... process payment ...
- emit InvoicePaid(id, ...)
- }
- }
Add Comment
Please, Sign In to add comment