tx · GEyqwWqGD7fMumMS1mdxgm4Eu2w4GMbZNz8eDbGms79

3Mz9N7YPfZPWGd4yYaX6H53Gcgrq6ifYiH7:  -0.01400000 Waves

2020.10.20 14:10 [1228811] smart account 3Mz9N7YPfZPWGd4yYaX6H53Gcgrq6ifYiH7 > SELF 0.00000000 Waves

{ "type": 13, "id": "GEyqwWqGD7fMumMS1mdxgm4Eu2w4GMbZNz8eDbGms79", "fee": 1400000, "feeAssetId": null, "timestamp": 1603192287084, "version": 2, "chainId": 84, "sender": "3Mz9N7YPfZPWGd4yYaX6H53Gcgrq6ifYiH7", "senderPublicKey": "2M25DqL2W4rGFLCFadgATboS8EPqyWAN3DjH12AH5Kdr", "proofs": [ "5gK94hMic5tFbFxAs69DpZSJ6dHT6kDzLZhQCH4LJxhgXquFRVkTsoU63GvvvXkqQ99EPNuc7bwJotjsD6jWzDYV" ], "script": null, "height": 1228811, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Ej65HjZ7QwACCjJpmcyJcprMN6HJJ6jdAreoFKw34ygC Next: J8MDZxsXUWhDtmyYh9bbtAsKaHvHtatenzjNqfG3j7bw Full:
OldNewDifferences
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-
1+# no script

github/deemru/w8io/3ef1775 
39.07 ms