paypal.ledger 390 B

123456789101112131415161718
  1. LEDGER Paypal {
  2. VAR withdraw_enabled = false;
  3. VAR deposits = {};
  4. ON tag = "approved" (tx) {
  5. withdraw_enabled[tx.to[0].to] = true;
  6. }
  7. Deposit(tx) {
  8. deposits[tx.to[0].to] += 1
  9. }
  10. Withdraw(tx) {
  11. IF despits[tx.from[0].from] == 1 && NOT withdraw_enabled(tx.from[0].from) {
  12. FAIL "Withdrawals are not enabled";
  13. }
  14. }
  15. }