tx · 7mCQXQpfg9qRiQFn37vmeynCp4PdaGoRT47G3GbkxW91

3NADYuG3G91PrmsrRqQfyeDCf2Pi53UV5id:  -0.01400000 Waves

2021.05.19 21:27 [1532905] smart account 3NADYuG3G91PrmsrRqQfyeDCf2Pi53UV5id > SELF 0.00000000 Waves

{ "type": 13, "id": "7mCQXQpfg9qRiQFn37vmeynCp4PdaGoRT47G3GbkxW91", "fee": 1400000, "feeAssetId": null, "timestamp": 1621448907944, "version": 2, "chainId": 84, "sender": "3NADYuG3G91PrmsrRqQfyeDCf2Pi53UV5id", "senderPublicKey": "8agr5kfwDL7NLuMetvciXCcd9TcDKZhRwYZPPTAShaCC", "proofs": [ "5US3vabQRp9BRkhQSjRsB2fARHrxukNmsi8a7eHWU5ECdNvkDEKfh556DuLMsqb35UtTYkBkna3cqvBPE8TXNjo9" ], "script": "base64:AAIEAAAAAAAAABUIAhIFCgMICAgSABIAEgASBAoCCAgAAAAKAAAAABBrZXlCdXlVV09STERSYXRlAgAAAA9idXlfVVdPUkxEX3JhdGUAAAAAHmtleUJ1eVVXT1JMRFJhdGVTY2FsZURlbGltaXRlcgIAAAAfYnV5X1VXT1JMRF9yYXRlX3NjYWxlX2RlbGltaXRlcgAAAAARa2V5U2VsbFVXT1JMRFJhdGUCAAAAEHNlbGxfVVdPUkxEX3JhdGUAAAAAH2tleVNlbGxVV09STERSYXRlU2NhbGVEZWxpbWl0ZXICAAAAIHNlbGxfVVdPUkxEX3JhdGVfc2NhbGVfZGVsaW1pdGVyAAAAAA1rZXlNYWtlTkZURmVlAgAAABBrZXlfbWFrZV9ORlRfZmVlAAAAAA1rZXlDb21taXNzaW9uAgAAAApjb21taXNzaW9uAAAAABtrZXlDb21taXNzaW9uU2NhbGVEZWxpbWl0ZXICAAAAGmNvbW1pc3Npb25fc2NhbGVfZGVsaW1pdGVyAAAAAARVU0ROAQAAACDksHLEGjv+8PYJNtljDWFsUYAqeC0sRtfKUlc+urlUoQAAAAAGVVdPUkxEAQAAACB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NyaXB0VHJhbnNmZXIAAAADBQAAABByZWNpcGllbnRBZGRyZXNzBQAAABdhbW91bnRXaXRob3V0Q29tbWlzc2lvbgUAAAAHYXNzZXRJZAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAADmFtb3VudENhc2hiYWNrBQAAAAZVV09STEQFAAAAA25pbAAAAACbkK+G", "height": 1532905, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: HVQkHsLULXyUXPMTB6KDw2uL6VToLhF6wpD6LoyVcVB5 Next: 7KY4WKeKifdorUY8t75VqUpuTaRt4LEfahgdanA3tB5X Diff:
OldNewDifferences
11 {-# STDLIB_VERSION 4 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let keyExchangeRate = "exchange_rate"
4+let keyBuyUWORLDRate = "buy_UWORLD_rate"
55
6-let keyExchangeRateScaleDelimiter = "exchange_rate_scale_delimiter"
6+let keyBuyUWORLDRateScaleDelimiter = "buy_UWORLD_rate_scale_delimiter"
7+
8+let keySellUWORLDRate = "sell_UWORLD_rate"
9+
10+let keySellUWORLDRateScaleDelimiter = "sell_UWORLD_rate_scale_delimiter"
11+
12+let keyMakeNFTFee = "key_make_NFT_fee"
713
814 let keyCommission = "commission"
915
1521
1622 let assetId = USDN
1723
18-let commission = 30000
19-
20-let commissionScaleDelimiter = 1000000
21-
22-let makeNFTfee = 1000000
23-
2424 @Callable(i)
2525 func makeNFT (name,description,productId) = {
26- let $t0864939 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
27- let pmtAmount = $t0864939._1
28- let pmtAssetId = $t0864939._2
26+ let $t010271102 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
27+ let pmtAmount = $t010271102._1
28+ let pmtAssetId = $t010271102._2
29+ let makeNFTfee = getIntegerValue(this, keyMakeNFTFee)
2930 if ((pmtAssetId != assetId))
3031 then throw("Asset must be USDN only")
3132 else if ((makeNFTfee > pmtAmount))
4243
4344
4445 @Callable(i)
45-func setParams (exchangeRate,exchangeRateScaleDelimiter) = if ((i.caller != this))
46+func setParams () = if ((i.caller != this))
4647 then throw("Only the DApp itself can call this function")
47- else [IntegerEntry(keyExchangeRate, exchangeRate), IntegerEntry(keyExchangeRateScaleDelimiter, exchangeRateScaleDelimiter), IntegerEntry(keyCommission, commission), IntegerEntry(keyCommissionScaleDelimiter, commissionScaleDelimiter)]
48+ else [IntegerEntry(keyBuyUWORLDRate, 150000), IntegerEntry(keyBuyUWORLDRateScaleDelimiter, 1000000), IntegerEntry(keySellUWORLDRate, 100000), IntegerEntry(keySellUWORLDRateScaleDelimiter, 1000000), IntegerEntry(keyCommission, 30000), IntegerEntry(keyCommissionScaleDelimiter, 1000000), IntegerEntry(keyMakeNFTFee, 1000000)]
4849
4950
5051
5152 @Callable(i)
5253 func buyUWORLD () = {
53- let $t019302005 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
54- let pmtAmount = $t019302005._1
55- let pmtAssetId = $t019302005._2
54+ let $t025102585 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
55+ let pmtAmount = $t025102585._1
56+ let pmtAssetId = $t025102585._2
5657 if ((pmtAssetId != assetId))
5758 then throw("Asset must be USDN only")
5859 else {
59- let exchangeRate = getIntegerValue(this, keyExchangeRate)
60- let exchangeRateScaleDelimiter = getIntegerValue(this, keyExchangeRateScaleDelimiter)
60+ let exchangeRate = getIntegerValue(this, keyBuyUWORLDRate)
61+ let exchangeRateScaleDelimiter = getIntegerValue(this, keyBuyUWORLDRateScaleDelimiter)
6162 let amountToPay = fraction(pmtAmount, exchangeRateScaleDelimiter, exchangeRate)
62- let amountCommission = fraction(amountToPay, commission, commissionScaleDelimiter)
63- let amountWithoutCommission = (amountToPay - amountCommission)
63+ let amountWithoutCommission = amountToPay
6464 [ScriptTransfer(i.caller, amountWithoutCommission, UWORLD)]
6565 }
6666 }
6969
7070 @Callable(i)
7171 func sellUWORLD () = {
72- let $t026632738 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
73- let pmtAmount = $t026632738._1
74- let pmtAssetId = $t026632738._2
72+ let $t032473322 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
73+ let pmtAmount = $t032473322._1
74+ let pmtAssetId = $t032473322._2
7575 if ((pmtAssetId != UWORLD))
7676 then throw("Asset must be UWORLD only")
7777 else {
78- let exchangeRate = getIntegerValue(this, keyExchangeRate)
79- let exchangeRateScaleDelimiter = getIntegerValue(this, keyExchangeRateScaleDelimiter)
78+ let exchangeRate = getIntegerValue(this, keySellUWORLDRate)
79+ let exchangeRateScaleDelimiter = getIntegerValue(this, keySellUWORLDRateScaleDelimiter)
8080 let amountToPay = fraction(pmtAmount, exchangeRate, exchangeRateScaleDelimiter)
81- let amountCommission = fraction(amountToPay, commission, commissionScaleDelimiter)
82- let amountWithoutCommission = (amountToPay - amountCommission)
81+ let amountWithoutCommission = amountToPay
8382 [ScriptTransfer(i.caller, amountWithoutCommission, USDN)]
8483 }
8584 }
8988 @Callable(i)
9089 func makePayment (recipient,productId) = {
9190 let recipientAddress = addressFromStringValue(recipient)
92- let $t034933568 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
93- let pmtAmount = $t034933568._1
94- let pmtAssetId = $t034933568._2
91+ let $t040834158 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
92+ let pmtAmount = $t040834158._1
93+ let pmtAssetId = $t040834158._2
9594 if ((pmtAssetId != assetId))
9695 then throw("Asset must be USDN only")
9796 else {
97+ let commission = getIntegerValue(this, keyCommission)
98+ let commissionScaleDelimiter = getIntegerValue(this, keyCommissionScaleDelimiter)
9899 let amountCommission = fraction(pmtAmount, commission, commissionScaleDelimiter)
99100 let amountWithoutCommission = (pmtAmount - amountCommission)
100- let amountCashback = fraction(pmtAmount, 10, 100)
101+ let amountCashback = fraction(pmtAmount, 100000, 1000000)
101102 if (isDefined(getString(this, productId)))
102103 then {
103104 let NFTassetId = fromBase58String(getStringValue(this, productId))
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 4 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let keyExchangeRate = "exchange_rate"
4+let keyBuyUWORLDRate = "buy_UWORLD_rate"
55
6-let keyExchangeRateScaleDelimiter = "exchange_rate_scale_delimiter"
6+let keyBuyUWORLDRateScaleDelimiter = "buy_UWORLD_rate_scale_delimiter"
7+
8+let keySellUWORLDRate = "sell_UWORLD_rate"
9+
10+let keySellUWORLDRateScaleDelimiter = "sell_UWORLD_rate_scale_delimiter"
11+
12+let keyMakeNFTFee = "key_make_NFT_fee"
713
814 let keyCommission = "commission"
915
1016 let keyCommissionScaleDelimiter = "commission_scale_delimiter"
1117
1218 let USDN = base58'GPi1Q6QVgUmuomtThbim81hBYBEUWyf5BVmE4Tnd3sNg'
1319
1420 let UWORLD = base58'7D191wpwpSs4WanizHWgiRhAYhCGkmpop4h3NzUQreig'
1521
1622 let assetId = USDN
1723
18-let commission = 30000
19-
20-let commissionScaleDelimiter = 1000000
21-
22-let makeNFTfee = 1000000
23-
2424 @Callable(i)
2525 func makeNFT (name,description,productId) = {
26- let $t0864939 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
27- let pmtAmount = $t0864939._1
28- let pmtAssetId = $t0864939._2
26+ let $t010271102 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
27+ let pmtAmount = $t010271102._1
28+ let pmtAssetId = $t010271102._2
29+ let makeNFTfee = getIntegerValue(this, keyMakeNFTFee)
2930 if ((pmtAssetId != assetId))
3031 then throw("Asset must be USDN only")
3132 else if ((makeNFTfee > pmtAmount))
3233 then throw(("Fee for make NFT token is " + toString(makeNFTfee)))
3334 else if (isDefined(getString(this, productId)))
3435 then throw("NFT for this productId is already issued.")
3536 else {
3637 let newAsset = Issue(name, (((description + "[") + productId) + "]"), 1, 0, false, unit, 0)
3738 let newAssetId = calculateAssetId(newAsset)
3839 [newAsset, StringEntry(productId, toBase58String(newAssetId))]
3940 }
4041 }
4142
4243
4344
4445 @Callable(i)
45-func setParams (exchangeRate,exchangeRateScaleDelimiter) = if ((i.caller != this))
46+func setParams () = if ((i.caller != this))
4647 then throw("Only the DApp itself can call this function")
47- else [IntegerEntry(keyExchangeRate, exchangeRate), IntegerEntry(keyExchangeRateScaleDelimiter, exchangeRateScaleDelimiter), IntegerEntry(keyCommission, commission), IntegerEntry(keyCommissionScaleDelimiter, commissionScaleDelimiter)]
48+ else [IntegerEntry(keyBuyUWORLDRate, 150000), IntegerEntry(keyBuyUWORLDRateScaleDelimiter, 1000000), IntegerEntry(keySellUWORLDRate, 100000), IntegerEntry(keySellUWORLDRateScaleDelimiter, 1000000), IntegerEntry(keyCommission, 30000), IntegerEntry(keyCommissionScaleDelimiter, 1000000), IntegerEntry(keyMakeNFTFee, 1000000)]
4849
4950
5051
5152 @Callable(i)
5253 func buyUWORLD () = {
53- let $t019302005 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
54- let pmtAmount = $t019302005._1
55- let pmtAssetId = $t019302005._2
54+ let $t025102585 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
55+ let pmtAmount = $t025102585._1
56+ let pmtAssetId = $t025102585._2
5657 if ((pmtAssetId != assetId))
5758 then throw("Asset must be USDN only")
5859 else {
59- let exchangeRate = getIntegerValue(this, keyExchangeRate)
60- let exchangeRateScaleDelimiter = getIntegerValue(this, keyExchangeRateScaleDelimiter)
60+ let exchangeRate = getIntegerValue(this, keyBuyUWORLDRate)
61+ let exchangeRateScaleDelimiter = getIntegerValue(this, keyBuyUWORLDRateScaleDelimiter)
6162 let amountToPay = fraction(pmtAmount, exchangeRateScaleDelimiter, exchangeRate)
62- let amountCommission = fraction(amountToPay, commission, commissionScaleDelimiter)
63- let amountWithoutCommission = (amountToPay - amountCommission)
63+ let amountWithoutCommission = amountToPay
6464 [ScriptTransfer(i.caller, amountWithoutCommission, UWORLD)]
6565 }
6666 }
6767
6868
6969
7070 @Callable(i)
7171 func sellUWORLD () = {
72- let $t026632738 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
73- let pmtAmount = $t026632738._1
74- let pmtAssetId = $t026632738._2
72+ let $t032473322 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
73+ let pmtAmount = $t032473322._1
74+ let pmtAssetId = $t032473322._2
7575 if ((pmtAssetId != UWORLD))
7676 then throw("Asset must be UWORLD only")
7777 else {
78- let exchangeRate = getIntegerValue(this, keyExchangeRate)
79- let exchangeRateScaleDelimiter = getIntegerValue(this, keyExchangeRateScaleDelimiter)
78+ let exchangeRate = getIntegerValue(this, keySellUWORLDRate)
79+ let exchangeRateScaleDelimiter = getIntegerValue(this, keySellUWORLDRateScaleDelimiter)
8080 let amountToPay = fraction(pmtAmount, exchangeRate, exchangeRateScaleDelimiter)
81- let amountCommission = fraction(amountToPay, commission, commissionScaleDelimiter)
82- let amountWithoutCommission = (amountToPay - amountCommission)
81+ let amountWithoutCommission = amountToPay
8382 [ScriptTransfer(i.caller, amountWithoutCommission, USDN)]
8483 }
8584 }
8685
8786
8887
8988 @Callable(i)
9089 func makePayment (recipient,productId) = {
9190 let recipientAddress = addressFromStringValue(recipient)
92- let $t034933568 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
93- let pmtAmount = $t034933568._1
94- let pmtAssetId = $t034933568._2
91+ let $t040834158 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
92+ let pmtAmount = $t040834158._1
93+ let pmtAssetId = $t040834158._2
9594 if ((pmtAssetId != assetId))
9695 then throw("Asset must be USDN only")
9796 else {
97+ let commission = getIntegerValue(this, keyCommission)
98+ let commissionScaleDelimiter = getIntegerValue(this, keyCommissionScaleDelimiter)
9899 let amountCommission = fraction(pmtAmount, commission, commissionScaleDelimiter)
99100 let amountWithoutCommission = (pmtAmount - amountCommission)
100- let amountCashback = fraction(pmtAmount, 10, 100)
101+ let amountCashback = fraction(pmtAmount, 100000, 1000000)
101102 if (isDefined(getString(this, productId)))
102103 then {
103104 let NFTassetId = fromBase58String(getStringValue(this, productId))
104105 [ScriptTransfer(recipientAddress, amountWithoutCommission, assetId), ScriptTransfer(i.caller, amountCashback, UWORLD), ScriptTransfer(i.caller, 1, NFTassetId)]
105106 }
106107 else [ScriptTransfer(recipientAddress, amountWithoutCommission, assetId), ScriptTransfer(i.caller, amountCashback, UWORLD)]
107108 }
108109 }
109110
110111

github/deemru/w8io/026f985 
41.93 ms