tx · s2Yjy5Deen9WnVckp5DPmwF2uesS3sDz8czhb219dKt 3NADYuG3G91PrmsrRqQfyeDCf2Pi53UV5id: -0.01000000 Waves 2022.01.08 22:49 [1870368] smart account 3NADYuG3G91PrmsrRqQfyeDCf2Pi53UV5id > SELF 0.00000000 Waves
{ "type": 13, "id": "s2Yjy5Deen9WnVckp5DPmwF2uesS3sDz8czhb219dKt", "fee": 1000000, "feeAssetId": null, "timestamp": 1641671338226, "version": 2, "chainId": 84, "sender": "3NADYuG3G91PrmsrRqQfyeDCf2Pi53UV5id", "senderPublicKey": "8agr5kfwDL7NLuMetvciXCcd9TcDKZhRwYZPPTAShaCC", "proofs": [ "3GKLDCo6AmRpQBpggtUBeKzEDhh4RMdM3x2b3SMPxrEXeW8aFynLUKndnPcBfEwPJSKEixM9Rcx18tkV9DT5Sf2J" ], "script": "base64:AAIFAAAAAAAAABkIAhIFCgMICAgSABIAEgASABIGCgQICAgIAAAADAAAAAADU0VQAgAAAAJfXwAAAAAOa2V5QnV5VUxVU1JhdGUCAAAADWJ1eV9VTFVTX3JhdGUAAAAAHGtleUJ1eVVMVVNSYXRlU2NhbGVEZWxpbWl0ZXICAAAAHWJ1eV9VTFVTX3JhdGVfc2NhbGVfZGVsaW1pdGVyAAAAAA9rZXlTZWxsVUxVU1JhdGUCAAAADnNlbGxfVUxVU19yYXRlAAAAAB1rZXlTZWxsVUxVU1JhdGVTY2FsZURlbGltaXRlcgIAAAAec2VsbF9VTFVTX3JhdGVfc2NhbGVfZGVsaW1pdGVyAAAAAA1rZXlNYWtlTkZURmVlAgAAABBrZXlfbWFrZV9ORlRfZmVlAAAAAA1rZXlDb21taXNzaW9uAgAAAApjb21taXNzaW9uAAAAABtrZXlDb21taXNzaW9uU2NhbGVEZWxpbWl0ZXICAAAAGmNvbW1pc3Npb25fc2NhbGVfZGVsaW1pdGVyAAAAAARVU0ROAQAAACDksHLEGjv+8PYJNtljDWFsUYAqeC0sRtfKUlc+urlUoQAAAAAEVUxVUw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BbW91bnQFAAAAEGFtb3VudENvbW1pc3Npb24FAAAAFmFtb3VudElzc3VlckNvbW1pc3Npb24JAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAAQcmVjaXBpZW50QWRkcmVzcwUAAAAYYW1vdW50V2l0aG91dENvbW1pc3Npb25zBQAAAApwbXRBc3NldElkCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAAEWNvbW1pc3Npb25BZGRyZXNzBQAAABBhbW91bnRDb21taXNzaW9uBQAAAApwbXRBc3NldElkCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAAEE5GVElzc3VlckFkZHJlc3MFAAAAFmFtb3VudElzc3VlckNvbW1pc3Npb24FAAAACnBtdEFzc2V0SWQJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAAA5hbW91bnRDYXNoYmFjawUAAAAEVUxVUwkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIAAAAAAAAAAAEFAAAACk5GVGFzc2V0SWQFAAAAA25pbAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAABByZWNpcGllbnRBZGRyZXNzBQAAABdhbW91bnRXaXRob3V0Q29tbWlzc2lvbgUAAAAKcG10QXNzZXRJZAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAABFjb21taXNzaW9uQWRkcmVzcwUAAAAQYW1vdW50Q29tbWlzc2lvbgUAAAAKcG10QXNzZXRJZAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAADmFtb3VudENhc2hiYWNrBQAAAARVTFVTBQAAAANuaWwAAAAA/IAurQ==", "height": 1870368, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3wRvdmcWHS8iKEttEbgkRKmXfpsd4RdoUKW4HQUPiyBN Next: BYYZ3PpLe56naSv9wPApgZbgEzMG44UuQGXrQzogmEij Diff:
Old | New | Differences | |
---|---|---|---|
68 | 68 | ||
69 | 69 | @Callable(i) | |
70 | 70 | func buyULUS () = { | |
71 | - | let $ | |
72 | - | let pmtAmount = $ | |
73 | - | let pmtAssetId = $ | |
71 | + | let $t033113386 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
72 | + | let pmtAmount = $t033113386._1 | |
73 | + | let pmtAssetId = $t033113386._2 | |
74 | 74 | if ((pmtAssetId != assetId)) | |
75 | 75 | then throw("Asset must be USDN only") | |
76 | 76 | else { | |
86 | 86 | ||
87 | 87 | @Callable(i) | |
88 | 88 | func sellULUS () = { | |
89 | - | let $ | |
90 | - | let pmtAmount = $ | |
91 | - | let pmtAssetId = $ | |
89 | + | let $t040404115 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
90 | + | let pmtAmount = $t040404115._1 | |
91 | + | let pmtAssetId = $t040404115._2 | |
92 | 92 | if ((pmtAssetId != ULUS)) | |
93 | 93 | then throw("Asset must be ULUS only") | |
94 | 94 | else { | |
106 | 106 | func makePayment (recipient,productId,backendSignature,backendTimestamp) = { | |
107 | 107 | let currentTs = lastBlock.timestamp | |
108 | 108 | let recipientAddress = addressFromStringValue(recipient) | |
109 | - | let $ | |
110 | - | let pmtAmount = $ | |
111 | - | let pmtAssetId = $ | |
109 | + | let $t049595034 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
110 | + | let pmtAmount = $t049595034._1 | |
111 | + | let pmtAssetId = $t049595034._2 | |
112 | 112 | let backendPubKey = base58'5fJ73uaebbc12bwCegVoRZgNKfn4BqpH8NB8Rs2NpBmg' | |
113 | 113 | let backendProof = (makeString([toString(this), backendTimestamp, toString(pmtAmount)], ";") + ";") | |
114 | 114 | if (!(sigVerify_8Kb(toBytes(backendProof), fromBase58String(backendSignature), backendPubKey))) | |
135 | 135 | if ((NFTbalance == 0)) | |
136 | 136 | then throw("NFTAsset doesn't exist.") | |
137 | 137 | else { | |
138 | - | let NFTinfo = split(value(assetInfo(NFTassetId)).description, SEP) | |
139 | - | if ((1 == 1)) | |
140 | - | then throw(("NFTAsset doesn't exist. balance=" + NFTinfo[0])) | |
141 | - | else [ScriptTransfer(recipientAddress, amountWithoutCommission, pmtAssetId), ScriptTransfer(commissionAddress, amountCommission, pmtAssetId), ScriptTransfer(i.caller, amountCashback, ULUS), ScriptTransfer(i.caller, 1, NFTassetId)] | |
138 | + | let NFTIssuer = split(value(assetInfo(NFTassetId)).description, SEP)[2] | |
139 | + | let NFTIssuerAddress = addressFromStringValue(NFTIssuer) | |
140 | + | let amountIssuerCommission = fraction(pmtAmount, 100000, 1000000) | |
141 | + | let amountWithoutCommissions = ((pmtAmount - amountCommission) - amountIssuerCommission) | |
142 | + | [ScriptTransfer(recipientAddress, amountWithoutCommissions, pmtAssetId), ScriptTransfer(commissionAddress, amountCommission, pmtAssetId), ScriptTransfer(NFTIssuerAddress, amountIssuerCommission, pmtAssetId), ScriptTransfer(i.caller, amountCashback, ULUS), ScriptTransfer(i.caller, 1, NFTassetId)] | |
142 | 143 | } | |
143 | 144 | } | |
144 | 145 | else [ScriptTransfer(recipientAddress, amountWithoutCommission, pmtAssetId), ScriptTransfer(commissionAddress, amountCommission, pmtAssetId), ScriptTransfer(i.caller, amountCashback, ULUS)] |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SEP = "__" | |
5 | 5 | ||
6 | 6 | let keyBuyULUSRate = "buy_ULUS_rate" | |
7 | 7 | ||
8 | 8 | let keyBuyULUSRateScaleDelimiter = "buy_ULUS_rate_scale_delimiter" | |
9 | 9 | ||
10 | 10 | let keySellULUSRate = "sell_ULUS_rate" | |
11 | 11 | ||
12 | 12 | let keySellULUSRateScaleDelimiter = "sell_ULUS_rate_scale_delimiter" | |
13 | 13 | ||
14 | 14 | let keyMakeNFTFee = "key_make_NFT_fee" | |
15 | 15 | ||
16 | 16 | let keyCommission = "commission" | |
17 | 17 | ||
18 | 18 | let keyCommissionScaleDelimiter = "commission_scale_delimiter" | |
19 | 19 | ||
20 | 20 | let USDN = base58'GPi1Q6QVgUmuomtThbim81hBYBEUWyf5BVmE4Tnd3sNg' | |
21 | 21 | ||
22 | 22 | let ULUS = base58'J74E8AHdZobVSkA3YboiRrxFUs4odMVxK8tGMg6QXA1n' | |
23 | 23 | ||
24 | 24 | let assetId = USDN | |
25 | 25 | ||
26 | 26 | let commissionAddress = Address(base58'3N1yGG2mA3gTLxReAh84njeRvCBzvUbCccg') | |
27 | 27 | ||
28 | 28 | @Callable(i) | |
29 | 29 | func makeNFT (name,description,productId) = { | |
30 | 30 | let $t011931268 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
31 | 31 | let pmtAmount = $t011931268._1 | |
32 | 32 | let pmtAssetId = $t011931268._2 | |
33 | 33 | let makeNFTfee = getIntegerValue(this, keyMakeNFTFee) | |
34 | 34 | if ((pmtAssetId != assetId)) | |
35 | 35 | then throw("Asset must be USDN only") | |
36 | 36 | else if ((makeNFTfee > pmtAmount)) | |
37 | 37 | then throw(("Fee for make NFT token is " + toString(makeNFTfee))) | |
38 | 38 | else if (isDefined(getString(this, productId))) | |
39 | 39 | then throw("NFT for this productId is already issued.") | |
40 | 40 | else { | |
41 | 41 | let newAsset = Issue(name, makeString([description, productId, toString(i.caller)], SEP), 1, 0, false, unit, 0) | |
42 | 42 | let newAssetId = calculateAssetId(newAsset) | |
43 | 43 | [newAsset, StringEntry(productId, toBase58String(newAssetId)), ScriptTransfer(commissionAddress, pmtAmount, pmtAssetId)] | |
44 | 44 | } | |
45 | 45 | } | |
46 | 46 | ||
47 | 47 | ||
48 | 48 | ||
49 | 49 | @Callable(i) | |
50 | 50 | func setParams () = if ((i.caller != this)) | |
51 | 51 | then throw("Only the DApp itself can call this function") | |
52 | 52 | else [IntegerEntry(keyBuyULUSRate, 150000), IntegerEntry(keyBuyULUSRateScaleDelimiter, 1000), IntegerEntry(keySellULUSRate, 100000), IntegerEntry(keySellULUSRateScaleDelimiter, 1000), IntegerEntry(keyCommission, 30000), IntegerEntry(keyCommissionScaleDelimiter, 1000000), IntegerEntry(keyMakeNFTFee, 1000000)] | |
53 | 53 | ||
54 | 54 | ||
55 | 55 | ||
56 | 56 | @Callable(i) | |
57 | 57 | func clearOldParams () = if ((i.caller != this)) | |
58 | 58 | then throw("Only the DApp itself can call this function") | |
59 | 59 | else { | |
60 | 60 | let keyBuyUWORLDRate = "buy_UWORLD_rate" | |
61 | 61 | let keyBuyUWORLDRateScaleDelimiter = "buy_UWORLD_rate_scale_delimiter" | |
62 | 62 | let keySellUWORLDRate = "sell_UWORLD_rate" | |
63 | 63 | let keySellUWORLDRateScaleDelimiter = "sell_UWORLD_rate_scale_delimiter" | |
64 | 64 | [DeleteEntry(keyBuyUWORLDRate), DeleteEntry(keyBuyUWORLDRateScaleDelimiter), DeleteEntry(keySellUWORLDRate), DeleteEntry(keySellUWORLDRateScaleDelimiter)] | |
65 | 65 | } | |
66 | 66 | ||
67 | 67 | ||
68 | 68 | ||
69 | 69 | @Callable(i) | |
70 | 70 | func buyULUS () = { | |
71 | - | let $ | |
72 | - | let pmtAmount = $ | |
73 | - | let pmtAssetId = $ | |
71 | + | let $t033113386 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
72 | + | let pmtAmount = $t033113386._1 | |
73 | + | let pmtAssetId = $t033113386._2 | |
74 | 74 | if ((pmtAssetId != assetId)) | |
75 | 75 | then throw("Asset must be USDN only") | |
76 | 76 | else { | |
77 | 77 | let exchangeRate = getIntegerValue(this, keyBuyULUSRate) | |
78 | 78 | let exchangeRateScaleDelimiter = getIntegerValue(this, keyBuyULUSRateScaleDelimiter) | |
79 | 79 | let amountToPay = fraction(pmtAmount, exchangeRateScaleDelimiter, exchangeRate) | |
80 | 80 | let amountWithoutCommission = amountToPay | |
81 | 81 | [ScriptTransfer(i.caller, amountWithoutCommission, ULUS)] | |
82 | 82 | } | |
83 | 83 | } | |
84 | 84 | ||
85 | 85 | ||
86 | 86 | ||
87 | 87 | @Callable(i) | |
88 | 88 | func sellULUS () = { | |
89 | - | let $ | |
90 | - | let pmtAmount = $ | |
91 | - | let pmtAssetId = $ | |
89 | + | let $t040404115 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
90 | + | let pmtAmount = $t040404115._1 | |
91 | + | let pmtAssetId = $t040404115._2 | |
92 | 92 | if ((pmtAssetId != ULUS)) | |
93 | 93 | then throw("Asset must be ULUS only") | |
94 | 94 | else { | |
95 | 95 | let exchangeRate = getIntegerValue(this, keySellULUSRate) | |
96 | 96 | let exchangeRateScaleDelimiter = getIntegerValue(this, keySellULUSRateScaleDelimiter) | |
97 | 97 | let amountToPay = fraction(pmtAmount, exchangeRate, exchangeRateScaleDelimiter) | |
98 | 98 | let amountWithoutCommission = amountToPay | |
99 | 99 | [ScriptTransfer(i.caller, amountWithoutCommission, USDN)] | |
100 | 100 | } | |
101 | 101 | } | |
102 | 102 | ||
103 | 103 | ||
104 | 104 | ||
105 | 105 | @Callable(i) | |
106 | 106 | func makePayment (recipient,productId,backendSignature,backendTimestamp) = { | |
107 | 107 | let currentTs = lastBlock.timestamp | |
108 | 108 | let recipientAddress = addressFromStringValue(recipient) | |
109 | - | let $ | |
110 | - | let pmtAmount = $ | |
111 | - | let pmtAssetId = $ | |
109 | + | let $t049595034 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
110 | + | let pmtAmount = $t049595034._1 | |
111 | + | let pmtAssetId = $t049595034._2 | |
112 | 112 | let backendPubKey = base58'5fJ73uaebbc12bwCegVoRZgNKfn4BqpH8NB8Rs2NpBmg' | |
113 | 113 | let backendProof = (makeString([toString(this), backendTimestamp, toString(pmtAmount)], ";") + ";") | |
114 | 114 | if (!(sigVerify_8Kb(toBytes(backendProof), fromBase58String(backendSignature), backendPubKey))) | |
115 | 115 | then throw("Invalid proof from backend.") | |
116 | 116 | else if (((currentTs - parseIntValue(backendTimestamp)) > ((1000 * 60) * 15))) | |
117 | 117 | then throw("The signature is expired. Repeat the operation again.") | |
118 | 118 | else if (if ((pmtAssetId != USDN)) | |
119 | 119 | then (pmtAssetId != ULUS) | |
120 | 120 | else false) | |
121 | 121 | then throw("Asset must be only USDN or ULUS") | |
122 | 122 | else { | |
123 | 123 | let commission = getIntegerValue(this, keyCommission) | |
124 | 124 | let commissionScaleDelimiter = getIntegerValue(this, keyCommissionScaleDelimiter) | |
125 | 125 | let amountCommission = fraction(pmtAmount, commission, commissionScaleDelimiter) | |
126 | 126 | let amountWithoutCommission = (pmtAmount - amountCommission) | |
127 | 127 | let assetDivider = if ((pmtAssetId == USDN)) | |
128 | 128 | then 1000000 | |
129 | 129 | else 1000 | |
130 | 130 | let amountCashback = fraction(pmtAmount, 100, assetDivider) | |
131 | 131 | if (isDefined(getString(this, productId))) | |
132 | 132 | then { | |
133 | 133 | let NFTassetId = fromBase58String(getStringValue(this, productId)) | |
134 | 134 | let NFTbalance = assetBalance(this, NFTassetId) | |
135 | 135 | if ((NFTbalance == 0)) | |
136 | 136 | then throw("NFTAsset doesn't exist.") | |
137 | 137 | else { | |
138 | - | let NFTinfo = split(value(assetInfo(NFTassetId)).description, SEP) | |
139 | - | if ((1 == 1)) | |
140 | - | then throw(("NFTAsset doesn't exist. balance=" + NFTinfo[0])) | |
141 | - | else [ScriptTransfer(recipientAddress, amountWithoutCommission, pmtAssetId), ScriptTransfer(commissionAddress, amountCommission, pmtAssetId), ScriptTransfer(i.caller, amountCashback, ULUS), ScriptTransfer(i.caller, 1, NFTassetId)] | |
138 | + | let NFTIssuer = split(value(assetInfo(NFTassetId)).description, SEP)[2] | |
139 | + | let NFTIssuerAddress = addressFromStringValue(NFTIssuer) | |
140 | + | let amountIssuerCommission = fraction(pmtAmount, 100000, 1000000) | |
141 | + | let amountWithoutCommissions = ((pmtAmount - amountCommission) - amountIssuerCommission) | |
142 | + | [ScriptTransfer(recipientAddress, amountWithoutCommissions, pmtAssetId), ScriptTransfer(commissionAddress, amountCommission, pmtAssetId), ScriptTransfer(NFTIssuerAddress, amountIssuerCommission, pmtAssetId), ScriptTransfer(i.caller, amountCashback, ULUS), ScriptTransfer(i.caller, 1, NFTassetId)] | |
142 | 143 | } | |
143 | 144 | } | |
144 | 145 | else [ScriptTransfer(recipientAddress, amountWithoutCommission, pmtAssetId), ScriptTransfer(commissionAddress, amountCommission, pmtAssetId), ScriptTransfer(i.caller, amountCashback, ULUS)] | |
145 | 146 | } | |
146 | 147 | } | |
147 | 148 | ||
148 | 149 |
github/deemru/w8io/026f985 33.47 ms ◑