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