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