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