tx · 6CoSEKknwXX6jCdLtMWwA7tZEXvLQNNxZ9MsuBErQeYj 3N8DijjUMpYq512vvE9GHnCTUBUd4AZwhH6: -0.01500000 Waves 2021.04.21 13:40 [1492104] smart account 3N8DijjUMpYq512vvE9GHnCTUBUd4AZwhH6 > SELF 0.00000000 Waves
{ "type": 13, "id": "6CoSEKknwXX6jCdLtMWwA7tZEXvLQNNxZ9MsuBErQeYj", "fee": 1500000, "feeAssetId": null, "timestamp": 1619001631554, "version": 2, "chainId": 84, "sender": "3N8DijjUMpYq512vvE9GHnCTUBUd4AZwhH6", "senderPublicKey": "75SuvmjmHX6J7smVGHvWY6acr5mqyRQCYpFxeFQh8Cy3", "proofs": [ "459Atp8n8c2Ms6g2LSFEhdR5SBSxQLSsHig861tZqUkJgSZBsy1VXsx4ZcUYjo71KKzBacYxwGpFtns1xotE1uGY" ], "script": "base64:AAIEAAAAAAAAABsIAhIAEgQKAggIEgUKAwEEARIECgIBCBIAEgAAAAAbAAAAAAd2ZXJzaW9uAgAAAAUxLjAuMAAAAAAKa2V5VmVyc2lvbgIAAAAHdmVyc2lvbgAAAAAJa2V5QWN0aXZlAgAAAAZhY3RpdmUAAAAAEWtleU51bWJlck9mVm90aW5nAgAAAA1udW1iZXJfdm90aW5nAAAAAA9rZXlIZWlnaHRPZlBvb2wCAAAAB19oZWlnaHQAAAAABWtleU5vAgAAAANfbm8AAAAABmtleVllcwIAAAAEX3llcwAAAAARa2V5U3RhdHVzT2ZWb3RpbmcCAAAAB19zdGF0dXMAAAAAEWtleUFtb3VudE9mVm90aW5nAgAAAA1hbW91bnRfdm90aW5nAAAAAA1rZXlDb21taXNzaW9uAgAAAApjb21taXNzaW9uAAAAABtrZXlDb21taXNzaW9uU2NhbGVEZWxpbWl0ZXICAAAAGmNvbW1pc3Npb25fc2NhbGVfZGVsaW1pdGVyAAAAAAhrZXlDYXVzZQIAAAAOc2h1dGRvd25fY2F1c2UAAAAADmtleUNhbmNlbENhdXNlAgAAAA1fY2Fu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FAAAAA25pbAAAAAFpAQAAAAhzaHV0ZG93bgAAAAADCQEAAAABIQAAAAEFAAAACGlzQWN0aXZlCQAAAgAAAAEJAAEsAAAAAgIAAAAiREFwcCBpcyBhbHJlYWR5IHN1c3BlbmRlZC4gQ2F1c2U6IAkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkABB0AAAACBQAAAAR0aGlzBQAAAAhrZXlDYXVzZQIAAAAadGhlIGNhdXNlIHdhc24ndCBzcGVjaWZpZWQJAQAAAAdzdXNwZW5kAAAAAQIAAAAPUGF1c2VkIGJ5IGFkbWluAAAAAWkBAAAACGFjdGl2YXRlAAAAAAMFAAAACGlzQWN0aXZlCQAAAgAAAAECAAAAFkRBcHAgaXMgYWxyZWFkeSBhY3RpdmUJAARMAAAAAgkBAAAADEJvb2xlYW5FbnRyeQAAAAIFAAAACWtleUFjdGl2ZQYJAARMAAAAAgkBAAAAC0RlbGV0ZUVudHJ5AAAAAQUAAAAIa2V5Q2F1c2UFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAG5uQ0VA==", "height": 1492104, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9UrYBHjBzPTYPKQnjFfbw5p1g9ao54FjQCxQYdwHy7JP Next: BqwA3gysyomn4rrLYkCKid1C7X3JRkcMrqhYBsRYFNBh Diff:
Old | New | Differences | |
---|---|---|---|
87 | 87 | ||
88 | 88 | ||
89 | 89 | @Callable(i) | |
90 | - | func voteForPool (voting,yesOrNo,voteAmt) = { | |
91 | - | let currentHeight = height | |
92 | - | let poolInitHeight = valueOrErrorMessage(getIntegerValue(this, (toString(voting) + keyHeightOfPool)), ("Voting " + toString(voting))) | |
93 | - | if (yesOrNo) | |
94 | - | then { | |
95 | - | let newVote = (valueOrElse(getIntegerValue(this, (toString(voting) + keyYes)), 0) + voteAmt) | |
96 | - | [IntegerEntry((toString(voting) + keyYes), newVote), IntegerEntry((((toString(i.caller) + "_") + toString(voting)) + keyYes), voteAmt)] | |
97 | - | } | |
98 | - | else { | |
99 | - | let newVote = (valueOrElse(getIntegerValue(this, (toString(voting) + keyNo)), 0) + voteAmt) | |
100 | - | [IntegerEntry((toString(voting) + keyNo), newVote), IntegerEntry((((toString(i.caller) + "_") + toString(voting)) + keyNo), voteAmt)] | |
101 | - | } | |
102 | - | } | |
90 | + | func voteForPool (voting,yesOrNo,voteAmt) = if (yesOrNo) | |
91 | + | then [IntegerEntry((toString(voting) + keyYes), voteAmt), IntegerEntry((((toString(i.caller) + "_") + toString(voting)) + keyYes), voteAmt)] | |
92 | + | else [IntegerEntry((toString(voting) + keyNo), voteAmt), IntegerEntry((((toString(i.caller) + "_") + toString(voting)) + keyNo), voteAmt)] | |
103 | 93 | ||
104 | 94 | ||
105 | 95 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let version = "1.0.0" | |
5 | 5 | ||
6 | 6 | let keyVersion = "version" | |
7 | 7 | ||
8 | 8 | let keyActive = "active" | |
9 | 9 | ||
10 | 10 | let keyNumberOfVoting = "number_voting" | |
11 | 11 | ||
12 | 12 | let keyHeightOfPool = "_height" | |
13 | 13 | ||
14 | 14 | let keyNo = "_no" | |
15 | 15 | ||
16 | 16 | let keyYes = "_yes" | |
17 | 17 | ||
18 | 18 | let keyStatusOfVoting = "_status" | |
19 | 19 | ||
20 | 20 | let keyAmountOfVoting = "amount_voting" | |
21 | 21 | ||
22 | 22 | let keyCommission = "commission" | |
23 | 23 | ||
24 | 24 | let keyCommissionScaleDelimiter = "commission_scale_delimiter" | |
25 | 25 | ||
26 | 26 | let keyCause = "shutdown_cause" | |
27 | 27 | ||
28 | 28 | let keyCancelCause = "_cancel_cause" | |
29 | 29 | ||
30 | 30 | let kUserTotalSWOP = "_SWOP_amount" | |
31 | 31 | ||
32 | 32 | let isActive = getBooleanValue(this, keyActive) | |
33 | 33 | ||
34 | 34 | let numberOfVoting = getIntegerValue(this, keyNumberOfVoting) | |
35 | 35 | ||
36 | 36 | let amountOfVoting = getIntegerValue(this, keyAmountOfVoting) | |
37 | 37 | ||
38 | 38 | let comissionForInitalizationOfVoting = 1000000000 | |
39 | 39 | ||
40 | 40 | let scaleValue3 = 1000 | |
41 | 41 | ||
42 | 42 | let scaleValue8 = 100000000 | |
43 | 43 | ||
44 | 44 | let slippageToleranceDelimiter = 1000 | |
45 | 45 | ||
46 | 46 | let scaleValue8Digits = 8 | |
47 | 47 | ||
48 | 48 | let maxAmountOfVoting = 5 | |
49 | 49 | ||
50 | 50 | let fiveDays = (1440 * 5) | |
51 | 51 | ||
52 | 52 | func getAssetInfoFromString (assetStr) = if ((assetStr == "WAVES")) | |
53 | 53 | then unit | |
54 | 54 | else fromBase58String(assetStr) | |
55 | 55 | ||
56 | 56 | ||
57 | 57 | func suspend (cause) = [BooleanEntry(keyActive, false), StringEntry(keyCause, cause)] | |
58 | 58 | ||
59 | 59 | ||
60 | 60 | func throwInsufficientAvailableBalance (amount,assetName) = throw(((((("Insufficient DApp balance to pay " + toString(amount)) + " ") + assetName) + " due to staking.") + ". Please contact support in Telegram: https://t.me/swopfisupport")) | |
61 | 61 | ||
62 | 62 | ||
63 | 63 | @Callable(i) | |
64 | 64 | func init () = { | |
65 | 65 | let initNumberOfVoting = 0 | |
66 | 66 | let initAmountOfVoting = 0 | |
67 | 67 | let initKeyActive = true | |
68 | 68 | [StringEntry(keyVersion, version), BooleanEntry(keyActive, initKeyActive), IntegerEntry(keyNumberOfVoting, initNumberOfVoting), IntegerEntry(keyAmountOfVoting, initAmountOfVoting)] | |
69 | 69 | } | |
70 | 70 | ||
71 | 71 | ||
72 | 72 | ||
73 | 73 | @Callable(i) | |
74 | 74 | func initVotingForNewPool (assetA,assetB) = { | |
75 | 75 | let $t029433042 = $Tuple2(getAssetInfoFromString(assetA), getAssetInfoFromString(assetB)) | |
76 | 76 | let poolAssetIdA = $t029433042._1 | |
77 | 77 | let poolAssetIdB = $t029433042._2 | |
78 | 78 | if (!(isActive)) | |
79 | 79 | then throw("DApp is inactive at this moment") | |
80 | 80 | else if ((poolAssetIdA == poolAssetIdB)) | |
81 | 81 | then throw("Assets must be different") | |
82 | 82 | else if ((numberOfVoting > maxAmountOfVoting)) | |
83 | 83 | then throw(("Too many votes. Maximum quantity -" + toString(maxAmountOfVoting))) | |
84 | 84 | else [IntegerEntry(((((assetA + "_") + assetB) + "_") + toString(amountOfVoting)), amountOfVoting), IntegerEntry((toString(amountOfVoting) + keyHeightOfPool), (height + fiveDays)), BooleanEntry((toString(amountOfVoting) + keyStatusOfVoting), true), IntegerEntry(keyAmountOfVoting, (amountOfVoting + 1)), IntegerEntry(keyNumberOfVoting, (numberOfVoting + 1))] | |
85 | 85 | } | |
86 | 86 | ||
87 | 87 | ||
88 | 88 | ||
89 | 89 | @Callable(i) | |
90 | - | func voteForPool (voting,yesOrNo,voteAmt) = { | |
91 | - | let currentHeight = height | |
92 | - | let poolInitHeight = valueOrErrorMessage(getIntegerValue(this, (toString(voting) + keyHeightOfPool)), ("Voting " + toString(voting))) | |
93 | - | if (yesOrNo) | |
94 | - | then { | |
95 | - | let newVote = (valueOrElse(getIntegerValue(this, (toString(voting) + keyYes)), 0) + voteAmt) | |
96 | - | [IntegerEntry((toString(voting) + keyYes), newVote), IntegerEntry((((toString(i.caller) + "_") + toString(voting)) + keyYes), voteAmt)] | |
97 | - | } | |
98 | - | else { | |
99 | - | let newVote = (valueOrElse(getIntegerValue(this, (toString(voting) + keyNo)), 0) + voteAmt) | |
100 | - | [IntegerEntry((toString(voting) + keyNo), newVote), IntegerEntry((((toString(i.caller) + "_") + toString(voting)) + keyNo), voteAmt)] | |
101 | - | } | |
102 | - | } | |
90 | + | func voteForPool (voting,yesOrNo,voteAmt) = if (yesOrNo) | |
91 | + | then [IntegerEntry((toString(voting) + keyYes), voteAmt), IntegerEntry((((toString(i.caller) + "_") + toString(voting)) + keyYes), voteAmt)] | |
92 | + | else [IntegerEntry((toString(voting) + keyNo), voteAmt), IntegerEntry((((toString(i.caller) + "_") + toString(voting)) + keyNo), voteAmt)] | |
103 | 93 | ||
104 | 94 | ||
105 | 95 | ||
106 | 96 | @Callable(i) | |
107 | 97 | func cancellationVoting (voting,cause) = [IntegerEntry(keyNumberOfVoting, (numberOfVoting - 1)), BooleanEntry((toString(voting) + keyStatusOfVoting), false), StringEntry((toString(voting) + keyCancelCause), cause)] | |
108 | 98 | ||
109 | 99 | ||
110 | 100 | ||
111 | 101 | @Callable(i) | |
112 | 102 | func shutdown () = if (!(isActive)) | |
113 | 103 | then throw(("DApp is already suspended. Cause: " + valueOrElse(getString(this, keyCause), "the cause wasn't specified"))) | |
114 | 104 | else suspend("Paused by admin") | |
115 | 105 | ||
116 | 106 | ||
117 | 107 | ||
118 | 108 | @Callable(i) | |
119 | 109 | func activate () = if (isActive) | |
120 | 110 | then throw("DApp is already active") | |
121 | 111 | else [BooleanEntry(keyActive, true), DeleteEntry(keyCause)] | |
122 | 112 | ||
123 | 113 | ||
124 | 114 | @Verifier(tx) | |
125 | 115 | func verify () = true | |
126 | 116 |
github/deemru/w8io/169f3d6 77.75 ms ◑