tx · 6pHsHCrvu1vz2NGNAyFgDMTzBdkCAg1isAFSCNTuPjSX 3N3ThrxAQfwbdarfoZiSb4jBzeRSjim63nT: -0.01400000 Waves 2022.04.04 16:28 [1993903] smart account 3N3ThrxAQfwbdarfoZiSb4jBzeRSjim63nT > SELF 0.00000000 Waves
{ "type": 13, "id": "6pHsHCrvu1vz2NGNAyFgDMTzBdkCAg1isAFSCNTuPjSX", "fee": 1400000, "feeAssetId": null, "timestamp": 1649078929555, "version": 1, "sender": "3N3ThrxAQfwbdarfoZiSb4jBzeRSjim63nT", "senderPublicKey": "BA8BVt7GxxXRVzXaEkeEaMeorLE65GfdGaR6dNZNtZFM", "proofs": [ "2DPFwwckJk5BoqMt7Xpdn7x3wvPz3Uj7eGs1dwGSdkJ98ENKDkAikBMiNgboTuec1SrSkwZ1Rh9AS3P8Cfkms8hB" ], "script": "base64:AAIFAAAAAAAAABcIAhIAEgASAwoBCBIDCgEBEgMKAQgSAAAAABUAAAAABm9yYWNsZQkBAAAAB0FkZHJlc3MAAAABAQAAABoBVMEQugxza0zTxSJ70/EPOAOm7zhpdY/ynAAAAAARU1dPUGdvdmVybmFuY2VBZHIJAQAAABFAZXh0ck5hdGl2ZSgxMDYyKQAAAAEJAQAAABN2YWx1ZU9yRXJyb3JNZXNzYWdlAAAAAgkABB0AAAACBQAAAAZvcmFjbGUCAAAAD3N3b3BfZ292ZXJuYW5jZQIAAAAZRW1wdHkga2V5IHN3b3BfZ292ZXJuYW5jZQAAAAANV2F2ZXNVc2RuUG9vbAkBAAAABXZhbHVlAAAAAQkABCYAAAABCQEAAAALdmFsdWVPckVsc2UAAAACCQAEHQAAAAIFAAAABm9yYWNsZQIAAAAPV0FWRVNfVVNETl9wb29sAgAAABlFbXB0eSBrZXkgV0FWRVNfVVNETl9wb29sAAAAAAljb25zdW1lcnMJAAS1AAAAAgkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkABB0AAAACBQAAAAZvcmFjbGUCAAAACWNvbnN1bWVycwIA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AAAAZjYWxsZXIAAAAFYnl0ZXMHCQAAAgAAAAECAAAAIU9ubHkgYWRtaW4gY2FuIGNhbGwgdGhpcyBmdW5jdGlvbgkABEwAAAACCQEAAAAMQm9vbGVhbkVudHJ5AAAAAgIAAAAOaXNfZGFwcF9hY3RpdmUHBQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAAAwkBAAAAASEAAAABCQEAAAAVaXNUcmFuc2FjdGlvbkFwcHJvdmVkAAAAAQkAAlgAAAABCAUAAAACdHgAAAACaWQJAAACAAAAAQIAAAAlVHJhbnNhY3Rpb24gaWQgbm90IGFwcHJvdmVkIGJ5IGFkbWlucwZcDBgD", "chainId": 84, "height": 1993903, "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'3N7WvE91gUwkV4fyewjrzzAVajRD4kcq8Fd') | |
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 () = 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 = valueOrErrorMessage(containsElement(consumers, originCallerAdr), "Empty key: consumers") | |
99 | + | if (!(isConsumerCall)) | |
100 | + | then throw((originCallerAdr + " is not a consumer")) | |
101 | + | else { | |
102 | + | let protocolFee = calcWavesProtocolFee() | |
103 | + | let userBalance = getUserBalance(user) | |
104 | + | let newUserBalance = (userBalance - protocolFee) | |
105 | + | let newOrverallBalance = (orverallBalance - protocolFee) | |
106 | + | if ((0 > newUserBalance)) | |
107 | + | then throw(((("Insufficient new balance: " + toString(newUserBalance)) + " for user ") + user)) | |
108 | + | else if ((0 > newOrverallBalance)) | |
109 | + | then throw(("Negativa overall balance:" + toString(newOrverallBalance))) | |
110 | + | else [IntegerEntry((user + keyBalance), newUserBalance), IntegerEntry(keyOverallBalance, newOrverallBalance)] | |
111 | + | } | |
112 | + | } | |
113 | + | ||
114 | + | ||
115 | + | ||
116 | + | @Callable(i) | |
117 | + | func replenishBalance (userToReplenish) = if (!(if (isProtocolActive) | |
118 | + | then isDappActive | |
119 | + | else false)) | |
120 | + | then throw("Protol stopped by admin") | |
121 | + | else { | |
122 | + | let userToReplenishAddress = valueOrErrorMessage(addressFromString(userToReplenish), "Argument must be base58 string address") | |
123 | + | let $t043754450 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
124 | + | let pmtAmount = $t043754450._1 | |
125 | + | let pmtAssetId = $t043754450._2 | |
126 | + | if ((pmtAssetId != unit)) | |
127 | + | then throw("Only WAVES available for replenishment") | |
128 | + | else { | |
129 | + | let userToReplenishBalance = getUserBalance(userToReplenish) | |
130 | + | let newUserBalance = (userToReplenishBalance + pmtAmount) | |
131 | + | let newOrverallBalance = (orverallBalance + pmtAmount) | |
132 | + | [IntegerEntry((toBase58String(userToReplenishAddress.bytes) + keyBalance), newUserBalance), IntegerEntry(keyOverallBalance, newOrverallBalance)] | |
133 | + | } | |
134 | + | } | |
135 | + | ||
136 | + | ||
137 | + | ||
138 | + | @Callable(i) | |
139 | + | func withdraw (withdrawAmt) = if (!(if (isProtocolActive) | |
140 | + | then isDappActive | |
141 | + | else false)) | |
142 | + | then throw("Protol stopped by admin") | |
143 | + | else { | |
144 | + | let callerStr = toString(i.caller) | |
145 | + | let callerBalance = getUserBalance(callerStr) | |
146 | + | let newCallerBalance = (callerBalance - withdrawAmt) | |
147 | + | let newOrverallBalance = (orverallBalance - withdrawAmt) | |
148 | + | if ((withdrawAmt > callerBalance)) | |
149 | + | then throw("withdrawAmt > callerBalance") | |
150 | + | else [IntegerEntry((callerStr + keyBalance), newCallerBalance), IntegerEntry(keyOverallBalance, newOrverallBalance), ScriptTransfer(i.caller, withdrawAmt, unit)] | |
151 | + | } | |
152 | + | ||
153 | + | ||
154 | + | ||
155 | + | @Callable(i) | |
156 | + | func incomeProtocolWithdraw (addresForSendingIncome) = if (!(if (isProtocolActive) | |
157 | + | then isDappActive | |
158 | + | else false)) | |
159 | + | then throw("Protocol stopped by admin") | |
160 | + | else if (!(isTransactionApproved(toBase58String(i.transactionId)))) | |
161 | + | then throw("Transaction id not approved by admins") | |
162 | + | else { | |
163 | + | let income = (wavesBalance(this).available - orverallBalance) | |
164 | + | if ((0 >= income)) | |
165 | + | then throw("income <= 0 ") | |
166 | + | else [ScriptTransfer(valueOrErrorMessage(addressFromString(addresForSendingIncome), "Argument must be base58 string address"), income, unit)] | |
167 | + | } | |
168 | + | ||
169 | + | ||
170 | + | ||
171 | + | @Callable(i) | |
172 | + | func shutdownDapp () = if (!(isDappActive)) | |
173 | + | then throw("Protol stopped by admin") | |
174 | + | else if (if (!(containsElement([admin1, admin2, admin3, admin4, admin5], i.caller))) | |
175 | + | then !(containsElement(consumers, toBase58String(i.caller.bytes))) | |
176 | + | else false) | |
177 | + | then throw("Only admin can call this function") | |
178 | + | else [BooleanEntry("is_dapp_active", false)] | |
179 | + | ||
180 | + | ||
181 | + | @Verifier(tx) | |
182 | + | func verify () = if (!(isTransactionApproved(toBase58String(tx.id)))) | |
183 | + | then throw("Transaction id not approved by admins") | |
184 | + | else true | |
185 | + |
github/deemru/w8io/026f985 31.17 ms ◑