tx · 91CsdXtbeQHMztpYnZhp3XaYbogqXCxGR12YEtKmDh9o

3NADYuG3G91PrmsrRqQfyeDCf2Pi53UV5id:  -0.01400000 Waves

2021.05.07 13:44 [1515163] smart account 3NADYuG3G91PrmsrRqQfyeDCf2Pi53UV5id > SELF 0.00000000 Waves

{ "type": 13, "id": "91CsdXtbeQHMztpYnZhp3XaYbogqXCxGR12YEtKmDh9o", "fee": 1400000, "feeAssetId": null, "timestamp": 1620384262341, "version": 2, "chainId": 84, "sender": "3NADYuG3G91PrmsrRqQfyeDCf2Pi53UV5id", "senderPublicKey": "8agr5kfwDL7NLuMetvciXCcd9TcDKZhRwYZPPTAShaCC", "proofs": [ "2bCHP7teub3UF1FUj1FZCjZG3Q9PEof2iUmt88H77dDjJ1vPYvuii9DbngQwA4uTFYWsXEdbb2Y4xaQTnBDUQFAx" ], "script": "base64:AAIEAAAAAAAAABEIAhIECgIBARIAEgASAwoBCAAAAAkAAAAAD2tleUV4Y2hhbmdlUmF0ZQIAAAANZXhjaGFuZ2VfcmF0ZQAAAAAda2V5RXhjaGFuZ2VSYXRlU2NhbGVEZWxpbWl0ZXICAAAAHWV4Y2hhbmdlX3JhdGVfc2NhbGVfZGVsaW1pdGVyAAAAAA1rZXlDb21taXNzaW9uAgAAAApjb21taXNzaW9uAAAAABtrZXlDb21taXNzaW9uU2NhbGVEZWxpbWl0ZXICAAAAGmNvbW1pc3Npb25fc2NhbGVfZGVsaW1pdGVyAAAAAARVU0ROAQAAACDksHLEGjv+8PYJNtljDWFsUYAqeC0sRtfKUlc+urlUoQAAAAAGVVdPUkxEAQAAACBcOT9fCNS+BgDGXve/DAHyIfgTONksYUCiHdU9D7LcXQAAAAAHYXNzZXRJZAUAAAAEVVNETgAAAAAKY29tbWlzc2lvbgAAAAAAAAB1MAAAAAAYY29tbWlzc2lvblNjYWxlRGVsaW1pdGVyAAAAAAAAD0JAAAAABAAAAAFpAQAAAAlzZXRQYXJhbXMAAAACAAAADGV4Y2hhbmdlUm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c2V0IG11c3QgYmUgVVNETiBvbmx5BAAAABBhbW91bnRDb21taXNzaW9uCQAAawAAAAMFAAAACXBtdEFtb3VudAUAAAAKY29tbWlzc2lvbgUAAAAYY29tbWlzc2lvblNjYWxlRGVsaW1pdGVyBAAAABdhbW91bnRXaXRob3V0Q29tbWlzc2lvbgkAAGUAAAACBQAAAAlwbXRBbW91bnQFAAAAEGFtb3VudENvbW1pc3Npb24EAAAADmFtb3VudENhc2hiYWNrCQAAawAAAAMFAAAACXBtdEFtb3VudAAAAAAAAAAACgAAAAAAAAAAZAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAABByZWNpcGllbnRBZGRyZXNzBQAAABdhbW91bnRXaXRob3V0Q29tbWlzc2lvbgUAAAAHYXNzZXRJZAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAABByZWNpcGllbnRBZGRyZXNzBQAAAA5hbW91bnRDYXNoYmFjawUAAAAGVVdPUkxECQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAAOYW1vdW50Q2FzaGJhY2sFAAAABlVXT1JMRAUAAAADbmlsAAAAAL8Lv5g=", "height": 1515163, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Bkyr8iMqHvrGkwGzWo8A4aUBCsuXcUBf1koQ6VfcuMhB Next: AQL6ZWm8ZTqQTt3n821DVYkPYMooH4y8bcSDs6GoA3vD Diff:
OldNewDifferences
3636 else {
3737 let exchangeRate = getIntegerValue(this, keyExchangeRate)
3838 let exchangeRateScaleDelimiter = getIntegerValue(this, keyExchangeRateScaleDelimiter)
39- let amountToPay = fraction(pmtAmount, exchangeRate, exchangeRateScaleDelimiter)
39+ let amountToPay = fraction(pmtAmount, exchangeRateScaleDelimiter, exchangeRate)
4040 let amountCommission = fraction(amountToPay, commission, commissionScaleDelimiter)
4141 let amountWithoutCommission = (amountToPay - amountCommission)
4242 [ScriptTransfer(i.caller, amountWithoutCommission, UWORLD)]
5555 else {
5656 let exchangeRate = getIntegerValue(this, keyExchangeRate)
5757 let exchangeRateScaleDelimiter = getIntegerValue(this, keyExchangeRateScaleDelimiter)
58- let amountToPay = fraction(pmtAmount, exchangeRateScaleDelimiter, exchangeRate)
58+ let amountToPay = fraction(pmtAmount, exchangeRate, exchangeRateScaleDelimiter)
5959 let amountCommission = fraction(amountToPay, commission, commissionScaleDelimiter)
6060 let amountWithoutCommission = (amountToPay - amountCommission)
6161 [ScriptTransfer(i.caller, amountWithoutCommission, USDN)]
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 4 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let keyExchangeRate = "exchange_rate"
55
66 let keyExchangeRateScaleDelimiter = "exchange_rate_scale_delimiter"
77
88 let keyCommission = "commission"
99
1010 let keyCommissionScaleDelimiter = "commission_scale_delimiter"
1111
1212 let USDN = base58'GPi1Q6QVgUmuomtThbim81hBYBEUWyf5BVmE4Tnd3sNg'
1313
1414 let UWORLD = base58'7D191wpwpSs4WanizHWgiRhAYhCGkmpop4h3NzUQreig'
1515
1616 let assetId = USDN
1717
1818 let commission = 30000
1919
2020 let commissionScaleDelimiter = 1000000
2121
2222 @Callable(i)
2323 func setParams (exchangeRate,exchangeRateScaleDelimiter) = if ((i.caller != this))
2424 then throw("Only the DApp itself can call this function")
2525 else [IntegerEntry(keyExchangeRate, exchangeRate), IntegerEntry(keyExchangeRateScaleDelimiter, exchangeRateScaleDelimiter), IntegerEntry(keyCommission, commission), IntegerEntry(keyCommissionScaleDelimiter, commissionScaleDelimiter)]
2626
2727
2828
2929 @Callable(i)
3030 func buyUWORLD () = {
3131 let $t012311306 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
3232 let pmtAmount = $t012311306._1
3333 let pmtAssetId = $t012311306._2
3434 if ((pmtAssetId != assetId))
3535 then throw("Asset must be USDN only")
3636 else {
3737 let exchangeRate = getIntegerValue(this, keyExchangeRate)
3838 let exchangeRateScaleDelimiter = getIntegerValue(this, keyExchangeRateScaleDelimiter)
39- let amountToPay = fraction(pmtAmount, exchangeRate, exchangeRateScaleDelimiter)
39+ let amountToPay = fraction(pmtAmount, exchangeRateScaleDelimiter, exchangeRate)
4040 let amountCommission = fraction(amountToPay, commission, commissionScaleDelimiter)
4141 let amountWithoutCommission = (amountToPay - amountCommission)
4242 [ScriptTransfer(i.caller, amountWithoutCommission, UWORLD)]
4343 }
4444 }
4545
4646
4747
4848 @Callable(i)
4949 func sellUWORLD () = {
5050 let $t019642039 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
5151 let pmtAmount = $t019642039._1
5252 let pmtAssetId = $t019642039._2
5353 if ((pmtAssetId != UWORLD))
5454 then throw("Asset must be UWORLD only")
5555 else {
5656 let exchangeRate = getIntegerValue(this, keyExchangeRate)
5757 let exchangeRateScaleDelimiter = getIntegerValue(this, keyExchangeRateScaleDelimiter)
58- let amountToPay = fraction(pmtAmount, exchangeRateScaleDelimiter, exchangeRate)
58+ let amountToPay = fraction(pmtAmount, exchangeRate, exchangeRateScaleDelimiter)
5959 let amountCommission = fraction(amountToPay, commission, commissionScaleDelimiter)
6060 let amountWithoutCommission = (amountToPay - amountCommission)
6161 [ScriptTransfer(i.caller, amountWithoutCommission, USDN)]
6262 }
6363 }
6464
6565
6666
6767 @Callable(i)
6868 func makePayment (recipient) = {
6969 let recipientAddress = addressFromStringValue(recipient)
7070 let $t027752850 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
7171 let pmtAmount = $t027752850._1
7272 let pmtAssetId = $t027752850._2
7373 if ((pmtAssetId != assetId))
7474 then throw("Asset must be USDN only")
7575 else {
7676 let amountCommission = fraction(pmtAmount, commission, commissionScaleDelimiter)
7777 let amountWithoutCommission = (pmtAmount - amountCommission)
7878 let amountCashback = fraction(pmtAmount, 10, 100)
7979 [ScriptTransfer(recipientAddress, amountWithoutCommission, assetId), ScriptTransfer(recipientAddress, amountCashback, UWORLD), ScriptTransfer(i.caller, amountCashback, UWORLD)]
8080 }
8181 }
8282
8383

github/deemru/w8io/026f985 
30.55 ms