tx · CKng7NpEX9NphT1zT6CV3dH66qQsPUf74TxaGBq4mqX6

3NADYuG3G91PrmsrRqQfyeDCf2Pi53UV5id:  -0.01000000 Waves

2022.01.06 16:08 [1867079] smart account 3NADYuG3G91PrmsrRqQfyeDCf2Pi53UV5id > SELF 0.00000000 Waves

{ "type": 13, "id": "CKng7NpEX9NphT1zT6CV3dH66qQsPUf74TxaGBq4mqX6", "fee": 1000000, "feeAssetId": null, "timestamp": 1641474567414, "version": 2, "chainId": 84, "sender": "3NADYuG3G91PrmsrRqQfyeDCf2Pi53UV5id", "senderPublicKey": "8agr5kfwDL7NLuMetvciXCcd9TcDKZhRwYZPPTAShaCC", "proofs": [ "31fGTe37sCAHpJxQk2HrWFShNESUedEBbpeQGu6SrYXvVoph9e12jjHTrSgRziVq2cEnBRxc9iTa9J6S45nchBV" ], "script": "base64:AAIFAAAAAAAAABgIAhIFCgMICAgSABIAEgASABIFCgMICAgAAAAMAAAAAA5rZXlCdXlVTFVTUmF0ZQIAAAANYnV5X1VMVVNfcmF0ZQAAAAAca2V5QnV5VUxVU1JhdGVTY2FsZURlbGltaXRlcgIAAAAdYnV5X1VMVVNfcmF0ZV9zY2FsZV9kZWxpbWl0ZXIAAAAAD2tleVNlbGxVTFVTUmF0ZQIAAAAOc2VsbF9VTFVTX3JhdGUAAAAAHWtleVNlbGxVTFVTUmF0ZVNjYWxlRGVsaW1pdGVyAgAAAB5zZWxsX1VMVVNfcmF0ZV9zY2FsZV9kZWxpbWl0ZXIAAAAADWtleU1ha2VORlRGZWUCAAAAEGtleV9tYWtlX05GVF9mZWUAAAAADWtleUNvbW1pc3Npb24CAAAACmNvbW1pc3Npb24AAAAAG2tleUNvbW1pc3Npb25TY2FsZURlbGltaXRlcgIAAAAaY29tbWlzc2lvbl9zY2FsZV9kZWxpbWl0ZXIAAAAABFVTRE4BAAAAIOSwcsQaO/7w9gk22WMNYWxRgCp4LSxG18pSVz66uVShAAAAAARVTFVTAQAAACBcOT9fCNS+BgDGXve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AAAJcHJvZHVjdElkBAAAAApORlRhc3NldElkCQACWQAAAAEJAQAAABFAZXh0ck5hdGl2ZSgxMDUzKQAAAAIFAAAABHRoaXMFAAAACXByb2R1Y3RJZAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAABByZWNpcGllbnRBZGRyZXNzBQAAABdhbW91bnRXaXRob3V0Q29tbWlzc2lvbgUAAAAKcG10QXNzZXRJZAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAABFjb21taXNzaW9uQWRkcmVzcwUAAAAQYW1vdW50Q29tbWlzc2lvbgUAAAAKcG10QXNzZXRJZAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAADmFtb3VudENhc2hiYWNrBQAAAARVTFVTCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgAAAAAAAAAAAQUAAAAKTkZUYXNzZXRJZAUAAAADbmlsCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAAEHJlY2lwaWVudEFkZHJlc3MFAAAAF2Ftb3VudFdpdGhvdXRDb21taXNzaW9uBQAAAApwbXRBc3NldElkCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAAEWNvbW1pc3Npb25BZGRyZXNzBQAAABBhbW91bnRDb21taXNzaW9uBQAAAApwbXRBc3NldElkCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAAOYW1vdW50Q2FzaGJhY2sFAAAABFVMVVMFAAAAA25pbAAAAAA6gBGi", "height": 1867079, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CQ624XhFv88hV4RQHSUWcoFa3Np6mbgkZNVwn7txiLRS Next: 3PwhYwTiWQRuBEWj3rTXqpixvu5mxYG2F2kU4Y5pjbfd Diff:
OldNewDifferences
110110 let pmtAssetId = $t047674842._2
111111 let backendProof = makeString([toString(this), toString(pmtAmount)], ";")
112112 if (!(sigVerify_8Kb(toBytes(backendProof), fromBase58String(backendSignature), backendPubKey)))
113- then throw("Invalid proof from backend")
113+ then throw(("Invalid proof from backend =" + backendProof))
114114 else if (if ((pmtAssetId != USDN))
115115 then (pmtAssetId != ULUS)
116116 else false)
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let keyBuyULUSRate = "buy_ULUS_rate"
55
66 let keyBuyULUSRateScaleDelimiter = "buy_ULUS_rate_scale_delimiter"
77
88 let keySellULUSRate = "sell_ULUS_rate"
99
1010 let keySellULUSRateScaleDelimiter = "sell_ULUS_rate_scale_delimiter"
1111
1212 let keyMakeNFTFee = "key_make_NFT_fee"
1313
1414 let keyCommission = "commission"
1515
1616 let keyCommissionScaleDelimiter = "commission_scale_delimiter"
1717
1818 let USDN = base58'GPi1Q6QVgUmuomtThbim81hBYBEUWyf5BVmE4Tnd3sNg'
1919
2020 let ULUS = base58'7D191wpwpSs4WanizHWgiRhAYhCGkmpop4h3NzUQreig'
2121
2222 let assetId = USDN
2323
2424 let commissionAddress = Address(base58'3P9pCG7EBbhAkTxJQkwp6oTyc12zghXGUBW')
2525
2626 let backendPubKey = base58'5fJ73uaebbc12bwCegVoRZgNKfn4BqpH8NB8Rs2NpBmg'
2727
2828 @Callable(i)
2929 func makeNFT (name,description,productId) = {
3030 let $t010861161 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
3131 let pmtAmount = $t010861161._1
3232 let pmtAssetId = $t010861161._2
3333 let makeNFTfee = getIntegerValue(this, keyMakeNFTFee)
3434 if ((pmtAssetId != assetId))
3535 then throw("Asset must be USDN only")
3636 else if ((makeNFTfee > pmtAmount))
3737 then throw(("Fee for make NFT token is " + toString(makeNFTfee)))
3838 else if (isDefined(getString(this, productId)))
3939 then throw("NFT for this productId is already issued.")
4040 else {
4141 let newAsset = Issue(name, (((description + "[") + productId) + "]"), 1, 0, false, unit, 0)
4242 let newAssetId = calculateAssetId(newAsset)
4343 [newAsset, StringEntry(productId, toBase58String(newAssetId)), ScriptTransfer(commissionAddress, pmtAmount, pmtAssetId)]
4444 }
4545 }
4646
4747
4848
4949 @Callable(i)
5050 func setParams () = if ((i.caller != this))
5151 then throw("Only the DApp itself can call this function")
5252 else [IntegerEntry(keyBuyULUSRate, 150000), IntegerEntry(keyBuyULUSRateScaleDelimiter, 1000), IntegerEntry(keySellULUSRate, 100000), IntegerEntry(keySellULUSRateScaleDelimiter, 1000), IntegerEntry(keyCommission, 30000), IntegerEntry(keyCommissionScaleDelimiter, 1000000), IntegerEntry(keyMakeNFTFee, 1000000)]
5353
5454
5555
5656 @Callable(i)
5757 func clearOldParams () = if ((i.caller != this))
5858 then throw("Only the DApp itself can call this function")
5959 else {
6060 let keyBuyUWORLDRate = "buy_UWORLD_rate"
6161 let keyBuyUWORLDRateScaleDelimiter = "buy_UWORLD_rate_scale_delimiter"
6262 let keySellUWORLDRate = "sell_UWORLD_rate"
6363 let keySellUWORLDRateScaleDelimiter = "sell_UWORLD_rate_scale_delimiter"
6464 [DeleteEntry(keyBuyUWORLDRate), DeleteEntry(keyBuyUWORLDRateScaleDelimiter), DeleteEntry(keySellUWORLDRate), DeleteEntry(keySellUWORLDRateScaleDelimiter)]
6565 }
6666
6767
6868
6969 @Callable(i)
7070 func buyULUS () = {
7171 let $t031763251 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
7272 let pmtAmount = $t031763251._1
7373 let pmtAssetId = $t031763251._2
7474 if ((pmtAssetId != assetId))
7575 then throw("Asset must be USDN only")
7676 else {
7777 let exchangeRate = getIntegerValue(this, keyBuyULUSRate)
7878 let exchangeRateScaleDelimiter = getIntegerValue(this, keyBuyULUSRateScaleDelimiter)
7979 let amountToPay = fraction(pmtAmount, exchangeRateScaleDelimiter, exchangeRate)
8080 let amountWithoutCommission = amountToPay
8181 [ScriptTransfer(i.caller, amountWithoutCommission, ULUS)]
8282 }
8383 }
8484
8585
8686
8787 @Callable(i)
8888 func sellULUS () = {
8989 let $t039053980 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
9090 let pmtAmount = $t039053980._1
9191 let pmtAssetId = $t039053980._2
9292 if ((pmtAssetId != ULUS))
9393 then throw("Asset must be ULUS only")
9494 else {
9595 let exchangeRate = getIntegerValue(this, keySellULUSRate)
9696 let exchangeRateScaleDelimiter = getIntegerValue(this, keySellULUSRateScaleDelimiter)
9797 let amountToPay = fraction(pmtAmount, exchangeRate, exchangeRateScaleDelimiter)
9898 let amountWithoutCommission = amountToPay
9999 [ScriptTransfer(i.caller, amountWithoutCommission, USDN)]
100100 }
101101 }
102102
103103
104104
105105 @Callable(i)
106106 func makePayment (recipient,productId,backendSignature) = {
107107 let recipientAddress = addressFromStringValue(recipient)
108108 let $t047674842 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
109109 let pmtAmount = $t047674842._1
110110 let pmtAssetId = $t047674842._2
111111 let backendProof = makeString([toString(this), toString(pmtAmount)], ";")
112112 if (!(sigVerify_8Kb(toBytes(backendProof), fromBase58String(backendSignature), backendPubKey)))
113- then throw("Invalid proof from backend")
113+ then throw(("Invalid proof from backend =" + backendProof))
114114 else if (if ((pmtAssetId != USDN))
115115 then (pmtAssetId != ULUS)
116116 else false)
117117 then throw("Asset must be only USDN or ULUS")
118118 else {
119119 let commission = getIntegerValue(this, keyCommission)
120120 let commissionScaleDelimiter = getIntegerValue(this, keyCommissionScaleDelimiter)
121121 let amountCommission = fraction(pmtAmount, commission, commissionScaleDelimiter)
122122 let amountWithoutCommission = (pmtAmount - amountCommission)
123123 let assetDivider = if ((pmtAssetId == USDN))
124124 then 1000000
125125 else 1000
126126 let amountCashback = fraction(pmtAmount, 100, assetDivider)
127127 if (isDefined(getString(this, productId)))
128128 then {
129129 let NFTassetId = fromBase58String(getStringValue(this, productId))
130130 [ScriptTransfer(recipientAddress, amountWithoutCommission, pmtAssetId), ScriptTransfer(commissionAddress, amountCommission, pmtAssetId), ScriptTransfer(i.caller, amountCashback, ULUS), ScriptTransfer(i.caller, 1, NFTassetId)]
131131 }
132132 else [ScriptTransfer(recipientAddress, amountWithoutCommission, pmtAssetId), ScriptTransfer(commissionAddress, amountCommission, pmtAssetId), ScriptTransfer(i.caller, amountCashback, ULUS)]
133133 }
134134 }
135135
136136

github/deemru/w8io/026f985 
31.78 ms