tx · CQ624XhFv88hV4RQHSUWcoFa3Np6mbgkZNVwn7txiLRS 3NADYuG3G91PrmsrRqQfyeDCf2Pi53UV5id: -0.01000000 Waves 2022.01.06 15:24 [1867036] smart account 3NADYuG3G91PrmsrRqQfyeDCf2Pi53UV5id > SELF 0.00000000 Waves
{ "type": 13, "id": "CQ624XhFv88hV4RQHSUWcoFa3Np6mbgkZNVwn7txiLRS", "fee": 1000000, "feeAssetId": null, "timestamp": 1641471868058, "version": 2, "chainId": 84, "sender": "3NADYuG3G91PrmsrRqQfyeDCf2Pi53UV5id", "senderPublicKey": "8agr5kfwDL7NLuMetvciXCcd9TcDKZhRwYZPPTAShaCC", "proofs": [ "2btAjLx62ippKS7JqLgAfKqXUGt2arm1MDqD2viHeVEF1faEXTwkR6oMTuAEJFcxofoxgx7SbpNEkFqVSdgRy8JN" ], "script": "base64:AAIFAAAAAAAAABgIAhIFCgMICAgSABIAEgASABIFCgMICAgAAAAMAAAAAA5rZXlCdXlVTFVTUmF0ZQIAAAANYnV5X1VMVVNfcmF0ZQAAAAAca2V5QnV5VUxVU1JhdGVTY2FsZURlbGltaXRlcgIAAAAdYnV5X1VMVVNfcmF0ZV9zY2FsZV9kZWxpbWl0ZXIAAAAAD2tleVNlbGxVTFVTUmF0ZQIAAAAOc2VsbF9VTFVTX3JhdGUAAAAAHWtleVNlbGxVTFVTUmF0ZVNjYWxlRGVsaW1pdGVyAgAAAB5zZWxsX1VMVVNfcmF0ZV9zY2FsZV9kZWxpbWl0ZXIAAAAADWtleU1ha2VORlRGZWUCAAAAEGtleV9tYWtlX05GVF9mZWUAAAAADWtleUNvbW1pc3Npb24CAAAACmNvbW1pc3Npb24AAAAAG2tleUNvbW1pc3Npb25TY2FsZURlbGltaXRlcgIAAAAaY29tbWlzc2lvbl9zY2FsZV9kZWxpbWl0ZXIAAAAABFVTRE4BAAAAIOSwcsQaO/7w9gk22WMNYWxRgCp4LSxG18pSVz66uVShAAAAAARVTFVTAQAAACBcOT9fCNS+B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kCQACWQAAAAEJAQAAABFAZXh0ck5hdGl2ZSgxMDUzKQAAAAIFAAAABHRoaXMFAAAACXByb2R1Y3RJZAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAABByZWNpcGllbnRBZGRyZXNzBQAAABdhbW91bnRXaXRob3V0Q29tbWlzc2lvbgUAAAAKcG10QXNzZXRJZAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAABFjb21taXNzaW9uQWRkcmVzcwUAAAAQYW1vdW50Q29tbWlzc2lvbgUAAAAKcG10QXNzZXRJZAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAADmFtb3VudENhc2hiYWNrBQAAAARVTFVTCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgAAAAAAAAAAAQUAAAAKTkZUYXNzZXRJZAUAAAADbmlsCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAAEHJlY2lwaWVudEFkZHJlc3MFAAAAF2Ftb3VudFdpdGhvdXRDb21taXNzaW9uBQAAAApwbXRBc3NldElkCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAAEWNvbW1pc3Npb25BZGRyZXNzBQAAABBhbW91bnRDb21taXNzaW9uBQAAAApwbXRBc3NldElkCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAAOYW1vdW50Q2FzaGJhY2sFAAAABFVMVVMFAAAAA25pbAAAAAD+0qZq", "height": 1867036, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: F1FsW4rDkF41sWwBUBtAE8vYPgjugEzp8W8YJVDGAPMd Next: CKng7NpEX9NphT1zT6CV3dH66qQsPUf74TxaGBq4mqX6 Diff:
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = "buy_ULUS_rate" | |
23 | 23 | ||
24 | 24 | let k = Address(base58'3P9pCG7EBbhAkTxJQkwp6oTyc12zghXGUBW') | |
25 | 25 | ||
26 | - | @Callable(l) | |
27 | - | func makeNFT (m,n,o) = { | |
28 | - | let p = $Tuple2(l.payments[0].amount, l.payments[0].assetId) | |
29 | - | let q = p._1 | |
30 | - | let r = p._2 | |
31 | - | let s = getIntegerValue(this, e) | |
32 | - | if ((r != j)) | |
26 | + | let l = base58'5fJ73uaebbc12bwCegVoRZgNKfn4BqpH8NB8Rs2NpBmg' | |
27 | + | ||
28 | + | @Callable(m) | |
29 | + | func makeNFT (n,o,p) = { | |
30 | + | let q = $Tuple2(m.payments[0].amount, m.payments[0].assetId) | |
31 | + | let r = q._1 | |
32 | + | let s = q._2 | |
33 | + | let t = getIntegerValue(this, e) | |
34 | + | if ((s != j)) | |
33 | 35 | then throw("Asset must be USDN only") | |
34 | - | else if (( | |
35 | - | then throw(("Fee for make NFT token is " + toString( | |
36 | - | else if (isDefined(getString(this, | |
36 | + | else if ((t > r)) | |
37 | + | then throw(("Fee for make NFT token is " + toString(t))) | |
38 | + | else if (isDefined(getString(this, p))) | |
37 | 39 | then throw("NFT for this productId is already issued.") | |
38 | 40 | else { | |
39 | - | let | |
40 | - | let | |
41 | - | [ | |
41 | + | let u = Issue(n, (((o + "[") + p) + "]"), 1, 0, false, unit, 0) | |
42 | + | let v = calculateAssetId(u) | |
43 | + | [u, StringEntry(p, toBase58String(v)), ScriptTransfer(k, r, s)] | |
42 | 44 | } | |
43 | 45 | } | |
44 | 46 | ||
45 | 47 | ||
46 | 48 | ||
47 | - | @Callable( | |
48 | - | func setParams () = if (( | |
49 | + | @Callable(m) | |
50 | + | func setParams () = if ((m.caller != this)) | |
49 | 51 | then throw("Only the DApp itself can call this function") | |
50 | 52 | else [IntegerEntry(a, 150000), IntegerEntry(b, 1000), IntegerEntry(c, 100000), IntegerEntry(d, 1000), IntegerEntry(f, 30000), IntegerEntry(g, 1000000), IntegerEntry(e, 1000000)] | |
51 | 53 | ||
52 | 54 | ||
53 | 55 | ||
54 | - | @Callable( | |
55 | - | func clearOldParams () = if (( | |
56 | + | @Callable(m) | |
57 | + | func clearOldParams () = if ((m.caller != this)) | |
56 | 58 | then throw("Only the DApp itself can call this function") | |
57 | 59 | else { | |
58 | - | let | |
59 | - | let | |
60 | - | let | |
61 | - | let | |
62 | - | [ | |
60 | + | let w = "buy_UWORLD_rate" | |
61 | + | let x = "buy_UWORLD_rate_scale_delimiter" | |
62 | + | let y = "sell_UWORLD_rate" | |
63 | + | let z = "sell_UWORLD_rate_scale_delimiter" | |
64 | + | [DeleteEntry(w), DeleteEntry(x), DeleteEntry(y), DeleteEntry(z)] | |
63 | 65 | } | |
64 | 66 | ||
65 | 67 | ||
66 | 68 | ||
67 | - | @Callable( | |
69 | + | @Callable(m) | |
68 | 70 | func buyULUS () = { | |
69 | - | let | |
70 | - | let | |
71 | - | let | |
72 | - | if (( | |
71 | + | let A = $Tuple2(m.payments[0].amount, m.payments[0].assetId) | |
72 | + | let r = A._1 | |
73 | + | let s = A._2 | |
74 | + | if ((s != j)) | |
73 | 75 | then throw("Asset must be USDN only") | |
74 | 76 | else { | |
75 | - | let | |
76 | - | let | |
77 | - | let | |
78 | - | let | |
79 | - | [ScriptTransfer( | |
77 | + | let B = getIntegerValue(this, a) | |
78 | + | let C = getIntegerValue(this, b) | |
79 | + | let D = fraction(r, C, B) | |
80 | + | let E = D | |
81 | + | [ScriptTransfer(m.caller, E, i)] | |
80 | 82 | } | |
81 | 83 | } | |
82 | 84 | ||
83 | 85 | ||
84 | 86 | ||
85 | - | @Callable( | |
87 | + | @Callable(m) | |
86 | 88 | func sellULUS () = { | |
87 | - | let | |
88 | - | let | |
89 | - | let | |
90 | - | if (( | |
89 | + | let F = $Tuple2(m.payments[0].amount, m.payments[0].assetId) | |
90 | + | let r = F._1 | |
91 | + | let s = F._2 | |
92 | + | if ((s != i)) | |
91 | 93 | then throw("Asset must be ULUS only") | |
92 | 94 | else { | |
93 | - | let | |
94 | - | let | |
95 | - | let | |
96 | - | let | |
97 | - | [ScriptTransfer( | |
95 | + | let B = getIntegerValue(this, c) | |
96 | + | let C = getIntegerValue(this, d) | |
97 | + | let D = fraction(r, B, C) | |
98 | + | let E = D | |
99 | + | [ScriptTransfer(m.caller, E, h)] | |
98 | 100 | } | |
99 | 101 | } | |
100 | 102 | ||
101 | 103 | ||
102 | 104 | ||
103 | - | @Callable(l) | |
104 | - | func makePayment (F,o,G) = { | |
105 | - | let H = addressFromStringValue(F) | |
106 | - | let I = $Tuple2(l.payments[0].amount, l.payments[0].assetId) | |
107 | - | let q = I._1 | |
108 | - | let r = I._2 | |
109 | - | if (if ((r != h)) | |
110 | - | then (r != i) | |
111 | - | else false) | |
112 | - | then throw("Asset must be only USDN or ULUS") | |
113 | - | else { | |
114 | - | let J = getIntegerValue(this, f) | |
115 | - | let K = getIntegerValue(this, g) | |
116 | - | let L = fraction(q, J, K) | |
117 | - | let D = (q - L) | |
118 | - | let M = if ((r == h)) | |
119 | - | then 1000000 | |
120 | - | else 1000 | |
121 | - | let N = fraction(q, 100, M) | |
122 | - | if (isDefined(getString(this, o))) | |
123 | - | then { | |
124 | - | let O = fromBase58String(getStringValue(this, o)) | |
125 | - | [ScriptTransfer(H, D, r), ScriptTransfer(k, L, r), ScriptTransfer(l.caller, N, i), ScriptTransfer(l.caller, 1, O)] | |
126 | - | } | |
127 | - | else [ScriptTransfer(H, D, r), ScriptTransfer(k, L, r), ScriptTransfer(l.caller, N, i)] | |
128 | - | } | |
105 | + | @Callable(m) | |
106 | + | func makePayment (G,p,H) = { | |
107 | + | let I = addressFromStringValue(G) | |
108 | + | let J = $Tuple2(m.payments[0].amount, m.payments[0].assetId) | |
109 | + | let r = J._1 | |
110 | + | let s = J._2 | |
111 | + | let K = makeString([toString(this), toString(r)], ";") | |
112 | + | if (!(sigVerify_8Kb(toBytes(K), fromBase58String(H), l))) | |
113 | + | then throw("Invalid proof from backend") | |
114 | + | else if (if ((s != h)) | |
115 | + | then (s != i) | |
116 | + | else false) | |
117 | + | then throw("Asset must be only USDN or ULUS") | |
118 | + | else { | |
119 | + | let L = getIntegerValue(this, f) | |
120 | + | let M = getIntegerValue(this, g) | |
121 | + | let N = fraction(r, L, M) | |
122 | + | let E = (r - N) | |
123 | + | let O = if ((s == h)) | |
124 | + | then 1000000 | |
125 | + | else 1000 | |
126 | + | let P = fraction(r, 100, O) | |
127 | + | if (isDefined(getString(this, p))) | |
128 | + | then { | |
129 | + | let Q = fromBase58String(getStringValue(this, p)) | |
130 | + | [ScriptTransfer(I, E, s), ScriptTransfer(k, N, s), ScriptTransfer(m.caller, P, i), ScriptTransfer(m.caller, 1, Q)] | |
131 | + | } | |
132 | + | else [ScriptTransfer(I, E, s), ScriptTransfer(k, N, s), ScriptTransfer(m.caller, P, i)] | |
133 | + | } | |
129 | 134 | } | |
130 | 135 | ||
131 | 136 |
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = "buy_ULUS_rate" | |
5 | 5 | ||
6 | 6 | let b = "buy_ULUS_rate_scale_delimiter" | |
7 | 7 | ||
8 | 8 | let c = "sell_ULUS_rate" | |
9 | 9 | ||
10 | 10 | let d = "sell_ULUS_rate_scale_delimiter" | |
11 | 11 | ||
12 | 12 | let e = "key_make_NFT_fee" | |
13 | 13 | ||
14 | 14 | let f = "commission" | |
15 | 15 | ||
16 | 16 | let g = "commission_scale_delimiter" | |
17 | 17 | ||
18 | 18 | let h = base58'GPi1Q6QVgUmuomtThbim81hBYBEUWyf5BVmE4Tnd3sNg' | |
19 | 19 | ||
20 | 20 | let i = base58'7D191wpwpSs4WanizHWgiRhAYhCGkmpop4h3NzUQreig' | |
21 | 21 | ||
22 | 22 | let j = h | |
23 | 23 | ||
24 | 24 | let k = Address(base58'3P9pCG7EBbhAkTxJQkwp6oTyc12zghXGUBW') | |
25 | 25 | ||
26 | - | @Callable(l) | |
27 | - | func makeNFT (m,n,o) = { | |
28 | - | let p = $Tuple2(l.payments[0].amount, l.payments[0].assetId) | |
29 | - | let q = p._1 | |
30 | - | let r = p._2 | |
31 | - | let s = getIntegerValue(this, e) | |
32 | - | if ((r != j)) | |
26 | + | let l = base58'5fJ73uaebbc12bwCegVoRZgNKfn4BqpH8NB8Rs2NpBmg' | |
27 | + | ||
28 | + | @Callable(m) | |
29 | + | func makeNFT (n,o,p) = { | |
30 | + | let q = $Tuple2(m.payments[0].amount, m.payments[0].assetId) | |
31 | + | let r = q._1 | |
32 | + | let s = q._2 | |
33 | + | let t = getIntegerValue(this, e) | |
34 | + | if ((s != j)) | |
33 | 35 | then throw("Asset must be USDN only") | |
34 | - | else if (( | |
35 | - | then throw(("Fee for make NFT token is " + toString( | |
36 | - | else if (isDefined(getString(this, | |
36 | + | else if ((t > r)) | |
37 | + | then throw(("Fee for make NFT token is " + toString(t))) | |
38 | + | else if (isDefined(getString(this, p))) | |
37 | 39 | then throw("NFT for this productId is already issued.") | |
38 | 40 | else { | |
39 | - | let | |
40 | - | let | |
41 | - | [ | |
41 | + | let u = Issue(n, (((o + "[") + p) + "]"), 1, 0, false, unit, 0) | |
42 | + | let v = calculateAssetId(u) | |
43 | + | [u, StringEntry(p, toBase58String(v)), ScriptTransfer(k, r, s)] | |
42 | 44 | } | |
43 | 45 | } | |
44 | 46 | ||
45 | 47 | ||
46 | 48 | ||
47 | - | @Callable( | |
48 | - | func setParams () = if (( | |
49 | + | @Callable(m) | |
50 | + | func setParams () = if ((m.caller != this)) | |
49 | 51 | then throw("Only the DApp itself can call this function") | |
50 | 52 | else [IntegerEntry(a, 150000), IntegerEntry(b, 1000), IntegerEntry(c, 100000), IntegerEntry(d, 1000), IntegerEntry(f, 30000), IntegerEntry(g, 1000000), IntegerEntry(e, 1000000)] | |
51 | 53 | ||
52 | 54 | ||
53 | 55 | ||
54 | - | @Callable( | |
55 | - | func clearOldParams () = if (( | |
56 | + | @Callable(m) | |
57 | + | func clearOldParams () = if ((m.caller != this)) | |
56 | 58 | then throw("Only the DApp itself can call this function") | |
57 | 59 | else { | |
58 | - | let | |
59 | - | let | |
60 | - | let | |
61 | - | let | |
62 | - | [ | |
60 | + | let w = "buy_UWORLD_rate" | |
61 | + | let x = "buy_UWORLD_rate_scale_delimiter" | |
62 | + | let y = "sell_UWORLD_rate" | |
63 | + | let z = "sell_UWORLD_rate_scale_delimiter" | |
64 | + | [DeleteEntry(w), DeleteEntry(x), DeleteEntry(y), DeleteEntry(z)] | |
63 | 65 | } | |
64 | 66 | ||
65 | 67 | ||
66 | 68 | ||
67 | - | @Callable( | |
69 | + | @Callable(m) | |
68 | 70 | func buyULUS () = { | |
69 | - | let | |
70 | - | let | |
71 | - | let | |
72 | - | if (( | |
71 | + | let A = $Tuple2(m.payments[0].amount, m.payments[0].assetId) | |
72 | + | let r = A._1 | |
73 | + | let s = A._2 | |
74 | + | if ((s != j)) | |
73 | 75 | then throw("Asset must be USDN only") | |
74 | 76 | else { | |
75 | - | let | |
76 | - | let | |
77 | - | let | |
78 | - | let | |
79 | - | [ScriptTransfer( | |
77 | + | let B = getIntegerValue(this, a) | |
78 | + | let C = getIntegerValue(this, b) | |
79 | + | let D = fraction(r, C, B) | |
80 | + | let E = D | |
81 | + | [ScriptTransfer(m.caller, E, i)] | |
80 | 82 | } | |
81 | 83 | } | |
82 | 84 | ||
83 | 85 | ||
84 | 86 | ||
85 | - | @Callable( | |
87 | + | @Callable(m) | |
86 | 88 | func sellULUS () = { | |
87 | - | let | |
88 | - | let | |
89 | - | let | |
90 | - | if (( | |
89 | + | let F = $Tuple2(m.payments[0].amount, m.payments[0].assetId) | |
90 | + | let r = F._1 | |
91 | + | let s = F._2 | |
92 | + | if ((s != i)) | |
91 | 93 | then throw("Asset must be ULUS only") | |
92 | 94 | else { | |
93 | - | let | |
94 | - | let | |
95 | - | let | |
96 | - | let | |
97 | - | [ScriptTransfer( | |
95 | + | let B = getIntegerValue(this, c) | |
96 | + | let C = getIntegerValue(this, d) | |
97 | + | let D = fraction(r, B, C) | |
98 | + | let E = D | |
99 | + | [ScriptTransfer(m.caller, E, h)] | |
98 | 100 | } | |
99 | 101 | } | |
100 | 102 | ||
101 | 103 | ||
102 | 104 | ||
103 | - | @Callable(l) | |
104 | - | func makePayment (F,o,G) = { | |
105 | - | let H = addressFromStringValue(F) | |
106 | - | let I = $Tuple2(l.payments[0].amount, l.payments[0].assetId) | |
107 | - | let q = I._1 | |
108 | - | let r = I._2 | |
109 | - | if (if ((r != h)) | |
110 | - | then (r != i) | |
111 | - | else false) | |
112 | - | then throw("Asset must be only USDN or ULUS") | |
113 | - | else { | |
114 | - | let J = getIntegerValue(this, f) | |
115 | - | let K = getIntegerValue(this, g) | |
116 | - | let L = fraction(q, J, K) | |
117 | - | let D = (q - L) | |
118 | - | let M = if ((r == h)) | |
119 | - | then 1000000 | |
120 | - | else 1000 | |
121 | - | let N = fraction(q, 100, M) | |
122 | - | if (isDefined(getString(this, o))) | |
123 | - | then { | |
124 | - | let O = fromBase58String(getStringValue(this, o)) | |
125 | - | [ScriptTransfer(H, D, r), ScriptTransfer(k, L, r), ScriptTransfer(l.caller, N, i), ScriptTransfer(l.caller, 1, O)] | |
126 | - | } | |
127 | - | else [ScriptTransfer(H, D, r), ScriptTransfer(k, L, r), ScriptTransfer(l.caller, N, i)] | |
128 | - | } | |
105 | + | @Callable(m) | |
106 | + | func makePayment (G,p,H) = { | |
107 | + | let I = addressFromStringValue(G) | |
108 | + | let J = $Tuple2(m.payments[0].amount, m.payments[0].assetId) | |
109 | + | let r = J._1 | |
110 | + | let s = J._2 | |
111 | + | let K = makeString([toString(this), toString(r)], ";") | |
112 | + | if (!(sigVerify_8Kb(toBytes(K), fromBase58String(H), l))) | |
113 | + | then throw("Invalid proof from backend") | |
114 | + | else if (if ((s != h)) | |
115 | + | then (s != i) | |
116 | + | else false) | |
117 | + | then throw("Asset must be only USDN or ULUS") | |
118 | + | else { | |
119 | + | let L = getIntegerValue(this, f) | |
120 | + | let M = getIntegerValue(this, g) | |
121 | + | let N = fraction(r, L, M) | |
122 | + | let E = (r - N) | |
123 | + | let O = if ((s == h)) | |
124 | + | then 1000000 | |
125 | + | else 1000 | |
126 | + | let P = fraction(r, 100, O) | |
127 | + | if (isDefined(getString(this, p))) | |
128 | + | then { | |
129 | + | let Q = fromBase58String(getStringValue(this, p)) | |
130 | + | [ScriptTransfer(I, E, s), ScriptTransfer(k, N, s), ScriptTransfer(m.caller, P, i), ScriptTransfer(m.caller, 1, Q)] | |
131 | + | } | |
132 | + | else [ScriptTransfer(I, E, s), ScriptTransfer(k, N, s), ScriptTransfer(m.caller, P, i)] | |
133 | + | } | |
129 | 134 | } | |
130 | 135 | ||
131 | 136 |
github/deemru/w8io/169f3d6 67.06 ms ◑