Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let subscriptionPeriod = 44000
- let signature = tx.proofs[0]
- let pk = tx.proofs[1]
- let requiredAmount = 100000
- #extracting the sender’s address from the transaction
- let this = extract(tx.sender)
- match tx {
- case d: DataTransaction =>
- #извлекаем дату последнего платежа
- #extracting the date of the most recent payment
- let lastPaymentHeight = extract(getInteger(this, d.data[0].key + "_lastPayment"))
- size(d.data) == 1 && d.data[0].value == "false" && lastPaymentHeight + subscriptionPeriod < height
- ||
- (
- let address = d.data[0].key
- #извлекаем трансфер-транзакцию по ID, указанному в пруфах
- #extracting the transfer transaction by the ID indicated in the proofs.
- let ttx = transactionById(d.proofs[0])
- size(d.data) == 2
- && d.data[0].value == "true"
- && d.data[1].key == address + "_lastPayment"
- && match ttx {
- case purchase : TransferTransaction =>
- d.data[1].value == transactionHeightById(purchase.id)
- && toBase58String(purchase.sender.bytes) == address
- && purchase.amount == requiredAmount
- && purchase.recipient == this
- #убеждаемся, что ассет waves
- #making sure the asset is WAVES
- && !isDefined(purchase.assetId)
- case _ => false
- }
- )
- case _ => false
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement