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