tx · svTePnfd7uu6cKhunRxuzk4bSuBUq6ZD8gXz1ZKFPDj 3N7UYW9TnmvBHnFst9imprHsoAMHQ3NR7Ub: -0.01400000 Waves 2019.02.03 19:27 [479049] smart account 3N7UYW9TnmvBHnFst9imprHsoAMHQ3NR7Ub > SELF 0.00000000 Waves
{ "type": 13, "id": "svTePnfd7uu6cKhunRxuzk4bSuBUq6ZD8gXz1ZKFPDj", "fee": 1400000, "feeAssetId": null, "timestamp": 1549211307516, "version": 1, "sender": "3N7UYW9TnmvBHnFst9imprHsoAMHQ3NR7Ub", "senderPublicKey": "CXpiWubcdkB79QekRVaEXMVY8N12qP2f9zJp5sziGfge", "proofs": [ "5efX6r1NS7PLzznVJQ3wD98dQRxjwPSM3uuB2xZnKvovbYamSopuu2xmC7kifU8s9RiABg1ikxQ93a28bq395mVf" ], "script": "base64:AQQAAAAIdm90ZUJhbmsIBQAAAAJ0eAAAAAZzZW5kZXIEAAAAE21pbmltYWxWb3RpbmdIZWlnaHQAAAAAAAAAAGQEAAAAByRtYXRjaDAFAAAAAnR4AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAA9EYXRhVHJhbnNhY3Rpb24EAAAAAWQFAAAAByRtYXRjaDADCQAAAAAAAAIJAAGQAAAAAQgFAAAAAWQAAAAEZGF0YQAAAAAAAAAAAwQAAAANZmVlVHJhbnNmZXJJZAkAA+gAAAABCQABkQAAAAIIBQAAAAFkAAAABnByb29mcwAAAAAAAAAAAAQAAAAHJG1hdGNoMQUAAAANZmVlVHJhbnNmZXJJZAMJAAABAAAAAgUAAAAHJG1hdGNoMQIAAAATVHJhbnNmZXJUcmFuc2FjdGlvbgQAAAACZlQFAAAAByRtYXRjaDEEAAAADHZvdGluZ0hlaWdodAkBAAAAB2V4dHJhY3QAAAABCQEAAAAKZ2V0SW50ZWdlcgAAAAIIBQAAAAFkAAAABGRhdGEAAAAAAAAAAAADAwMDAwMJAQAAAAEhAAAAAQkBAAAACWlzRGVmaW5lZAAAAAEJAAQ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RnJvbVN0cmluZwAAAAEJAQAAAAdleHRyYWN0AAAAAQkABB0AAAACBQAAAAh2b3RlQmFuawIAAAAEcHJvcwYJAAAAAAAAAgkABCQAAAABCAUAAAABdAAAAAlyZWNpcGllbnQJAQAAABFhZGRyZXNzRnJvbVN0cmluZwAAAAEJAQAAAAdleHRyYWN0AAAAAQkABB0AAAACBQAAAAh2b3RlQmFuawIAAAAEY29ucwcJAQAAAAlpc0RlZmluZWQAAAABCQAEHQAAAAIFAAAACHZvdGVCYW5rAgAAAARwcm9zBwkBAAAACWlzRGVmaW5lZAAAAAEJAAQdAAAAAgUAAAAIdm90ZUJhbmsCAAAABGNvbnMHCQAAAgAAAAECAAAAM3lvdSBjYW5ub3Qgdm90ZSB3aXRoIHRoaXMgdG9rZW4uIEl0J3Mgbm90IHJlZ2lzdHJlZAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAUU2V0U2NyaXB0VHJhbnNhY3Rpb24EAAAAAXMFAAAAByRtYXRjaDAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5B+luyaE=", "chainId": 84, "height": 479049, "spentComplexity": 0 } View: original | compacted Prev: AKJLHKozV1c3eELQtaqF4pbQm1ZQhyEYmztjFBuitEzy Next: AgwjSb2qd4yhLSQUTLwj7P7UvKoDmH5ZpRfabYR9dnry Diff:
Old | New | Differences | |
---|---|---|---|
31 | 31 | let accountScriptHash = extract(getBinary(voteBank, "IssuerAccountScriptHash")) | |
32 | 32 | let scriptTx = transactionById(accountScriptedProof) | |
33 | 33 | if ((fT.amount >= (i.quantity * 900000))) | |
34 | - | then if (if (if (if (if (if ( match scriptTx { | |
34 | + | then if (if (if (if (if (if (if ( match scriptTx { | |
35 | 35 | case s: SetScriptTransaction => | |
36 | 36 | if ((sha256(extract(s.script)) == accountScriptHash)) | |
37 | 37 | then true | |
51 | 51 | then true | |
52 | 52 | else throw("trying to reg asset of another issuer") | |
53 | 53 | else false) | |
54 | - | then (fromBase58String(d.data[0].key) == extract(fT.attachment)) | |
54 | + | then if (!(isDefined(getBinary(voteBank, toBase58String(sha256(i.description)))))) | |
55 | + | then true | |
56 | + | else throw("voting question already registred") | |
57 | + | else false) | |
58 | + | then (fromBase58String(d.data[0].key) == fT.attachment) | |
55 | 59 | else false) | |
56 | 60 | then if (sigVerify(d.bodyBytes, d.proofs[1], fT.senderPublicKey)) | |
57 | 61 | then true |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 1 #-} | |
2 | 2 | {-# CONTENT_TYPE EXPRESSION #-} | |
3 | 3 | let voteBank = tx.sender | |
4 | 4 | let minimalVotingHeight = 100 | |
5 | 5 | match tx { | |
6 | 6 | case d: DataTransaction => | |
7 | 7 | if ((size(d.data) == 3)) | |
8 | 8 | then { | |
9 | 9 | let feeTransferId = transactionById(d.proofs[0]) | |
10 | 10 | match feeTransferId { | |
11 | 11 | case fT: TransferTransaction => | |
12 | 12 | let votingHeight = extract(getInteger(d.data, 0)) | |
13 | 13 | if (if (if (if (if (if (!(isDefined(getInteger(voteBank, d.data[0].key)))) | |
14 | 14 | then true | |
15 | 15 | else throw("asset already registred")) | |
16 | 16 | then if ((fT.recipient == voteBank)) | |
17 | 17 | then true | |
18 | 18 | else throw("fee recipient not votebank") | |
19 | 19 | else false) | |
20 | 20 | then !(isDefined(fT.assetId)) | |
21 | 21 | else false) | |
22 | 22 | then (votingHeight > height) | |
23 | 23 | else false) | |
24 | 24 | then if (((votingHeight - height) >= minimalVotingHeight)) | |
25 | 25 | then true | |
26 | 26 | else throw("voting interval should be more than 100 blocks") | |
27 | 27 | else false) | |
28 | 28 | then match transactionById(fromBase58String(d.data[0].key)) { | |
29 | 29 | case i: IssueTransaction => | |
30 | 30 | let accountScriptedProof = extract(getBinary(d.data, 1)) | |
31 | 31 | let accountScriptHash = extract(getBinary(voteBank, "IssuerAccountScriptHash")) | |
32 | 32 | let scriptTx = transactionById(accountScriptedProof) | |
33 | 33 | if ((fT.amount >= (i.quantity * 900000))) | |
34 | - | then if (if (if (if (if (if ( match scriptTx { | |
34 | + | then if (if (if (if (if (if (if ( match scriptTx { | |
35 | 35 | case s: SetScriptTransaction => | |
36 | 36 | if ((sha256(extract(s.script)) == accountScriptHash)) | |
37 | 37 | then true | |
38 | 38 | else throw("script hash not fit requirements") | |
39 | 39 | case _ => | |
40 | 40 | throw("voting initiator not scripted, or script is wrong") | |
41 | 41 | }) | |
42 | 42 | then (i.decimals == 0) | |
43 | 43 | else false) | |
44 | 44 | then (fT.senderPublicKey == i.senderPublicKey) | |
45 | 45 | else false) | |
46 | 46 | then if ((getBinary(d.data, 2) == i.id)) | |
47 | 47 | then true | |
48 | 48 | else throw("voting question should be registred with question") | |
49 | 49 | else false) | |
50 | 50 | then if ((d.data[1].key == toBase58String(i.sender.bytes))) | |
51 | 51 | then true | |
52 | 52 | else throw("trying to reg asset of another issuer") | |
53 | 53 | else false) | |
54 | - | then (fromBase58String(d.data[0].key) == extract(fT.attachment)) | |
54 | + | then if (!(isDefined(getBinary(voteBank, toBase58String(sha256(i.description)))))) | |
55 | + | then true | |
56 | + | else throw("voting question already registred") | |
57 | + | else false) | |
58 | + | then (fromBase58String(d.data[0].key) == fT.attachment) | |
55 | 59 | else false) | |
56 | 60 | then if (sigVerify(d.bodyBytes, d.proofs[1], fT.senderPublicKey)) | |
57 | 61 | then true | |
58 | 62 | else throw("wrong signature") | |
59 | 63 | else false | |
60 | 64 | else throw(("minimum trasfer transaction amount is" + toString((i.quantity * 900000)))) | |
61 | 65 | case _ => | |
62 | 66 | throw("data key at 0 index should contain voting asset id") | |
63 | 67 | } | |
64 | 68 | else false | |
65 | 69 | case _ => | |
66 | 70 | throw("proof at index 0 doesn't contain fee transfer transaction") | |
67 | 71 | } | |
68 | 72 | } | |
69 | 73 | else throw("data tx should contain two key-value pairs: 0 - assetId-maxVotingHeight, 1 - ") | |
70 | 74 | case t: TransferTransaction => | |
71 | 75 | if (isDefined(getInteger(voteBank, toBase58String(extract(t.assetId))))) | |
72 | 76 | then { | |
73 | 77 | let h = getInteger(voteBank, toBase58String(extract(t.assetId))) | |
74 | 78 | if (if (if ((extract(h) > height)) | |
75 | 79 | then if ((addressFromRecipient(t.recipient) == addressFromString(extract(getString(voteBank, "pros"))))) | |
76 | 80 | then true | |
77 | 81 | else (addressFromRecipient(t.recipient) == addressFromString(extract(getString(voteBank, "cons")))) | |
78 | 82 | else false) | |
79 | 83 | then isDefined(getString(voteBank, "pros")) | |
80 | 84 | else false) | |
81 | 85 | then isDefined(getString(voteBank, "cons")) | |
82 | 86 | else false | |
83 | 87 | } | |
84 | 88 | else throw("you cannot vote with this token. It's not registred") | |
85 | 89 | case s: SetScriptTransaction => | |
86 | 90 | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
87 | 91 | case _ => | |
88 | 92 | false | |
89 | 93 | } |
github/deemru/w8io/026f985 39.33 ms ◑