tx · GBCWCN9NYhEF2Aw5SUPmBM4bvcu82XGFBULuVGFkGBwf

3MrT6o7YAdo3KMs4cTvd2WU8WDYVMUyEdri:  -0.01000000 Waves

2022.04.17 05:49 [2011958] smart account 3MrT6o7YAdo3KMs4cTvd2WU8WDYVMUyEdri > SELF 0.00000000 Waves

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

github/deemru/w8io/169f3d6 
20.27 ms