tx · D9dY31qkz78JEGN9U3ZT1mf8HQ451rX3McnvXDv871q2 3NBQt6u1ihfso7qJr8AUg8CTTEc69ZGn2S9: -0.01000000 Waves 2020.11.09 15:03 [1257776] smart account 3NBQt6u1ihfso7qJr8AUg8CTTEc69ZGn2S9 > SELF 0.00000000 Waves
{ "type": 13, "id": "D9dY31qkz78JEGN9U3ZT1mf8HQ451rX3McnvXDv871q2", "fee": 1000000, "feeAssetId": null, "timestamp": 1604923426387, "version": 2, "chainId": 84, "sender": "3NBQt6u1ihfso7qJr8AUg8CTTEc69ZGn2S9", "senderPublicKey": "2WGVdYvyy9bNSmtxRgiojwNkZ8cgkvYdCdWCc3z8WVGu", "proofs": [ "hjiwYR5HtTXw6sXcw1ozv21LgyzZcZXJMUY63PkuwRhgS75i9KuuQsS8gtVWaQ8WoG4UouaR3HP7fZDvo73zzk4" ], "script": "base64:AAIEAAAAAAAAABQIAhIAEgASBAoCAQESABIECgIIAQAAABMAAAAABFVTRFQCAAAALEI3Zlg2a0JBUVJpYVRoQTF0YzFYNDNNU0VDOVdvSmNRZmJDTWltZlJTaXM2AAAAAARVU0ROAgAAACxGcTdtWkVDWGViU01IclV4WGFGY0NQRFpCRExkc0Y3MzI2NlpraUNiajh6NgAAAAAGaWRVU0ROCQACWQAAAAEFAAAABFVTRE4AAAAABmlkVVNEVAkAAlkAAAABBQAAAARVU0RUAAAAAA13aXRoZHJhd0RlbGF5AAAAAAAAAAABAAAAAA9kZWNpbWFsUGFydFVTRE4AAAAAAAAPQkAAAAAAD2RlY2ltYWxQYXJ0VVNEVAAAAAAAAA9CQAAAAAAXbWluaW1hbEFtb3VudFRvU3dhcFVTRFQJAABoAAAAAgAAAAAAAAAnEAUAAAAPZGVjaW1hbFBhcnRVU0ROAAAAABdtaW5pbWFsQW1vdW50VG9Td2FwVVNETgkAAGgAAAACAAAAAAAAACcQBQAAAA9kZWNpbWFsUGFydFVTRFQBAAAACmNvbGxlY3RLZXkAAAADAAAAB2FkZHJlc3MA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zYWdlAAAAAgkAAZEAAAACBQAAAARkYXRhAAAAAAAAAAABAgAAACJXcm9uZyAnY3VycmVudFdpdGhkcmF3YWxzJyBtZXRob2QhBAAAAANmZWUJAQAAABN2YWx1ZU9yRXJyb3JNZXNzYWdlAAAAAgkAAZEAAAACBQAAAARkYXRhAAAAAAAAAAACAgAAACJXcm9uZyAnY3VycmVudFdpdGhkcmF3YWxzJyBtZXRob2QhBAAAAAV0b3RhbAkAAGUAAAACCQAAZAAAAAIFAAAAEXRvV2l0aGRyYXdXaXRoRmVlBQAAABR0b1dpdGhkcmF3V2l0aG91dEZlZQUAAAADZmVlCQAAAgAAAAEJAAEsAAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAAAh7ImZlZSI6IAkAAaQAAAABBQAAAANmZWUCAAAAFywgInRvV2l0aGRyYXdXaXRoRmVlIjogCQABpAAAAAEFAAAAEXRvV2l0aGRyYXdXaXRoRmVlAgAAABosICJ0b1dpdGhkcmF3V2l0aG91dEZlZSI6IAkAAaQAAAABBQAAABR0b1dpdGhkcmF3V2l0aG91dEZlZQIAAAALLCAidG90YWwiOiAJAAGkAAAAAQUAAAAFdG90YWwCAAAAAX0AAAAA1ab+VA==", "height": 1257776, "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 = "B7fX6kBAQRiaThA1tc1X43MSEC9WoJcQfbCMimfRSis6" | |
5 | + | ||
6 | + | let b = "Fq7mZECXebSMHrUxXaFcCPDZBDLdsF73266ZkiCbj8z6" | |
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([k, "WITHDRAW", toString(l), "HEIGHT", toString(m)], "_") | |
23 | + | ||
24 | + | ||
25 | + | func n (k) = makeString([k, "balance"], "_") | |
26 | + | ||
27 | + | ||
28 | + | func o (k) = makeString([k, "balance_with_fee"], "_") | |
29 | + | ||
30 | + | ||
31 | + | func p () = throw("To swap USDT to USDN you need attach payment in USDT") | |
32 | + | ||
33 | + | ||
34 | + | func q () = throw("To swap USDN to USDT you need attach payment in USDN") | |
35 | + | ||
36 | + | ||
37 | + | func r () = throw((("you can swap at least " + toString((h / g))) + " tokens")) | |
38 | + | ||
39 | + | ||
40 | + | func s (t) = if ((0 > t)) | |
41 | + | then (t * -1) | |
42 | + | else t | |
43 | + | ||
44 | + | ||
45 | + | func u (v,w) = min([v, w]) | |
46 | + | ||
47 | + | ||
48 | + | func x (y,z,A) = if ((size(y) > z)) | |
49 | + | then y[z] | |
50 | + | else A | |
51 | + | ||
52 | + | ||
53 | + | func B (k,v) = { | |
54 | + | let C = n(k) | |
55 | + | let D = o(k) | |
56 | + | let E = valueOrElse(getInteger(this, C), 0) | |
57 | + | let F = valueOrElse(getInteger(this, D), 0) | |
58 | + | let G = (E + F) | |
59 | + | if (if ((v > G)) | |
60 | + | then true | |
61 | + | else (i > v)) | |
62 | + | then throw("Swap amount fail, amount is to small or to big.") | |
63 | + | else { | |
64 | + | let H = u(v, E) | |
65 | + | let I = (v - H) | |
66 | + | let J = ((I / 100) * 1) | |
67 | + | [H, I, J] | |
68 | + | } | |
69 | + | } | |
70 | + | ||
71 | + | ||
72 | + | @Callable(K) | |
73 | + | func swapUSDTtoUSDN () = { | |
74 | + | let C = o(toString(K.caller)) | |
75 | + | let L = value(K.payments[0]) | |
76 | + | if ((L.assetId != d)) | |
77 | + | then p() | |
78 | + | else { | |
79 | + | let v = L.amount | |
80 | + | let M = valueOrElse(getInteger(this, C), 0) | |
81 | + | if ((h > v)) | |
82 | + | then r() | |
83 | + | else [IntegerEntry(C, (M + v)), ScriptTransfer(K.caller, v, c)] | |
84 | + | } | |
85 | + | } | |
86 | + | ||
87 | + | ||
88 | + | ||
89 | + | @Callable(K) | |
90 | + | func initializationUSDNtoUSDTswap () = { | |
91 | + | let L = value(K.payments[0]) | |
92 | + | let k = toString(K.caller) | |
93 | + | if ((L.assetId != c)) | |
94 | + | then q() | |
95 | + | else { | |
96 | + | let v = L.amount | |
97 | + | let C = n(k) | |
98 | + | let D = o(k) | |
99 | + | let E = valueOrElse(getInteger(this, C), 0) | |
100 | + | let F = valueOrElse(getInteger(this, D), 0) | |
101 | + | let G = (E + F) | |
102 | + | let N = B(toString(K.caller), v) | |
103 | + | let H = valueOrErrorMessage(N[0], "Wrong 'currentWithdrawals' method!") | |
104 | + | let I = valueOrErrorMessage(N[1], "Wrong 'currentWithdrawals' method!") | |
105 | + | let J = valueOrErrorMessage(N[2], "Wrong 'currentWithdrawals' method!") | |
106 | + | let O = ((I + H) - J) | |
107 | + | let P = (height + e) | |
108 | + | if (isDefined(getString(this, j(toString(K.caller), v, P)))) | |
109 | + | then throw("You have already started withdrawal process, wait next block.") | |
110 | + | else [IntegerEntry(C, (E - H)), IntegerEntry(D, (F - I)), StringEntry(j(toString(K.caller), v, P), makeString(["not_withdrawn", toString((v - J))], "_"))] | |
111 | + | } | |
112 | + | } | |
113 | + | ||
114 | + | ||
115 | + | ||
116 | + | @Callable(K) | |
117 | + | func swapUSDNtoUSDT (v,Q) = { | |
118 | + | let R = j(toString(K.caller), v, Q) | |
119 | + | let S = valueOrErrorMessage(getString(this, R), ((("This key doesn't exists " + R) + " at address ") + toString(this))) | |
120 | + | let T = x(split(S, "_"), 2, toString(v)) | |
121 | + | if (if ((height >= Q)) | |
122 | + | then contains(S, "not_withdrawn") | |
123 | + | else false) | |
124 | + | then [DeleteEntry(R), ScriptTransfer(K.caller, valueOrErrorMessage(parseInt(T), "Wrong withdraw data!"), d)] | |
125 | + | else throw((("Withdrawal is possible after " + toString(Q)) + " height or you have already withdrawn USDT.")) | |
126 | + | } | |
127 | + | ||
128 | + | ||
129 | + | ||
130 | + | @Callable(K) | |
131 | + | func getWithdrawalFee () = throw("{\"fee\": 1}") | |
132 | + | ||
133 | + | ||
134 | + | ||
135 | + | @Callable(K) | |
136 | + | func getWithdrawalData (k,v) = { | |
137 | + | let N = B(k, v) | |
138 | + | let H = valueOrErrorMessage(N[0], "Wrong 'currentWithdrawals' method!") | |
139 | + | let I = valueOrErrorMessage(N[1], "Wrong 'currentWithdrawals' method!") | |
140 | + | let J = valueOrErrorMessage(N[2], "Wrong 'currentWithdrawals' method!") | |
141 | + | let O = ((I + H) - J) | |
142 | + | throw((((((((("{\"fee\": " + toString(J)) + ", \"toWithdrawWithFee\": ") + toString(I)) + ", \"toWithdrawWithoutFee\": ") + toString(H)) + ", \"total\": ") + toString(O)) + "}")) | |
143 | + | } | |
144 | + | ||
145 | + |
github/deemru/w8io/fabc49c 29.32 ms ◑