tx · AeRLF5VgPooFZGhsQVYouBCkrSsCfjPTFyytP7jt7rVj 3N4uWa2T9W2p4WgDwLPo3kWRp8eXRatp4vv: -0.00700000 Waves 2022.07.23 21:22 [2152776] smart account 3N4uWa2T9W2p4WgDwLPo3kWRp8eXRatp4vv > SELF 0.00000000 Waves
{ "type": 13, "id": "AeRLF5VgPooFZGhsQVYouBCkrSsCfjPTFyytP7jt7rVj", "fee": 700000, "feeAssetId": null, "timestamp": 1658600616565, "version": 2, "chainId": 84, "sender": "3N4uWa2T9W2p4WgDwLPo3kWRp8eXRatp4vv", "senderPublicKey": "6pUz5KTgi8pySNF2EuYHUMBkXbTyxL7R7YWGgb2PkhgU", "proofs": [ "y7kkkzFTDeFdwhY2x6cMP8FdVqqzkcnwNffurv7xtoi4BwxKxqDRTmQ9k28aFCZYt3Uaew5PiwHcDBfcE65UMBa" ], "script": "base64:AAIFAAAAAAAAAAcIAhIDCgEBAAAACgAAAAAKZWdnQXNzZXRJZAEAAAAgF/4YCdBeNnPXi9mYwFve9iIGEZ5QZQVegfUQpkcQUdwAAAAAEGNvbGxlY3RvckFkZHJlc3MBAAAAGgFUAqwIk+AYdvRW0p5bt95mLATeRN8JIV7TAAAAAAVkZWxheQAAAAAAAAAFoAAAAAALbWF4RXhjaGFuZ2UAAAAAADuaygAAAAAADGV4Y2hhbmdlUmF0ZQAAAAAAAAAAAgAAAAAMd2F2ZURlY2ltYWxzAAAAAAAAAAAIAAAAAA10b2tlbkRlY2ltYWxzAAAAAAAAAAAIAQAAAA10cnlHZXRJbnRlZ2VyAAAAAQAAAANrZXkEAAAAA3ZhbAQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYgUAAAAHJG1hdGNoMAUAAAABYgAAAAAAAAAAAAUAAAADdmFsAQAAAAx0cnlHZXRTdHJpbmcAAAABAAAAA2tleQQAAAADdmFsBAAAAAckbWF0Y2gwC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25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5DlzsVg==", "height": 2152776, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9zSY659oHNi928rcGVZtGpudVui6ENEr61EceouzzUXW Next: 6abPacCV6SA8LQ8MYnRuta7yg1yqt373HVgSkWBL9cHE Diff:
Old | New | Differences | |
---|---|---|---|
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = base58'2cf6jyVG19oHU79R8iHfqFEesjstr3e7nSYEUhb2WagB' | |
5 | 5 | ||
6 | - | let b = | |
6 | + | let b = base58'3MpADDQFqadaCADNH9JDMQAGw9WEaMcymVU' | |
7 | 7 | ||
8 | - | let c = | |
8 | + | let c = 1440 | |
9 | 9 | ||
10 | - | let d = | |
10 | + | let d = 1000000000 | |
11 | 11 | ||
12 | - | let e = | |
12 | + | let e = 2 | |
13 | 13 | ||
14 | - | let f = | |
14 | + | let f = 8 | |
15 | 15 | ||
16 | - | let g = | |
16 | + | let g = 8 | |
17 | 17 | ||
18 | - | func h (i,j) = (((i + "_") + toBase58String(j)) + "_status") | |
19 | - | ||
20 | - | ||
21 | - | func k (i,j) = (((i + "_") + toBase58String(j)) + "_fh") | |
22 | - | ||
23 | - | ||
24 | - | func l (i,j) = (((i + "_") + toBase58String(j)) + "_di") | |
25 | - | ||
26 | - | ||
27 | - | func m (n) = (("stats_" + n) + "_amount") | |
28 | - | ||
29 | - | ||
30 | - | func o (p) = { | |
31 | - | let q = { | |
32 | - | let r = getInteger(this, p) | |
33 | - | if ($isInstanceOf(r, "Int")) | |
18 | + | func h (i) = { | |
19 | + | let j = { | |
20 | + | let k = getInteger(this, i) | |
21 | + | if ($isInstanceOf(k, "Int")) | |
34 | 22 | then { | |
35 | - | let | |
36 | - | | |
23 | + | let l = k | |
24 | + | l | |
37 | 25 | } | |
38 | 26 | else 0 | |
39 | 27 | } | |
40 | - | | |
28 | + | j | |
41 | 29 | } | |
42 | 30 | ||
43 | 31 | ||
44 | - | func t (u,j,v,w) = { | |
45 | - | let x = value(blockInfoByHeight((v - 1))) | |
46 | - | let y = sha256((j + value(x.vrf))) | |
47 | - | (toInt(y, (w * 8)) % u) | |
32 | + | func m (i) = { | |
33 | + | let j = { | |
34 | + | let k = getString(this, i) | |
35 | + | if ($isInstanceOf(k, "String")) | |
36 | + | then { | |
37 | + | let l = k | |
38 | + | l | |
39 | + | } | |
40 | + | else "" | |
41 | + | } | |
42 | + | j | |
48 | 43 | } | |
49 | 44 | ||
50 | 45 | ||
51 | - | func z (A) = o(m(A)) | |
52 | - | ||
53 | - | ||
54 | - | func B (j,v) = { | |
55 | - | let C = toString(t(6, j, v, 0)) | |
56 | - | let D = toString(t(5, j, v, 0)) | |
57 | - | let E = toString(t(3, j, v, 0)) | |
58 | - | let F = toString(t(43, j, v, 0)) | |
59 | - | let G = toString(t(34, j, v, 0)) | |
60 | - | let H = t(4, j, v, 1) | |
61 | - | let I = if ((H == 0)) | |
62 | - | then "R" | |
63 | - | else if ((H == 1)) | |
64 | - | then "G" | |
65 | - | else if ((H == 2)) | |
66 | - | then "B" | |
67 | - | else "Y" | |
68 | - | $Tuple2(((((((("PANDA-" + C) + D) + E) + F) + G) + "-") + I), "PANDA") | |
46 | + | func n (i) = { | |
47 | + | let k = getBoolean(this, i) | |
48 | + | if ($isInstanceOf(k, "Boolean")) | |
49 | + | then { | |
50 | + | let l = k | |
51 | + | l | |
52 | + | } | |
53 | + | else false | |
69 | 54 | } | |
70 | 55 | ||
71 | 56 | ||
72 | - | func J (K) = { | |
73 | - | let L = K | |
74 | - | let M = c | |
75 | - | let N = d | |
76 | - | let O = pow((100 + ((L * M) / (10 * N))), 2, 5, 1, 2, DOWN) | |
77 | - | (O * 1000000) | |
57 | + | @Callable(o) | |
58 | + | func exchangeToken (p) = { | |
59 | + | let q = toBase58String(o.transactionId) | |
60 | + | let r = (p / e) | |
61 | + | let s = h((("receiver_" + toString(o.originCaller)) + "_lastDay")) | |
62 | + | let t = h((("receiver_" + toString(o.originCaller)) + "_totalAmountInDay")) | |
63 | + | if ((height > (s + c))) | |
64 | + | then if ((t > d)) | |
65 | + | then throw("Max exchange limit reached. Please try after 24 hours.") | |
66 | + | else if (((t + p) > d)) | |
67 | + | then throw("Max exchange crossed. Please try with lower value.") | |
68 | + | else [IntegerEntry((("receiver_" + toString(o.originCaller)) + "_totalAmountInDay"), (t + p)), IntegerEntry((((("receiver_" + toString(o.originCaller)) + "_transactionId_") + q) + "_waveAmount"), p), IntegerEntry((((("receiver_" + toString(o.originCaller)) + "_transactionId_") + q) + "_tokenAmount"), r), ScriptTransfer(Address(b), p, unit), ScriptTransfer(o.originCaller, r, a)] | |
69 | + | else [IntegerEntry((("receiver_" + toString(o.originCaller)) + "_lastDay"), height), IntegerEntry((("receiver_" + toString(o.originCaller)) + "_totalAmountInDay"), p), IntegerEntry((((("receiver_" + toString(o.originCaller)) + "_transactionId_") + q) + "_waveAmount"), p), IntegerEntry((((("receiver_" + toString(o.originCaller)) + "_transactionId_") + q) + "_tokenAmount"), r), ScriptTransfer(Address(b), p, unit), ScriptTransfer(o.originCaller, r, a)] | |
78 | 70 | } | |
79 | 71 | ||
80 | 72 | ||
81 | - | @Callable(P) | |
82 | - | func startPandaAdoption () = { | |
83 | - | let K = o("ducks_amount") | |
84 | - | let Q = J(K) | |
85 | - | let R = value(P.payments[0]) | |
86 | - | let S = [StringEntry(h(toString(P.originCaller), P.transactionId), f), IntegerEntry(k(toString(P.originCaller), P.transactionId), (height + b)), IntegerEntry("ducks_amount", (K + 1)), IntegerEntry("ducks_last_price", (Q / 1000000))] | |
87 | - | if ((R.assetId != a)) | |
88 | - | then throw(("You can attach only EGG tokens with the following asset id: " + toBase58String(a))) | |
89 | - | else if ((Q > R.amount)) | |
90 | - | then throw(("To hatch a duck you currently need the following amount of EGGlets: " + toString(Q))) | |
91 | - | else (S ++ [ScriptTransfer(P.caller, (R.amount - Q), a)]) | |
92 | - | } | |
93 | - | ||
94 | - | ||
95 | - | ||
96 | - | @Callable(P) | |
97 | - | func finishPandaAdoption (T) = { | |
98 | - | let j = fromBase58String(T) | |
99 | - | let U = h(toString(P.caller), j) | |
100 | - | let V = k(toString(P.caller), j) | |
101 | - | let W = l(toString(P.caller), j) | |
102 | - | let X = { | |
103 | - | let r = getBoolean((("Adoption_" + T) + "_babyDuck")) | |
104 | - | if ($isInstanceOf(r, "Boolean")) | |
105 | - | then { | |
106 | - | let N = r | |
107 | - | N | |
108 | - | } | |
109 | - | else false | |
110 | - | } | |
111 | - | let Y = getStringValue(this, U) | |
112 | - | let v = getIntegerValue(this, V) | |
113 | - | if ((Y == g)) | |
114 | - | then { | |
115 | - | let Z = getStringValue(this, l(toString(P.caller), j)) | |
116 | - | throw(("The duck was hatched and claimed already, here is the folowing: " + Z)) | |
117 | - | } | |
118 | - | else if ((v > height)) | |
119 | - | then throw((((("Adoption is not finished yet " + toString((v - height))) + " blocks remaining, it will take around ") + toString((v - height))) + " minutes")) | |
120 | - | else { | |
121 | - | let aa = B(j, v) | |
122 | - | let ab = aa._1 | |
123 | - | let ac = aa._2 | |
124 | - | let ad = (("{\"genotype\": \"" + ab) + "\", \"crossbreeding\": true}") | |
125 | - | let ae = Issue(ab, ad, 1, 0, false, unit, v) | |
126 | - | let af = calculateAssetId(ae) | |
127 | - | let ag = (o(m(ab)) + 1) | |
128 | - | [StringEntry(U, g), StringEntry(W, toBase58String(af)), StringEntry(toBase58String(af), W), BooleanEntry((("duck_" + toBase58String(af)) + "_grown"), X), IntegerEntry(m(ab), ag), IntegerEntry((("stats_" + ac) + "_quantity"), (o((("stats_" + ac) + "_quantity")) + 1)), ae, ScriptTransfer(P.caller, 1, af)] | |
129 | - | } | |
130 | - | } | |
131 | - | ||
132 | - | ||
133 | - | @Verifier(ah) | |
134 | - | func ai () = sigVerify(ah.bodyBytes, ah.proofs[0], ah.senderPublicKey) | |
73 | + | @Verifier(u) | |
74 | + | func v () = sigVerify(u.bodyBytes, u.proofs[0], u.senderPublicKey) | |
135 | 75 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = base58'2cf6jyVG19oHU79R8iHfqFEesjstr3e7nSYEUhb2WagB' | |
5 | 5 | ||
6 | - | let b = | |
6 | + | let b = base58'3MpADDQFqadaCADNH9JDMQAGw9WEaMcymVU' | |
7 | 7 | ||
8 | - | let c = | |
8 | + | let c = 1440 | |
9 | 9 | ||
10 | - | let d = | |
10 | + | let d = 1000000000 | |
11 | 11 | ||
12 | - | let e = | |
12 | + | let e = 2 | |
13 | 13 | ||
14 | - | let f = | |
14 | + | let f = 8 | |
15 | 15 | ||
16 | - | let g = | |
16 | + | let g = 8 | |
17 | 17 | ||
18 | - | func h (i,j) = (((i + "_") + toBase58String(j)) + "_status") | |
19 | - | ||
20 | - | ||
21 | - | func k (i,j) = (((i + "_") + toBase58String(j)) + "_fh") | |
22 | - | ||
23 | - | ||
24 | - | func l (i,j) = (((i + "_") + toBase58String(j)) + "_di") | |
25 | - | ||
26 | - | ||
27 | - | func m (n) = (("stats_" + n) + "_amount") | |
28 | - | ||
29 | - | ||
30 | - | func o (p) = { | |
31 | - | let q = { | |
32 | - | let r = getInteger(this, p) | |
33 | - | if ($isInstanceOf(r, "Int")) | |
18 | + | func h (i) = { | |
19 | + | let j = { | |
20 | + | let k = getInteger(this, i) | |
21 | + | if ($isInstanceOf(k, "Int")) | |
34 | 22 | then { | |
35 | - | let | |
36 | - | | |
23 | + | let l = k | |
24 | + | l | |
37 | 25 | } | |
38 | 26 | else 0 | |
39 | 27 | } | |
40 | - | | |
28 | + | j | |
41 | 29 | } | |
42 | 30 | ||
43 | 31 | ||
44 | - | func t (u,j,v,w) = { | |
45 | - | let x = value(blockInfoByHeight((v - 1))) | |
46 | - | let y = sha256((j + value(x.vrf))) | |
47 | - | (toInt(y, (w * 8)) % u) | |
32 | + | func m (i) = { | |
33 | + | let j = { | |
34 | + | let k = getString(this, i) | |
35 | + | if ($isInstanceOf(k, "String")) | |
36 | + | then { | |
37 | + | let l = k | |
38 | + | l | |
39 | + | } | |
40 | + | else "" | |
41 | + | } | |
42 | + | j | |
48 | 43 | } | |
49 | 44 | ||
50 | 45 | ||
51 | - | func z (A) = o(m(A)) | |
52 | - | ||
53 | - | ||
54 | - | func B (j,v) = { | |
55 | - | let C = toString(t(6, j, v, 0)) | |
56 | - | let D = toString(t(5, j, v, 0)) | |
57 | - | let E = toString(t(3, j, v, 0)) | |
58 | - | let F = toString(t(43, j, v, 0)) | |
59 | - | let G = toString(t(34, j, v, 0)) | |
60 | - | let H = t(4, j, v, 1) | |
61 | - | let I = if ((H == 0)) | |
62 | - | then "R" | |
63 | - | else if ((H == 1)) | |
64 | - | then "G" | |
65 | - | else if ((H == 2)) | |
66 | - | then "B" | |
67 | - | else "Y" | |
68 | - | $Tuple2(((((((("PANDA-" + C) + D) + E) + F) + G) + "-") + I), "PANDA") | |
46 | + | func n (i) = { | |
47 | + | let k = getBoolean(this, i) | |
48 | + | if ($isInstanceOf(k, "Boolean")) | |
49 | + | then { | |
50 | + | let l = k | |
51 | + | l | |
52 | + | } | |
53 | + | else false | |
69 | 54 | } | |
70 | 55 | ||
71 | 56 | ||
72 | - | func J (K) = { | |
73 | - | let L = K | |
74 | - | let M = c | |
75 | - | let N = d | |
76 | - | let O = pow((100 + ((L * M) / (10 * N))), 2, 5, 1, 2, DOWN) | |
77 | - | (O * 1000000) | |
57 | + | @Callable(o) | |
58 | + | func exchangeToken (p) = { | |
59 | + | let q = toBase58String(o.transactionId) | |
60 | + | let r = (p / e) | |
61 | + | let s = h((("receiver_" + toString(o.originCaller)) + "_lastDay")) | |
62 | + | let t = h((("receiver_" + toString(o.originCaller)) + "_totalAmountInDay")) | |
63 | + | if ((height > (s + c))) | |
64 | + | then if ((t > d)) | |
65 | + | then throw("Max exchange limit reached. Please try after 24 hours.") | |
66 | + | else if (((t + p) > d)) | |
67 | + | then throw("Max exchange crossed. Please try with lower value.") | |
68 | + | else [IntegerEntry((("receiver_" + toString(o.originCaller)) + "_totalAmountInDay"), (t + p)), IntegerEntry((((("receiver_" + toString(o.originCaller)) + "_transactionId_") + q) + "_waveAmount"), p), IntegerEntry((((("receiver_" + toString(o.originCaller)) + "_transactionId_") + q) + "_tokenAmount"), r), ScriptTransfer(Address(b), p, unit), ScriptTransfer(o.originCaller, r, a)] | |
69 | + | else [IntegerEntry((("receiver_" + toString(o.originCaller)) + "_lastDay"), height), IntegerEntry((("receiver_" + toString(o.originCaller)) + "_totalAmountInDay"), p), IntegerEntry((((("receiver_" + toString(o.originCaller)) + "_transactionId_") + q) + "_waveAmount"), p), IntegerEntry((((("receiver_" + toString(o.originCaller)) + "_transactionId_") + q) + "_tokenAmount"), r), ScriptTransfer(Address(b), p, unit), ScriptTransfer(o.originCaller, r, a)] | |
78 | 70 | } | |
79 | 71 | ||
80 | 72 | ||
81 | - | @Callable(P) | |
82 | - | func startPandaAdoption () = { | |
83 | - | let K = o("ducks_amount") | |
84 | - | let Q = J(K) | |
85 | - | let R = value(P.payments[0]) | |
86 | - | let S = [StringEntry(h(toString(P.originCaller), P.transactionId), f), IntegerEntry(k(toString(P.originCaller), P.transactionId), (height + b)), IntegerEntry("ducks_amount", (K + 1)), IntegerEntry("ducks_last_price", (Q / 1000000))] | |
87 | - | if ((R.assetId != a)) | |
88 | - | then throw(("You can attach only EGG tokens with the following asset id: " + toBase58String(a))) | |
89 | - | else if ((Q > R.amount)) | |
90 | - | then throw(("To hatch a duck you currently need the following amount of EGGlets: " + toString(Q))) | |
91 | - | else (S ++ [ScriptTransfer(P.caller, (R.amount - Q), a)]) | |
92 | - | } | |
93 | - | ||
94 | - | ||
95 | - | ||
96 | - | @Callable(P) | |
97 | - | func finishPandaAdoption (T) = { | |
98 | - | let j = fromBase58String(T) | |
99 | - | let U = h(toString(P.caller), j) | |
100 | - | let V = k(toString(P.caller), j) | |
101 | - | let W = l(toString(P.caller), j) | |
102 | - | let X = { | |
103 | - | let r = getBoolean((("Adoption_" + T) + "_babyDuck")) | |
104 | - | if ($isInstanceOf(r, "Boolean")) | |
105 | - | then { | |
106 | - | let N = r | |
107 | - | N | |
108 | - | } | |
109 | - | else false | |
110 | - | } | |
111 | - | let Y = getStringValue(this, U) | |
112 | - | let v = getIntegerValue(this, V) | |
113 | - | if ((Y == g)) | |
114 | - | then { | |
115 | - | let Z = getStringValue(this, l(toString(P.caller), j)) | |
116 | - | throw(("The duck was hatched and claimed already, here is the folowing: " + Z)) | |
117 | - | } | |
118 | - | else if ((v > height)) | |
119 | - | then throw((((("Adoption is not finished yet " + toString((v - height))) + " blocks remaining, it will take around ") + toString((v - height))) + " minutes")) | |
120 | - | else { | |
121 | - | let aa = B(j, v) | |
122 | - | let ab = aa._1 | |
123 | - | let ac = aa._2 | |
124 | - | let ad = (("{\"genotype\": \"" + ab) + "\", \"crossbreeding\": true}") | |
125 | - | let ae = Issue(ab, ad, 1, 0, false, unit, v) | |
126 | - | let af = calculateAssetId(ae) | |
127 | - | let ag = (o(m(ab)) + 1) | |
128 | - | [StringEntry(U, g), StringEntry(W, toBase58String(af)), StringEntry(toBase58String(af), W), BooleanEntry((("duck_" + toBase58String(af)) + "_grown"), X), IntegerEntry(m(ab), ag), IntegerEntry((("stats_" + ac) + "_quantity"), (o((("stats_" + ac) + "_quantity")) + 1)), ae, ScriptTransfer(P.caller, 1, af)] | |
129 | - | } | |
130 | - | } | |
131 | - | ||
132 | - | ||
133 | - | @Verifier(ah) | |
134 | - | func ai () = sigVerify(ah.bodyBytes, ah.proofs[0], ah.senderPublicKey) | |
73 | + | @Verifier(u) | |
74 | + | func v () = sigVerify(u.bodyBytes, u.proofs[0], u.senderPublicKey) | |
135 | 75 |
github/deemru/w8io/169f3d6 59.71 ms ◑