tx · 43idGd9Vn7B3UU77WTYagVXrzDFa9WH2BpR8MTPDWF5s 3N8z4JJhDdc8DkVdFfvi5YMcDj8HrJdQdPL: -0.01400000 Waves 2021.12.03 01:42 [1817272] smart account 3N8z4JJhDdc8DkVdFfvi5YMcDj8HrJdQdPL > SELF 0.00000000 Waves
{ "type": 13, "id": "43idGd9Vn7B3UU77WTYagVXrzDFa9WH2BpR8MTPDWF5s", "fee": 1400000, "feeAssetId": null, "timestamp": 1638484994304, "version": 1, "sender": "3N8z4JJhDdc8DkVdFfvi5YMcDj8HrJdQdPL", "senderPublicKey": "ArqyNx1AQnqPx7C3UaznjXHqoJ9MdeEgvYhfHGLqqnji", "proofs": [ "3yKnxaHv68wc95Fvv24r2oPT9zucrW6TuL6EAHuozQqZBHbhmdXNctuMYLmBUSFUXD5FWuCXDtXNqYhKMCRPKrF6" ], "script": "base64:AAIFAAAAAAAAABoIAhIAEgMKAQQSAwoBCBIDCgEBEgMKAQgSAAAAABUAAAAABm9yYWNsZQkBAAAAB0FkZHJlc3MAAAABAQAAABoBVH0KfOG62moCo2XE+BnRFKoj95zRSmS3wAAAAAARU1dPUGdvdmVybmFuY2VBZHIJAQAAABFAZXh0ck5hdGl2ZSgxMDYyKQAAAAEJAQAAABN2YWx1ZU9yRXJyb3JNZXNzYWdlAAAAAgkABB0AAAACBQAAAAZvcmFjbGUCAAAAD3N3b3BfZ292ZXJuYW5jZQIAAAAZRW1wdHkga2V5IHN3b3BfZ292ZXJuYW5jZQAAAAANV2F2ZXNVc2RuUG9vbAkBAAAABXZhbHVlAAAAAQkABCYAAAABCQEAAAALdmFsdWVPckVsc2UAAAACCQAEHQAAAAIFAAAABm9yYWNsZQIAAAAPV0FWRVNfVVNETl9wb29sAgAAABlFbXB0eSBrZXkgV0FWRVNfVVNETl9wb29sAAAAAAljb25zdW1lcnMJAAS1AAAAAgkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkABB0AAAACBQAAAAZvcmFjbGUCAAAACWNvbnN1bW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YWRtaW41BQAAAANuaWwIBQAAAAFpAAAABmNhbGxlcgkBAAAAASEAAAABCQEAAAAPY29udGFpbnNFbGVtZW50AAAAAgUAAAAJY29uc3VtZXJzCQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMHCQAAAgAAAAECAAAAIU9ubHkgYWRtaW4gY2FuIGNhbGwgdGhpcyBmdW5jdGlvbgkABEwAAAACCQEAAAAMQm9vbGVhbkVudHJ5AAAAAgIAAAAOaXNfZGFwcF9hY3RpdmUHBQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAAAwkBAAAAASEAAAABCQEAAAAVaXNUcmFuc2FjdGlvbkFwcHJvdmVkAAAAAQkAAlgAAAABCAUAAAACdHgAAAACaWQJAAACAAAAAQIAAAAlVHJhbnNhY3Rpb24gaWQgbm90IGFwcHJvdmVkIGJ5IGFkbWlucwbHiQcC", "chainId": 84, "height": 1817272, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let oracle = Address(base58'3N1KEoc6CDgbMSExXfJMAtXQBAsxvTWPyCb') | |
5 | + | ||
6 | + | let SWOPgovernanceAdr = addressFromStringValue(valueOrErrorMessage(getString(oracle, "swop_governance"), "Empty key swop_governance")) | |
7 | + | ||
8 | + | let WavesUsdnPool = value(addressFromString(valueOrElse(getString(oracle, "WAVES_USDN_pool"), "Empty key WAVES_USDN_pool"))) | |
9 | + | ||
10 | + | let consumers = split(valueOrElse(getString(oracle, "consumers"), "Empty key consumer"), ",") | |
11 | + | ||
12 | + | let admin1 = addressFromStringValue(valueOrElse(getString(oracle, "admin_1"), "Empty key admin_1")) | |
13 | + | ||
14 | + | let admin2 = addressFromStringValue(valueOrElse(getString(oracle, "admin_2"), "Empty key admin_2")) | |
15 | + | ||
16 | + | let admin3 = addressFromStringValue(valueOrElse(getString(oracle, "admin_3"), "Empty key admin_3")) | |
17 | + | ||
18 | + | let admin4 = addressFromStringValue(valueOrElse(getString(oracle, "admin_4"), "Empty key admin_4")) | |
19 | + | ||
20 | + | let admin5 = addressFromStringValue(valueOrElse(getString(oracle, "admin_5"), "Empty key admin_5")) | |
21 | + | ||
22 | + | let feeInUSDN = valueOrErrorMessage(getInteger(oracle, "protocol_fee_in_usdn"), "Empty protocol_fee_in_usdn") | |
23 | + | ||
24 | + | let isProtocolActive = valueOrErrorMessage(getBoolean(oracle, "is_protocol_active"), "Empty key is_protocol_active") | |
25 | + | ||
26 | + | let keyAutomateOwner = "owner" | |
27 | + | ||
28 | + | let keyBalance = "_balance" | |
29 | + | ||
30 | + | let keyIsDappActive = "is_dapp_active" | |
31 | + | ||
32 | + | let keyOverallBalance = "overall_balance" | |
33 | + | ||
34 | + | let isDappActive = valueOrErrorMessage(getBoolean(this, keyIsDappActive), "Empty key is_dapp_active") | |
35 | + | ||
36 | + | let orverallBalance = valueOrErrorMessage(getInteger(this, keyOverallBalance), "Empty key overall_balance") | |
37 | + | ||
38 | + | let blockchainFee = 500000 | |
39 | + | ||
40 | + | func getUserBalance (userStr) = { | |
41 | + | let userBalance = match getInteger(this, (userStr + keyBalance)) { | |
42 | + | case ub: Int => | |
43 | + | ub | |
44 | + | case empty: Unit => | |
45 | + | 0 | |
46 | + | case _ => | |
47 | + | throw("Match error") | |
48 | + | } | |
49 | + | userBalance | |
50 | + | } | |
51 | + | ||
52 | + | ||
53 | + | func calcWavesProtocolFee () = { | |
54 | + | let balanceUSDN = valueOrErrorMessage(getInteger(WavesUsdnPool, "B_asset_balance"), "Empty B_asset_balance") | |
55 | + | let balanceWAVES = valueOrErrorMessage(getInteger(WavesUsdnPool, "A_asset_balance"), "Empty A_asset_balance") | |
56 | + | let feeInWAVES = fraction(feeInUSDN, balanceWAVES, balanceUSDN) | |
57 | + | (feeInWAVES + blockchainFee) | |
58 | + | } | |
59 | + | ||
60 | + | ||
61 | + | func isTransactionApproved (txStr) = { | |
62 | + | let admin1Signed = if (valueOrElse(getBoolean(admin1, txStr), false)) | |
63 | + | then 1 | |
64 | + | else 0 | |
65 | + | let admin2Signed = if (valueOrElse(getBoolean(admin2, txStr), false)) | |
66 | + | then 1 | |
67 | + | else 0 | |
68 | + | let admin3Signed = if (valueOrElse(getBoolean(admin3, txStr), false)) | |
69 | + | then 1 | |
70 | + | else 0 | |
71 | + | let admin4Signed = if (valueOrElse(getBoolean(admin4, txStr), false)) | |
72 | + | then 1 | |
73 | + | else 0 | |
74 | + | let admin5Signed = if (valueOrElse(getBoolean(admin5, txStr), false)) | |
75 | + | then 1 | |
76 | + | else 0 | |
77 | + | (((((admin1Signed + admin2Signed) + admin3Signed) + admin4Signed) + admin5Signed) >= 3) | |
78 | + | } | |
79 | + | ||
80 | + | ||
81 | + | @Callable(i) | |
82 | + | func init () = if (if (isDefined(getString(this, "is_dapp_active"))) | |
83 | + | then true | |
84 | + | else isDefined(getInteger(this, "overall_balance"))) | |
85 | + | then throw("Already initialized") | |
86 | + | else [IntegerEntry("overall_balance", 0), BooleanEntry("is_dapp_active", true)] | |
87 | + | ||
88 | + | ||
89 | + | ||
90 | + | @Callable(i) | |
91 | + | func extractFee (isFeeExtract) = if (!(if (isProtocolActive) | |
92 | + | then isDappActive | |
93 | + | else false)) | |
94 | + | then throw("Protol stopped by admin") | |
95 | + | else { | |
96 | + | let user = valueOrErrorMessage(getString(i.caller, keyAutomateOwner), "Empty keyOwner") | |
97 | + | let originCallerAdr = toString(i.originCaller) | |
98 | + | let isConsumerCall = if (valueOrErrorMessage(containsElement(consumers, originCallerAdr), "Empty key: consumers")) | |
99 | + | then true | |
100 | + | else (originCallerAdr == user) | |
101 | + | if (!(isConsumerCall)) | |
102 | + | then throw((originCallerAdr + " is not a consumer or user")) | |
103 | + | else { | |
104 | + | let protocolFee = if (isFeeExtract) | |
105 | + | then calcWavesProtocolFee() | |
106 | + | else 0 | |
107 | + | let userBalance = getUserBalance(user) | |
108 | + | let newUserBalance = (userBalance - protocolFee) | |
109 | + | let newOrverallBalance = (orverallBalance - protocolFee) | |
110 | + | if ((0 > newUserBalance)) | |
111 | + | then throw(((("Insufficient new balance: " + toString(newUserBalance)) + " for user ") + user)) | |
112 | + | else if ((0 > newOrverallBalance)) | |
113 | + | then throw(("Negativa overall balance:" + toString(newOrverallBalance))) | |
114 | + | else [IntegerEntry((user + keyBalance), newUserBalance), IntegerEntry(keyOverallBalance, newOrverallBalance)] | |
115 | + | } | |
116 | + | } | |
117 | + | ||
118 | + | ||
119 | + | ||
120 | + | @Callable(i) | |
121 | + | func replenishBalance (userToReplenish) = if (!(if (isProtocolActive) | |
122 | + | then isDappActive | |
123 | + | else false)) | |
124 | + | then throw("Protol stopped by admin") | |
125 | + | else { | |
126 | + | let userToReplenishAddress = valueOrErrorMessage(addressFromString(userToReplenish), "Argument must be base58 string address") | |
127 | + | let $t044594534 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
128 | + | let pmtAmount = $t044594534._1 | |
129 | + | let pmtAssetId = $t044594534._2 | |
130 | + | if ((pmtAssetId != unit)) | |
131 | + | then throw("Only WAVES available for replenishment") | |
132 | + | else { | |
133 | + | let userToReplenishBalance = getUserBalance(userToReplenish) | |
134 | + | let newUserBalance = (userToReplenishBalance + pmtAmount) | |
135 | + | let newOrverallBalance = (orverallBalance + pmtAmount) | |
136 | + | [IntegerEntry((toBase58String(userToReplenishAddress.bytes) + keyBalance), newUserBalance), IntegerEntry(keyOverallBalance, newOrverallBalance)] | |
137 | + | } | |
138 | + | } | |
139 | + | ||
140 | + | ||
141 | + | ||
142 | + | @Callable(i) | |
143 | + | func withdraw (withdrawAmt) = if (!(if (isProtocolActive) | |
144 | + | then isDappActive | |
145 | + | else false)) | |
146 | + | then throw("Protol stopped by admin") | |
147 | + | else { | |
148 | + | let callerStr = toString(i.caller) | |
149 | + | let callerBalance = getUserBalance(callerStr) | |
150 | + | let newCallerBalance = (callerBalance - withdrawAmt) | |
151 | + | let newOrverallBalance = (orverallBalance - withdrawAmt) | |
152 | + | if ((withdrawAmt > callerBalance)) | |
153 | + | then throw("withdrawAmt > callerBalance") | |
154 | + | else [IntegerEntry((callerStr + keyBalance), newCallerBalance), IntegerEntry(keyOverallBalance, newOrverallBalance), ScriptTransfer(i.caller, withdrawAmt, unit)] | |
155 | + | } | |
156 | + | ||
157 | + | ||
158 | + | ||
159 | + | @Callable(i) | |
160 | + | func incomeProtocolWithdraw (addresForSendingIncome) = if (!(if (isProtocolActive) | |
161 | + | then isDappActive | |
162 | + | else false)) | |
163 | + | then throw("Protocol stopped by admin") | |
164 | + | else if (!(isTransactionApproved(toBase58String(i.transactionId)))) | |
165 | + | then throw("Transaction id not approved by admins") | |
166 | + | else { | |
167 | + | let income = (wavesBalance(this).available - orverallBalance) | |
168 | + | if ((0 >= income)) | |
169 | + | then throw("income <= 0 ") | |
170 | + | else [ScriptTransfer(valueOrErrorMessage(addressFromString(addresForSendingIncome), "Argument must be base58 string address"), income, unit)] | |
171 | + | } | |
172 | + | ||
173 | + | ||
174 | + | ||
175 | + | @Callable(i) | |
176 | + | func shutdownDapp () = if (!(isDappActive)) | |
177 | + | then throw("Protol stopped by admin") | |
178 | + | else if (if (!(containsElement([admin1, admin2, admin3, admin4, admin5], i.caller))) | |
179 | + | then !(containsElement(consumers, toBase58String(i.caller.bytes))) | |
180 | + | else false) | |
181 | + | then throw("Only admin can call this function") | |
182 | + | else [BooleanEntry("is_dapp_active", false)] | |
183 | + | ||
184 | + | ||
185 | + | @Verifier(tx) | |
186 | + | func verify () = if (!(isTransactionApproved(toBase58String(tx.id)))) | |
187 | + | then throw("Transaction id not approved by admins") | |
188 | + | else true | |
189 | + |
github/deemru/w8io/026f985 18.57 ms ◑