tx · BP9noXNL359rtLEcABu2HgJQCDvwjYF7vKot7vLcVd5J 3ND1UEC8y7FViTVvjJgHP51WMEuQD2W57Lg: -0.01000000 Waves 2020.10.20 17:03 [1228981] smart account 3ND1UEC8y7FViTVvjJgHP51WMEuQD2W57Lg > SELF 0.00000000 Waves
{ "type": 13, "id": "BP9noXNL359rtLEcABu2HgJQCDvwjYF7vKot7vLcVd5J", "fee": 1000000, "feeAssetId": null, "timestamp": 1603202615878, "version": 2, "chainId": 84, "sender": "3ND1UEC8y7FViTVvjJgHP51WMEuQD2W57Lg", "senderPublicKey": "7nGyzQvY91xLa2mGkd6ar8kvVCZxG3vZBVZLgY6VD6p9", "proofs": [ "3hT84guS1aZkyTToYHnhL23nouAQgmqcydPtpY2GUoK1YjcGRTdb5FNffpJbbcsk34DHnZM2VjCdrBckeAFTyLeN" ], "script": "base64:AAIEAAAAAAAAAAwIAhIAEgASBAoCAQEAAAANAAAAAARVU0RUAgAAACwzRUptN1pOWlJqV25nalZRNnFqRlVlZjNpUlV5SlpvVDRWWW9DWWFlVmRxWgAAAAAEVVNETgIAAAAsMzdqVkhaSzJjZ2JOVEFrTUNMR2RyYnp2RzFyd01qVHJwRDJUR3praWN0d0wAAAAABmlkVVNETgkAAlkAAAABBQAAAARVU0ROAAAAAAZpZFVTRFQJAAJZAAAAAQUAAAAEVVNEVAAAAAANd2l0aGRyYXdEZWxheQAAAAAAAAAAAQAAAAAPZGVjaW1hbFBhcnRVU0ROAAAAAAAAD0JAAAAAAA9kZWNpbWFsUGFydFVTRFQAAAAAAAAPQkAAAAAAF21pbmltYWxBbW91bnRUb1N3YXBVU0RUCQAAaAAAAAIAAAAAAAAAJxAFAAAAD2RlY2ltYWxQYXJ0VVNETgAAAAAXbWluaW1hbEFtb3VudFRvU3dhcFVTRE4JAABoAAAAAgAAAAAAAAAnEAUAAAAPZGVjaW1hbFBhcnRVU0RUAQAAAApjb2xsZWN0S2V5AAAAAwAAAAdhZGRyZXNzAAAAEWFtb3Vud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zc2libGUgYWZ0ZXIgCQABpAAAAAEFAAAAC2hlaWdodEluS2V5AgAAACogaGVpZ2h0IG9yIHlvdSBoYXZlIGFscmVhZHkgd2l0aGRyYXduIFVTRFQAAAAAnNHtaw==", "height": 1228981, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 4 #-} | |
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) = makeString([toString(k), "WITHDRAW", toString(l), "HEIGHT", toString(m)], "_") | |
23 | + | ||
24 | + | ||
25 | + | func n (k) = makeString([toString(k), "balance"], "_") | |
26 | + | ||
27 | + | ||
28 | + | func o () = throw("To swap USDT to USDN you need attach payment in USDT") | |
29 | + | ||
30 | + | ||
31 | + | func p () = throw((("you can swap at least " + toString((h / g))) + " tokens")) | |
32 | + | ||
33 | + | ||
34 | + | @Callable(q) | |
35 | + | func swapUSDTtoUSDN () = { | |
36 | + | let r = n(q.caller) | |
37 | + | let s = valueOrErrorMessage(q.payments[0], "Payment is not attached!") | |
38 | + | if ((s.assetId != d)) | |
39 | + | then o() | |
40 | + | else { | |
41 | + | let t = s.amount | |
42 | + | let u = q.caller | |
43 | + | let v = valueOrElse(getInteger(this, r), 0) | |
44 | + | if ((h > t)) | |
45 | + | then p() | |
46 | + | else [IntegerEntry(r, (v + t)), ScriptTransfer(q.caller, t, c)] | |
47 | + | } | |
48 | + | } | |
49 | + | ||
50 | + | ||
51 | + | ||
52 | + | @Callable(q) | |
53 | + | func initializationUSDNtoUSDTswap () = { | |
54 | + | let s = value(q.payments[0]) | |
55 | + | let w = s.assetId | |
56 | + | let x = s.amount | |
57 | + | let u = q.caller | |
58 | + | let r = n(q.caller) | |
59 | + | let v = { | |
60 | + | let y = getInteger(this, r) | |
61 | + | if ($isInstanceOf(y, "Int")) | |
62 | + | then { | |
63 | + | let z = y | |
64 | + | getIntegerValue(this, r) | |
65 | + | } | |
66 | + | else 0 | |
67 | + | } | |
68 | + | if ((w != c)) | |
69 | + | then throw("to swap USDN to USDT you need attach payment in USDN") | |
70 | + | else if (if ((x > v)) | |
71 | + | then true | |
72 | + | else (i > x)) | |
73 | + | then throw("swap amount fail") | |
74 | + | else { | |
75 | + | let A = (height + e) | |
76 | + | if (isDefined(getString(this, j(q.caller, x, A)))) | |
77 | + | then throw("you have already started withdrawal process, wait next block") | |
78 | + | else [IntegerEntry((toString(q.caller) + "_balance"), (v - x)), StringEntry(j(q.caller, x, A), "not_withdrawn")] | |
79 | + | } | |
80 | + | } | |
81 | + | ||
82 | + | ||
83 | + | ||
84 | + | @Callable(q) | |
85 | + | func swapUSDNtoUSDT (l,B) = { | |
86 | + | let C = j(q.caller, l, B) | |
87 | + | let D = { | |
88 | + | let y = getString(this, C) | |
89 | + | if ($isInstanceOf(y, "String")) | |
90 | + | then { | |
91 | + | let D = y | |
92 | + | getStringValue(this, C) | |
93 | + | } | |
94 | + | else throw(((("this key doesn't exists " + C) + " at address ") + toString(this))) | |
95 | + | } | |
96 | + | if (if ((height >= B)) | |
97 | + | then (D == "not_withdrawn") | |
98 | + | else false) | |
99 | + | then [StringEntry(C, "withdrawn"), ScriptTransfer(q.caller, l, d)] | |
100 | + | else throw((("withdrawal is possible after " + toString(B)) + " height or you have already withdrawn USDT")) | |
101 | + | } | |
102 | + | ||
103 | + |
github/deemru/w8io/169f3d6 18.50 ms ◑