tx · CXd5K5d2okxiagrheUKZAJMR6Voz2MRwB6uHF3zSbLjH 3MrQ4g9YCsAN2Wr4QUXiWAPhNPv7DGdQNWb: -0.00700000 Waves 2023.03.21 19:54 [2500031] smart account 3MrQ4g9YCsAN2Wr4QUXiWAPhNPv7DGdQNWb > SELF 0.00000000 Waves
{ "type": 13, "id": "CXd5K5d2okxiagrheUKZAJMR6Voz2MRwB6uHF3zSbLjH", "fee": 700000, "feeAssetId": null, "timestamp": 1679417653340, "version": 2, "chainId": 84, "sender": "3MrQ4g9YCsAN2Wr4QUXiWAPhNPv7DGdQNWb", "senderPublicKey": "2VQGRNRWyFAZvjDtkgZwdZcTwZvBJJ61n8zJfYYxm5eK", "proofs": [ "5TsKVBxGvtt7uZUjqQU3Td2Bk4htA1sJcJ4YC4p1KsvnkcsvmJn33kaZ9hDGisHVPBy39YbgggaQxM9gDiv8Yznc" ], "script": "base64:BgI6CAISBAoCCAgSBAoCCAESAwoBCBIGCgQICAgIEgUKAwgICBIDCgECEgMKAQgSBgoECAEBARIECgIBARMADmNvbGxlY3Rpb25OYW1lCQERQGV4dHJOYXRpdmUoMTA1OCkBAg5jb2xsZWN0aW9uTmFtZQAGc3ltYm9sCQERQGV4dHJOYXRpdmUoMTA1OCkBAgZzeW1ib2wAC2Rlc2NyaXB0aW9uCQERQGV4dHJOYXRpdmUoMTA1OCkBAgtkZXNjcmlwdGlvbgALdG90YWxBbW91bnQJARFAZXh0ck5hdGl2ZSgxMDU1KQECC3RvdGFsQW1vdW50AAdiYXNlVVJJCQERQGV4dHJOYXRpdmUoMTA1OCkBAgdiYXNlVVJJAAhkQXBwSnNvbgkBB0FkZHJlc3MBCQDZBAECIzNNckdhWlZSaGtuRUdmSEoxOXR0VVBObkRSb0ZxY0hoVk43AAx0b2tlblBheW1lbnQJARFAZXh0ck5hdGl2ZSgxMDU3KQECDHRva2VuUGF5bWVudAARdG9rZW5QYXltZW50QXNzZXQJARN2YWx1ZU9yRXJyb3JNZXNzYWdlAg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cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgCefXkL", "height": 2500031, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9dgVmxNtsfMkYsJB5QzDYDTwBojPRNUGJh8ZXCUiThc4 Next: none Diff:
Old | New | Differences | |
---|---|---|---|
9 | 9 | ||
10 | 10 | let d = getIntegerValue("totalAmount") | |
11 | 11 | ||
12 | - | let e = | |
12 | + | let e = getStringValue("baseURI") | |
13 | 13 | ||
14 | - | let f = Address( | |
14 | + | let f = Address(fromBase58String("3MrGaZVRhknEGfHJ19ttUPNnDRoFqcHhVN7")) | |
15 | 15 | ||
16 | - | func g (h) = if ((h == this)) | |
16 | + | let g = getBinaryValue("tokenPayment") | |
17 | + | ||
18 | + | let h = valueOrErrorMessage(assetInfo(getBinaryValue("tokenPayment")), "token payment asset doesn't connect") | |
19 | + | ||
20 | + | let i = getIntegerValue("lendCount") | |
21 | + | ||
22 | + | let j = getIntegerValue("lendCurrentCount") | |
23 | + | ||
24 | + | func k (l) = valueOrErrorMessage(assetInfo(fromBase58String(l)), "Can't find asset by asset id") | |
25 | + | ||
26 | + | ||
27 | + | func m (n) = if ((n == this)) | |
17 | 28 | then unit | |
18 | 29 | else throw("Only internal call") | |
19 | 30 | ||
20 | 31 | ||
21 | - | func | |
22 | - | then StringEntry(" | |
23 | - | else ScriptTransfer( | |
32 | + | func o (p,l) = if ((p == this)) | |
33 | + | then StringEntry("smth", "smth") | |
34 | + | else ScriptTransfer(p, 1, l) | |
24 | 35 | ||
25 | 36 | ||
26 | - | func l (k) = valueOrErrorMessage(assetInfo(fromBase58String(k)), "Can't find asset by asset id") | |
27 | - | ||
28 | - | ||
29 | - | func m (h,k) = if ((assetBalance(h, fromBase58String(k)) == 1)) | |
37 | + | func q (n,l) = if ((assetBalance(n, fromBase58String(l)) == 1)) | |
30 | 38 | then unit | |
31 | 39 | else throw("Only asset owner") | |
32 | 40 | ||
33 | 41 | ||
34 | - | @Callable(n) | |
35 | - | func makeJSONInternal (o,p) = valueOrElse(g(n.caller), { | |
36 | - | let q = invoke(e, "makeJSON", [o, p], nil) | |
37 | - | if ((q == q)) | |
38 | - | then $Tuple2(nil, q) | |
42 | + | func r (s,t) = if ((s[0].amount >= t)) | |
43 | + | then unit | |
44 | + | else throw("amount less then need") | |
45 | + | ||
46 | + | ||
47 | + | func u (v) = { | |
48 | + | let w = toString(v) | |
49 | + | getStringValue(("lend-" + w)) | |
50 | + | } | |
51 | + | ||
52 | + | ||
53 | + | func x (y,z) = { | |
54 | + | let A = { | |
55 | + | let B = invoke(f, "readByJSONKey", [y, z], nil) | |
56 | + | if ($isInstanceOf(B, "String")) | |
57 | + | then B | |
58 | + | else throw(($getType(B) + " couldn't be cast to String")) | |
59 | + | } | |
60 | + | if ((A == A)) | |
61 | + | then A | |
62 | + | else throw("Strict value is not equal to itself.") | |
63 | + | } | |
64 | + | ||
65 | + | ||
66 | + | func C (v) = { | |
67 | + | let w = toString(v) | |
68 | + | getIntegerValue(("lend-rentCount-" + w)) | |
69 | + | } | |
70 | + | ||
71 | + | ||
72 | + | func D (v,A) = { | |
73 | + | let y = u(v) | |
74 | + | let E = x(y, "timeUnitPrice") | |
75 | + | if ((E == E)) | |
76 | + | then { | |
77 | + | let F = parseIntValue(E) | |
78 | + | (A * F) | |
79 | + | } | |
80 | + | else throw("Strict value is not equal to itself.") | |
81 | + | } | |
82 | + | ||
83 | + | ||
84 | + | @Callable(G) | |
85 | + | func setString (H,I) = valueOrElse(m(G.caller), [StringEntry(H, I)]) | |
86 | + | ||
87 | + | ||
88 | + | ||
89 | + | @Callable(G) | |
90 | + | func setInt (H,I) = valueOrElse(m(G.caller), [IntegerEntry(H, I)]) | |
91 | + | ||
92 | + | ||
93 | + | ||
94 | + | @Callable(G) | |
95 | + | func deleteEntry (H) = valueOrElse(m(G.caller), [DeleteEntry(H)]) | |
96 | + | ||
97 | + | ||
98 | + | ||
99 | + | @Callable(G) | |
100 | + | func init (J,K,L,M) = valueOrElse(m(G.caller), [StringEntry("collectionName", J), StringEntry("symbol", K), StringEntry("description", L), IntegerEntry("totalAmount", 0), StringEntry("baseURI", M)]) | |
101 | + | ||
102 | + | ||
103 | + | ||
104 | + | @Callable(G) | |
105 | + | func setUser (l,N,O) = { | |
106 | + | let P = invoke(f, "makeJSON", [["user", "expires"], [N, O]], nil) | |
107 | + | if ((P == P)) | |
108 | + | then $Tuple2([StringEntry(("userOf-" + l), { | |
109 | + | let B = P | |
110 | + | if ($isInstanceOf(B, "String")) | |
111 | + | then B | |
112 | + | else throw(($getType(B) + " couldn't be cast to String")) | |
113 | + | })], P) | |
114 | + | else throw("Strict value is not equal to itself.") | |
115 | + | } | |
116 | + | ||
117 | + | ||
118 | + | ||
119 | + | @Callable(G) | |
120 | + | func setTokenPayment (Q) = valueOrElse(m(G.caller), [BinaryEntry("tokenPayment", Q)]) | |
121 | + | ||
122 | + | ||
123 | + | ||
124 | + | @Callable(G) | |
125 | + | func mint (p) = { | |
126 | + | let R = (d + 1) | |
127 | + | let S = toString(R) | |
128 | + | let T = ((b + "#") + S) | |
129 | + | let U = if ((16 >= size(T))) | |
130 | + | then T | |
131 | + | else S | |
132 | + | let V = (e + S) | |
133 | + | let W = { | |
134 | + | let B = invoke(f, "makeJSON", [["tokenURI"], [V]], nil) | |
135 | + | if ($isInstanceOf(B, "String")) | |
136 | + | then B | |
137 | + | else throw(($getType(B) + " couldn't be cast to String")) | |
138 | + | } | |
139 | + | let X = Issue(U, W, 1, 0, false, unit, height) | |
140 | + | let l = calculateAssetId(X) | |
141 | + | let Y = Address(fromBase58String(p)) | |
142 | + | let Z = o(Y, l) | |
143 | + | if ((Z == Z)) | |
144 | + | then [X, Z, IntegerEntry("totalAmount", R), StringEntry(U, V)] | |
145 | + | else throw("Strict value is not equal to itself.") | |
146 | + | } | |
147 | + | ||
148 | + | ||
149 | + | ||
150 | + | @Callable(G) | |
151 | + | func initLend (l,A,F,aa) = valueOrElse(q(G.caller, l), { | |
152 | + | let X = k(l) | |
153 | + | let V = { | |
154 | + | let B = invoke(f, "readByJSONKey", [X.description, "tokenURI"], nil) | |
155 | + | if ($isInstanceOf(B, "String")) | |
156 | + | then B | |
157 | + | else throw(($getType(B) + " couldn't be cast to String")) | |
158 | + | } | |
159 | + | if ((V == V)) | |
160 | + | then { | |
161 | + | let y = { | |
162 | + | let B = invoke(f, "makeJSON", [["supportedInterface", "assetdId", "tokenURI", "owner", "timeUnitSeconds", "timeUnitPrice", "timeUnitCount", "startTimestamp", "endTimestamp", "deposit", "claimed"], ["0", l, V, toString(G.caller), toString(A), toString(F), toString(aa), toString(lastBlock.timestamp), toString((lastBlock.timestamp + (A * aa))), "0", "0"]], nil) | |
163 | + | if ($isInstanceOf(B, "String")) | |
164 | + | then B | |
165 | + | else throw(($getType(B) + " couldn't be cast to String")) | |
166 | + | } | |
167 | + | if ((y == y)) | |
168 | + | then { | |
169 | + | let w = toString(i) | |
170 | + | [IntegerEntry("lendCount", (i + 1)), IntegerEntry("lendCurrentCount", (j + 1)), IntegerEntry(("lend-rentCount-" + w), 0), StringEntry(("lend-" + w), y)] | |
171 | + | } | |
172 | + | else throw("Strict value is not equal to itself.") | |
173 | + | } | |
39 | 174 | else throw("Strict value is not equal to itself.") | |
40 | 175 | }) | |
41 | 176 | ||
42 | 177 | ||
43 | 178 | ||
44 | - | @Callable(n) | |
45 | - | func addToJSONInternal (r,o,p) = valueOrElse(g(n.caller), { | |
46 | - | let q = invoke(e, "addToJSON", [r, o, p], nil) | |
47 | - | if ((q == q)) | |
48 | - | then $Tuple2(nil, q) | |
49 | - | else throw("Strict value is not equal to itself.") | |
50 | - | }) | |
51 | - | ||
52 | - | ||
53 | - | ||
54 | - | @Callable(n) | |
55 | - | func readByJSONKeyInternal (r,s) = valueOrElse(g(n.caller), { | |
56 | - | let q = invoke(e, "readByJSONKey", [r, s], nil) | |
57 | - | if ((q == q)) | |
58 | - | then $Tuple2(nil, q) | |
59 | - | else throw("Strict value is not equal to itself.") | |
60 | - | }) | |
61 | - | ||
62 | - | ||
63 | - | ||
64 | - | @Callable(n) | |
65 | - | func deleteByJSONKeyInternal (r,s) = valueOrElse(g(n.caller), { | |
66 | - | let q = invoke(e, "deleteByJSONKey", [r, s], nil) | |
67 | - | if ((q == q)) | |
68 | - | then $Tuple2(nil, q) | |
69 | - | else throw("Strict value is not equal to itself.") | |
70 | - | }) | |
71 | - | ||
72 | - | ||
73 | - | ||
74 | - | @Callable(n) | |
75 | - | func storageJsonInternal (t,u) = valueOrElse(g(n.caller), [StringEntry(t, u)]) | |
76 | - | ||
77 | - | ||
78 | - | ||
79 | - | @Callable(n) | |
80 | - | func setUser (k,v,w) = { | |
81 | - | let q = invoke(e, "makeJSON", [["user", "expires"], [v, w]], nil) | |
82 | - | if ((q == q)) | |
83 | - | then $Tuple2([StringEntry(("userOf-" + k), { | |
84 | - | let x = q | |
85 | - | if ($isInstanceOf(x, "String")) | |
86 | - | then x | |
87 | - | else throw(($getType(x) + " couldn't be cast to String")) | |
88 | - | })], q) | |
89 | - | else throw("Strict value is not equal to itself.") | |
90 | - | } | |
91 | - | ||
92 | - | ||
93 | - | ||
94 | - | @Callable(n) | |
95 | - | func setTokenPayment (k) = valueOrElse(g(n.caller), [BinaryEntry("tokenPayment", k)]) | |
96 | - | ||
97 | - | ||
98 | - | ||
99 | - | @Callable(n) | |
100 | - | func deleteValueByKey (s) = valueOrElse(g(n.caller), [DeleteEntry(s)]) | |
101 | - | ||
102 | - | ||
103 | - | ||
104 | - | @Callable(n) | |
105 | - | func setString (s,y) = valueOrElse(g(n.caller), [StringEntry(s, y)]) | |
106 | - | ||
107 | - | ||
108 | - | ||
109 | - | @Callable(n) | |
110 | - | func init (a,b,c) = valueOrElse(g(n.caller), [StringEntry("collectionName", a), StringEntry("symbol", b), StringEntry("description", c), IntegerEntry("totalAmount", 0)]) | |
111 | - | ||
112 | - | ||
113 | - | ||
114 | - | @Callable(n) | |
115 | - | func mint (j,z) = { | |
116 | - | let A = (d + 1) | |
117 | - | let B = ((b + "#") + toString(A)) | |
118 | - | let C = if ((16 >= size(B))) | |
119 | - | then B | |
120 | - | else toString(A) | |
121 | - | let r = { | |
122 | - | let x = invoke(e, "makeJSON", [["tokenURI"], [z]], nil) | |
123 | - | if ($isInstanceOf(x, "String")) | |
124 | - | then x | |
125 | - | else throw(($getType(x) + " couldn't be cast to String")) | |
179 | + | @Callable(G) | |
180 | + | func initRent (v,aa) = valueOrElse(r(G.payments, D(v, aa)), { | |
181 | + | let w = toString(v) | |
182 | + | let y = getStringValue(("lend-" + w)) | |
183 | + | let ab = C(v) | |
184 | + | let ac = toString(ab) | |
185 | + | let A = { | |
186 | + | let B = invoke(f, "readByJSONKey", [y, "timeUnitSeconds"], nil) | |
187 | + | if ($isInstanceOf(B, "String")) | |
188 | + | then B | |
189 | + | else throw(($getType(B) + " couldn't be cast to String")) | |
126 | 190 | } | |
127 | - | let D = Issue(C, r, 1, 0, false, unit, height) | |
128 | - | let k = calculateAssetId(D) | |
129 | - | let E = Address(fromBase58String(j)) | |
130 | - | let F = i(E, k) | |
131 | - | if ((F == F)) | |
132 | - | then [D, F, IntegerEntry("totalAmount", A), StringEntry(C, z)] | |
133 | - | else throw("Strict value is not equal to itself.") | |
134 | - | } | |
135 | - | ||
136 | - | ||
137 | - | ||
138 | - | @Callable(n) | |
139 | - | func initLend (k,G,H,I) = valueOrElse(m(n.caller, k), { | |
140 | - | let D = l(k) | |
141 | - | let z = { | |
142 | - | let x = invoke(e, "readByJSONKey", [D.description, "tokenURI"], nil) | |
143 | - | if ($isInstanceOf(x, "String")) | |
144 | - | then x | |
145 | - | else throw(($getType(x) + " couldn't be cast to String")) | |
146 | - | } | |
147 | - | if ((z == z)) | |
191 | + | if ((A == A)) | |
148 | 192 | then { | |
149 | - | let J = getStringValue("Lends") | |
150 | - | let K = { | |
151 | - | let x = invoke(e, "deleteByJSONKey", [J, "lendCount"], nil) | |
152 | - | if ($isInstanceOf(x, "(String, String)")) | |
153 | - | then x | |
154 | - | else throw(($getType(x) + " couldn't be cast to (String, String)")) | |
155 | - | } | |
156 | - | if ((K == K)) | |
193 | + | let ad = parseIntValue(A) | |
194 | + | if ((ad == ad)) | |
157 | 195 | then { | |
158 | - | let L = K._1 | |
159 | - | let M = toString((parseIntValue(L) + 1)) | |
160 | - | let N = { | |
161 | - | let x = invoke(e, "makeJSON", [["supportedInterface", "assetdId", "tokenURI", "owner", "timeUnitSeconds", "timeUnitPrice", "timeUnitCount", "startTimestamp", "endTimestamp", "deposit", "claimed", "rents"], ["0", k, z, toString(n.caller), toString(G), toString(H), toString(I), toString(lastBlock.timestamp), toString((lastBlock.timestamp + (G * I))), "0", "0", "{\"name\":\"Rents\",\"rentCount\":\"0\"}"]], nil) | |
162 | - | if ($isInstanceOf(x, "String")) | |
163 | - | then x | |
164 | - | else throw(($getType(x) + " couldn't be cast to String")) | |
196 | + | let ae = { | |
197 | + | let B = invoke(f, "makeJSON", [["customer", "timeUnitCount", "startTimestamp", "endTimestamp", "closed"], [toString(G.caller), toString(aa), toString(lastBlock.timestamp), toString((lastBlock.timestamp + (ad * aa))), "0"]], nil) | |
198 | + | if ($isInstanceOf(B, "String")) | |
199 | + | then B | |
200 | + | else throw(($getType(B) + " couldn't be cast to String")) | |
165 | 201 | } | |
166 | - | if ((N == N)) | |
167 | - | then { | |
168 | - | let O = { | |
169 | - | let x = invoke(e, "addToJSON", [K._2, [L, "lendCount"], [N, M]], nil) | |
170 | - | if ($isInstanceOf(x, "String")) | |
171 | - | then x | |
172 | - | else throw(($getType(x) + " couldn't be cast to String")) | |
173 | - | } | |
174 | - | if ((O == O)) | |
175 | - | then [StringEntry("Lends", O)] | |
176 | - | else throw("Strict value is not equal to itself.") | |
177 | - | } | |
202 | + | if ((ae == ae)) | |
203 | + | then [IntegerEntry(("lend-rentCount-" + w), (ab + 1)), StringEntry(((("lend-rent-" + w) + "-") + ac), ae)] | |
178 | 204 | else throw("Strict value is not equal to itself.") | |
179 | 205 | } | |
180 | 206 | else throw("Strict value is not equal to itself.") | |
183 | 209 | }) | |
184 | 210 | ||
185 | 211 | ||
186 | - | ||
187 | - | @Callable(n) | |
188 | - | func initRent (L,I) = { | |
189 | - | let P = toString(L) | |
190 | - | let J = getStringValue("Lends") | |
191 | - | let Q = { | |
192 | - | let x = invoke(e, "deleteByJSONKey", [J, "lendCount"], nil) | |
193 | - | if ($isInstanceOf(x, "(String, String)")) | |
194 | - | then x | |
195 | - | else throw(($getType(x) + " couldn't be cast to (String, String)")) | |
196 | - | } | |
197 | - | if ((Q == Q)) | |
198 | - | then { | |
199 | - | let R = { | |
200 | - | let x = invoke(e, "deleteByJSONKey", [Q._2, P], nil) | |
201 | - | if ($isInstanceOf(x, "(String, String)")) | |
202 | - | then x | |
203 | - | else throw(($getType(x) + " couldn't be cast to (String, String)")) | |
204 | - | } | |
205 | - | if ((R == R)) | |
206 | - | then [StringEntry("Debug", R._1)] | |
207 | - | else throw("Strict value is not equal to itself.") | |
208 | - | } | |
209 | - | else throw("Strict value is not equal to itself.") | |
210 | - | } | |
211 | - | ||
212 | - |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = getStringValue("collectionName") | |
5 | 5 | ||
6 | 6 | let b = getStringValue("symbol") | |
7 | 7 | ||
8 | 8 | let c = getStringValue("description") | |
9 | 9 | ||
10 | 10 | let d = getIntegerValue("totalAmount") | |
11 | 11 | ||
12 | - | let e = | |
12 | + | let e = getStringValue("baseURI") | |
13 | 13 | ||
14 | - | let f = Address( | |
14 | + | let f = Address(fromBase58String("3MrGaZVRhknEGfHJ19ttUPNnDRoFqcHhVN7")) | |
15 | 15 | ||
16 | - | func g (h) = if ((h == this)) | |
16 | + | let g = getBinaryValue("tokenPayment") | |
17 | + | ||
18 | + | let h = valueOrErrorMessage(assetInfo(getBinaryValue("tokenPayment")), "token payment asset doesn't connect") | |
19 | + | ||
20 | + | let i = getIntegerValue("lendCount") | |
21 | + | ||
22 | + | let j = getIntegerValue("lendCurrentCount") | |
23 | + | ||
24 | + | func k (l) = valueOrErrorMessage(assetInfo(fromBase58String(l)), "Can't find asset by asset id") | |
25 | + | ||
26 | + | ||
27 | + | func m (n) = if ((n == this)) | |
17 | 28 | then unit | |
18 | 29 | else throw("Only internal call") | |
19 | 30 | ||
20 | 31 | ||
21 | - | func | |
22 | - | then StringEntry(" | |
23 | - | else ScriptTransfer( | |
32 | + | func o (p,l) = if ((p == this)) | |
33 | + | then StringEntry("smth", "smth") | |
34 | + | else ScriptTransfer(p, 1, l) | |
24 | 35 | ||
25 | 36 | ||
26 | - | func l (k) = valueOrErrorMessage(assetInfo(fromBase58String(k)), "Can't find asset by asset id") | |
27 | - | ||
28 | - | ||
29 | - | func m (h,k) = if ((assetBalance(h, fromBase58String(k)) == 1)) | |
37 | + | func q (n,l) = if ((assetBalance(n, fromBase58String(l)) == 1)) | |
30 | 38 | then unit | |
31 | 39 | else throw("Only asset owner") | |
32 | 40 | ||
33 | 41 | ||
34 | - | @Callable(n) | |
35 | - | func makeJSONInternal (o,p) = valueOrElse(g(n.caller), { | |
36 | - | let q = invoke(e, "makeJSON", [o, p], nil) | |
37 | - | if ((q == q)) | |
38 | - | then $Tuple2(nil, q) | |
42 | + | func r (s,t) = if ((s[0].amount >= t)) | |
43 | + | then unit | |
44 | + | else throw("amount less then need") | |
45 | + | ||
46 | + | ||
47 | + | func u (v) = { | |
48 | + | let w = toString(v) | |
49 | + | getStringValue(("lend-" + w)) | |
50 | + | } | |
51 | + | ||
52 | + | ||
53 | + | func x (y,z) = { | |
54 | + | let A = { | |
55 | + | let B = invoke(f, "readByJSONKey", [y, z], nil) | |
56 | + | if ($isInstanceOf(B, "String")) | |
57 | + | then B | |
58 | + | else throw(($getType(B) + " couldn't be cast to String")) | |
59 | + | } | |
60 | + | if ((A == A)) | |
61 | + | then A | |
62 | + | else throw("Strict value is not equal to itself.") | |
63 | + | } | |
64 | + | ||
65 | + | ||
66 | + | func C (v) = { | |
67 | + | let w = toString(v) | |
68 | + | getIntegerValue(("lend-rentCount-" + w)) | |
69 | + | } | |
70 | + | ||
71 | + | ||
72 | + | func D (v,A) = { | |
73 | + | let y = u(v) | |
74 | + | let E = x(y, "timeUnitPrice") | |
75 | + | if ((E == E)) | |
76 | + | then { | |
77 | + | let F = parseIntValue(E) | |
78 | + | (A * F) | |
79 | + | } | |
80 | + | else throw("Strict value is not equal to itself.") | |
81 | + | } | |
82 | + | ||
83 | + | ||
84 | + | @Callable(G) | |
85 | + | func setString (H,I) = valueOrElse(m(G.caller), [StringEntry(H, I)]) | |
86 | + | ||
87 | + | ||
88 | + | ||
89 | + | @Callable(G) | |
90 | + | func setInt (H,I) = valueOrElse(m(G.caller), [IntegerEntry(H, I)]) | |
91 | + | ||
92 | + | ||
93 | + | ||
94 | + | @Callable(G) | |
95 | + | func deleteEntry (H) = valueOrElse(m(G.caller), [DeleteEntry(H)]) | |
96 | + | ||
97 | + | ||
98 | + | ||
99 | + | @Callable(G) | |
100 | + | func init (J,K,L,M) = valueOrElse(m(G.caller), [StringEntry("collectionName", J), StringEntry("symbol", K), StringEntry("description", L), IntegerEntry("totalAmount", 0), StringEntry("baseURI", M)]) | |
101 | + | ||
102 | + | ||
103 | + | ||
104 | + | @Callable(G) | |
105 | + | func setUser (l,N,O) = { | |
106 | + | let P = invoke(f, "makeJSON", [["user", "expires"], [N, O]], nil) | |
107 | + | if ((P == P)) | |
108 | + | then $Tuple2([StringEntry(("userOf-" + l), { | |
109 | + | let B = P | |
110 | + | if ($isInstanceOf(B, "String")) | |
111 | + | then B | |
112 | + | else throw(($getType(B) + " couldn't be cast to String")) | |
113 | + | })], P) | |
114 | + | else throw("Strict value is not equal to itself.") | |
115 | + | } | |
116 | + | ||
117 | + | ||
118 | + | ||
119 | + | @Callable(G) | |
120 | + | func setTokenPayment (Q) = valueOrElse(m(G.caller), [BinaryEntry("tokenPayment", Q)]) | |
121 | + | ||
122 | + | ||
123 | + | ||
124 | + | @Callable(G) | |
125 | + | func mint (p) = { | |
126 | + | let R = (d + 1) | |
127 | + | let S = toString(R) | |
128 | + | let T = ((b + "#") + S) | |
129 | + | let U = if ((16 >= size(T))) | |
130 | + | then T | |
131 | + | else S | |
132 | + | let V = (e + S) | |
133 | + | let W = { | |
134 | + | let B = invoke(f, "makeJSON", [["tokenURI"], [V]], nil) | |
135 | + | if ($isInstanceOf(B, "String")) | |
136 | + | then B | |
137 | + | else throw(($getType(B) + " couldn't be cast to String")) | |
138 | + | } | |
139 | + | let X = Issue(U, W, 1, 0, false, unit, height) | |
140 | + | let l = calculateAssetId(X) | |
141 | + | let Y = Address(fromBase58String(p)) | |
142 | + | let Z = o(Y, l) | |
143 | + | if ((Z == Z)) | |
144 | + | then [X, Z, IntegerEntry("totalAmount", R), StringEntry(U, V)] | |
145 | + | else throw("Strict value is not equal to itself.") | |
146 | + | } | |
147 | + | ||
148 | + | ||
149 | + | ||
150 | + | @Callable(G) | |
151 | + | func initLend (l,A,F,aa) = valueOrElse(q(G.caller, l), { | |
152 | + | let X = k(l) | |
153 | + | let V = { | |
154 | + | let B = invoke(f, "readByJSONKey", [X.description, "tokenURI"], nil) | |
155 | + | if ($isInstanceOf(B, "String")) | |
156 | + | then B | |
157 | + | else throw(($getType(B) + " couldn't be cast to String")) | |
158 | + | } | |
159 | + | if ((V == V)) | |
160 | + | then { | |
161 | + | let y = { | |
162 | + | let B = invoke(f, "makeJSON", [["supportedInterface", "assetdId", "tokenURI", "owner", "timeUnitSeconds", "timeUnitPrice", "timeUnitCount", "startTimestamp", "endTimestamp", "deposit", "claimed"], ["0", l, V, toString(G.caller), toString(A), toString(F), toString(aa), toString(lastBlock.timestamp), toString((lastBlock.timestamp + (A * aa))), "0", "0"]], nil) | |
163 | + | if ($isInstanceOf(B, "String")) | |
164 | + | then B | |
165 | + | else throw(($getType(B) + " couldn't be cast to String")) | |
166 | + | } | |
167 | + | if ((y == y)) | |
168 | + | then { | |
169 | + | let w = toString(i) | |
170 | + | [IntegerEntry("lendCount", (i + 1)), IntegerEntry("lendCurrentCount", (j + 1)), IntegerEntry(("lend-rentCount-" + w), 0), StringEntry(("lend-" + w), y)] | |
171 | + | } | |
172 | + | else throw("Strict value is not equal to itself.") | |
173 | + | } | |
39 | 174 | else throw("Strict value is not equal to itself.") | |
40 | 175 | }) | |
41 | 176 | ||
42 | 177 | ||
43 | 178 | ||
44 | - | @Callable(n) | |
45 | - | func addToJSONInternal (r,o,p) = valueOrElse(g(n.caller), { | |
46 | - | let q = invoke(e, "addToJSON", [r, o, p], nil) | |
47 | - | if ((q == q)) | |
48 | - | then $Tuple2(nil, q) | |
49 | - | else throw("Strict value is not equal to itself.") | |
50 | - | }) | |
51 | - | ||
52 | - | ||
53 | - | ||
54 | - | @Callable(n) | |
55 | - | func readByJSONKeyInternal (r,s) = valueOrElse(g(n.caller), { | |
56 | - | let q = invoke(e, "readByJSONKey", [r, s], nil) | |
57 | - | if ((q == q)) | |
58 | - | then $Tuple2(nil, q) | |
59 | - | else throw("Strict value is not equal to itself.") | |
60 | - | }) | |
61 | - | ||
62 | - | ||
63 | - | ||
64 | - | @Callable(n) | |
65 | - | func deleteByJSONKeyInternal (r,s) = valueOrElse(g(n.caller), { | |
66 | - | let q = invoke(e, "deleteByJSONKey", [r, s], nil) | |
67 | - | if ((q == q)) | |
68 | - | then $Tuple2(nil, q) | |
69 | - | else throw("Strict value is not equal to itself.") | |
70 | - | }) | |
71 | - | ||
72 | - | ||
73 | - | ||
74 | - | @Callable(n) | |
75 | - | func storageJsonInternal (t,u) = valueOrElse(g(n.caller), [StringEntry(t, u)]) | |
76 | - | ||
77 | - | ||
78 | - | ||
79 | - | @Callable(n) | |
80 | - | func setUser (k,v,w) = { | |
81 | - | let q = invoke(e, "makeJSON", [["user", "expires"], [v, w]], nil) | |
82 | - | if ((q == q)) | |
83 | - | then $Tuple2([StringEntry(("userOf-" + k), { | |
84 | - | let x = q | |
85 | - | if ($isInstanceOf(x, "String")) | |
86 | - | then x | |
87 | - | else throw(($getType(x) + " couldn't be cast to String")) | |
88 | - | })], q) | |
89 | - | else throw("Strict value is not equal to itself.") | |
90 | - | } | |
91 | - | ||
92 | - | ||
93 | - | ||
94 | - | @Callable(n) | |
95 | - | func setTokenPayment (k) = valueOrElse(g(n.caller), [BinaryEntry("tokenPayment", k)]) | |
96 | - | ||
97 | - | ||
98 | - | ||
99 | - | @Callable(n) | |
100 | - | func deleteValueByKey (s) = valueOrElse(g(n.caller), [DeleteEntry(s)]) | |
101 | - | ||
102 | - | ||
103 | - | ||
104 | - | @Callable(n) | |
105 | - | func setString (s,y) = valueOrElse(g(n.caller), [StringEntry(s, y)]) | |
106 | - | ||
107 | - | ||
108 | - | ||
109 | - | @Callable(n) | |
110 | - | func init (a,b,c) = valueOrElse(g(n.caller), [StringEntry("collectionName", a), StringEntry("symbol", b), StringEntry("description", c), IntegerEntry("totalAmount", 0)]) | |
111 | - | ||
112 | - | ||
113 | - | ||
114 | - | @Callable(n) | |
115 | - | func mint (j,z) = { | |
116 | - | let A = (d + 1) | |
117 | - | let B = ((b + "#") + toString(A)) | |
118 | - | let C = if ((16 >= size(B))) | |
119 | - | then B | |
120 | - | else toString(A) | |
121 | - | let r = { | |
122 | - | let x = invoke(e, "makeJSON", [["tokenURI"], [z]], nil) | |
123 | - | if ($isInstanceOf(x, "String")) | |
124 | - | then x | |
125 | - | else throw(($getType(x) + " couldn't be cast to String")) | |
179 | + | @Callable(G) | |
180 | + | func initRent (v,aa) = valueOrElse(r(G.payments, D(v, aa)), { | |
181 | + | let w = toString(v) | |
182 | + | let y = getStringValue(("lend-" + w)) | |
183 | + | let ab = C(v) | |
184 | + | let ac = toString(ab) | |
185 | + | let A = { | |
186 | + | let B = invoke(f, "readByJSONKey", [y, "timeUnitSeconds"], nil) | |
187 | + | if ($isInstanceOf(B, "String")) | |
188 | + | then B | |
189 | + | else throw(($getType(B) + " couldn't be cast to String")) | |
126 | 190 | } | |
127 | - | let D = Issue(C, r, 1, 0, false, unit, height) | |
128 | - | let k = calculateAssetId(D) | |
129 | - | let E = Address(fromBase58String(j)) | |
130 | - | let F = i(E, k) | |
131 | - | if ((F == F)) | |
132 | - | then [D, F, IntegerEntry("totalAmount", A), StringEntry(C, z)] | |
133 | - | else throw("Strict value is not equal to itself.") | |
134 | - | } | |
135 | - | ||
136 | - | ||
137 | - | ||
138 | - | @Callable(n) | |
139 | - | func initLend (k,G,H,I) = valueOrElse(m(n.caller, k), { | |
140 | - | let D = l(k) | |
141 | - | let z = { | |
142 | - | let x = invoke(e, "readByJSONKey", [D.description, "tokenURI"], nil) | |
143 | - | if ($isInstanceOf(x, "String")) | |
144 | - | then x | |
145 | - | else throw(($getType(x) + " couldn't be cast to String")) | |
146 | - | } | |
147 | - | if ((z == z)) | |
191 | + | if ((A == A)) | |
148 | 192 | then { | |
149 | - | let J = getStringValue("Lends") | |
150 | - | let K = { | |
151 | - | let x = invoke(e, "deleteByJSONKey", [J, "lendCount"], nil) | |
152 | - | if ($isInstanceOf(x, "(String, String)")) | |
153 | - | then x | |
154 | - | else throw(($getType(x) + " couldn't be cast to (String, String)")) | |
155 | - | } | |
156 | - | if ((K == K)) | |
193 | + | let ad = parseIntValue(A) | |
194 | + | if ((ad == ad)) | |
157 | 195 | then { | |
158 | - | let L = K._1 | |
159 | - | let M = toString((parseIntValue(L) + 1)) | |
160 | - | let N = { | |
161 | - | let x = invoke(e, "makeJSON", [["supportedInterface", "assetdId", "tokenURI", "owner", "timeUnitSeconds", "timeUnitPrice", "timeUnitCount", "startTimestamp", "endTimestamp", "deposit", "claimed", "rents"], ["0", k, z, toString(n.caller), toString(G), toString(H), toString(I), toString(lastBlock.timestamp), toString((lastBlock.timestamp + (G * I))), "0", "0", "{\"name\":\"Rents\",\"rentCount\":\"0\"}"]], nil) | |
162 | - | if ($isInstanceOf(x, "String")) | |
163 | - | then x | |
164 | - | else throw(($getType(x) + " couldn't be cast to String")) | |
196 | + | let ae = { | |
197 | + | let B = invoke(f, "makeJSON", [["customer", "timeUnitCount", "startTimestamp", "endTimestamp", "closed"], [toString(G.caller), toString(aa), toString(lastBlock.timestamp), toString((lastBlock.timestamp + (ad * aa))), "0"]], nil) | |
198 | + | if ($isInstanceOf(B, "String")) | |
199 | + | then B | |
200 | + | else throw(($getType(B) + " couldn't be cast to String")) | |
165 | 201 | } | |
166 | - | if ((N == N)) | |
167 | - | then { | |
168 | - | let O = { | |
169 | - | let x = invoke(e, "addToJSON", [K._2, [L, "lendCount"], [N, M]], nil) | |
170 | - | if ($isInstanceOf(x, "String")) | |
171 | - | then x | |
172 | - | else throw(($getType(x) + " couldn't be cast to String")) | |
173 | - | } | |
174 | - | if ((O == O)) | |
175 | - | then [StringEntry("Lends", O)] | |
176 | - | else throw("Strict value is not equal to itself.") | |
177 | - | } | |
202 | + | if ((ae == ae)) | |
203 | + | then [IntegerEntry(("lend-rentCount-" + w), (ab + 1)), StringEntry(((("lend-rent-" + w) + "-") + ac), ae)] | |
178 | 204 | else throw("Strict value is not equal to itself.") | |
179 | 205 | } | |
180 | 206 | else throw("Strict value is not equal to itself.") | |
181 | 207 | } | |
182 | 208 | else throw("Strict value is not equal to itself.") | |
183 | 209 | }) | |
184 | 210 | ||
185 | 211 | ||
186 | - | ||
187 | - | @Callable(n) | |
188 | - | func initRent (L,I) = { | |
189 | - | let P = toString(L) | |
190 | - | let J = getStringValue("Lends") | |
191 | - | let Q = { | |
192 | - | let x = invoke(e, "deleteByJSONKey", [J, "lendCount"], nil) | |
193 | - | if ($isInstanceOf(x, "(String, String)")) | |
194 | - | then x | |
195 | - | else throw(($getType(x) + " couldn't be cast to (String, String)")) | |
196 | - | } | |
197 | - | if ((Q == Q)) | |
198 | - | then { | |
199 | - | let R = { | |
200 | - | let x = invoke(e, "deleteByJSONKey", [Q._2, P], nil) | |
201 | - | if ($isInstanceOf(x, "(String, String)")) | |
202 | - | then x | |
203 | - | else throw(($getType(x) + " couldn't be cast to (String, String)")) | |
204 | - | } | |
205 | - | if ((R == R)) | |
206 | - | then [StringEntry("Debug", R._1)] | |
207 | - | else throw("Strict value is not equal to itself.") | |
208 | - | } | |
209 | - | else throw("Strict value is not equal to itself.") | |
210 | - | } | |
211 | - | ||
212 | - |
github/deemru/w8io/026f985 37.21 ms ◑