Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let depositDivisor = 10
- let heightUnit = 1000
- let finalHeight = 100000
- match tx {
- case e : TransferTransaction =>
- #извлекаем высоту транзакции по ID транзакции в седьмом пруфе
- #extracting the height of the transaction by the transaction ID, which is in the seventh proof
- let depositHeight = extract(transactionHeightById(e.proofs[7]))
- #извлекаем транзакцию депозита
- #extracting the deposit transaction
- let purchaseTx = transactionById(e.proofs[7])
- match purchaseTx {
- case deposit : TransferTransaction =>
- let correctSender = deposit.sender == e.sender
- #убеждаемся, что пользователь переводит себе корректную сумму депозита + проценты
- #checking that the user transfers to himself the correct sum of the deposit and the interest
- let correctAmount = deposit.amount + deposit.amount / depositDivisor * (height - depositHeight) / heightUnit == e.amount
- let correctProof = extract(getBinary(this, toBase58String(deposit.id))) == e.id
- correctSender && correctProof && correctAmount
- case _ => false
- }
- && finalHeight <= height
- case _ => sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement