tx · mvBeaTcVMZgX6bMcNUspWUWGPuG2YgeKrdGoGYsLbGe 3N1XAEyg1TQGa5FCEerrRhLGi5KyVq26Xm8: -0.00400000 Waves 2023.01.22 16:54 [2416247] smart account 3N1XAEyg1TQGa5FCEerrRhLGi5KyVq26Xm8 > SELF 0.00000000 Waves
{ "type": 13, "id": "mvBeaTcVMZgX6bMcNUspWUWGPuG2YgeKrdGoGYsLbGe", "fee": 400000, "feeAssetId": null, "timestamp": 1674395683925, "version": 2, "chainId": 84, "sender": "3N1XAEyg1TQGa5FCEerrRhLGi5KyVq26Xm8", "senderPublicKey": "ATuPi6fn8277fNiCoRgPTav9QG15CJoW95GEGcDmfYt8", "proofs": [ "2R1yVss8XXXmsSB4YBJw9G8QjW4Q4qVh4RPy7M2qfLMkvZBvJPvHZyN6grM463YckYfurHDKLYSv9LdB96u3xK5Z" ], "script": "base64:BgIPCAISABIAEgMKAQgSABIAGQAFd2NkSWQCLDVXRTZIQlZzbUFiYXBUbVRLcG15V21VUjY3ZmMxNnliRnJOanh6bURCdFBhAAt3Y2REZWNpbWFscwACARN0b3RhbFNoYXJlQnlVc2VyS0VZAQVvd25lcgkAuQkCCQDMCAICBnNoYXJlcwkAzAgCBQVvd25lcgUDbmlsAgFfARR0b3RhbFNoYXJlQnlVc2VyUkVBRAEFb3duZXIJAQt2YWx1ZU9yRWxzZQIJAJoIAgUEdGhpcwkBE3RvdGFsU2hhcmVCeVVzZXJLRVkBBQVvd25lcgAAABJ0b3RhbElzc3VlZFdDRF9LRVkCEHRvdGFsX2lzc3VlZF9XQ0QBE3RvdGFsSXNzdWVkV0NEX1JFQUQACQELdmFsdWVPckVsc2UCCQCaCAIFBHRoaXMFEnRvdGFsSXNzdWVkV0NEX0tFWQAAAA50b3RhbFNoYXJlc0tFWQIMdG90YWxfc2hhcmVzAQ90b3RhbFNoYXJlc1JFQUQACQELdmFsdWVPckVsc2UCCQCaCAIFBHRoaXMFDnRvdGFsU2hhcmVzS0VZAAAAEnRvdG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AgOmDsd4WBA90b3RhbENvbGxhdGVyYWwJARN0b3RhbENvbGxhdGVyYWxSRUFEAAQMdG90YWxfaXNzdWVkCQETdG90YWxJc3N1ZWRXQ0RfUkVBRAAJAMwIAgkBDEludGVnZXJFbnRyeQIFEnRvdGFsQ29sbGF0ZXJhbEtFWQkAZAIFD3RvdGFsQ29sbGF0ZXJhbAgFA3BtdAZhbW91bnQJAMwIAgkBDEludGVnZXJFbnRyeQIFEnRvdGFsSXNzdWVkV0NEX0tFWQkAZAIFDHRvdGFsX2lzc3VlZAUQd2NkX2lzc3VlX2Ftb3VudAkAzAgCCQEOU2NyaXB0VHJhbnNmZXIDCQERQGV4dHJOYXRpdmUoMTA2MikBBQdhY2NvdW50BRB3Y2RfaXNzdWVfYW1vdW50CQDZBAEFBXdjZElkBQNuaWwBaQESdGVzdF9nZXRfdXNlcl90bWR1AQdhY2NvdW50CQACAQkArAICAghSZXN1bHQ6IAkApAMBCQEPZ2V0VXNlclRNRFVfV0NEAQUHYWNjb3VudAFpAQ10ZXN0X2dldF90bWR1AAkAAgEJAKwCAgIIUmVzdWx0OiAJAKQDAQkBB2dldFRNRFUAAWkBDXRlc3RfZ2V0X3RtZGkACQACAQkArAICAghSZXN1bHQ6IAkApAMBCQEHZ2V0VE1ESQAA+qgWZw==", "height": 2416247, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 6B8yquQo5zKWp4TxiBXMmMUNszj1kwqXtNnd5NxF5xxf Next: CuuvyDUBVWrFjNi6QpNg5BYQ6Xgkot66vAjiLjxqrjtr Diff:
Old | New | Differences | |
---|---|---|---|
65 | 65 | ||
66 | 66 | func A () = { | |
67 | 67 | let B = (k() - i()) | |
68 | + | w((B * 10), g(), s()) | |
69 | + | } | |
70 | + | ||
71 | + | ||
72 | + | func C () = { | |
73 | + | let B = (k() - i()) | |
68 | 74 | if ((B > 0)) | |
69 | 75 | then { | |
70 | - | let | |
71 | - | if ((B > | |
72 | - | then | |
73 | - | else | |
76 | + | let D = A() | |
77 | + | if ((B > D)) | |
78 | + | then D | |
79 | + | else B | |
74 | 80 | } | |
75 | 81 | else 0 | |
76 | 82 | } | |
77 | 83 | ||
78 | 84 | ||
79 | - | func | |
85 | + | func E (d) = (1000000 * fraction(z(), o(d), n())) | |
80 | 86 | ||
81 | 87 | ||
82 | - | func | |
88 | + | func F (d) = fraction(C(), o(d), 100000000) | |
83 | 89 | ||
84 | 90 | ||
85 | - | func | |
91 | + | func G (d) = fraction(fraction(C(), o(d), 100000000), n(), 100000000) | |
86 | 92 | ||
87 | 93 | ||
88 | - | @Callable( | |
94 | + | @Callable(H) | |
89 | 95 | func deposit_share () = { | |
90 | - | let | |
91 | - | then | |
96 | + | let I = if ((size(H.payments) == 1)) | |
97 | + | then H.payments[0] | |
92 | 98 | else throw("Attached payment is required") | |
93 | - | if (isDefined( | |
99 | + | if (isDefined(I.assetId)) | |
94 | 100 | then throw("Only WAVES is allowed.") | |
95 | 101 | else { | |
96 | - | let | |
97 | - | let | |
102 | + | let J = toString(H.caller) | |
103 | + | let K = e(J) | |
98 | 104 | let p = i() | |
99 | - | let | |
100 | - | [IntegerEntry(c( | |
105 | + | let L = k() | |
106 | + | [IntegerEntry(c(J), (K + I.amount)), IntegerEntry(h, (p + I.amount)), IntegerEntry(j, (L + I.amount))] | |
101 | 107 | } | |
102 | 108 | } | |
103 | 109 | ||
104 | 110 | ||
105 | 111 | ||
106 | - | @Callable( | |
112 | + | @Callable(H) | |
107 | 113 | func issue () = { | |
108 | - | let | |
109 | - | then | |
114 | + | let I = if ((size(H.payments) == 1)) | |
115 | + | then H.payments[0] | |
110 | 116 | else throw("Attached payment is required") | |
111 | - | if (isDefined( | |
117 | + | if (isDefined(I.assetId)) | |
112 | 118 | then throw("Only WAVES is allowed.") | |
113 | 119 | else { | |
114 | - | let | |
115 | - | let | |
116 | - | if (( | |
117 | - | then throw((((("User lock limit is " + toString( | |
120 | + | let J = toString(H.caller) | |
121 | + | let M = E(J) | |
122 | + | if ((I.amount > M)) | |
123 | + | then throw((((("User lock limit is " + toString(M)) + " WAVES. Sent ") + toString(I.amount)) + " WAVES.")) | |
118 | 124 | else { | |
119 | - | let | |
120 | - | let | |
121 | - | let | |
122 | - | [IntegerEntry(j, ( | |
125 | + | let N = fraction(I.amount, n(), 100000000000000) | |
126 | + | let L = k() | |
127 | + | let O = g() | |
128 | + | [IntegerEntry(j, (L + I.amount)), IntegerEntry(f, (O + N)), ScriptTransfer(addressFromStringValue(J), N, fromBase58String(a))] | |
123 | 129 | } | |
124 | 130 | } | |
125 | 131 | } | |
126 | 132 | ||
127 | 133 | ||
128 | 134 | ||
129 | - | @Callable( | |
130 | - | func test ( | |
135 | + | @Callable(H) | |
136 | + | func test_get_user_tmdu (J) = throw(("Result: " + toString(G(J)))) | |
131 | 137 | ||
132 | 138 | ||
133 | 139 | ||
134 | - | @Callable(G) | |
135 | - | func test_ii () = throw(("Result: " + toString(A()))) | |
140 | + | @Callable(H) | |
141 | + | func test_get_tmdu () = throw(("Result: " + toString(C()))) | |
142 | + | ||
143 | + | ||
144 | + | ||
145 | + | @Callable(H) | |
146 | + | func test_get_tmdi () = throw(("Result: " + toString(z()))) | |
136 | 147 | ||
137 | 148 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = "5WE6HBVsmAbapTmTKpmyWmUR67fc16ybFrNjxzmDBtPa" | |
5 | 5 | ||
6 | 6 | let b = 2 | |
7 | 7 | ||
8 | 8 | func c (d) = makeString(["shares", d], "_") | |
9 | 9 | ||
10 | 10 | ||
11 | 11 | func e (d) = valueOrElse(getInteger(this, c(d)), 0) | |
12 | 12 | ||
13 | 13 | ||
14 | 14 | let f = "total_issued_WCD" | |
15 | 15 | ||
16 | 16 | func g () = valueOrElse(getInteger(this, f), 0) | |
17 | 17 | ||
18 | 18 | ||
19 | 19 | let h = "total_shares" | |
20 | 20 | ||
21 | 21 | func i () = valueOrElse(getInteger(this, h), 0) | |
22 | 22 | ||
23 | 23 | ||
24 | 24 | let j = "total_collateral" | |
25 | 25 | ||
26 | 26 | func k () = valueOrElse(getInteger(this, j), 0) | |
27 | 27 | ||
28 | 28 | ||
29 | 29 | let l = 240000000 | |
30 | 30 | ||
31 | 31 | let m = "waves_reference_price" | |
32 | 32 | ||
33 | 33 | func n () = valueOrElse(getInteger(this, m), l) | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | func o (d) = { | |
37 | 37 | let p = i() | |
38 | 38 | if ((p > 0)) | |
39 | 39 | then { | |
40 | 40 | let q = e(d) | |
41 | 41 | fraction(100000000, q, p) | |
42 | 42 | } | |
43 | 43 | else 0 | |
44 | 44 | } | |
45 | 45 | ||
46 | 46 | ||
47 | 47 | let r = "A" | |
48 | 48 | ||
49 | 49 | func s () = valueOrElse(getInteger(this, "A"), 100) | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | func t (u,v) = (500000000 - (log(u, b, 10, 0, 6, HALFUP) * v)) | |
53 | 53 | ||
54 | 54 | ||
55 | 55 | func w (x,u,v) = fraction(x, pow(10, 0, t(u, v), 8, 8, HALFUP), 100000000) | |
56 | 56 | ||
57 | 57 | ||
58 | 58 | func y (u,v) = if ((u > 10000000)) | |
59 | 59 | then w(u, u, v) | |
60 | 60 | else 10000000 | |
61 | 61 | ||
62 | 62 | ||
63 | 63 | func z () = y(g(), s()) | |
64 | 64 | ||
65 | 65 | ||
66 | 66 | func A () = { | |
67 | 67 | let B = (k() - i()) | |
68 | + | w((B * 10), g(), s()) | |
69 | + | } | |
70 | + | ||
71 | + | ||
72 | + | func C () = { | |
73 | + | let B = (k() - i()) | |
68 | 74 | if ((B > 0)) | |
69 | 75 | then { | |
70 | - | let | |
71 | - | if ((B > | |
72 | - | then | |
73 | - | else | |
76 | + | let D = A() | |
77 | + | if ((B > D)) | |
78 | + | then D | |
79 | + | else B | |
74 | 80 | } | |
75 | 81 | else 0 | |
76 | 82 | } | |
77 | 83 | ||
78 | 84 | ||
79 | - | func | |
85 | + | func E (d) = (1000000 * fraction(z(), o(d), n())) | |
80 | 86 | ||
81 | 87 | ||
82 | - | func | |
88 | + | func F (d) = fraction(C(), o(d), 100000000) | |
83 | 89 | ||
84 | 90 | ||
85 | - | func | |
91 | + | func G (d) = fraction(fraction(C(), o(d), 100000000), n(), 100000000) | |
86 | 92 | ||
87 | 93 | ||
88 | - | @Callable( | |
94 | + | @Callable(H) | |
89 | 95 | func deposit_share () = { | |
90 | - | let | |
91 | - | then | |
96 | + | let I = if ((size(H.payments) == 1)) | |
97 | + | then H.payments[0] | |
92 | 98 | else throw("Attached payment is required") | |
93 | - | if (isDefined( | |
99 | + | if (isDefined(I.assetId)) | |
94 | 100 | then throw("Only WAVES is allowed.") | |
95 | 101 | else { | |
96 | - | let | |
97 | - | let | |
102 | + | let J = toString(H.caller) | |
103 | + | let K = e(J) | |
98 | 104 | let p = i() | |
99 | - | let | |
100 | - | [IntegerEntry(c( | |
105 | + | let L = k() | |
106 | + | [IntegerEntry(c(J), (K + I.amount)), IntegerEntry(h, (p + I.amount)), IntegerEntry(j, (L + I.amount))] | |
101 | 107 | } | |
102 | 108 | } | |
103 | 109 | ||
104 | 110 | ||
105 | 111 | ||
106 | - | @Callable( | |
112 | + | @Callable(H) | |
107 | 113 | func issue () = { | |
108 | - | let | |
109 | - | then | |
114 | + | let I = if ((size(H.payments) == 1)) | |
115 | + | then H.payments[0] | |
110 | 116 | else throw("Attached payment is required") | |
111 | - | if (isDefined( | |
117 | + | if (isDefined(I.assetId)) | |
112 | 118 | then throw("Only WAVES is allowed.") | |
113 | 119 | else { | |
114 | - | let | |
115 | - | let | |
116 | - | if (( | |
117 | - | then throw((((("User lock limit is " + toString( | |
120 | + | let J = toString(H.caller) | |
121 | + | let M = E(J) | |
122 | + | if ((I.amount > M)) | |
123 | + | then throw((((("User lock limit is " + toString(M)) + " WAVES. Sent ") + toString(I.amount)) + " WAVES.")) | |
118 | 124 | else { | |
119 | - | let | |
120 | - | let | |
121 | - | let | |
122 | - | [IntegerEntry(j, ( | |
125 | + | let N = fraction(I.amount, n(), 100000000000000) | |
126 | + | let L = k() | |
127 | + | let O = g() | |
128 | + | [IntegerEntry(j, (L + I.amount)), IntegerEntry(f, (O + N)), ScriptTransfer(addressFromStringValue(J), N, fromBase58String(a))] | |
123 | 129 | } | |
124 | 130 | } | |
125 | 131 | } | |
126 | 132 | ||
127 | 133 | ||
128 | 134 | ||
129 | - | @Callable( | |
130 | - | func test ( | |
135 | + | @Callable(H) | |
136 | + | func test_get_user_tmdu (J) = throw(("Result: " + toString(G(J)))) | |
131 | 137 | ||
132 | 138 | ||
133 | 139 | ||
134 | - | @Callable(G) | |
135 | - | func test_ii () = throw(("Result: " + toString(A()))) | |
140 | + | @Callable(H) | |
141 | + | func test_get_tmdu () = throw(("Result: " + toString(C()))) | |
142 | + | ||
143 | + | ||
144 | + | ||
145 | + | @Callable(H) | |
146 | + | func test_get_tmdi () = throw(("Result: " + toString(z()))) | |
136 | 147 | ||
137 | 148 |
github/deemru/w8io/169f3d6 46.99 ms ◑