tx · EBCjkdcdvxCWGWfusJiMxMVR1KbwPDU5eQ2FMvEdyfjg

3NADYuG3G91PrmsrRqQfyeDCf2Pi53UV5id:  -0.01000000 Waves

2021.07.28 22:44 [1633932] smart account 3NADYuG3G91PrmsrRqQfyeDCf2Pi53UV5id > SELF 0.00000000 Waves

{ "type": 13, "id": "EBCjkdcdvxCWGWfusJiMxMVR1KbwPDU5eQ2FMvEdyfjg", "fee": 1000000, "feeAssetId": null, "timestamp": 1627501430107, "version": 2, "chainId": 84, "sender": "3NADYuG3G91PrmsrRqQfyeDCf2Pi53UV5id", "senderPublicKey": "8agr5kfwDL7NLuMetvciXCcd9TcDKZhRwYZPPTAShaCC", "proofs": [ "2rciyhiWSSar9v5J1GQhTx7HLQuk7kWMSpRRXpBuD5Yyk3zLRtDWWmQAqW1Lb93UpySwRNQcG8fpU88HVb7rHATE" ], "script": "base64:AAIEAAAAAAAAABcIAhIFCgMICAgSABIAEgASABIECgIICAAAAAoAAAAADmtleUJ1eVVMVVNSYXRlAgAAAA1idXlfVUxVU19yYXRlAAAAABxrZXlCdXlVTFVTUmF0ZVNjYWxlRGVsaW1pdGVyAgAAAB1idXlfVUxVU19yYXRlX3NjYWxlX2RlbGltaXRlcgAAAAAPa2V5U2VsbFVMVVNSYXRlAgAAAA5zZWxsX1VMVVNfcmF0ZQAAAAAda2V5U2VsbFVMVVNSYXRlU2NhbGVEZWxpbWl0ZXICAAAAHnNlbGxfVUxVU19yYXRlX3NjYWxlX2RlbGltaXRlcgAAAAANa2V5TWFrZU5GVEZlZQIAAAAQa2V5X21ha2VfTkZUX2ZlZQAAAAANa2V5Q29tbWlzc2lvbgIAAAAKY29tbWlzc2lvbgAAAAAba2V5Q29tbWlzc2lvblNjYWxlRGVsaW1pdGVyAgAAABpjb21taXNzaW9uX3NjYWxlX2RlbGltaXRlcgAAAAAEVVNETgEAAAAg5LByxBo7/vD2CTbZYw1hbFGAKngtLEbXylJXPrq5VKEAAAAABFVMVVMBAAAAIFw5P18I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AAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAAA5hbW91bnRDYXNoYmFjawUAAAAEVUxVUwUAAAADbmlsAAAAAC4cpik=", "height": 1633932, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BLqg4XdSr1MqZirMZDmj61NdjdWAnnZGMWV3hynpTyZL Next: EiHK8PHhSRW8C4DMrmEBGLZEWvpNUQ7anvZfcSQPcDCS Diff:
OldNewDifferences
1717
1818 let USDN = base58'GPi1Q6QVgUmuomtThbim81hBYBEUWyf5BVmE4Tnd3sNg'
1919
20-let ULUS = base58'J74E8AHdZobVSkA3YboiRrxFUs4odMVxK8tGMg6QXA1n'
20+let ULUS = base58'7D191wpwpSs4WanizHWgiRhAYhCGkmpop4h3NzUQreig'
2121
2222 let assetId = USDN
2323
104104 let $t046804755 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
105105 let pmtAmount = $t046804755._1
106106 let pmtAssetId = $t046804755._2
107- if ((pmtAssetId != assetId))
108- then throw("Asset must be USDN only")
107+ if (if ((pmtAssetId != USDN))
108+ then (pmtAssetId != ULUS)
109+ else false)
110+ then throw("Asset must be only USDN or ULUS")
109111 else {
110112 let commission = getIntegerValue(this, keyCommission)
111113 let commissionScaleDelimiter = getIntegerValue(this, keyCommissionScaleDelimiter)
112114 let amountCommission = fraction(pmtAmount, commission, commissionScaleDelimiter)
113115 let amountWithoutCommission = (pmtAmount - amountCommission)
114- let amountCashback = fraction(pmtAmount, 100, 1000000)
116+ let assetDivider = if ((pmtAssetId == USDN))
117+ then 1000000
118+ else 1000
119+ let amountCashback = fraction(pmtAmount, 100, assetDivider)
115120 if (isDefined(getString(this, productId)))
116121 then {
117122 let NFTassetId = fromBase58String(getStringValue(this, productId))
118-[ScriptTransfer(recipientAddress, amountWithoutCommission, assetId), ScriptTransfer(i.caller, amountCashback, ULUS), ScriptTransfer(i.caller, 1, NFTassetId)]
123+[ScriptTransfer(recipientAddress, amountWithoutCommission, pmtAssetId), ScriptTransfer(i.caller, amountCashback, ULUS), ScriptTransfer(i.caller, 1, NFTassetId)]
119124 }
120- else [ScriptTransfer(recipientAddress, amountWithoutCommission, assetId), ScriptTransfer(i.caller, amountCashback, ULUS)]
125+ else [ScriptTransfer(recipientAddress, amountWithoutCommission, pmtAssetId), ScriptTransfer(i.caller, amountCashback, ULUS)]
121126 }
122127 }
123128
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 4 #-}
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
20-let ULUS = base58'J74E8AHdZobVSkA3YboiRrxFUs4odMVxK8tGMg6QXA1n'
20+let ULUS = base58'7D191wpwpSs4WanizHWgiRhAYhCGkmpop4h3NzUQreig'
2121
2222 let assetId = USDN
2323
2424 @Callable(i)
2525 func makeNFT (name,description,productId) = {
2626 let $t010971172 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
2727 let pmtAmount = $t010971172._1
2828 let pmtAssetId = $t010971172._2
2929 let makeNFTfee = getIntegerValue(this, keyMakeNFTFee)
3030 if ((pmtAssetId != assetId))
3131 then throw("Asset must be USDN only")
3232 else if ((makeNFTfee > pmtAmount))
3333 then throw(("Fee for make NFT token is " + toString(makeNFTfee)))
3434 else if (isDefined(getString(this, productId)))
3535 then throw("NFT for this productId is already issued.")
3636 else {
3737 let newAsset = Issue(name, (((description + "[") + productId) + "]"), 1, 0, false, unit, 0)
3838 let newAssetId = calculateAssetId(newAsset)
3939 [newAsset, StringEntry(productId, toBase58String(newAssetId))]
4040 }
4141 }
4242
4343
4444
4545 @Callable(i)
4646 func setParams () = if ((i.caller != this))
4747 then throw("Only the DApp itself can call this function")
4848 else [IntegerEntry(keyBuyULUSRate, 150000), IntegerEntry(keyBuyULUSRateScaleDelimiter, 1000), IntegerEntry(keySellULUSRate, 100000), IntegerEntry(keySellULUSRateScaleDelimiter, 1000), IntegerEntry(keyCommission, 30000), IntegerEntry(keyCommissionScaleDelimiter, 1000000), IntegerEntry(keyMakeNFTFee, 1000000)]
4949
5050
5151
5252 @Callable(i)
5353 func clearOldParams () = if ((i.caller != this))
5454 then throw("Only the DApp itself can call this function")
5555 else {
5656 let keyBuyUWORLDRate = "buy_UWORLD_rate"
5757 let keyBuyUWORLDRateScaleDelimiter = "buy_UWORLD_rate_scale_delimiter"
5858 let keySellUWORLDRate = "sell_UWORLD_rate"
5959 let keySellUWORLDRateScaleDelimiter = "sell_UWORLD_rate_scale_delimiter"
6060 [DeleteEntry(keyBuyUWORLDRate), DeleteEntry(keyBuyUWORLDRateScaleDelimiter), DeleteEntry(keySellUWORLDRate), DeleteEntry(keySellUWORLDRateScaleDelimiter)]
6161 }
6262
6363
6464
6565 @Callable(i)
6666 func buyULUS () = {
6767 let $t031233198 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
6868 let pmtAmount = $t031233198._1
6969 let pmtAssetId = $t031233198._2
7070 if ((pmtAssetId != assetId))
7171 then throw("Asset must be USDN only")
7272 else {
7373 let exchangeRate = getIntegerValue(this, keyBuyULUSRate)
7474 let exchangeRateScaleDelimiter = getIntegerValue(this, keyBuyULUSRateScaleDelimiter)
7575 let amountToPay = fraction(pmtAmount, exchangeRateScaleDelimiter, exchangeRate)
7676 let amountWithoutCommission = amountToPay
7777 [ScriptTransfer(i.caller, amountWithoutCommission, ULUS)]
7878 }
7979 }
8080
8181
8282
8383 @Callable(i)
8484 func sellULUS () = {
8585 let $t038523927 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
8686 let pmtAmount = $t038523927._1
8787 let pmtAssetId = $t038523927._2
8888 if ((pmtAssetId != ULUS))
8989 then throw("Asset must be ULUS only")
9090 else {
9191 let exchangeRate = getIntegerValue(this, keySellULUSRate)
9292 let exchangeRateScaleDelimiter = getIntegerValue(this, keySellULUSRateScaleDelimiter)
9393 let amountToPay = fraction(pmtAmount, exchangeRate, exchangeRateScaleDelimiter)
9494 let amountWithoutCommission = amountToPay
9595 [ScriptTransfer(i.caller, amountWithoutCommission, USDN)]
9696 }
9797 }
9898
9999
100100
101101 @Callable(i)
102102 func makePayment (recipient,productId) = {
103103 let recipientAddress = addressFromStringValue(recipient)
104104 let $t046804755 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
105105 let pmtAmount = $t046804755._1
106106 let pmtAssetId = $t046804755._2
107- if ((pmtAssetId != assetId))
108- then throw("Asset must be USDN only")
107+ if (if ((pmtAssetId != USDN))
108+ then (pmtAssetId != ULUS)
109+ else false)
110+ then throw("Asset must be only USDN or ULUS")
109111 else {
110112 let commission = getIntegerValue(this, keyCommission)
111113 let commissionScaleDelimiter = getIntegerValue(this, keyCommissionScaleDelimiter)
112114 let amountCommission = fraction(pmtAmount, commission, commissionScaleDelimiter)
113115 let amountWithoutCommission = (pmtAmount - amountCommission)
114- let amountCashback = fraction(pmtAmount, 100, 1000000)
116+ let assetDivider = if ((pmtAssetId == USDN))
117+ then 1000000
118+ else 1000
119+ let amountCashback = fraction(pmtAmount, 100, assetDivider)
115120 if (isDefined(getString(this, productId)))
116121 then {
117122 let NFTassetId = fromBase58String(getStringValue(this, productId))
118-[ScriptTransfer(recipientAddress, amountWithoutCommission, assetId), ScriptTransfer(i.caller, amountCashback, ULUS), ScriptTransfer(i.caller, 1, NFTassetId)]
123+[ScriptTransfer(recipientAddress, amountWithoutCommission, pmtAssetId), ScriptTransfer(i.caller, amountCashback, ULUS), ScriptTransfer(i.caller, 1, NFTassetId)]
119124 }
120- else [ScriptTransfer(recipientAddress, amountWithoutCommission, assetId), ScriptTransfer(i.caller, amountCashback, ULUS)]
125+ else [ScriptTransfer(recipientAddress, amountWithoutCommission, pmtAssetId), ScriptTransfer(i.caller, amountCashback, ULUS)]
121126 }
122127 }
123128
124129

github/deemru/w8io/026f985 
30.30 ms