tx · BLqg4XdSr1MqZirMZDmj61NdjdWAnnZGMWV3hynpTyZL 3NADYuG3G91PrmsrRqQfyeDCf2Pi53UV5id: -0.01000000 Waves 2021.07.20 14:23 [1621878] smart account 3NADYuG3G91PrmsrRqQfyeDCf2Pi53UV5id > SELF 0.00000000 Waves
{ "type": 13, "id": "BLqg4XdSr1MqZirMZDmj61NdjdWAnnZGMWV3hynpTyZL", "fee": 1000000, "feeAssetId": null, "timestamp": 1626780217208, "version": 2, "chainId": 84, "sender": "3NADYuG3G91PrmsrRqQfyeDCf2Pi53UV5id", "senderPublicKey": "8agr5kfwDL7NLuMetvciXCcd9TcDKZhRwYZPPTAShaCC", "proofs": [ "9hUjzGffxucE6DNovt5oUUbLdud1STgvLTLduBqjgS8usQDhJg5peFfHP4gy9Tqm9DJ4EkQRKnJYrBjtx8bNF9y" ], "script": "base64:AAIEAAAAAAAAABcIAhIFCgMICAgSABIAEgASABIECgIICAAAAAoAAAAADmtleUJ1eVVMVVNSYXRlAgAAAA1idXlfVUxVU19yYXRlAAAAABxrZXlCdXlVTFVTUmF0ZVNjYWxlRGVsaW1pdGVyAgAAAB1idXlfVUxVU19yYXRlX3NjYWxlX2RlbGltaXRlcgAAAAAPa2V5U2VsbFVMVVNSYXRlAgAAAA5zZWxsX1VMVVNfcmF0ZQAAAAAda2V5U2VsbFVMVVNSYXRlU2NhbGVEZWxpbWl0ZXICAAAAHnNlbGxfVUxVU19yYXRlX3NjYWxlX2RlbGltaXRlcgAAAAANa2V5TWFrZU5GVEZlZQIAAAAQa2V5X21ha2VfTkZUX2ZlZQAAAAANa2V5Q29tbWlzc2lvbgIAAAAKY29tbWlzc2lvbgAAAAAba2V5Q29tbWlzc2lvblNjYWxlRGVsaW1pdGVyAgAAABpjb21taXNzaW9uX3NjYWxlX2RlbGltaXRlcgAAAAAEVVNETgEAAAAg5LByxBo7/vD2CTbZYw1hbFGAKngtLEbXylJXPrq5VKEAAAAABFVMVVMBAAAAIP4jz4BuqYV1tlXQ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AAJcG10QW1vdW50BQAAAApjb21taXNzaW9uBQAAABhjb21taXNzaW9uU2NhbGVEZWxpbWl0ZXIEAAAAF2Ftb3VudFdpdGhvdXRDb21taXNzaW9uCQAAZQAAAAIFAAAACXBtdEFtb3VudAUAAAAQYW1vdW50Q29tbWlzc2lvbgQAAAAOYW1vdW50Q2FzaGJhY2sJAABrAAAAAwUAAAAJcG10QW1vdW50AAAAAAAAAABkAAAAAAAAD0JAAwkBAAAACWlzRGVmaW5lZAAAAAEJAAQdAAAAAgUAAAAEdGhpcwUAAAAJcHJvZHVjdElkBAAAAApORlRhc3NldElkCQACWQAAAAEJAQAAABFAZXh0ck5hdGl2ZSgxMDUzKQAAAAIFAAAABHRoaXMFAAAACXByb2R1Y3RJZAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAABByZWNpcGllbnRBZGRyZXNzBQAAABdhbW91bnRXaXRob3V0Q29tbWlzc2lvbgUAAAAHYXNzZXRJZAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAADmFtb3VudENhc2hiYWNrBQAAAARVTFVTCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgAAAAAAAAAAAQUAAAAKTkZUYXNzZXRJZAUAAAADbmlsCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAAEHJlY2lwaWVudEFkZHJlc3MFAAAAF2Ftb3VudFdpdGhvdXRDb21taXNzaW9uBQAAAAdhc3NldElkCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAAOYW1vdW50Q2FzaGJhY2sFAAAABFVMVVMFAAAAA25pbAAAAAC7hfW9", "height": 1621878, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 2GAS8qHCS21MCFuvVwgaLDZUKbyZgJViYmonVrwNM1LG Next: EBCjkdcdvxCWGWfusJiMxMVR1KbwPDU5eQ2FMvEdyfjg Diff:
Old | New | Differences | |
---|---|---|---|
50 | 50 | ||
51 | 51 | ||
52 | 52 | @Callable(i) | |
53 | + | func clearOldParams () = if ((i.caller != this)) | |
54 | + | then throw("Only the DApp itself can call this function") | |
55 | + | else { | |
56 | + | let keyBuyUWORLDRate = "buy_UWORLD_rate" | |
57 | + | let keyBuyUWORLDRateScaleDelimiter = "buy_UWORLD_rate_scale_delimiter" | |
58 | + | let keySellUWORLDRate = "sell_UWORLD_rate" | |
59 | + | let keySellUWORLDRateScaleDelimiter = "sell_UWORLD_rate_scale_delimiter" | |
60 | + | [DeleteEntry(keyBuyUWORLDRate), DeleteEntry(keyBuyUWORLDRateScaleDelimiter), DeleteEntry(keySellUWORLDRate), DeleteEntry(keySellUWORLDRateScaleDelimiter)] | |
61 | + | } | |
62 | + | ||
63 | + | ||
64 | + | ||
65 | + | @Callable(i) | |
53 | 66 | func buyULUS () = { | |
54 | - | let $ | |
55 | - | let pmtAmount = $ | |
56 | - | let pmtAssetId = $ | |
67 | + | let $t031233198 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
68 | + | let pmtAmount = $t031233198._1 | |
69 | + | let pmtAssetId = $t031233198._2 | |
57 | 70 | if ((pmtAssetId != assetId)) | |
58 | 71 | then throw("Asset must be USDN only") | |
59 | 72 | else { | |
69 | 82 | ||
70 | 83 | @Callable(i) | |
71 | 84 | func sellULUS () = { | |
72 | - | let $ | |
73 | - | let pmtAmount = $ | |
74 | - | let pmtAssetId = $ | |
85 | + | let $t038523927 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
86 | + | let pmtAmount = $t038523927._1 | |
87 | + | let pmtAssetId = $t038523927._2 | |
75 | 88 | if ((pmtAssetId != ULUS)) | |
76 | 89 | then throw("Asset must be ULUS only") | |
77 | 90 | else { | |
88 | 101 | @Callable(i) | |
89 | 102 | func makePayment (recipient,productId) = { | |
90 | 103 | let recipientAddress = addressFromStringValue(recipient) | |
91 | - | let $ | |
92 | - | let pmtAmount = $ | |
93 | - | let pmtAssetId = $ | |
104 | + | let $t046804755 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
105 | + | let pmtAmount = $t046804755._1 | |
106 | + | let pmtAssetId = $t046804755._2 | |
94 | 107 | if ((pmtAssetId != assetId)) | |
95 | 108 | then throw("Asset must be USDN only") | |
96 | 109 | else { |
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 | + | func clearOldParams () = if ((i.caller != this)) | |
54 | + | then throw("Only the DApp itself can call this function") | |
55 | + | else { | |
56 | + | let keyBuyUWORLDRate = "buy_UWORLD_rate" | |
57 | + | let keyBuyUWORLDRateScaleDelimiter = "buy_UWORLD_rate_scale_delimiter" | |
58 | + | let keySellUWORLDRate = "sell_UWORLD_rate" | |
59 | + | let keySellUWORLDRateScaleDelimiter = "sell_UWORLD_rate_scale_delimiter" | |
60 | + | [DeleteEntry(keyBuyUWORLDRate), DeleteEntry(keyBuyUWORLDRateScaleDelimiter), DeleteEntry(keySellUWORLDRate), DeleteEntry(keySellUWORLDRateScaleDelimiter)] | |
61 | + | } | |
62 | + | ||
63 | + | ||
64 | + | ||
65 | + | @Callable(i) | |
53 | 66 | func buyULUS () = { | |
54 | - | let $ | |
55 | - | let pmtAmount = $ | |
56 | - | let pmtAssetId = $ | |
67 | + | let $t031233198 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
68 | + | let pmtAmount = $t031233198._1 | |
69 | + | let pmtAssetId = $t031233198._2 | |
57 | 70 | if ((pmtAssetId != assetId)) | |
58 | 71 | then throw("Asset must be USDN only") | |
59 | 72 | else { | |
60 | 73 | let exchangeRate = getIntegerValue(this, keyBuyULUSRate) | |
61 | 74 | let exchangeRateScaleDelimiter = getIntegerValue(this, keyBuyULUSRateScaleDelimiter) | |
62 | 75 | let amountToPay = fraction(pmtAmount, exchangeRateScaleDelimiter, exchangeRate) | |
63 | 76 | let amountWithoutCommission = amountToPay | |
64 | 77 | [ScriptTransfer(i.caller, amountWithoutCommission, ULUS)] | |
65 | 78 | } | |
66 | 79 | } | |
67 | 80 | ||
68 | 81 | ||
69 | 82 | ||
70 | 83 | @Callable(i) | |
71 | 84 | func sellULUS () = { | |
72 | - | let $ | |
73 | - | let pmtAmount = $ | |
74 | - | let pmtAssetId = $ | |
85 | + | let $t038523927 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
86 | + | let pmtAmount = $t038523927._1 | |
87 | + | let pmtAssetId = $t038523927._2 | |
75 | 88 | if ((pmtAssetId != ULUS)) | |
76 | 89 | then throw("Asset must be ULUS only") | |
77 | 90 | else { | |
78 | 91 | let exchangeRate = getIntegerValue(this, keySellULUSRate) | |
79 | 92 | let exchangeRateScaleDelimiter = getIntegerValue(this, keySellULUSRateScaleDelimiter) | |
80 | 93 | let amountToPay = fraction(pmtAmount, exchangeRate, exchangeRateScaleDelimiter) | |
81 | 94 | let amountWithoutCommission = amountToPay | |
82 | 95 | [ScriptTransfer(i.caller, amountWithoutCommission, USDN)] | |
83 | 96 | } | |
84 | 97 | } | |
85 | 98 | ||
86 | 99 | ||
87 | 100 | ||
88 | 101 | @Callable(i) | |
89 | 102 | func makePayment (recipient,productId) = { | |
90 | 103 | let recipientAddress = addressFromStringValue(recipient) | |
91 | - | let $ | |
92 | - | let pmtAmount = $ | |
93 | - | let pmtAssetId = $ | |
104 | + | let $t046804755 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
105 | + | let pmtAmount = $t046804755._1 | |
106 | + | let pmtAssetId = $t046804755._2 | |
94 | 107 | if ((pmtAssetId != assetId)) | |
95 | 108 | then throw("Asset must be USDN only") | |
96 | 109 | else { | |
97 | 110 | let commission = getIntegerValue(this, keyCommission) | |
98 | 111 | let commissionScaleDelimiter = getIntegerValue(this, keyCommissionScaleDelimiter) | |
99 | 112 | let amountCommission = fraction(pmtAmount, commission, commissionScaleDelimiter) | |
100 | 113 | let amountWithoutCommission = (pmtAmount - amountCommission) | |
101 | 114 | let amountCashback = fraction(pmtAmount, 100, 1000000) | |
102 | 115 | if (isDefined(getString(this, productId))) | |
103 | 116 | then { | |
104 | 117 | let NFTassetId = fromBase58String(getStringValue(this, productId)) | |
105 | 118 | [ScriptTransfer(recipientAddress, amountWithoutCommission, assetId), ScriptTransfer(i.caller, amountCashback, ULUS), ScriptTransfer(i.caller, 1, NFTassetId)] | |
106 | 119 | } | |
107 | 120 | else [ScriptTransfer(recipientAddress, amountWithoutCommission, assetId), ScriptTransfer(i.caller, amountCashback, ULUS)] | |
108 | 121 | } | |
109 | 122 | } | |
110 | 123 | ||
111 | 124 |
github/deemru/w8io/026f985 29.59 ms ◑