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