tx · 4uY7uNg682mijftWrXTcGkFmEr7crcMbESXSNoywPLUY 3MsRQhp2cbXJQxHETzdZQdj2QfP4b3Mp6UL: -0.01000000 Waves 2022.04.26 03:54 [2024755] smart account 3MsRQhp2cbXJQxHETzdZQdj2QfP4b3Mp6UL > SELF 0.00000000 Waves
{ "type": 13, "id": "4uY7uNg682mijftWrXTcGkFmEr7crcMbESXSNoywPLUY", "fee": 1000000, "feeAssetId": null, "timestamp": 1650934517190, "version": 2, "chainId": 84, "sender": "3MsRQhp2cbXJQxHETzdZQdj2QfP4b3Mp6UL", "senderPublicKey": "FuM9F3sAdx6ZQfJfJMCdjC9w4wzTDx6F1KgWCbAM1KRy", "proofs": [ "3kLSmNoKg2FzUyywFChSTfdQ7HAiKFZsuxUhtEN3E1WvwCyTdzQaFSw66WRomHCK1RceCgeS5EoeFrCw65GQkQ25" ], "script": "base64:AAIFAAAAAAAAABkIAhIECgIBCBIECgIBCBIDCgEBEgQKAgEIAAAACgEAAAAFYXNJbnQAAAABAAAABXZhbHVlBAAAAAckbWF0Y2gwBQAAAAV2YWx1ZQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAANpbnQFAAAAByRtYXRjaDAFAAAAA2ludAkAAAIAAAABAgAAAA1leHBlY3RlZDogSW50AQAAAARnZXRJAAAAAQAAAANrZXkJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AQAAAAh3cml0ZUludAAAAAIAAAADa2V5AAAABXZhbHVlAwkAAGYAAAACAAAAAAAAAAAABQAAAAV2YWx1ZQkAAAIAAAABCQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAABd3cml0aW5nIG5lZ2F0aXZlIHZhbHVlIAkAAaQAAAABBQAAAAV2YWx1ZQIAAAAJIGZvciBrZXkgBQAAAANrZXkJAQAAAAxJbnRlZ2VyRW50cnkAAAACBQAAAANrZXkFAAAABXZhbHVlAAAAAARtYWluCQEAAAARQGV4dHJOYXRpdmUoMTA2MikAAAABAgAAACMzUE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AAAACCQEAAAAId3JpdGVJbnQAAAACAgAAAAVNeUJhbAkAAGUAAAACBQAAAAJ1YwUAAAABdgUAAAADbmlsCQEAAAAFYXNJbnQAAAABCQAD/AAAAAQFAAAABG1haW4CAAAACHdpdGhkcmF3CQAETAAAAAIFAAAAD2Fzc2V0U3RyaW5nVXNkYwkABEwAAAACBQAAAAF2BQAAAANuaWwFAAAAA25pbAAAAAFpAQAAAA1raXNzbWVnb29kYnllAAAAAgAAAAZsaW1pdGQAAAADa2V5AwkBAAAAAiE9AAAAAggFAAAAAWkAAAAGY2FsbGVyBQAAAAZzZW5kZXIJAAACAAAAAQIAAAABMQQAAAAJYXZhaWxhYmxlCQAD8AAAAAIFAAAAC3Jlc2VydmVVc2RjBQAAAAdhc3NldElkAwkAAGYAAAACBQAAAAZsaW1pdGQFAAAACWF2YWlsYWJsZQkAAAIAAAABAgAAAAExBAAAAARmbGFnCQEAAAALdmFsdWVPckVsc2UAAAACCQEAAAAEZ2V0SQAAAAEFAAAAA2tleQAAAAAAAAAAAAMJAAAAAAAAAgUAAAAEZmxhZwAAAAAAAAAAAQkAAAIAAAABAgAAAAEyCQAFFAAAAAIJAARMAAAAAgkBAAAACHdyaXRlSW50AAAAAgUAAAADa2V5AAAAAAAAAAABBQAAAANuaWwJAQAAAAVhc0ludAAAAAEJAAP8AAAABAUAAAAEbWFpbgIAAAAId2l0aGRyYXcJAARMAAAAAgUAAAAPYXNzZXRTdHJpbmdVc2RjCQAETAAAAAIFAAAABmxpbWl0ZAUAAAADbmlsBQAAAANuaWwAAAAAkxNwIw==", "height": 2024755, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Crb2Sx4M1dQ6zLiZNsVjeEvBJaCZcCkCSWrLNxpKzwZL Next: 4RqV2EvrxCMR2H4FZwXdBcv4SeXbCDBufPQq3q9jDVfK Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | func a (b,c) = if (!(isDefined(getString(this, b)))) | |
5 | - | then StringEntry(b, c) | |
6 | - | else throw(("already initialized: " + b)) | |
4 | + | func a (b) = { | |
5 | + | let c = b | |
6 | + | if ($isInstanceOf(c, "Int")) | |
7 | + | then { | |
8 | + | let d = c | |
9 | + | d | |
10 | + | } | |
11 | + | else throw("expected: Int") | |
12 | + | } | |
7 | 13 | ||
8 | 14 | ||
9 | - | let d = "config" | |
10 | - | ||
11 | - | let e = addressFromStringValue("3MsRQhp2cbXJQxHETzdZQdj2QfP4b3Mp6UL") | |
12 | - | ||
13 | - | let f = { | |
14 | - | let g = getString(e, "oracle_address") | |
15 | - | if ($isInstanceOf(g, "String")) | |
16 | - | then { | |
17 | - | let h = g | |
18 | - | addressFromString(h) | |
19 | - | } | |
20 | - | else unit | |
21 | - | } | |
22 | - | ||
23 | - | let i = height | |
24 | - | ||
25 | - | let j = 1440 | |
26 | - | ||
27 | - | func k (l) = 1000000000 | |
15 | + | func e (f) = getInteger(this, f) | |
28 | 16 | ||
29 | 17 | ||
30 | - | func m (n,l) = ((("withdrawn_" + n) + "_") + l) | |
18 | + | func g (f,b) = if ((0 > b)) | |
19 | + | then throw(((("writing negative value " + toString(b)) + " for key ") + f)) | |
20 | + | else IntegerEntry(f, b) | |
31 | 21 | ||
32 | 22 | ||
33 | - | @Callable(o) | |
34 | - | func initialize (p) = [a(d, p)] | |
23 | + | let h = addressFromStringValue("3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT") | |
24 | + | ||
25 | + | let i = "6XtHjpXbs9RRJP2Sr9GUyVqzACcby9TkThHXnjVC5CDJ" | |
26 | + | ||
27 | + | let j = addressFromStringValue("3PFoA1JFDoLWQJ3DqzAHNrrWR4riVuBfHks") | |
28 | + | ||
29 | + | let k = addressFromStringValue("3PGCkrHBxFMi7tz1xqnxgBpeNvn5E4M4g8S") | |
30 | + | ||
31 | + | let l = fromBase58String(i) | |
32 | + | ||
33 | + | let m = addressFromStringValue("3PFSaPNBhUSsTmZwFF5DDbStDDJGrhcniS3") | |
34 | + | ||
35 | + | func n (o,p) = a(invoke(j, (("valid" + o) + "imit"), [i, toString(this), (0 - p)], nil)) | |
36 | + | ||
37 | + | ||
38 | + | @Callable(q) | |
39 | + | func initbal (r,f) = $Tuple2([g("MyBal", r), g(f, 0)], unit) | |
35 | 40 | ||
36 | 41 | ||
37 | 42 | ||
38 | - | @Callable(o) | |
39 | - | func validateWithdrawLimit (l,n,q) = { | |
40 | - | let g = k(l) | |
41 | - | if ($isInstanceOf(g, "Int")) | |
42 | - | then { | |
43 | - | let r = g | |
44 | - | let s = ((i / j) * j) | |
45 | - | let t = ((1 + (i / j)) * j) | |
46 | - | let u = m(n, l) | |
47 | - | let v = { | |
48 | - | let w = getString(u) | |
49 | - | if ($isInstanceOf(w, "String")) | |
50 | - | then { | |
51 | - | let h = w | |
52 | - | let x = split(h, "|") | |
53 | - | $Tuple2(parseIntValue(x[0]), parseIntValue(x[1])) | |
43 | + | @Callable(q) | |
44 | + | func withdraw (s,o) = if ((q.caller != m)) | |
45 | + | then throw("1") | |
46 | + | else { | |
47 | + | let t = assetBalance(k, l) | |
48 | + | if ((s > t)) | |
49 | + | then throw("1") | |
50 | + | else { | |
51 | + | let u = a(invoke(k, "userDepositUSD", [toString(this)], nil)) | |
52 | + | let v = if ((t > u)) | |
53 | + | then u | |
54 | + | else t | |
55 | + | if ((v == 0)) | |
56 | + | then throw("2") | |
57 | + | else { | |
58 | + | let w = n(o, (v - 1000000000)) | |
59 | + | $Tuple2(nil, (w + a(invoke(h, "withdraw", [i, v], nil)))) | |
54 | 60 | } | |
55 | - | else $Tuple2(0, 0) | |
56 | 61 | } | |
57 | - | let y = v._1 | |
58 | - | let z = v._2 | |
59 | - | let A = if ((y == s)) | |
60 | - | then z | |
61 | - | else 0 | |
62 | - | if (((A + q) > r)) | |
63 | - | then throw(((((((((((("breaching withdraw limit per " + toString(r)) + " ") + l) + " over ") + toString(j)) + " blocks. Available: ") + toString((r - A))) + " current epoch: ") + toString(s)) + "-") + toString(t))) | |
64 | - | else $Tuple2([StringEntry(u, ((toString(s) + "|") + toString((A + q))))], ((r - A) - q)) | |
62 | + | } | |
63 | + | ||
64 | + | ||
65 | + | ||
66 | + | @Callable(q) | |
67 | + | func goodbye (s) = { | |
68 | + | let t = assetBalance(k, l) | |
69 | + | if ((s > t)) | |
70 | + | then throw("1") | |
71 | + | else { | |
72 | + | let u = valueOrElse(e("MyBal"), 0) | |
73 | + | let v = if ((t > u)) | |
74 | + | then u | |
75 | + | else t | |
76 | + | if ((v == 0)) | |
77 | + | then throw("2") | |
78 | + | else $Tuple2([g("MyBal", (u - v))], a(invoke(h, "withdraw", [i, v], nil))) | |
65 | 79 | } | |
66 | - | else $Tuple2(nil, -1) | |
67 | 80 | } | |
81 | + | ||
82 | + | ||
83 | + | ||
84 | + | @Callable(q) | |
85 | + | func kissmegoodbye (x,f) = if ((q.caller != m)) | |
86 | + | then throw("1") | |
87 | + | else { | |
88 | + | let t = assetBalance(k, l) | |
89 | + | if ((x > t)) | |
90 | + | then throw("1") | |
91 | + | else { | |
92 | + | let y = valueOrElse(e(f), 0) | |
93 | + | if ((y == 1)) | |
94 | + | then throw("2") | |
95 | + | else $Tuple2([g(f, 1)], a(invoke(h, "withdraw", [i, x], nil))) | |
96 | + | } | |
97 | + | } | |
68 | 98 | ||
69 | 99 |
github/deemru/w8io/026f985 31.62 ms ◑