Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. let subscriptionPeriod = 44000
  2. let signature = tx.proofs[0]
  3. let pk = tx.proofs[1]
  4. let requiredAmount = 100000
  5. #extracting the sender’s address from the transaction
  6. let this = extract(tx.sender)
  7.  
  8. match tx {
  9. case d: DataTransaction =>
  10. #извлекаем дату последнего платежа
  11. #extracting the date of the most recent payment
  12. let lastPaymentHeight = extract(getInteger(this, d.data[0].key + "_lastPayment"))
  13. size(d.data) == 1 && d.data[0].value == "false" && lastPaymentHeight + subscriptionPeriod < height
  14. ||
  15. (
  16. let address = d.data[0].key
  17.  
  18. #извлекаем трансфер-транзакцию по ID, указанному в пруфах
  19. #extracting the transfer transaction by the ID indicated in the proofs.
  20. let ttx = transactionById(d.proofs[0])
  21.  
  22. size(d.data) == 2
  23. && d.data[0].value == "true"
  24. && d.data[1].key == address + "_lastPayment"
  25. && match ttx {
  26. case purchase : TransferTransaction =>
  27. d.data[1].value == transactionHeightById(purchase.id)
  28. && toBase58String(purchase.sender.bytes) == address
  29. && purchase.amount == requiredAmount
  30. && purchase.recipient == this
  31. #убеждаемся, что ассет waves
  32. #making sure the asset is WAVES
  33. && !isDefined(purchase.assetId)
  34. case _ => false
  35. }
  36. )
  37. case _ => false
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement