tx · GF7ZjKbMbMU39ckahaE9wLTz4tGNaFMAoUnMnbS7LuLB

3Mr7HCJPTazuYjJbfbbpRMvZX8xrNTjT1Kx:  -0.01000000 Waves

2023.03.06 18:28 [2478409] smart account 3Mr7HCJPTazuYjJbfbbpRMvZX8xrNTjT1Kx > SELF 0.00000000 Waves

{ "type": 13, "id": "GF7ZjKbMbMU39ckahaE9wLTz4tGNaFMAoUnMnbS7LuLB", "fee": 1000000, "feeAssetId": null, "timestamp": 1678116498722, "version": 2, "chainId": 84, "sender": "3Mr7HCJPTazuYjJbfbbpRMvZX8xrNTjT1Kx", "senderPublicKey": "D35PGQCSSdrp9pvujggj7b2DaCK1BhcU3kho7tikKJYs", "proofs": [ "44UsYtaursimsUpSo5YMa52zw2sCsMvxeXq1iu1uTxpj7XutjQDzmKoMQA22CncBmLjRzeNC8YQUCGHFdB5RG3wd" ], "script": "base64:BgIgCAISBAoCAQESABIDCgEBEgQKAhgREgQKAggIEgMKAQgCAAxvcHRpb25zX2FkZHIJAQdBZGRyZXNzAQEaAVRBW/gr9hfqKqHLxIrx+8e7siBhMf6HIMEABHRVU0QBIKskSmq2Qkbr0vzjebBhusOuaVdNUnrKRRynQB0RsCkOBgFpAQlpc3N1ZUJpbGwCCXByb3ZpZGluZwRzaXplBApjdXJyZW50S2V5CQDYBAEICAUBaQZjYWxsZXIFYnl0ZXMEDWN1cnJlbnRBbW91bnQEByRtYXRjaDAJAJoIAgUEdGhpcwUKY3VycmVudEtleQMJAAECBQckbWF0Y2gwAgNJbnQEAWEFByRtYXRjaDAFAWEAAAQRbWluQmlsbERlcG9zaXRTdHIEByRtYXRjaDAJAJ0IAgUMb3B0aW9uc19hZGRyAhBtaW5fYmlsbF9kZXBvc2l0AwkAAQIFByRtYXRjaDACBFVuaXQCATADCQABAgUHJG1hdGNoMAIGU3RyaW5nBAF4BQckbWF0Y2gwBQF4CQACAQILTWF0Y2ggZXJyb3IED2V4Y2hhbmdlUmF0ZVN0cgQHJG1hdGNoMA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gBBnZlcmlmeQAJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAIBQJ0eA9zZW5kZXJQdWJsaWNLZXnKqYXj", "height": 2478409, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: EJ9nG6iQZ9g1JgfTRFP9AVoNorczwu833p6D7DCChgLh Next: ENSaAqFBmZqcNXXLwV2rq6MohGAmVMqK6AkD7gtm8RFo Diff:
OldNewDifferences
66 let tUSD = base58'CX4p6XcuSBUvv44r1avCqYka5PYAVzBK5hSXaT7maU85'
77
88 @Callable(i)
9-func issueBill (providing) = {
9+func issueBill (providing,size) = {
1010 let currentKey = toBase58String(i.caller.bytes)
1111 let currentAmount = match getInteger(this, currentKey) {
1212 case a: Int =>
2222 case _ =>
2323 throw("Match error")
2424 }
25+ let exchangeRateStr = match getString(options_addr, "exchange_rate") {
26+ case _: Unit =>
27+ "0"
28+ case x: String =>
29+ x
30+ case _ =>
31+ throw("Match error")
32+ }
2533 let minBillDeposit = match parseInt(split(minBillDepositStr, ".")[0]) {
34+ case _: Unit =>
35+ 0
36+ case t: Int =>
37+ t
38+ case _ =>
39+ throw("Match error")
40+ }
41+ let exchangeRate = match parseInt(split(exchangeRateStr, ".")[0]) {
2642 case _: Unit =>
2743 0
2844 case t: Int =>
3551 then throw((((("The security deposit must be more than " + minBillDepositStr) + ". You set the size: ") + toString((providing / 100))) + ".00"))
3652 else if ((0 > newAmount))
3753 then throw("Not enough balance")
38- else {
39- let issue = Issue(("bill for:" + toString((providing / 100))), currentKey, 1, 0, false)
40- let id = calculateAssetId(issue)
41- $Tuple2([IntegerEntry(currentKey, newAmount), issue, ScriptTransfer(i.caller, 1, id), IntegerEntry(("l_u_" + toBase58String(id)), providing)], unit)
42- }
54+ else if ((size > (currentAmount * exchangeRate)))
55+ then throw((("The nominal value of the promissory bill exceeds the collateral minimum (" + minBillDepositStr) + ")"))
56+ else {
57+ let issue = Issue(("bill for:" + toString((providing / 100))), ((currentKey + ":") + toString(size)), 1, 0, false)
58+ let id = calculateAssetId(issue)
59+ $Tuple2([IntegerEntry(currentKey, newAmount), issue, ScriptTransfer(i.caller, 1, id), IntegerEntry(("l_u_" + toBase58String(id)), providing)], unit)
60+ }
4361 }
4462
4563
117135 throw("Match error")
118136 }
119137 func addStringEntry (accum,nextValue) = {
120- let $t046504673 = accum
121- let result = $t046504673._1
122- let j = $t046504673._2
138+ let $t052975320 = accum
139+ let result = $t052975320._1
140+ let j = $t052975320._2
123141 $Tuple2((result :+ IntegerEntry(opts[j], nextValue)), (j + 1))
124142 }
125143
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let options_addr = Address(base58'3MusfsY6PqDh1YnF7YyTi5ffVT16Dm2bqf6')
55
66 let tUSD = base58'CX4p6XcuSBUvv44r1avCqYka5PYAVzBK5hSXaT7maU85'
77
88 @Callable(i)
9-func issueBill (providing) = {
9+func issueBill (providing,size) = {
1010 let currentKey = toBase58String(i.caller.bytes)
1111 let currentAmount = match getInteger(this, currentKey) {
1212 case a: Int =>
1313 a
1414 case _ =>
1515 0
1616 }
1717 let minBillDepositStr = match getString(options_addr, "min_bill_deposit") {
1818 case _: Unit =>
1919 "0"
2020 case x: String =>
2121 x
2222 case _ =>
2323 throw("Match error")
2424 }
25+ let exchangeRateStr = match getString(options_addr, "exchange_rate") {
26+ case _: Unit =>
27+ "0"
28+ case x: String =>
29+ x
30+ case _ =>
31+ throw("Match error")
32+ }
2533 let minBillDeposit = match parseInt(split(minBillDepositStr, ".")[0]) {
34+ case _: Unit =>
35+ 0
36+ case t: Int =>
37+ t
38+ case _ =>
39+ throw("Match error")
40+ }
41+ let exchangeRate = match parseInt(split(exchangeRateStr, ".")[0]) {
2642 case _: Unit =>
2743 0
2844 case t: Int =>
2945 t
3046 case _ =>
3147 throw("Match error")
3248 }
3349 let newAmount = (currentAmount - providing)
3450 if (((minBillDeposit * 100) > providing))
3551 then throw((((("The security deposit must be more than " + minBillDepositStr) + ". You set the size: ") + toString((providing / 100))) + ".00"))
3652 else if ((0 > newAmount))
3753 then throw("Not enough balance")
38- else {
39- let issue = Issue(("bill for:" + toString((providing / 100))), currentKey, 1, 0, false)
40- let id = calculateAssetId(issue)
41- $Tuple2([IntegerEntry(currentKey, newAmount), issue, ScriptTransfer(i.caller, 1, id), IntegerEntry(("l_u_" + toBase58String(id)), providing)], unit)
42- }
54+ else if ((size > (currentAmount * exchangeRate)))
55+ then throw((("The nominal value of the promissory bill exceeds the collateral minimum (" + minBillDepositStr) + ")"))
56+ else {
57+ let issue = Issue(("bill for:" + toString((providing / 100))), ((currentKey + ":") + toString(size)), 1, 0, false)
58+ let id = calculateAssetId(issue)
59+ $Tuple2([IntegerEntry(currentKey, newAmount), issue, ScriptTransfer(i.caller, 1, id), IntegerEntry(("l_u_" + toBase58String(id)), providing)], unit)
60+ }
4361 }
4462
4563
4664
4765 @Callable(i)
4866 func deposit () = if ((size(i.payments) == 0))
4967 then throw("Payment not attached")
5068 else {
5169 let pmt = value(i.payments)[0]
5270 let minDepositStr = match getString(options_addr, "min_deposit") {
5371 case _: Unit =>
5472 "0"
5573 case x: String =>
5674 x
5775 case _ =>
5876 throw("Match error")
5977 }
6078 let minDeposit = match parseInt(split(minDepositStr, ".")[0]) {
6179 case _: Unit =>
6280 0
6381 case t: Int =>
6482 t
6583 case _ =>
6684 throw("Match error")
6785 }
6886 if ((pmt.assetId != tUSD))
6987 then throw("holded payment not tUSD")
7088 else if (((minDeposit * 100) > pmt.amount))
7189 then throw((((("You have set the deposit amount to " + toString((pmt.amount / 100))) + ".00, which is less than the minimum (") + minDepositStr) + ")"))
7290 else {
7391 let currentKey = toBase58String(i.caller.bytes)
7492 let currentAmount = match getInteger(this, currentKey) {
7593 case a: Int =>
7694 a
7795 case _ =>
7896 0
7997 }
8098 let newAmount = (currentAmount + pmt.amount)
8199 [IntegerEntry(currentKey, newAmount)]
82100 }
83101 }
84102
85103
86104
87105 @Callable(i)
88106 func withdraw (amount) = {
89107 let currentKey = toBase58String(i.caller.bytes)
90108 let currentAmount = match getInteger(this, currentKey) {
91109 case a: Int =>
92110 a
93111 case _ =>
94112 0
95113 }
96114 let newAmount = (currentAmount - amount)
97115 if ((0 > amount))
98116 then throw("Can't withdraw negative amount")
99117 else if ((0 > newAmount))
100118 then throw("Not enough balance")
101119 else $Tuple2([IntegerEntry(currentKey, newAmount), ScriptTransfer(i.caller, amount, tUSD)], unit)
102120 }
103121
104122
105123
106124 @Callable(i)
107125 func setOptions (opts,vals) = {
108126 let opt_size = size(opts)
109127 if ((100 >= opt_size))
110128 then {
111129 let adminList = match getString(options_addr, "admin_list") {
112130 case _: Unit =>
113131 "unset"
114132 case x: String =>
115133 x
116134 case _ =>
117135 throw("Match error")
118136 }
119137 func addStringEntry (accum,nextValue) = {
120- let $t046504673 = accum
121- let result = $t046504673._1
122- let j = $t046504673._2
138+ let $t052975320 = accum
139+ let result = $t052975320._1
140+ let j = $t052975320._2
123141 $Tuple2((result :+ IntegerEntry(opts[j], nextValue)), (j + 1))
124142 }
125143
126144 let r = {
127145 let $l = vals
128146 let $s = size($l)
129147 let $acc0 = $Tuple2(nil, 0)
130148 func $f0_1 ($a,$i) = if (($i >= $s))
131149 then $a
132150 else addStringEntry($a, $l[$i])
133151
134152 func $f0_2 ($a,$i) = if (($i >= $s))
135153 then $a
136154 else throw("List size exceeds 100")
137155
138156 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40), 41), 42), 43), 44), 45), 46), 47), 48), 49), 50), 51), 52), 53), 54), 55), 56), 57), 58), 59), 60), 61), 62), 63), 64), 65), 66), 67), 68), 69), 70), 71), 72), 73), 74), 75), 76), 77), 78), 79), 80), 81), 82), 83), 84), 85), 86), 87), 88), 89), 90), 91), 92), 93), 94), 95), 96), 97), 98), 99), 100)
139157 }
140158 let callerAddressStr = toString(i.caller)
141159 if ((adminList != "unset"))
142160 then {
143161 let test = getString(addressFromStringValue(adminList), callerAddressStr)
144162 let isAdmin = match test {
145163 case x: String =>
146164 x
147165 case _: Unit =>
148166 "no admin"
149167 case _ =>
150168 throw("Match error")
151169 }
152170 func add_elm (options) = {
153171 let opt = split(options, "|")
154172 StringEntry(opt[0], opt[1])
155173 }
156174
157175 if ((isAdmin != "no admin"))
158176 then r
159177 else throw((((((("You not admin: " + adminList) + ", isAdmin: ") + isAdmin) + ", callerAddressStr: ") + callerAddressStr) + ", "))
160178 }
161179 else throw("Unset admin list")
162180 }
163181 else throw("The number of list elements must not exceed 100")
164182 }
165183
166184
167185
168186 @Callable(i)
169187 func setOption (variable,value) = {
170188 let adminList = match getString(options_addr, "admin_list") {
171189 case _: Unit =>
172190 "unset"
173191 case x: String =>
174192 x
175193 case _ =>
176194 throw("Match error")
177195 }
178196 let callerAddressStr = toString(i.caller)
179197 if ((adminList != "unset"))
180198 then {
181199 let test = getString(addressFromStringValue(adminList), callerAddressStr)
182200 let isAdmin = match test {
183201 case x: String =>
184202 x
185203 case _: Unit =>
186204 "no admin"
187205 case _ =>
188206 throw("Match error")
189207 }
190208 if ((isAdmin != "no admin"))
191209 then $Tuple2([StringEntry(variable, value)], unit)
192210 else throw((((((("You not admin: " + adminList) + ", isAdmin: ") + isAdmin) + ", callerAddressStr: ") + callerAddressStr) + ", "))
193211 }
194212 else throw("Unset admin list")
195213 }
196214
197215
198216
199217 @Callable(i)
200218 func delOption (variable) = {
201219 let adminList = match getString(options_addr, "admin_list") {
202220 case _: Unit =>
203221 "unset"
204222 case x: String =>
205223 x
206224 case _ =>
207225 throw("Match error")
208226 }
209227 let callerAddressStr = toString(i.caller)
210228 if ((adminList != "unset"))
211229 then {
212230 let test = getString(addressFromStringValue(adminList), callerAddressStr)
213231 let isAdmin = match test {
214232 case x: String =>
215233 x
216234 case _: Unit =>
217235 "no admin"
218236 case _ =>
219237 throw("Match error")
220238 }
221239 if ((isAdmin != "no admin"))
222240 then $Tuple2([DeleteEntry(variable)], unit)
223241 else throw((((((("You not admin: " + adminList) + ", isAdmin: ") + isAdmin) + ", callerAddressStr: ") + callerAddressStr) + ", "))
224242 }
225243 else throw("Unset admin list")
226244 }
227245
228246
229247 @Verifier(tx)
230248 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
231249

github/deemru/w8io/169f3d6 
48.79 ms