tx · HVQkHsLULXyUXPMTB6KDw2uL6VToLhF6wpD6LoyVcVB5 3NADYuG3G91PrmsrRqQfyeDCf2Pi53UV5id: -0.01400000 Waves 2021.05.19 20:45 [1532862] smart account 3NADYuG3G91PrmsrRqQfyeDCf2Pi53UV5id > SELF 0.00000000 Waves
{ "type": 13, "id": "HVQkHsLULXyUXPMTB6KDw2uL6VToLhF6wpD6LoyVcVB5", "fee": 1400000, "feeAssetId": null, "timestamp": 1621446372695, "version": 2, "chainId": 84, "sender": "3NADYuG3G91PrmsrRqQfyeDCf2Pi53UV5id", "senderPublicKey": "8agr5kfwDL7NLuMetvciXCcd9TcDKZhRwYZPPTAShaCC", "proofs": [ "5PLHSrVWR8Kt2troJR8Nz66SZZoTA2Z16QCm2wwJMkaPRuAVoRyW3QLYbmMXqALhZiJbQDQvpyEjcXvgs7S2Mdoz" ], "script": "base64:AAIEAAAAAAAAABkIAhIFCgMICAgSBAoCAQESABIAEgQKAggIAAAACgAAAAAPa2V5RXhjaGFuZ2VSYXRlAgAAAA1leGNoYW5nZV9yYXRlAAAAAB1rZXlFeGNoYW5nZVJhdGVTY2FsZURlbGltaXRlcgIAAAAdZXhjaGFuZ2VfcmF0ZV9zY2FsZV9kZWxpbWl0ZXIAAAAADWtleUNvbW1pc3Npb24CAAAACmNvbW1pc3Npb24AAAAAG2tleUNvbW1pc3Npb25TY2FsZURlbGltaXRlcgIAAAAaY29tbWlzc2lvbl9zY2FsZV9kZWxpbWl0ZXIAAAAABFVTRE4BAAAAIOSwcsQaO/7w9gk22WMNYWxRgCp4LSxG18pSVz66uVShAAAAAAZVV09STEQBAAAAIFw5P18I1L4GAMZe978MAfIh+BM42SxhQKId1T0PstxdAAAAAAdhc3NldElkBQAAAARVU0ROAAAAAApjb21taXNzaW9uAAAAAAAAAHUwAAAAABhjb21taXNzaW9uU2NhbGVEZWxpbWl0ZXIAAAAAAAAPQkAAAAAACm1ha2VORlRmZWUAAAAAAAAPQkAAAAAFAAAAAWkBAAAAB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", "height": 1532862, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BK7R1AQkZxZy2wzVvBz2hJhT5pJHheV5SNfJ7pcV5Jv9 Next: 7mCQXQpfg9qRiQFn37vmeynCp4PdaGoRT47G3GbkxW91 Diff:
Old | New | Differences | |
---|---|---|---|
101 | 101 | if (isDefined(getString(this, productId))) | |
102 | 102 | then { | |
103 | 103 | let NFTassetId = fromBase58String(getStringValue(this, productId)) | |
104 | - | [ScriptTransfer(recipientAddress, amountWithoutCommission, assetId | |
104 | + | [ScriptTransfer(recipientAddress, amountWithoutCommission, assetId), ScriptTransfer(i.caller, amountCashback, UWORLD), ScriptTransfer(i.caller, 1, NFTassetId)] | |
105 | 105 | } | |
106 | - | else [ScriptTransfer(recipientAddress, amountWithoutCommission, assetId), ScriptTransfer( | |
106 | + | else [ScriptTransfer(recipientAddress, amountWithoutCommission, assetId), ScriptTransfer(i.caller, amountCashback, UWORLD)] | |
107 | 107 | } | |
108 | 108 | } | |
109 | 109 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let keyExchangeRate = "exchange_rate" | |
5 | 5 | ||
6 | 6 | let keyExchangeRateScaleDelimiter = "exchange_rate_scale_delimiter" | |
7 | 7 | ||
8 | 8 | let keyCommission = "commission" | |
9 | 9 | ||
10 | 10 | let keyCommissionScaleDelimiter = "commission_scale_delimiter" | |
11 | 11 | ||
12 | 12 | let USDN = base58'GPi1Q6QVgUmuomtThbim81hBYBEUWyf5BVmE4Tnd3sNg' | |
13 | 13 | ||
14 | 14 | let UWORLD = base58'7D191wpwpSs4WanizHWgiRhAYhCGkmpop4h3NzUQreig' | |
15 | 15 | ||
16 | 16 | let assetId = USDN | |
17 | 17 | ||
18 | 18 | let commission = 30000 | |
19 | 19 | ||
20 | 20 | let commissionScaleDelimiter = 1000000 | |
21 | 21 | ||
22 | 22 | let makeNFTfee = 1000000 | |
23 | 23 | ||
24 | 24 | @Callable(i) | |
25 | 25 | func makeNFT (name,description,productId) = { | |
26 | 26 | let $t0864939 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
27 | 27 | let pmtAmount = $t0864939._1 | |
28 | 28 | let pmtAssetId = $t0864939._2 | |
29 | 29 | if ((pmtAssetId != assetId)) | |
30 | 30 | then throw("Asset must be USDN only") | |
31 | 31 | else if ((makeNFTfee > pmtAmount)) | |
32 | 32 | then throw(("Fee for make NFT token is " + toString(makeNFTfee))) | |
33 | 33 | else if (isDefined(getString(this, productId))) | |
34 | 34 | then throw("NFT for this productId is already issued.") | |
35 | 35 | else { | |
36 | 36 | let newAsset = Issue(name, (((description + "[") + productId) + "]"), 1, 0, false, unit, 0) | |
37 | 37 | let newAssetId = calculateAssetId(newAsset) | |
38 | 38 | [newAsset, StringEntry(productId, toBase58String(newAssetId))] | |
39 | 39 | } | |
40 | 40 | } | |
41 | 41 | ||
42 | 42 | ||
43 | 43 | ||
44 | 44 | @Callable(i) | |
45 | 45 | func setParams (exchangeRate,exchangeRateScaleDelimiter) = if ((i.caller != this)) | |
46 | 46 | then throw("Only the DApp itself can call this function") | |
47 | 47 | else [IntegerEntry(keyExchangeRate, exchangeRate), IntegerEntry(keyExchangeRateScaleDelimiter, exchangeRateScaleDelimiter), IntegerEntry(keyCommission, commission), IntegerEntry(keyCommissionScaleDelimiter, commissionScaleDelimiter)] | |
48 | 48 | ||
49 | 49 | ||
50 | 50 | ||
51 | 51 | @Callable(i) | |
52 | 52 | func buyUWORLD () = { | |
53 | 53 | let $t019302005 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
54 | 54 | let pmtAmount = $t019302005._1 | |
55 | 55 | let pmtAssetId = $t019302005._2 | |
56 | 56 | if ((pmtAssetId != assetId)) | |
57 | 57 | then throw("Asset must be USDN only") | |
58 | 58 | else { | |
59 | 59 | let exchangeRate = getIntegerValue(this, keyExchangeRate) | |
60 | 60 | let exchangeRateScaleDelimiter = getIntegerValue(this, keyExchangeRateScaleDelimiter) | |
61 | 61 | let amountToPay = fraction(pmtAmount, exchangeRateScaleDelimiter, exchangeRate) | |
62 | 62 | let amountCommission = fraction(amountToPay, commission, commissionScaleDelimiter) | |
63 | 63 | let amountWithoutCommission = (amountToPay - amountCommission) | |
64 | 64 | [ScriptTransfer(i.caller, amountWithoutCommission, UWORLD)] | |
65 | 65 | } | |
66 | 66 | } | |
67 | 67 | ||
68 | 68 | ||
69 | 69 | ||
70 | 70 | @Callable(i) | |
71 | 71 | func sellUWORLD () = { | |
72 | 72 | let $t026632738 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
73 | 73 | let pmtAmount = $t026632738._1 | |
74 | 74 | let pmtAssetId = $t026632738._2 | |
75 | 75 | if ((pmtAssetId != UWORLD)) | |
76 | 76 | then throw("Asset must be UWORLD only") | |
77 | 77 | else { | |
78 | 78 | let exchangeRate = getIntegerValue(this, keyExchangeRate) | |
79 | 79 | let exchangeRateScaleDelimiter = getIntegerValue(this, keyExchangeRateScaleDelimiter) | |
80 | 80 | let amountToPay = fraction(pmtAmount, exchangeRate, exchangeRateScaleDelimiter) | |
81 | 81 | let amountCommission = fraction(amountToPay, commission, commissionScaleDelimiter) | |
82 | 82 | let amountWithoutCommission = (amountToPay - amountCommission) | |
83 | 83 | [ScriptTransfer(i.caller, amountWithoutCommission, USDN)] | |
84 | 84 | } | |
85 | 85 | } | |
86 | 86 | ||
87 | 87 | ||
88 | 88 | ||
89 | 89 | @Callable(i) | |
90 | 90 | func makePayment (recipient,productId) = { | |
91 | 91 | let recipientAddress = addressFromStringValue(recipient) | |
92 | 92 | let $t034933568 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
93 | 93 | let pmtAmount = $t034933568._1 | |
94 | 94 | let pmtAssetId = $t034933568._2 | |
95 | 95 | if ((pmtAssetId != assetId)) | |
96 | 96 | then throw("Asset must be USDN only") | |
97 | 97 | else { | |
98 | 98 | let amountCommission = fraction(pmtAmount, commission, commissionScaleDelimiter) | |
99 | 99 | let amountWithoutCommission = (pmtAmount - amountCommission) | |
100 | 100 | let amountCashback = fraction(pmtAmount, 10, 100) | |
101 | 101 | if (isDefined(getString(this, productId))) | |
102 | 102 | then { | |
103 | 103 | let NFTassetId = fromBase58String(getStringValue(this, productId)) | |
104 | - | [ScriptTransfer(recipientAddress, amountWithoutCommission, assetId | |
104 | + | [ScriptTransfer(recipientAddress, amountWithoutCommission, assetId), ScriptTransfer(i.caller, amountCashback, UWORLD), ScriptTransfer(i.caller, 1, NFTassetId)] | |
105 | 105 | } | |
106 | - | else [ScriptTransfer(recipientAddress, amountWithoutCommission, assetId), ScriptTransfer( | |
106 | + | else [ScriptTransfer(recipientAddress, amountWithoutCommission, assetId), ScriptTransfer(i.caller, amountCashback, UWORLD)] | |
107 | 107 | } | |
108 | 108 | } | |
109 | 109 | ||
110 | 110 |
github/deemru/w8io/026f985 30.20 ms ◑