tx · 7QFFvqgiKWDdWe1ZTM3AMz7HyP7ehUwEZgUHiqSguJZ9 3MrT6o7YAdo3KMs4cTvd2WU8WDYVMUyEdri: -0.01000000 Waves 2022.04.17 05:54 [2011964] smart account 3MrT6o7YAdo3KMs4cTvd2WU8WDYVMUyEdri > SELF 0.00000000 Waves
{ "type": 13, "id": "7QFFvqgiKWDdWe1ZTM3AMz7HyP7ehUwEZgUHiqSguJZ9", "fee": 1000000, "feeAssetId": null, "timestamp": 1650164062635, "version": 2, "chainId": 84, "sender": "3MrT6o7YAdo3KMs4cTvd2WU8WDYVMUyEdri", "senderPublicKey": "FGHViFjw9c8erhypDqmSN7Rejo83uy7EuBm9VdnZFutH", "proofs": [ "4s9rHJFuxd3x4JXRLyKmn91SYYQiGFYf16vrkz341dCi3MV4vxHxRMCBYmKYr7U5A5act82JeuqpXp41ekyJ8wRP" ], "script": "base64:AAIFAAAAAAAAAAcIAhIDCgEBAAAABQEAAAAFYXNJbnQAAAABAAAABXZhbHVlBAAAAAckbWF0Y2gwBQAAAAV2YWx1ZQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAANpbnQFAAAAByRtYXRjaDAFAAAAA2ludAkAAAIAAAABAgAAAA1leHBlY3RlZDogSW50AQAAABFhc1VzZXJCYWxhbmNlRGF0YQAAAAEAAAAFdmFsdWUEAAAAByRtYXRjaDAFAAAABXZhbHVlAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAACIoSW50LCBJbnQsIEludCwgSW50LCBJbnQsIEJvb2xlYW4pBAAAAAF4BQAAAAckbWF0Y2gwBQAAAAF4BAAAAAF0BQAAAAckbWF0Y2gwCQAAAgAAAAECAAAAIndyb25nIHR5cGUsIGV4cGVjdGVkOiBJbnQ1JkJvb2xlYW4AAAAABG1haW4JAQAAABFAZXh0ck5hdGl2ZSgxMDYyKQAAAAECAAAAIzNQQVp2OXRnSzFQWDdkS1I3YjRrY2hxNXFkcFVTM0c1c1lUAAAAAA9hc3NldFN0c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": 0 } View: original | compacted Prev: GBCWCN9NYhEF2Aw5SUPmBM4bvcu82XGFBULuVGFkGBwf Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func asInt (value) = match value { | |
5 | 5 | case int: Int => | |
6 | 6 | int | |
7 | 7 | case _ => | |
8 | 8 | throw("expected: Int") | |
9 | 9 | } | |
10 | 10 | ||
11 | 11 | ||
12 | 12 | func asUserBalanceData (value) = match value { | |
13 | 13 | case x: (Int, Int, Int, Int, Int, Boolean) => | |
14 | 14 | x | |
15 | 15 | case t => | |
16 | 16 | throw("wrong type, expected: Int5&Boolean") | |
17 | 17 | } | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | let main = addressFromStringValue("3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT") | |
21 | 21 | ||
22 | 22 | let assetStringUsdt = "34N9YcEETLWn93qYQ64EsP1x89tSruJU44RrEMSXXEPJ" | |
23 | 23 | ||
24 | 24 | let reserveUsdt = addressFromStringValue("3PEiD1zJWTMZNWSCyzhvBw9pxxAWeEwaghR") | |
25 | 25 | ||
26 | 26 | @Callable(i) | |
27 | 27 | func withdraw (min_amount) = { | |
28 | 28 | let assetId = fromBase58String(assetStringUsdt) | |
29 | 29 | let available = assetBalance(reserveUsdt, assetId) | |
30 | 30 | if ((min_amount > available)) | |
31 | 31 | then throw(toString(available)) | |
32 | 32 | else { | |
33 | 33 | let userbalancedata = asUserBalanceData(invoke(reserveUsdt, "userBalance", [toString(this)], nil)) | |
34 | 34 | let depositUsd = userbalancedata._3 | |
35 | 35 | let v = if ((available > depositUsd)) | |
36 | 36 | then depositUsd | |
37 | 37 | else available | |
38 | 38 | if ((min_amount > v)) | |
39 | 39 | then throw(toString(v)) | |
40 | 40 | else { | |
41 | 41 | let amount = asInt(invoke(main, "withdraw", [assetStringUsdt, v], nil)) | |
42 | 42 | $Tuple2(nil, amount) | |
43 | 43 | } | |
44 | 44 | } | |
45 | 45 | } | |
46 | 46 | ||
47 | 47 |
github/deemru/w8io/169f3d6 22.96 ms ◑