tx · AQL6ZWm8ZTqQTt3n821DVYkPYMooH4y8bcSDs6GoA3vD 3NADYuG3G91PrmsrRqQfyeDCf2Pi53UV5id: -0.01400000 Waves 2021.05.19 02:52 [1531803] smart account 3NADYuG3G91PrmsrRqQfyeDCf2Pi53UV5id > SELF 0.00000000 Waves
{ "type": 13, "id": "AQL6ZWm8ZTqQTt3n821DVYkPYMooH4y8bcSDs6GoA3vD", "fee": 1400000, "feeAssetId": null, "timestamp": 1621381970168, "version": 2, "chainId": 84, "sender": "3NADYuG3G91PrmsrRqQfyeDCf2Pi53UV5id", "senderPublicKey": "8agr5kfwDL7NLuMetvciXCcd9TcDKZhRwYZPPTAShaCC", "proofs": [ "56uXaBpLwDhoLRSwvnqHyLNU9wqUKqGSNWPr7tkjU8REpsooj2McFZi6vUcX5wag4DV4Ju6TUHqtUeUgMPMQkUEd" ], "script": "base64:AAIEAAAAAAAAABkIAhIFCgMICAgSBAoCAQESABIAEgQKAggIAAAACgAAAAAPa2V5RXhjaGFuZ2VSYXRlAgAAAA1leGNoYW5nZV9yYXRlAAAAAB1rZXlFeGNoYW5nZVJhdGVTY2FsZURlbGltaXRlcgIAAAAdZXhjaGFuZ2VfcmF0ZV9zY2FsZV9kZWxpbWl0ZXIAAAAADWtleUNvbW1pc3Npb24CAAAACmNvbW1pc3Npb24AAAAAG2tleUNvbW1pc3Npb25TY2FsZURlbGltaXRlcgIAAAAaY29tbWlzc2lvbl9zY2FsZV9kZWxpbWl0ZXIAAAAABFVTRE4BAAAAIOSwcsQaO/7w9gk22WMNYWxRgCp4LSxG18pSVz66uVShAAAAAAZVV09STEQBAAAAIFw5P18I1L4GAMZe978MAfIh+BM42SxhQKId1T0PstxdAAAAAAdhc3NldElkBQAAAARVU0ROAAAAAApjb21taXNzaW9uAAAAAAAAAHUwAAAAABhjb21taXNzaW9uU2NhbGVEZWxpbWl0ZXIAAAAAAAAPQkAAAAAACm1ha2VORlRmZWUAAAAAAAAHoSAAAAAFAAAAAWkBAAAAB21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bnRBZGRyZXNzBQAAAA5hbW91bnRDYXNoYmFjawUAAAAGVVdPUkxECQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAAOYW1vdW50Q2FzaGJhY2sFAAAABlVXT1JMRAUAAAADbmlsAAAAAOdVtZA=", "height": 1531803, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 91CsdXtbeQHMztpYnZhp3XaYbogqXCxGR12YEtKmDh9o Next: 89nPJifB1jkjboZ8cuba1sms6BbasLPyJzpcXrDHsRqS Diff:
Old | New | Differences | |
---|---|---|---|
19 | 19 | ||
20 | 20 | let i = 1000000 | |
21 | 21 | ||
22 | - | @Callable(j) | |
23 | - | func setParams (k,l) = if ((j.caller != this)) | |
24 | - | then throw("Only the DApp itself can call this function") | |
25 | - | else [IntegerEntry(a, k), IntegerEntry(b, l), IntegerEntry(c, h), IntegerEntry(d, i)] | |
22 | + | let j = 500000 | |
23 | + | ||
24 | + | @Callable(k) | |
25 | + | func makeNFT (l,m,n) = { | |
26 | + | let o = $Tuple2(k.payments[0].amount, k.payments[0].assetId) | |
27 | + | let p = o._1 | |
28 | + | let q = o._2 | |
29 | + | if ((q != g)) | |
30 | + | then throw("Asset must be USDN only") | |
31 | + | else if ((j > p)) | |
32 | + | then throw(("Fee for make NFT token is " + toString(j))) | |
33 | + | else if (isDefined(getString(this, n))) | |
34 | + | then throw("NFT for this productId is already issued.") | |
35 | + | else { | |
36 | + | let r = Issue(l, (((m + "[") + n) + "]"), 1, 0, true, unit, 0) | |
37 | + | let s = calculateAssetId(r) | |
38 | + | [r, StringEntry(n, toBase58String(s))] | |
39 | + | } | |
40 | + | } | |
26 | 41 | ||
27 | 42 | ||
28 | 43 | ||
29 | - | @Callable(j) | |
44 | + | @Callable(k) | |
45 | + | func setParams (t,u) = if ((k.caller != this)) | |
46 | + | then throw("Only the DApp itself can call this function") | |
47 | + | else [IntegerEntry(a, t), IntegerEntry(b, u), IntegerEntry(c, h), IntegerEntry(d, i)] | |
48 | + | ||
49 | + | ||
50 | + | ||
51 | + | @Callable(k) | |
30 | 52 | func buyUWORLD () = { | |
31 | - | let | |
32 | - | let | |
33 | - | let | |
34 | - | if (( | |
53 | + | let v = $Tuple2(k.payments[0].amount, k.payments[0].assetId) | |
54 | + | let p = v._1 | |
55 | + | let q = v._2 | |
56 | + | if ((q != g)) | |
35 | 57 | then throw("Asset must be USDN only") | |
36 | 58 | else { | |
37 | - | let | |
38 | - | let | |
39 | - | let | |
40 | - | let | |
41 | - | let | |
42 | - | [ScriptTransfer( | |
59 | + | let t = getIntegerValue(this, a) | |
60 | + | let u = getIntegerValue(this, b) | |
61 | + | let w = fraction(p, u, t) | |
62 | + | let x = fraction(w, h, i) | |
63 | + | let y = (w - x) | |
64 | + | [ScriptTransfer(k.caller, y, f)] | |
43 | 65 | } | |
44 | 66 | } | |
45 | 67 | ||
46 | 68 | ||
47 | 69 | ||
48 | - | @Callable( | |
70 | + | @Callable(k) | |
49 | 71 | func sellUWORLD () = { | |
50 | - | let | |
51 | - | let | |
52 | - | let | |
53 | - | if (( | |
72 | + | let z = $Tuple2(k.payments[0].amount, k.payments[0].assetId) | |
73 | + | let p = z._1 | |
74 | + | let q = z._2 | |
75 | + | if ((q != f)) | |
54 | 76 | then throw("Asset must be UWORLD only") | |
55 | 77 | else { | |
56 | - | let | |
57 | - | let | |
58 | - | let | |
59 | - | let | |
60 | - | let | |
61 | - | [ScriptTransfer( | |
78 | + | let t = getIntegerValue(this, a) | |
79 | + | let u = getIntegerValue(this, b) | |
80 | + | let w = fraction(p, t, u) | |
81 | + | let x = fraction(w, h, i) | |
82 | + | let y = (w - x) | |
83 | + | [ScriptTransfer(k.caller, y, e)] | |
62 | 84 | } | |
63 | 85 | } | |
64 | 86 | ||
65 | 87 | ||
66 | 88 | ||
67 | - | @Callable( | |
68 | - | func makePayment ( | |
69 | - | let | |
70 | - | let | |
71 | - | let | |
72 | - | let | |
73 | - | if (( | |
89 | + | @Callable(k) | |
90 | + | func makePayment (A,n) = { | |
91 | + | let B = addressFromStringValue(A) | |
92 | + | let C = $Tuple2(k.payments[0].amount, k.payments[0].assetId) | |
93 | + | let p = C._1 | |
94 | + | let q = C._2 | |
95 | + | if ((q != g)) | |
74 | 96 | then throw("Asset must be USDN only") | |
75 | 97 | else { | |
76 | - | let q = fraction(n, h, i) | |
77 | - | let r = (n - q) | |
78 | - | let w = fraction(n, 10, 100) | |
79 | - | [ScriptTransfer(u, r, g), ScriptTransfer(u, w, f), ScriptTransfer(j.caller, w, f)] | |
98 | + | let x = fraction(p, h, i) | |
99 | + | let y = (p - x) | |
100 | + | let D = fraction(p, 10, 100) | |
101 | + | let E = fromBase58String(getStringValue(this, n)) | |
102 | + | if (isDefined(E)) | |
103 | + | then [ScriptTransfer(B, y, g), ScriptTransfer(B, D, f), ScriptTransfer(k.caller, D, f), ScriptTransfer(k.caller, 1, E)] | |
104 | + | else [ScriptTransfer(B, y, g), ScriptTransfer(B, D, f), ScriptTransfer(k.caller, D, f)] | |
80 | 105 | } | |
81 | 106 | } | |
82 | 107 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = "exchange_rate" | |
5 | 5 | ||
6 | 6 | let b = "exchange_rate_scale_delimiter" | |
7 | 7 | ||
8 | 8 | let c = "commission" | |
9 | 9 | ||
10 | 10 | let d = "commission_scale_delimiter" | |
11 | 11 | ||
12 | 12 | let e = base58'GPi1Q6QVgUmuomtThbim81hBYBEUWyf5BVmE4Tnd3sNg' | |
13 | 13 | ||
14 | 14 | let f = base58'7D191wpwpSs4WanizHWgiRhAYhCGkmpop4h3NzUQreig' | |
15 | 15 | ||
16 | 16 | let g = e | |
17 | 17 | ||
18 | 18 | let h = 30000 | |
19 | 19 | ||
20 | 20 | let i = 1000000 | |
21 | 21 | ||
22 | - | @Callable(j) | |
23 | - | func setParams (k,l) = if ((j.caller != this)) | |
24 | - | then throw("Only the DApp itself can call this function") | |
25 | - | else [IntegerEntry(a, k), IntegerEntry(b, l), IntegerEntry(c, h), IntegerEntry(d, i)] | |
22 | + | let j = 500000 | |
23 | + | ||
24 | + | @Callable(k) | |
25 | + | func makeNFT (l,m,n) = { | |
26 | + | let o = $Tuple2(k.payments[0].amount, k.payments[0].assetId) | |
27 | + | let p = o._1 | |
28 | + | let q = o._2 | |
29 | + | if ((q != g)) | |
30 | + | then throw("Asset must be USDN only") | |
31 | + | else if ((j > p)) | |
32 | + | then throw(("Fee for make NFT token is " + toString(j))) | |
33 | + | else if (isDefined(getString(this, n))) | |
34 | + | then throw("NFT for this productId is already issued.") | |
35 | + | else { | |
36 | + | let r = Issue(l, (((m + "[") + n) + "]"), 1, 0, true, unit, 0) | |
37 | + | let s = calculateAssetId(r) | |
38 | + | [r, StringEntry(n, toBase58String(s))] | |
39 | + | } | |
40 | + | } | |
26 | 41 | ||
27 | 42 | ||
28 | 43 | ||
29 | - | @Callable(j) | |
44 | + | @Callable(k) | |
45 | + | func setParams (t,u) = if ((k.caller != this)) | |
46 | + | then throw("Only the DApp itself can call this function") | |
47 | + | else [IntegerEntry(a, t), IntegerEntry(b, u), IntegerEntry(c, h), IntegerEntry(d, i)] | |
48 | + | ||
49 | + | ||
50 | + | ||
51 | + | @Callable(k) | |
30 | 52 | func buyUWORLD () = { | |
31 | - | let | |
32 | - | let | |
33 | - | let | |
34 | - | if (( | |
53 | + | let v = $Tuple2(k.payments[0].amount, k.payments[0].assetId) | |
54 | + | let p = v._1 | |
55 | + | let q = v._2 | |
56 | + | if ((q != g)) | |
35 | 57 | then throw("Asset must be USDN only") | |
36 | 58 | else { | |
37 | - | let | |
38 | - | let | |
39 | - | let | |
40 | - | let | |
41 | - | let | |
42 | - | [ScriptTransfer( | |
59 | + | let t = getIntegerValue(this, a) | |
60 | + | let u = getIntegerValue(this, b) | |
61 | + | let w = fraction(p, u, t) | |
62 | + | let x = fraction(w, h, i) | |
63 | + | let y = (w - x) | |
64 | + | [ScriptTransfer(k.caller, y, f)] | |
43 | 65 | } | |
44 | 66 | } | |
45 | 67 | ||
46 | 68 | ||
47 | 69 | ||
48 | - | @Callable( | |
70 | + | @Callable(k) | |
49 | 71 | func sellUWORLD () = { | |
50 | - | let | |
51 | - | let | |
52 | - | let | |
53 | - | if (( | |
72 | + | let z = $Tuple2(k.payments[0].amount, k.payments[0].assetId) | |
73 | + | let p = z._1 | |
74 | + | let q = z._2 | |
75 | + | if ((q != f)) | |
54 | 76 | then throw("Asset must be UWORLD only") | |
55 | 77 | else { | |
56 | - | let | |
57 | - | let | |
58 | - | let | |
59 | - | let | |
60 | - | let | |
61 | - | [ScriptTransfer( | |
78 | + | let t = getIntegerValue(this, a) | |
79 | + | let u = getIntegerValue(this, b) | |
80 | + | let w = fraction(p, t, u) | |
81 | + | let x = fraction(w, h, i) | |
82 | + | let y = (w - x) | |
83 | + | [ScriptTransfer(k.caller, y, e)] | |
62 | 84 | } | |
63 | 85 | } | |
64 | 86 | ||
65 | 87 | ||
66 | 88 | ||
67 | - | @Callable( | |
68 | - | func makePayment ( | |
69 | - | let | |
70 | - | let | |
71 | - | let | |
72 | - | let | |
73 | - | if (( | |
89 | + | @Callable(k) | |
90 | + | func makePayment (A,n) = { | |
91 | + | let B = addressFromStringValue(A) | |
92 | + | let C = $Tuple2(k.payments[0].amount, k.payments[0].assetId) | |
93 | + | let p = C._1 | |
94 | + | let q = C._2 | |
95 | + | if ((q != g)) | |
74 | 96 | then throw("Asset must be USDN only") | |
75 | 97 | else { | |
76 | - | let q = fraction(n, h, i) | |
77 | - | let r = (n - q) | |
78 | - | let w = fraction(n, 10, 100) | |
79 | - | [ScriptTransfer(u, r, g), ScriptTransfer(u, w, f), ScriptTransfer(j.caller, w, f)] | |
98 | + | let x = fraction(p, h, i) | |
99 | + | let y = (p - x) | |
100 | + | let D = fraction(p, 10, 100) | |
101 | + | let E = fromBase58String(getStringValue(this, n)) | |
102 | + | if (isDefined(E)) | |
103 | + | then [ScriptTransfer(B, y, g), ScriptTransfer(B, D, f), ScriptTransfer(k.caller, D, f), ScriptTransfer(k.caller, 1, E)] | |
104 | + | else [ScriptTransfer(B, y, g), ScriptTransfer(B, D, f), ScriptTransfer(k.caller, D, f)] | |
80 | 105 | } | |
81 | 106 | } | |
82 | 107 | ||
83 | 108 |
github/deemru/w8io/026f985 36.56 ms ◑