tx · CyNfGRtvYhMa3YqpoPdtCXcHoUYJFrbqmYkrchSFTMe5 3MpDjMyCVWwgTgP5hPkBNqYm1ReCQJVreKQ: -0.01000000 Waves 2020.10.20 14:21 [1228821] smart account 3MpDjMyCVWwgTgP5hPkBNqYm1ReCQJVreKQ > SELF 0.00000000 Waves
{ "type": 13, "id": "CyNfGRtvYhMa3YqpoPdtCXcHoUYJFrbqmYkrchSFTMe5", "fee": 1000000, "feeAssetId": null, "timestamp": 1603192876211, "version": 2, "chainId": 84, "sender": "3MpDjMyCVWwgTgP5hPkBNqYm1ReCQJVreKQ", "senderPublicKey": "FoqMm9tSLFNfTCkgkHoFyuGeWNHotVbhXQhfjvQJvHcM", "proofs": [ "24dK8TdTmQAcKkm1ku1ctSqze1JJ4yoQjbNHinmAGPm6hyatRwZjqnV8FLcfLxBt11Y5GM6SnLg8AHmAY29EDxQh" ], "script": "base64:AAIDAAAAAAAAAAwIARIAEgASBAoCAQEAAAAKAAAAAARVU0RUAgAAACwzRUptN1pOWlJqV25nalZRNnFqRlVlZjNpUlV5SlpvVDRWWW9DWWFlVmRxWgAAAAAEVVNETgIAAAAsMzdqVkhaSzJjZ2JOVEFrTUNMR2RyYnp2RzFyd01qVHJwRDJUR3praWN0d0wAAAAABmlkVVNETgkAAlkAAAABBQAAAARVU0ROAAAAAAZpZFVTRFQJAAJZAAAAAQUAAAAEVVNEVAAAAAANd2l0aGRyYXdEZWxheQAAAAAAAAAAAQAAAAAPZGVjaW1hbFBhcnRVU0ROAAAAAAAAD0JAAAAAAA9kZWNpbWFsUGFydFVTRFQAAAAAAAAPQkAAAAAAF21pbmltYWxBbW91bnRUb1N3YXBVU0RUCQAAaAAAAAIAAAAAAAAAJxAFAAAAD2RlY2ltYWxQYXJ0VVNETgAAAAAXbWluaW1hbEFtb3VudFRvU3dhcFVTRE4JAABoAAAAAgAAAAAAAAAnEAUAAAAPZGVjaW1hbFBhcnRVU0RUAQAAAApjb2xsZWN0S2V5AAAAAwAAAAdhZ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aGVpZ2h0BQAAAAtoZWlnaHRJbktleQkAAAAAAAACBQAAAA13aXRoZHJhd25JbmZvAgAAAA1ub3Rfd2l0aGRyYXduBwkBAAAADFNjcmlwdFJlc3VsdAAAAAIJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAAA2tleQIAAAAJd2l0aGRyYXduBQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAACmNvbnRleHRPYmoAAAAGY2FsbGVyBQAAABFhbW91bnRUb1N3YXBJbktleQUAAAAGaWRVU0RUBQAAAANuaWwJAAACAAAAAQkAASwAAAACCQABLAAAAAICAAAAHXdpdGhkcmF3YWwgaXMgcG9zc2libGUgYWZ0ZXIgCQABpAAAAAEFAAAAC2hlaWdodEluS2V5AgAAACogaGVpZ2h0IG9yIHlvdSBoYXZlIGFscmVhZHkgd2l0aGRyYXduIFVTRFQAAAAAVI2x8A==", "height": 1228821, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let a = "3EJm7ZNZRjWngjVQ6qjFUef3iRUyJZoT4VYoCYaeVdqZ" | |
5 | + | ||
6 | + | let b = "37jVHZK2cgbNTAkMCLGdrbzvG1rwMjTrpD2TGzkictwL" | |
7 | + | ||
8 | + | let c = fromBase58String(b) | |
9 | + | ||
10 | + | let d = fromBase58String(a) | |
11 | + | ||
12 | + | let e = 1 | |
13 | + | ||
14 | + | let f = 1000000 | |
15 | + | ||
16 | + | let g = 1000000 | |
17 | + | ||
18 | + | let h = (10000 * f) | |
19 | + | ||
20 | + | let i = (10000 * g) | |
21 | + | ||
22 | + | func j (k,l,m) = ((((toString(k) + "_WITHDRAW_") + toString(l)) + "_HEIGHT_") + toString(m)) | |
23 | + | ||
24 | + | ||
25 | + | @Callable(n) | |
26 | + | func swapUSDTtoUSDN () = { | |
27 | + | let o = { | |
28 | + | let p = n.payment | |
29 | + | if ($isInstanceOf(p, "AttachedPayment")) | |
30 | + | then { | |
31 | + | let q = p | |
32 | + | q | |
33 | + | } | |
34 | + | else throw("Payment not attached") | |
35 | + | } | |
36 | + | let r = o.assetId | |
37 | + | let s = o.amount | |
38 | + | let t = n.caller | |
39 | + | let u = { | |
40 | + | let p = getInteger(this, (toString(t) + "_balance")) | |
41 | + | if ($isInstanceOf(p, "Int")) | |
42 | + | then { | |
43 | + | let v = p | |
44 | + | value(getInteger(this, (toString(t) + "_balance"))) | |
45 | + | } | |
46 | + | else 0 | |
47 | + | } | |
48 | + | if ((r != d)) | |
49 | + | then throw("to swap USDT to USDN you need attach payment in USDT") | |
50 | + | else if ((h > s)) | |
51 | + | then throw((("you can swap at least " + toString((h / g))) + " tokens")) | |
52 | + | else ScriptResult(WriteSet([DataEntry((toString(n.caller) + "_balance"), (u + s))]), TransferSet([ScriptTransfer(n.caller, s, c)])) | |
53 | + | } | |
54 | + | ||
55 | + | ||
56 | + | ||
57 | + | @Callable(n) | |
58 | + | func initializationUSDNtoUSDTswap () = { | |
59 | + | let o = { | |
60 | + | let p = n.payment | |
61 | + | if ($isInstanceOf(p, "AttachedPayment")) | |
62 | + | then { | |
63 | + | let q = p | |
64 | + | q | |
65 | + | } | |
66 | + | else throw("Payment not attached") | |
67 | + | } | |
68 | + | let r = o.assetId | |
69 | + | let w = o.amount | |
70 | + | let t = n.caller | |
71 | + | let u = { | |
72 | + | let p = getInteger(this, (toString(t) + "_balance")) | |
73 | + | if ($isInstanceOf(p, "Int")) | |
74 | + | then { | |
75 | + | let v = p | |
76 | + | getIntegerValue(this, (toString(t) + "_balance")) | |
77 | + | } | |
78 | + | else 0 | |
79 | + | } | |
80 | + | if ((r != c)) | |
81 | + | then throw("to swap USDN to USDT you need attach payment in USDN") | |
82 | + | else if (if ((w > u)) | |
83 | + | then true | |
84 | + | else (i > w)) | |
85 | + | then throw("swap amount fail") | |
86 | + | else { | |
87 | + | let x = (height + e) | |
88 | + | if (isDefined(getString(this, j(n.caller, w, x)))) | |
89 | + | then throw("you have already started withdrawal process, wait next block") | |
90 | + | else ScriptResult(WriteSet([DataEntry((toString(n.caller) + "_balance"), (u - w)), DataEntry(j(n.caller, w, x), "not_withdrawn")]), TransferSet(nil)) | |
91 | + | } | |
92 | + | } | |
93 | + | ||
94 | + | ||
95 | + | ||
96 | + | @Callable(n) | |
97 | + | func swapUSDNtoUSDT (l,y) = { | |
98 | + | let z = j(n.caller, l, y) | |
99 | + | let A = { | |
100 | + | let p = getString(this, z) | |
101 | + | if ($isInstanceOf(p, "String")) | |
102 | + | then { | |
103 | + | let A = p | |
104 | + | getStringValue(this, z) | |
105 | + | } | |
106 | + | else throw(((("this key doesn't exists " + z) + " at address ") + toString(this))) | |
107 | + | } | |
108 | + | if (if ((height >= y)) | |
109 | + | then (A == "not_withdrawn") | |
110 | + | else false) | |
111 | + | then ScriptResult(WriteSet([DataEntry(z, "withdrawn")]), TransferSet([ScriptTransfer(n.caller, l, d)])) | |
112 | + | else throw((("withdrawal is possible after " + toString(y)) + " height or you have already withdrawn USDT")) | |
113 | + | } | |
114 | + | ||
115 | + |
github/deemru/w8io/026f985 16.39 ms ◑