tx · BPpsuZXBUvJesgRb2hy8PRtHjn6QvW4m6vnCqWAu3wpc 3MvbEM1UBE4gWS9jUyn4r1eajhzufY4TbWL: -0.01000000 Waves 2021.04.21 13:14 [1492078] smart account 3MvbEM1UBE4gWS9jUyn4r1eajhzufY4TbWL > SELF 0.00000000 Waves
{ "type": 13, "id": "BPpsuZXBUvJesgRb2hy8PRtHjn6QvW4m6vnCqWAu3wpc", "fee": 1000000, "feeAssetId": null, "timestamp": 1619000053481, "version": 2, "chainId": 84, "sender": "3MvbEM1UBE4gWS9jUyn4r1eajhzufY4TbWL", "senderPublicKey": "4Qfz7tpS7rGYzRpgcvFhi8n6BHqe3t8xt2kCwgVHwKuC", "proofs": [ "4ictvcLjk5PdYa8qVFNBeAVZViUgvNAfBQwNbQNeEtU37aMDNhPsrAS97qjSn5CBQim1bgy9ZzU8XRodY78xuMFS" ], "script": "base64:AAIEAAAAAAAAABsIAhIAEgQKAggIEgUKAwEEARIECgIBCBIAEgAAAAAkAAAAAAd2ZXJzaW9uAgAAAAUxLjAuMAAAAAAKa2V5VmVyc2lvbgIAAAAHdmVyc2lvbgAAAAAJa2V5QWN0aXZlAgAAAAZhY3RpdmUAAAAAEWtleU51bWJlck9mVm90aW5nAgAAAA1udW1iZXJfdm90aW5nAAAAAA9rZXlIZWlnaHRPZlBvb2wCAAAAB19oZWlnaHQAAAAABWtleU5vAgAAAANfbm8AAAAABmtleVllcwIAAAAEX3llcwAAAAARa2V5U3RhdHVzT2ZWb3RpbmcCAAAAB19zdGF0dXMAAAAAEWtleUFtb3VudE9mVm90aW5nAgAAAA1hbW91bnRfdm90aW5nAAAAAA1rZXlDb21taXNzaW9uAgAAAApjb21taXNzaW9uAAAAABtrZXlDb21taXNzaW9uU2NhbGVEZWxpbWl0ZXICAAAAGmNvbW1pc3Npb25fc2NhbGVfZGVsaW1pdGVyAAAAAAhrZXlDYXVzZQIAAAAOc2h1dGRvd25fY2F1c2UAAAAADmtleUNhbmNlbENhdXNlAgAAAA1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AAAAAIFAAAADGFkbWluUHViS2V5MwkABEwAAAACBQAAABRhZG1pblB1YktleVN0YXJ0U3RvcAUAAAADbmlsCAUAAAABaQAAAA9jYWxsZXJQdWJsaWNLZXkJAAACAAAAAQIAAAAhT25seSBhZG1pbiBjYW4gY2FsbCB0aGlzIGZ1bmN0aW9uCQAETAAAAAIJAQAAAAxCb29sZWFuRW50cnkAAAACBQAAAAlrZXlBY3RpdmUGCQAETAAAAAIJAQAAAAtEZWxldGVFbnRyeQAAAAEFAAAACGtleUNhdXNlBQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAABAAAABJhZG1pblB1YktleTFTaWduZWQDCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAUAAAAMYWRtaW5QdWJLZXkxAAAAAAAAAAABAAAAAAAAAAAABAAAABJhZG1pblB1YktleTJTaWduZWQDCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAQUAAAAMYWRtaW5QdWJLZXkyAAAAAAAAAAABAAAAAAAAAAAABAAAABJhZG1pblB1YktleTNTaWduZWQDCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAgUAAAAMYWRtaW5QdWJLZXkzAAAAAAAAAAABAAAAAAAAAAAACQAAZwAAAAIJAABkAAAAAgkAAGQAAAACBQAAABJhZG1pblB1YktleTFTaWduZWQFAAAAEmFkbWluUHViS2V5MlNpZ25lZAUAAAASYWRtaW5QdWJLZXkzU2lnbmVkAAAAAAAAAAACUY/BQA==", "height": 1492078, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 4 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let version = "1.0.0" | |
5 | + | ||
6 | + | let keyVersion = "version" | |
7 | + | ||
8 | + | let keyActive = "active" | |
9 | + | ||
10 | + | let keyNumberOfVoting = "number_voting" | |
11 | + | ||
12 | + | let keyHeightOfPool = "_height" | |
13 | + | ||
14 | + | let keyNo = "_no" | |
15 | + | ||
16 | + | let keyYes = "_yes" | |
17 | + | ||
18 | + | let keyStatusOfVoting = "_status" | |
19 | + | ||
20 | + | let keyAmountOfVoting = "amount_voting" | |
21 | + | ||
22 | + | let keyCommission = "commission" | |
23 | + | ||
24 | + | let keyCommissionScaleDelimiter = "commission_scale_delimiter" | |
25 | + | ||
26 | + | let keyCause = "shutdown_cause" | |
27 | + | ||
28 | + | let keyCancelCause = "_cancel_cause" | |
29 | + | ||
30 | + | let kUserTotalSWOP = "_SWOP_amount" | |
31 | + | ||
32 | + | let adminPubKey1 = base58'DXDY2itiEcYBtGkVLnkpHtDFyWQUkoLJz79uJ7ECbMrA' | |
33 | + | ||
34 | + | let adminPubKey2 = base58'E6Wa1SGoktYcjHjsKrvjMiqJY3SWmGKcD8Q5L8kxSPS7' | |
35 | + | ||
36 | + | let adminPubKey3 = base58'AZmWJtuy4GeVrMmJH4hfFBRApe1StvhJSk4jcbT6bArQ' | |
37 | + | ||
38 | + | let adminPubKeyStartStop = base58'AZmWJtuy4GeVrMmJH4hfFBRApe1StvhJSk4jcbT6bArQ' | |
39 | + | ||
40 | + | let walletAddress = Address(base58'3NAGTtZz6WpupSN89NZD5rMZwwziZEg4Kx4') | |
41 | + | ||
42 | + | let govAddr = Address(base58'3PLHVWCqA9DJPDbadUofTohnCULLauiDWhS') | |
43 | + | ||
44 | + | let USDN = base58'DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p' | |
45 | + | ||
46 | + | let SWOP = base58'DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p' | |
47 | + | ||
48 | + | let isActive = getBooleanValue(this, keyActive) | |
49 | + | ||
50 | + | let numberOfVoting = getIntegerValue(this, keyNumberOfVoting) | |
51 | + | ||
52 | + | let amountOfVoting = getIntegerValue(this, keyAmountOfVoting) | |
53 | + | ||
54 | + | let comissionForInitalizationOfVoting = 1000000000 | |
55 | + | ||
56 | + | let scaleValue3 = 1000 | |
57 | + | ||
58 | + | let scaleValue8 = 100000000 | |
59 | + | ||
60 | + | let slippageToleranceDelimiter = 1000 | |
61 | + | ||
62 | + | let scaleValue8Digits = 8 | |
63 | + | ||
64 | + | let maxAmountOfVoting = 5 | |
65 | + | ||
66 | + | let fiveDays = (1440 * 5) | |
67 | + | ||
68 | + | func getAssetInfoFromString (assetStr) = if ((assetStr == "WAVES")) | |
69 | + | then unit | |
70 | + | else fromBase58String(assetStr) | |
71 | + | ||
72 | + | ||
73 | + | func isCallerInGovernance (user) = if ((valueOrElse(getInteger(govAddr, (toString(user) + kUserTotalSWOP)), 0) > 0)) | |
74 | + | then true | |
75 | + | else false | |
76 | + | ||
77 | + | ||
78 | + | func suspend (cause) = [BooleanEntry(keyActive, false), StringEntry(keyCause, cause)] | |
79 | + | ||
80 | + | ||
81 | + | 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")) | |
82 | + | ||
83 | + | ||
84 | + | @Callable(i) | |
85 | + | func init () = { | |
86 | + | let initNumberOfVoting = 0 | |
87 | + | let initAmountOfVoting = 0 | |
88 | + | let initKeyActive = true | |
89 | + | [StringEntry(keyVersion, version), BooleanEntry(keyActive, initKeyActive), IntegerEntry(keyNumberOfVoting, initNumberOfVoting), IntegerEntry(keyAmountOfVoting, initAmountOfVoting)] | |
90 | + | } | |
91 | + | ||
92 | + | ||
93 | + | ||
94 | + | @Callable(i) | |
95 | + | func initVotingForNewPool (assetA,assetB) = { | |
96 | + | let $t029173016 = $Tuple2(getAssetInfoFromString(assetA), getAssetInfoFromString(assetB)) | |
97 | + | let poolAssetIdA = $t029173016._1 | |
98 | + | let poolAssetIdB = $t029173016._2 | |
99 | + | if (!(isActive)) | |
100 | + | then throw("DApp is inactive at this moment") | |
101 | + | else if ((poolAssetIdA == poolAssetIdB)) | |
102 | + | then throw("Assets must be different") | |
103 | + | else if ((numberOfVoting > maxAmountOfVoting)) | |
104 | + | then throw(("Too many votes. Maximum quantity -" + toString(maxAmountOfVoting))) | |
105 | + | 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))] | |
106 | + | } | |
107 | + | ||
108 | + | ||
109 | + | ||
110 | + | @Callable(i) | |
111 | + | func voteForPool (voting,yesOrNo,voteAmt) = { | |
112 | + | let currentHeight = height | |
113 | + | let poolInitHeight = valueOrErrorMessage(getIntegerValue(this, (toString(voting) + keyHeightOfPool)), ("Voting " + toString(voting))) | |
114 | + | if (yesOrNo) | |
115 | + | then { | |
116 | + | let newVote = (getIntegerValue(this, (toString(voting) + keyYes)) + voteAmt) | |
117 | + | [IntegerEntry((toString(voting) + keyYes), newVote), IntegerEntry((((toString(i.caller) + "_") + toString(voting)) + keyYes), voteAmt)] | |
118 | + | } | |
119 | + | else { | |
120 | + | let newVote = (getIntegerValue(this, (toString(voting) + keyNo)) + voteAmt) | |
121 | + | [IntegerEntry((toString(voting) + keyNo), newVote), IntegerEntry((((toString(i.caller) + "_") + toString(voting)) + keyNo), voteAmt)] | |
122 | + | } | |
123 | + | } | |
124 | + | ||
125 | + | ||
126 | + | ||
127 | + | @Callable(i) | |
128 | + | func cancellationVoting (voting,cause) = [IntegerEntry(keyNumberOfVoting, (numberOfVoting - 1)), BooleanEntry((toString(voting) + keyStatusOfVoting), false), StringEntry((toString(voting) + keyCancelCause), cause)] | |
129 | + | ||
130 | + | ||
131 | + | ||
132 | + | @Callable(i) | |
133 | + | func shutdown () = if (!(isActive)) | |
134 | + | then throw(("DApp is already suspended. Cause: " + valueOrElse(getString(this, keyCause), "the cause wasn't specified"))) | |
135 | + | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, adminPubKeyStartStop], i.callerPublicKey))) | |
136 | + | then throw("Only admin can call this function") | |
137 | + | else suspend("Paused by admin") | |
138 | + | ||
139 | + | ||
140 | + | ||
141 | + | @Callable(i) | |
142 | + | func activate () = if (isActive) | |
143 | + | then throw("DApp is already active") | |
144 | + | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, adminPubKeyStartStop], i.callerPublicKey))) | |
145 | + | then throw("Only admin can call this function") | |
146 | + | else [BooleanEntry(keyActive, true), DeleteEntry(keyCause)] | |
147 | + | ||
148 | + | ||
149 | + | @Verifier(tx) | |
150 | + | func verify () = { | |
151 | + | let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) | |
152 | + | then 1 | |
153 | + | else 0 | |
154 | + | let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[1], adminPubKey2)) | |
155 | + | then 1 | |
156 | + | else 0 | |
157 | + | let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[2], adminPubKey3)) | |
158 | + | then 1 | |
159 | + | else 0 | |
160 | + | (((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) >= 2) | |
161 | + | } | |
162 | + |
github/deemru/w8io/026f985 31.33 ms ◑