tx · 5UtSetHduvm2WkQVDLwUYghJybjEbHThgwLxc8VP7GyD 3NCVp18FAUoyhqmpShGvFPUZ9GVXub79QqF: -0.05000000 Waves 2021.09.29 16:58 [1724332] smart account 3NCVp18FAUoyhqmpShGvFPUZ9GVXub79QqF > SELF 0.00000000 Waves
{ "type": 13, "id": "5UtSetHduvm2WkQVDLwUYghJybjEbHThgwLxc8VP7GyD", "fee": 5000000, "feeAssetId": null, "timestamp": 1632923871373, "version": 2, "chainId": 84, "sender": "3NCVp18FAUoyhqmpShGvFPUZ9GVXub79QqF", "senderPublicKey": "4RrGWbA8e8thBzBtEHyrov2WBWdwDG5KA2ZG76cJbjX8", "proofs": [ "2NVhCe5xtYe3CBGXoeHwHScvhvsaZBvNFbyVvfN88MaH1AmSCjHXCM8gXdJgcrtcD7EPJqDgTqFgKxMF6iFB4Dn7" ], "script": "base64:AAIFAAAAAAAAAAYIAhIAEgAAAAAGAAAAAAtmcm9lQXNzZXRJZAEAAAAgSsv1ZJ09Ny43QbbnBS7IGxI8mddY9Mw8h+wjzyuSMzUAAAAABm9uZURheQAAAAAAAAAFoAAAAAAPZGF5c1ZvdGVJc1ZhbGlkCQAAaAAAAAIFAAAABm9uZURheQAAAAAAAAAABwAAAAAXZGF5c1ZvdGVJc1ZhbGlkSW5CbG9ja3MJAABkAAAAAgUAAAAPZGF5c1ZvdGVJc1ZhbGlkBQAAAAZoZWlnaHQAAAAACmdyYW5kVG90YWwJAAPwAAAAAgUAAAAEdGhpcwUAAAALZnJvZUFzc2V0SWQBAAAAD2NhbGN1bGF0ZVJld2FyZAAAAAEAAAAKcGVyY2VudGFnZQQAAAAQcGVyY2VudGFnZVJld2FyZAkAAGkAAAACBQAAAApwZXJjZW50YWdlAAAAAAAAAABkBAAAAAZyZXdhcmQJAABoAAAAAgUAAAAQcGVyY2VudGFnZVJld2FyZAUAAAAKZ3JhbmRUb3RhbAUAAAAGcmV3YXJkAAAAAgAAAAFpAQAAAARWb3RlAAAAAAQAAAADcG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m9yIGVsaWdpYmxlIHdpdGhkcmF3YWxzAwkAAAAAAAACBQAAAA5jaGVja1ZhbGlkVm90ZQAAAAAAAAAAAAkAAAIAAAABAgAAABNObyBWYWxpZCBWb3RlIEZvdW5kCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgkAAGQAAAACCQEAAAARQGV4dHJOYXRpdmUoMTA1MCkAAAACBQAAAAR0aGlzCQABLAAAAAICAAAAEFZvdGVfQW1vdW50X0Zvcl8FAAAADkFkZHJlc3NPZlZvdGVyBQAAAAZyZXdhcmQFAAAAC2Zyb2VBc3NldElkBQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleeXwnF0=", "height": 1724332, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: F5xL3zwkzXmLdx9WQ2UieF8hU2R28oWL5KPyXRftGXyn Next: FtFqz9XSKVHy3ZeTAsmBRYgUmT821kUrkqCSB7LjsvUm Diff:
Old | New | Differences | |
---|---|---|---|
10 | 10 | let daysVoteIsValidInBlocks = (daysVoteIsValid + height) | |
11 | 11 | ||
12 | 12 | let grandTotal = assetBalance(this, froeAssetId) | |
13 | - | ||
14 | - | func initialWithDrawstate () = StringEntry("Withdraw_State", "DISABLED") | |
15 | - | ||
16 | - | ||
17 | - | func votersCounter (index) = { | |
18 | - | let initialIndex = index | |
19 | - | initialIndex | |
20 | - | } | |
21 | - | ||
22 | 13 | ||
23 | 14 | func calculateReward (percentage) = { | |
24 | 15 | let percentageReward = (percentage / 100) | |
58 | 49 | then throw((("Incorrect asset attached, please attach " + toBase58String(froeAssetId)) + " only.")) | |
59 | 50 | else if ((10000 != pmt.amount)) | |
60 | 51 | then throw("Exactly 1 Froe is need to make a vote") | |
61 | - | else [StringEntry("Voter", AddressOfVoter), IntegerEntry(("Vote_Amount_For" + AddressOfVoter), pmt.amount), IntegerEntry("Vote_Index", (votersIndex + 1)) | |
52 | + | else [StringEntry("Voter", AddressOfVoter), IntegerEntry(("Vote_Amount_For_" + AddressOfVoter), pmt.amount), IntegerEntry("Vote_Index", (votersIndex + 1))] | |
62 | 53 | } | |
63 | 54 | ||
64 | 55 | ||
68 | 59 | let checkWithDrawState = getStringValue("Withdraw_State") | |
69 | 60 | let AddressOfVoter = toBase58String(i.caller.bytes) | |
70 | 61 | let reward = calculateReward(81) | |
71 | - | let checkValidVote = getIntegerValue(this, ("Vote_Amount_For" + AddressOfVoter)) | |
62 | + | let checkValidVote = getIntegerValue(this, ("Vote_Amount_For_" + AddressOfVoter)) | |
72 | 63 | if ((checkWithDrawState == "DISABLED")) | |
73 | - | then throw("Withdrawal Is currently disabled. A minimum of 7 Days is | |
64 | + | then throw("Withdrawal Is currently disabled. A minimum of 7 Days is needed for eligible withdrawals") | |
74 | 65 | else if ((checkValidVote == 0)) | |
75 | 66 | then throw("No Valid Vote Found") | |
76 | - | else [ScriptTransfer(i.caller, (getIntegerValue(this, ("Vote_Amount_For" + AddressOfVoter)) + reward), froeAssetId)] | |
67 | + | else [ScriptTransfer(i.caller, (getIntegerValue(this, ("Vote_Amount_For_" + AddressOfVoter)) + reward), froeAssetId)] | |
77 | 68 | } | |
78 | 69 | ||
79 | 70 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let froeAssetId = base58'62yYzfZL17bnZ2aPCuDoT1mfwick4PMHNooyAewfq8Sp' | |
5 | 5 | ||
6 | 6 | let oneDay = 1440 | |
7 | 7 | ||
8 | 8 | let daysVoteIsValid = (oneDay * 7) | |
9 | 9 | ||
10 | 10 | let daysVoteIsValidInBlocks = (daysVoteIsValid + height) | |
11 | 11 | ||
12 | 12 | let grandTotal = assetBalance(this, froeAssetId) | |
13 | - | ||
14 | - | func initialWithDrawstate () = StringEntry("Withdraw_State", "DISABLED") | |
15 | - | ||
16 | - | ||
17 | - | func votersCounter (index) = { | |
18 | - | let initialIndex = index | |
19 | - | initialIndex | |
20 | - | } | |
21 | - | ||
22 | 13 | ||
23 | 14 | func calculateReward (percentage) = { | |
24 | 15 | let percentageReward = (percentage / 100) | |
25 | 16 | let reward = (percentageReward * grandTotal) | |
26 | 17 | reward | |
27 | 18 | } | |
28 | 19 | ||
29 | 20 | ||
30 | 21 | @Callable(i) | |
31 | 22 | func Vote () = { | |
32 | 23 | let pmt = if ((size(i.payments) == 1)) | |
33 | 24 | then i.payments[0] | |
34 | 25 | else throw("You need exactly one froe to make a vote") | |
35 | 26 | let AddressOfVoter = toBase58String(i.caller.bytes) | |
36 | 27 | let currentvalue = match getInteger(this, "Total_vote_amount") { | |
37 | 28 | case t: Int => | |
38 | 29 | t | |
39 | 30 | case _ => | |
40 | 31 | 0 | |
41 | 32 | } | |
42 | 33 | let checkVoter = match getInteger(this, ("Vote_Amount_For" + AddressOfVoter)) { | |
43 | 34 | case c: Int => | |
44 | 35 | c | |
45 | 36 | case _ => | |
46 | 37 | unit | |
47 | 38 | } | |
48 | 39 | let votersIndex = match getInteger(this, "Vote_Index") { | |
49 | 40 | case a: Int => | |
50 | 41 | a | |
51 | 42 | case _ => | |
52 | 43 | 0 | |
53 | 44 | } | |
54 | 45 | let rewardValue = calculateReward(81) | |
55 | 46 | if ((checkVoter != unit)) | |
56 | 47 | then throw("You already Voted") | |
57 | 48 | else if ((pmt.assetId != froeAssetId)) | |
58 | 49 | then throw((("Incorrect asset attached, please attach " + toBase58String(froeAssetId)) + " only.")) | |
59 | 50 | else if ((10000 != pmt.amount)) | |
60 | 51 | then throw("Exactly 1 Froe is need to make a vote") | |
61 | - | else [StringEntry("Voter", AddressOfVoter), IntegerEntry(("Vote_Amount_For" + AddressOfVoter), pmt.amount), IntegerEntry("Vote_Index", (votersIndex + 1)) | |
52 | + | else [StringEntry("Voter", AddressOfVoter), IntegerEntry(("Vote_Amount_For_" + AddressOfVoter), pmt.amount), IntegerEntry("Vote_Index", (votersIndex + 1))] | |
62 | 53 | } | |
63 | 54 | ||
64 | 55 | ||
65 | 56 | ||
66 | 57 | @Callable(i) | |
67 | 58 | func Withdraw () = { | |
68 | 59 | let checkWithDrawState = getStringValue("Withdraw_State") | |
69 | 60 | let AddressOfVoter = toBase58String(i.caller.bytes) | |
70 | 61 | let reward = calculateReward(81) | |
71 | - | let checkValidVote = getIntegerValue(this, ("Vote_Amount_For" + AddressOfVoter)) | |
62 | + | let checkValidVote = getIntegerValue(this, ("Vote_Amount_For_" + AddressOfVoter)) | |
72 | 63 | if ((checkWithDrawState == "DISABLED")) | |
73 | - | then throw("Withdrawal Is currently disabled. A minimum of 7 Days is | |
64 | + | then throw("Withdrawal Is currently disabled. A minimum of 7 Days is needed for eligible withdrawals") | |
74 | 65 | else if ((checkValidVote == 0)) | |
75 | 66 | then throw("No Valid Vote Found") | |
76 | - | else [ScriptTransfer(i.caller, (getIntegerValue(this, ("Vote_Amount_For" + AddressOfVoter)) + reward), froeAssetId)] | |
67 | + | else [ScriptTransfer(i.caller, (getIntegerValue(this, ("Vote_Amount_For_" + AddressOfVoter)) + reward), froeAssetId)] | |
77 | 68 | } | |
78 | 69 | ||
79 | 70 | ||
80 | 71 | @Verifier(tx) | |
81 | 72 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
82 | 73 |
github/deemru/w8io/026f985 61.37 ms ◑