tx · DcxcgTQyBRwYB1Fhw1RExW5yocQiNe2uNUrKdrTNSwgf
3My6kED2uUWAEFmNmUsKXAEwNE3pCeMmjRt: -0.01400000 Waves
2019.02.06 14:08 [483103] smart account 3My6kED2uUWAEFmNmUsKXAEwNE3pCeMmjRt > SELF 0.00000000 Waves
{
"type": 13,
"id": "DcxcgTQyBRwYB1Fhw1RExW5yocQiNe2uNUrKdrTNSwgf",
"fee": 1400000,
"feeAssetId": null,
"timestamp": 1549451271882,
"version": 1,
"sender": "3My6kED2uUWAEFmNmUsKXAEwNE3pCeMmjRt",
"senderPublicKey": "3qrTmx4jsup6WcnWLUdfzZayosrNHVNwSV99S6KvZwPy",
"proofs": [
"2ABTLdftYgXw46ktLx6rtVdxgegez73CdTeAF8SqMhckv8Evsah1Nqjp3VJhtUbxLt51skfKa2LZkwCw7rEe5cWu"
],
"script": "base64:AQQAAAAJcGF5b3V0RmVlAAAAAAAAB6EgBAAAAAJtZQgFAAAAAnR4AAAABnNlbmRlcgQAAAAOYWRtaW5QdWJsaWNLZXkBAAAAIA8ufrYwEBekADD70lJQmB+to0n91q0fxSddAhqP4FtMBAAAAAZhbnN3ZXIJAQAAAAdleHRyYWN0AAAAAQkABBwAAAACBQAAAAJtZQIAAAAGYW5zd2VyBAAAAAh0aWNrZXRJZAkAAlkAAAABCQEAAAAHZXh0cmFjdAAAAAEJAAQdAAAAAgUAAAACbWUCAAAABnRpY2tldAQAAAAJZ2FtZVByaWNlCQEAAAAHZXh0cmFjdAAAAAEJAAQaAAAAAgUAAAACbWUCAAAABXByaWNlBAAAAAckbWF0Y2gwBQAAAAJ0eAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAPRGF0YVRyYW5zYWN0aW9uBAAAAAZ0dW5pbmcFAAAAByRtYXRjaDADCQAB9AAAAAMIBQAAAAZ0dW5pbmcAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAZ0dW5pbmcAAAAGcHJvb2ZzAAAAAAAAAAAABQAAAA5hZG1pblB1YmxpY0tleQYJAAACAAAAAQIAAAAVWW91IGFyZW4ndCBxdWl6IGFkbWluAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABNUcmFuc2ZlclRyYW5zYWN0aW9uBAAAAAZwYXlvdXQFAAAAByRtYXRjaDAEAAAADXRpY2tldEJhbGFuY2UJAAPrAAAAAggFAAAABnBheW91dAAAAAlyZWNpcGllbnQFAAAACHRpY2tldElkBAAAAARwYWlkCQAAZwAAAAIFAAAADXRpY2tldEJhbGFuY2UFAAAACWdhbWVQcmljZQMJAQAAAAEhAAAAAQUAAAAEcGFpZAkAAAIAAAABCQABLAAAAAIJAAEsAAAAAgIAAAAOWW91IG11c3QgaGF2ZSAJAAGkAAAAAQUAAAAJZ2FtZVByaWNlAgAAAAggdGlja2V0cwQAAAAHY29ycmVjdAkAAAAAAAACCQAB9wAAAAEIBQAAAAZwYXlvdXQAAAAKYXR0YWNobWVudAUAAAAGYW5zd2VyAwkBAAAAASEAAAABBQAAAAdjb3JyZWN0CQAAAgAAAAECAAAAEEluY29ycmVjdCBhbnN3ZXIDCQAAAAAAAAIIBQAAAAZwYXlvdXQAAAADZmVlBQAAAAlwYXlvdXRGZWUJAQAAAAEhAAAAAQkBAAAACWlzRGVmaW5lZAAAAAEIBQAAAAZwYXlvdXQAAAAKZmVlQXNzZXRJZAcGwdDLww==",
"chainId": 84,
"height": 483103,
"spentComplexity": 0
}
View: original | compacted
Prev: CpTx2FFp6XQVdM7XfDrRLC5MFQhuV5CprUsc8h2GZ7nA
Next: 81bz7vBk87CqzmV6sH9aN8fBZa1ALfwkCUDx341d97od
Diff:
Old | New | | Differences |
---|
3 | 3 | | let payoutFee = 500000 |
---|
4 | 4 | | let me = tx.sender |
---|
5 | 5 | | let adminPublicKey = base58'22GEgQRoT3xuSPQTTBNofWLnYQsn2ZTwAzd5f51CMFeb' |
---|
6 | | - | let adminAddress = addressFromPublicKey(adminPublicKey) |
---|
7 | 6 | | let answer = extract(getBinary(me, "answer")) |
---|
8 | | - | let startHeight = extract(getInteger(me, "height")) |
---|
9 | 7 | | let ticketId = fromBase58String(extract(getString(me, "ticket"))) |
---|
10 | 8 | | let gamePrice = extract(getInteger(me, "price")) |
---|
11 | 9 | | match tx { |
---|
|
15 | 13 | | else throw("You aren't quiz admin") |
---|
16 | 14 | | case payout: TransferTransaction => |
---|
17 | 15 | | let ticketBalance = assetBalance(payout.recipient, ticketId) |
---|
18 | | - | let correct = (sha256(payout.attachment) == answer) |
---|
19 | | - | if (if (if (if ((ticketBalance >= gamePrice)) |
---|
20 | | - | then (height >= startHeight) |
---|
21 | | - | else false) |
---|
22 | | - | then correct |
---|
23 | | - | else false) |
---|
24 | | - | then (payout.fee == payoutFee) |
---|
25 | | - | else false) |
---|
26 | | - | then !(isDefined(payout.feeAssetId)) |
---|
27 | | - | else false |
---|
| 16 | + | let paid = (ticketBalance >= gamePrice) |
---|
| 17 | + | if (!(paid)) |
---|
| 18 | + | then throw((("You must have " + toString(gamePrice)) + " tickets")) |
---|
| 19 | + | else { |
---|
| 20 | + | let correct = (sha256(payout.attachment) == answer) |
---|
| 21 | + | if (!(correct)) |
---|
| 22 | + | then throw("Incorrect answer") |
---|
| 23 | + | else if ((payout.fee == payoutFee)) |
---|
| 24 | + | then !(isDefined(payout.feeAssetId)) |
---|
| 25 | + | else false |
---|
| 26 | + | } |
---|
28 | 27 | | case _ => |
---|
29 | 28 | | true |
---|
30 | 29 | | } |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 1 #-} |
---|
2 | 2 | | {-# CONTENT_TYPE EXPRESSION #-} |
---|
3 | 3 | | let payoutFee = 500000 |
---|
4 | 4 | | let me = tx.sender |
---|
5 | 5 | | let adminPublicKey = base58'22GEgQRoT3xuSPQTTBNofWLnYQsn2ZTwAzd5f51CMFeb' |
---|
6 | | - | let adminAddress = addressFromPublicKey(adminPublicKey) |
---|
7 | 6 | | let answer = extract(getBinary(me, "answer")) |
---|
8 | | - | let startHeight = extract(getInteger(me, "height")) |
---|
9 | 7 | | let ticketId = fromBase58String(extract(getString(me, "ticket"))) |
---|
10 | 8 | | let gamePrice = extract(getInteger(me, "price")) |
---|
11 | 9 | | match tx { |
---|
12 | 10 | | case tuning: DataTransaction => |
---|
13 | 11 | | if (sigVerify(tuning.bodyBytes, tuning.proofs[0], adminPublicKey)) |
---|
14 | 12 | | then true |
---|
15 | 13 | | else throw("You aren't quiz admin") |
---|
16 | 14 | | case payout: TransferTransaction => |
---|
17 | 15 | | let ticketBalance = assetBalance(payout.recipient, ticketId) |
---|
18 | | - | let correct = (sha256(payout.attachment) == answer) |
---|
19 | | - | if (if (if (if ((ticketBalance >= gamePrice)) |
---|
20 | | - | then (height >= startHeight) |
---|
21 | | - | else false) |
---|
22 | | - | then correct |
---|
23 | | - | else false) |
---|
24 | | - | then (payout.fee == payoutFee) |
---|
25 | | - | else false) |
---|
26 | | - | then !(isDefined(payout.feeAssetId)) |
---|
27 | | - | else false |
---|
| 16 | + | let paid = (ticketBalance >= gamePrice) |
---|
| 17 | + | if (!(paid)) |
---|
| 18 | + | then throw((("You must have " + toString(gamePrice)) + " tickets")) |
---|
| 19 | + | else { |
---|
| 20 | + | let correct = (sha256(payout.attachment) == answer) |
---|
| 21 | + | if (!(correct)) |
---|
| 22 | + | then throw("Incorrect answer") |
---|
| 23 | + | else if ((payout.fee == payoutFee)) |
---|
| 24 | + | then !(isDefined(payout.feeAssetId)) |
---|
| 25 | + | else false |
---|
| 26 | + | } |
---|
28 | 27 | | case _ => |
---|
29 | 28 | | true |
---|
30 | 29 | | } |
---|