tx · 2zUQyavBZRUayyPqiDmKu91GoW8Mj9JLU21CxU1y8B5v 3MsRQhp2cbXJQxHETzdZQdj2QfP4b3Mp6UL: -0.01000000 Waves 2022.04.21 06:09 [2017736] smart account 3MsRQhp2cbXJQxHETzdZQdj2QfP4b3Mp6UL > SELF 0.00000000 Waves
{ "type": 13, "id": "2zUQyavBZRUayyPqiDmKu91GoW8Mj9JLU21CxU1y8B5v", "fee": 1000000, "feeAssetId": null, "timestamp": 1650509752334, "version": 2, "chainId": 84, "sender": "3MsRQhp2cbXJQxHETzdZQdj2QfP4b3Mp6UL", "senderPublicKey": "FuM9F3sAdx6ZQfJfJMCdjC9w4wzTDx6F1KgWCbAM1KRy", "proofs": [ "1Ekmqcy9GqKVPNdkYSBqUXrE3aj2tzgCW3Bz62aectbQihmeRuUEYSeWTdaTZj9SZYwmccXSAdSP9KZxQ1MYdU2" ], "script": "base64:AAIFAAAAAAAAAAwIAhIDCgEBEgMKAQEAAAAGAQAAAAVhc0ludAAAAAEAAAAFdmFsdWUEAAAAByRtYXRjaDAFAAAABXZhbHVlAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAA2ludAUAAAAHJG1hdGNoMAUAAAADaW50CQAAAgAAAAECAAAADWV4cGVjdGVkOiBJbnQBAAAAEWFzVXNlckJhbGFuY2VEYXRhAAAAAQAAAAV2YWx1ZQQAAAAHJG1hdGNoMAUAAAAFdmFsdWUDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAIihJbnQsIEludCwgSW50LCBJbnQsIEludCwgQm9vbGVhbikEAAAAAXgFAAAAByRtYXRjaDAIBQAAAAF4AAAAAl8zBAAAAAF0BQAAAAckbWF0Y2gwCQAAAgAAAAECAAAAIndyb25nIHR5cGUsIGV4cGVjdGVkOiBJbnQ1JkJvb2xlYW4AAAAABG1haW4JAQAAABFAZXh0ck5hdGl2ZSgxMDYyKQAAAAECAAAAIzNQQVp2OXRnSzFQWDdkS1I3YjRrY2hxNXFkcFVTM0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FAAAACWF2YWlsYWJsZQMJAABmAAAAAgUAAAAEbWlubQUAAAABdgkAAAIAAAABCQABpAAAAAEFAAAAAXYEAAAABmFtb3VudAkBAAAABWFzSW50AAAAAQkAA/wAAAAEBQAAAARtYWluAgAAAAh3aXRoZHJhdwkABEwAAAACBQAAAA9hc3NldFN0cmluZ1VzZGMJAARMAAAAAgUAAAABdgUAAAADbmlsBQAAAANuaWwJAAUUAAAAAgUAAAADbmlsBQAAAAZhbW91bnQAAAAAaAkUrw==", "height": 2017736, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: 2sSdTEDee55h4KAjazCZKfEbgSMGgMS5RUApuYztzmnE Full:
Old | New | Differences | |
---|---|---|---|
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._3 | |
15 | + | case t => | |
16 | + | throw("wrong type, expected: Int5&Boolean") | |
17 | + | } | |
18 | + | ||
19 | + | ||
20 | + | let main = addressFromStringValue("3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT") | |
21 | + | ||
22 | + | let assetStringUsdc = "6XtHjpXbs9RRJP2Sr9GUyVqzACcby9TkThHXnjVC5CDJ" | |
23 | + | ||
24 | + | let reserveUsdc = addressFromStringValue("3PGCkrHBxFMi7tz1xqnxgBpeNvn5E4M4g8S") | |
25 | + | ||
26 | + | let assetId = fromBase58String(assetStringUsdc) | |
27 | + | ||
28 | + | @Callable(i) | |
29 | + | func t1 (minm) = { | |
30 | + | let available = assetBalance(reserveUsdc, assetId) | |
31 | + | if ((minm > available)) | |
32 | + | then { | |
33 | + | let depositUsd = asUserBalanceData(invoke(reserveUsdc, "userBalance", [toString(this)], nil)) | |
34 | + | throw("1") | |
35 | + | } | |
36 | + | else throw(toString(available)) | |
37 | + | } | |
38 | + | ||
39 | + | ||
40 | + | ||
41 | + | @Callable(i) | |
42 | + | func byebye (minm) = { | |
43 | + | let available = assetBalance(reserveUsdc, assetId) | |
44 | + | if ((minm > available)) | |
45 | + | then throw(toString(available)) | |
46 | + | else { | |
47 | + | let depositUsd = asUserBalanceData(invoke(reserveUsdc, "userBalance", [toString(this)], nil)) | |
48 | + | let v = if ((available > depositUsd)) | |
49 | + | then depositUsd | |
50 | + | else available | |
51 | + | if ((minm > v)) | |
52 | + | then throw(toString(v)) | |
53 | + | else { | |
54 | + | let amount = asInt(invoke(main, "withdraw", [assetStringUsdc, v], nil)) | |
55 | + | $Tuple2(nil, amount) | |
56 | + | } | |
57 | + | } | |
58 | + | } | |
59 | + | ||
60 | + |
github/deemru/w8io/026f985 15.79 ms ◑