tx · BsCrNyVKeMHgGDJcaeAF4GMprBkgQ72cvqucJ1g9ftAC 3MrQ4g9YCsAN2Wr4QUXiWAPhNPv7DGdQNWb: -0.00500000 Waves 2023.03.16 22:57 [2493028] smart account 3MrQ4g9YCsAN2Wr4QUXiWAPhNPv7DGdQNWb > SELF 0.00000000 Waves
{ "type": 13, "id": "BsCrNyVKeMHgGDJcaeAF4GMprBkgQ72cvqucJ1g9ftAC", "fee": 500000, "feeAssetId": null, "timestamp": 1678996672583, "version": 2, "chainId": 84, "sender": "3MrQ4g9YCsAN2Wr4QUXiWAPhNPv7DGdQNWb", "senderPublicKey": "2VQGRNRWyFAZvjDtkgZwdZcTwZvBJJ61n8zJfYYxm5eK", "proofs": [ "3ZksZ9hJjo4kvK4yf5XFMtsFYN2wqK4yMCB8u3TbLxQoHcQDkohnWL9SYdcW7benkNEFh2ZaA6ePfvvM7GBr8VNu" ], "script": "base64:BgJCCAISBAoCGBgSBQoDCBgYEgQKAggIEgQKAggIEgQKAggIEgUKAwgICBIDCgECEgUKAwgICBIECgIICBIGCgQIAQEBCgAOY29sbGVjdGlvbk5hbWUJARFAZXh0ck5hdGl2ZSgxMDU4KQECDmNvbGxlY3Rpb25OYW1lAAZzeW1ib2wJARFAZXh0ck5hdGl2ZSgxMDU4KQECBnN5bWJvbAALZGVzY3JpcHRpb24JARFAZXh0ck5hdGl2ZSgxMDU4KQECC2Rlc2NyaXB0aW9uAAt0b3RhbEFtb3VudAkBEUBleHRyTmF0aXZlKDEwNTUpAQILdG90YWxBbW91bnQACGRBcHBKc29uCQEHQWRkcmVzcwEJANkEAQIjM01yR2FaVlJoa25FR2ZISjE5dHRVUE5uRFJvRnFjSGhWTjcADHRva2VuUGF5bWVudAkBB0FkZHJlc3MBCQERQGV4dHJOYXRpdmUoMTA1NykBAgx0b2tlblBheW1lbnQBDG9ubHlJbnRlcm5hbAEGY2FsbGVyAwkAAAIFBmNhbGxlcgUEdGhpcwUEdW5pdAkAAgECEk9ubHkgaW50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N0YW1wCQDMCAICB2RlcG9zaXQJAMwIAgIHY2xhaW1lZAkAzAgCAgVyZW50cwUDbmlsCQDMCAIJAMwIAgAACQDMCAIFB2Fzc2V0SWQJAMwIAgUIdG9rZW5VcmkJAMwIAggFAWkGY2FsbGVyCQDMCAIFD3RpbWVVbml0U2Vjb25kcwkAzAgCBQ10aW1lVW5pdFByaWNlCQDMCAIFDXRpbWVVbml0Q291bnQJAMwIAggFCWxhc3RCbG9jawl0aW1lc3RhbXAJAMwIAgkAZAIIBQlsYXN0QmxvY2sJdGltZXN0YW1wCQBoAgUPdGltZVVuaXRTZWNvbmRzBQ10aW1lVW5pdENvdW50CQDMCAIAAAkAzAgCBwkAzAgCAg17ImNvdW50IjoiMCJ9BQNuaWwFA25pbAUDbmlsAwkAAAIFBHJlczIFBHJlczIJAMwIAgkBC1N0cmluZ0VudHJ5AgIFTGVuZHMKAAFABQRyZXMyAwkAAQIFAUACBlN0cmluZwUBQAkAAgEJAKwCAgkAAwEFAUACGyBjb3VsZG4ndCBiZSBjYXN0IHRvIFN0cmluZwUDbmlsCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAOLBJvU=", "height": 2493028, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Hc5NxFAYykVAm27kKY7w7DS2j7HxHbS1vmksieSEwRUH Next: eRhpXC1HR3iWSD4wiDgDYADB4ytQ2WHGmfswn29dGJz Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let a = getStringValue( | |
4 | + | let a = getStringValue("collectionName") | |
5 | 5 | ||
6 | - | let b = getStringValue( | |
6 | + | let b = getStringValue("symbol") | |
7 | 7 | ||
8 | - | let c = getStringValue( | |
8 | + | let c = getStringValue("description") | |
9 | 9 | ||
10 | - | let d = getIntegerValue( | |
10 | + | let d = getIntegerValue("totalAmount") | |
11 | 11 | ||
12 | 12 | let e = Address(fromBase58String("3MrGaZVRhknEGfHJ19ttUPNnDRoFqcHhVN7")) | |
13 | 13 | ||
14 | - | let f = Address(getBinaryValue( | |
14 | + | let f = Address(getBinaryValue("tokenPayment")) | |
15 | 15 | ||
16 | 16 | func g (h) = if ((h == this)) | |
17 | 17 | then unit | |
23 | 23 | else ScriptTransfer(j, 1, k) | |
24 | 24 | ||
25 | 25 | ||
26 | - | @Callable(l) | |
27 | - | func makeJSONInternal (m,n) = valueOrElse(g(l.caller), { | |
28 | - | let o = invoke(e, "makeJSON", [m, n], nil) | |
29 | - | if ((o == o)) | |
30 | - | then $Tuple2(nil, o) | |
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)) | |
30 | + | then unit | |
31 | + | else throw("Only asset owner") | |
32 | + | ||
33 | + | ||
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) | |
31 | 39 | else throw("Strict value is not equal to itself.") | |
32 | 40 | }) | |
33 | 41 | ||
34 | 42 | ||
35 | 43 | ||
36 | - | @Callable( | |
37 | - | func addToJSONInternal ( | |
38 | - | let | |
39 | - | if (( | |
40 | - | then $Tuple2(nil, | |
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) | |
41 | 49 | else throw("Strict value is not equal to itself.") | |
42 | 50 | }) | |
43 | 51 | ||
44 | 52 | ||
45 | 53 | ||
46 | - | @Callable( | |
47 | - | func readByJSONKeyInternal ( | |
48 | - | let | |
49 | - | if (( | |
50 | - | then $Tuple2(nil, | |
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) | |
51 | 59 | else throw("Strict value is not equal to itself.") | |
52 | 60 | }) | |
53 | 61 | ||
54 | 62 | ||
55 | 63 | ||
56 | - | @Callable( | |
57 | - | func deleteByJSONKeyInternal ( | |
58 | - | let | |
59 | - | if (( | |
60 | - | then $Tuple2(nil, | |
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) | |
61 | 69 | else throw("Strict value is not equal to itself.") | |
62 | 70 | }) | |
63 | 71 | ||
64 | 72 | ||
65 | 73 | ||
66 | - | @Callable( | |
67 | - | func storageJsonInternal ( | |
74 | + | @Callable(n) | |
75 | + | func storageJsonInternal (t,u) = valueOrElse(g(n.caller), [StringEntry(t, u)]) | |
68 | 76 | ||
69 | 77 | ||
70 | 78 | ||
71 | - | @Callable( | |
72 | - | func setUser (k, | |
73 | - | let | |
74 | - | if (( | |
79 | + | @Callable(n) | |
80 | + | func setUser (k,v,w) = { | |
81 | + | let q = invoke(e, "makeJSON", [["user", "expires"], [v, w]], nil) | |
82 | + | if ((q == q)) | |
75 | 83 | then $Tuple2([StringEntry(("userOf-" + k), { | |
76 | - | let u = o | |
77 | - | if ($isInstanceOf(u, "String")) | |
78 | - | then u | |
79 | - | else throw(($getType(u) + " couldn't be cast to String")) | |
80 | - | })], o) | |
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 init (a,b,c) = valueOrElse(g(n.caller), [StringEntry("collectionName", a), StringEntry("symbol", b), StringEntry("description", c), IntegerEntry("totalAmount", 0)]) | |
101 | + | ||
102 | + | ||
103 | + | ||
104 | + | @Callable(n) | |
105 | + | func mint (j,y) = valueOrElse(g(n.caller), { | |
106 | + | let z = (d + 1) | |
107 | + | let A = ((b + "#") + toString(z)) | |
108 | + | let B = if ((16 >= size(A))) | |
109 | + | then A | |
110 | + | else toString(z) | |
111 | + | let C = Issue(B, (("{uri:\"" + y) + "\"}"), 1, 0, false, unit, height) | |
112 | + | let k = calculateAssetId(C) | |
113 | + | let D = Address(fromBase58String(j)) | |
114 | + | let E = i(D, k) | |
115 | + | if ((E == E)) | |
116 | + | then [C, E, IntegerEntry("totalAmount", z), StringEntry(B, y)] | |
81 | 117 | else throw("Strict value is not equal to itself.") | |
82 | 118 | }) | |
83 | 119 | ||
84 | 120 | ||
85 | 121 | ||
86 | - | @Callable(l) | |
87 | - | func setTokenPayment (k) = valueOrElse(g(l.caller), [BinaryEntry("tokenPayment", k)]) | |
88 | - | ||
89 | - | ||
90 | - | ||
91 | - | @Callable(l) | |
92 | - | func init (a,b,c) = valueOrElse(g(l.caller), [StringEntry("collectionName", a), StringEntry("symbol", b), StringEntry("description", c), IntegerEntry("totalAmount", 0)]) | |
93 | - | ||
94 | - | ||
95 | - | ||
96 | - | @Callable(l) | |
97 | - | func mint (j,v) = valueOrElse(g(l.caller), { | |
98 | - | let w = (d + 1) | |
99 | - | let x = ((b + "#") + toString(w)) | |
100 | - | let y = if ((16 >= size(x))) | |
101 | - | then x | |
102 | - | else toString(w) | |
103 | - | let z = Issue(y, (("{uri:\"" + v) + "\"}"), 1, 0, false, unit, height) | |
104 | - | let k = calculateAssetId(z) | |
105 | - | let A = Address(fromBase58String(j)) | |
106 | - | let B = i(A, k) | |
107 | - | if ((B == B)) | |
108 | - | then [z, B, IntegerEntry("totalAmount", w), StringEntry(y, v)] | |
122 | + | @Callable(n) | |
123 | + | func initLend (k,F,G,H) = valueOrElse(m(n.caller, k), { | |
124 | + | let C = l(k) | |
125 | + | let I = C.description | |
126 | + | let J = getStringValue("Lends") | |
127 | + | let K = invoke(e, "readByJSONKey", [J, "count"], nil) | |
128 | + | let L = (parseIntValue({ | |
129 | + | let x = K | |
130 | + | if ($isInstanceOf(x, "String")) | |
131 | + | then x | |
132 | + | else throw(($getType(x) + " couldn't be cast to String")) | |
133 | + | }) + 1) | |
134 | + | let M = invoke(e, "makeJSON", [["supportedInterface", "assetdId", "tokenUri", "owner", "timeUnitSeconds", "timeUnitPrice", "timeUnitCount", "startTimestamp", "endTimestamp", "deposit", "claimed", "rents"], [0, k, I, n.caller, F, G, H, lastBlock.timestamp, (lastBlock.timestamp + (F * H)), 0, false, "{\"count\":\"0\"}"]], nil) | |
135 | + | if ((M == M)) | |
136 | + | then [StringEntry("Lends", { | |
137 | + | let x = M | |
138 | + | if ($isInstanceOf(x, "String")) | |
139 | + | then x | |
140 | + | else throw(($getType(x) + " couldn't be cast to String")) | |
141 | + | })] | |
109 | 142 | else throw("Strict value is not equal to itself.") | |
110 | 143 | }) | |
111 | 144 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let a = getStringValue( | |
4 | + | let a = getStringValue("collectionName") | |
5 | 5 | ||
6 | - | let b = getStringValue( | |
6 | + | let b = getStringValue("symbol") | |
7 | 7 | ||
8 | - | let c = getStringValue( | |
8 | + | let c = getStringValue("description") | |
9 | 9 | ||
10 | - | let d = getIntegerValue( | |
10 | + | let d = getIntegerValue("totalAmount") | |
11 | 11 | ||
12 | 12 | let e = Address(fromBase58String("3MrGaZVRhknEGfHJ19ttUPNnDRoFqcHhVN7")) | |
13 | 13 | ||
14 | - | let f = Address(getBinaryValue( | |
14 | + | let f = Address(getBinaryValue("tokenPayment")) | |
15 | 15 | ||
16 | 16 | func g (h) = if ((h == this)) | |
17 | 17 | then unit | |
18 | 18 | else throw("Only internal call") | |
19 | 19 | ||
20 | 20 | ||
21 | 21 | func i (j,k) = if ((j == this)) | |
22 | 22 | then StringEntry("костыль", "костыль") | |
23 | 23 | else ScriptTransfer(j, 1, k) | |
24 | 24 | ||
25 | 25 | ||
26 | - | @Callable(l) | |
27 | - | func makeJSONInternal (m,n) = valueOrElse(g(l.caller), { | |
28 | - | let o = invoke(e, "makeJSON", [m, n], nil) | |
29 | - | if ((o == o)) | |
30 | - | then $Tuple2(nil, o) | |
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)) | |
30 | + | then unit | |
31 | + | else throw("Only asset owner") | |
32 | + | ||
33 | + | ||
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) | |
31 | 39 | else throw("Strict value is not equal to itself.") | |
32 | 40 | }) | |
33 | 41 | ||
34 | 42 | ||
35 | 43 | ||
36 | - | @Callable( | |
37 | - | func addToJSONInternal ( | |
38 | - | let | |
39 | - | if (( | |
40 | - | then $Tuple2(nil, | |
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) | |
41 | 49 | else throw("Strict value is not equal to itself.") | |
42 | 50 | }) | |
43 | 51 | ||
44 | 52 | ||
45 | 53 | ||
46 | - | @Callable( | |
47 | - | func readByJSONKeyInternal ( | |
48 | - | let | |
49 | - | if (( | |
50 | - | then $Tuple2(nil, | |
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) | |
51 | 59 | else throw("Strict value is not equal to itself.") | |
52 | 60 | }) | |
53 | 61 | ||
54 | 62 | ||
55 | 63 | ||
56 | - | @Callable( | |
57 | - | func deleteByJSONKeyInternal ( | |
58 | - | let | |
59 | - | if (( | |
60 | - | then $Tuple2(nil, | |
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) | |
61 | 69 | else throw("Strict value is not equal to itself.") | |
62 | 70 | }) | |
63 | 71 | ||
64 | 72 | ||
65 | 73 | ||
66 | - | @Callable( | |
67 | - | func storageJsonInternal ( | |
74 | + | @Callable(n) | |
75 | + | func storageJsonInternal (t,u) = valueOrElse(g(n.caller), [StringEntry(t, u)]) | |
68 | 76 | ||
69 | 77 | ||
70 | 78 | ||
71 | - | @Callable( | |
72 | - | func setUser (k, | |
73 | - | let | |
74 | - | if (( | |
79 | + | @Callable(n) | |
80 | + | func setUser (k,v,w) = { | |
81 | + | let q = invoke(e, "makeJSON", [["user", "expires"], [v, w]], nil) | |
82 | + | if ((q == q)) | |
75 | 83 | then $Tuple2([StringEntry(("userOf-" + k), { | |
76 | - | let u = o | |
77 | - | if ($isInstanceOf(u, "String")) | |
78 | - | then u | |
79 | - | else throw(($getType(u) + " couldn't be cast to String")) | |
80 | - | })], o) | |
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 init (a,b,c) = valueOrElse(g(n.caller), [StringEntry("collectionName", a), StringEntry("symbol", b), StringEntry("description", c), IntegerEntry("totalAmount", 0)]) | |
101 | + | ||
102 | + | ||
103 | + | ||
104 | + | @Callable(n) | |
105 | + | func mint (j,y) = valueOrElse(g(n.caller), { | |
106 | + | let z = (d + 1) | |
107 | + | let A = ((b + "#") + toString(z)) | |
108 | + | let B = if ((16 >= size(A))) | |
109 | + | then A | |
110 | + | else toString(z) | |
111 | + | let C = Issue(B, (("{uri:\"" + y) + "\"}"), 1, 0, false, unit, height) | |
112 | + | let k = calculateAssetId(C) | |
113 | + | let D = Address(fromBase58String(j)) | |
114 | + | let E = i(D, k) | |
115 | + | if ((E == E)) | |
116 | + | then [C, E, IntegerEntry("totalAmount", z), StringEntry(B, y)] | |
81 | 117 | else throw("Strict value is not equal to itself.") | |
82 | 118 | }) | |
83 | 119 | ||
84 | 120 | ||
85 | 121 | ||
86 | - | @Callable(l) | |
87 | - | func setTokenPayment (k) = valueOrElse(g(l.caller), [BinaryEntry("tokenPayment", k)]) | |
88 | - | ||
89 | - | ||
90 | - | ||
91 | - | @Callable(l) | |
92 | - | func init (a,b,c) = valueOrElse(g(l.caller), [StringEntry("collectionName", a), StringEntry("symbol", b), StringEntry("description", c), IntegerEntry("totalAmount", 0)]) | |
93 | - | ||
94 | - | ||
95 | - | ||
96 | - | @Callable(l) | |
97 | - | func mint (j,v) = valueOrElse(g(l.caller), { | |
98 | - | let w = (d + 1) | |
99 | - | let x = ((b + "#") + toString(w)) | |
100 | - | let y = if ((16 >= size(x))) | |
101 | - | then x | |
102 | - | else toString(w) | |
103 | - | let z = Issue(y, (("{uri:\"" + v) + "\"}"), 1, 0, false, unit, height) | |
104 | - | let k = calculateAssetId(z) | |
105 | - | let A = Address(fromBase58String(j)) | |
106 | - | let B = i(A, k) | |
107 | - | if ((B == B)) | |
108 | - | then [z, B, IntegerEntry("totalAmount", w), StringEntry(y, v)] | |
122 | + | @Callable(n) | |
123 | + | func initLend (k,F,G,H) = valueOrElse(m(n.caller, k), { | |
124 | + | let C = l(k) | |
125 | + | let I = C.description | |
126 | + | let J = getStringValue("Lends") | |
127 | + | let K = invoke(e, "readByJSONKey", [J, "count"], nil) | |
128 | + | let L = (parseIntValue({ | |
129 | + | let x = K | |
130 | + | if ($isInstanceOf(x, "String")) | |
131 | + | then x | |
132 | + | else throw(($getType(x) + " couldn't be cast to String")) | |
133 | + | }) + 1) | |
134 | + | let M = invoke(e, "makeJSON", [["supportedInterface", "assetdId", "tokenUri", "owner", "timeUnitSeconds", "timeUnitPrice", "timeUnitCount", "startTimestamp", "endTimestamp", "deposit", "claimed", "rents"], [0, k, I, n.caller, F, G, H, lastBlock.timestamp, (lastBlock.timestamp + (F * H)), 0, false, "{\"count\":\"0\"}"]], nil) | |
135 | + | if ((M == M)) | |
136 | + | then [StringEntry("Lends", { | |
137 | + | let x = M | |
138 | + | if ($isInstanceOf(x, "String")) | |
139 | + | then x | |
140 | + | else throw(($getType(x) + " couldn't be cast to String")) | |
141 | + | })] | |
109 | 142 | else throw("Strict value is not equal to itself.") | |
110 | 143 | }) | |
111 | 144 | ||
112 | 145 |
github/deemru/w8io/169f3d6 58.33 ms ◑