tx · GyZscZDR6jNh3Fx2y88kroBkVoRYrjjTB1Q63ibCVSn9

3NADYuG3G91PrmsrRqQfyeDCf2Pi53UV5id:  -0.01400000 Waves

2021.05.06 02:23 [1513044] smart account 3NADYuG3G91PrmsrRqQfyeDCf2Pi53UV5id > SELF 0.00000000 Waves

{ "type": 13, "id": "GyZscZDR6jNh3Fx2y88kroBkVoRYrjjTB1Q63ibCVSn9", "fee": 1400000, "feeAssetId": null, "timestamp": 1620257063896, "version": 2, "chainId": 84, "sender": "3NADYuG3G91PrmsrRqQfyeDCf2Pi53UV5id", "senderPublicKey": "8agr5kfwDL7NLuMetvciXCcd9TcDKZhRwYZPPTAShaCC", "proofs": [ "5KjRmZWpk7goQvcbWBpeCuLh1dLaz19fdNZ9mY8iDeJjND3yT9hQP5nLLryNPHLsWMmuFMK1557NLe5ur4CHMX3N" ], "script": "base64:AAIEAAAAAAAAABEIAhIECgIBARIAEgASAwoBCAAAAAkAAAAAD2tleUV4Y2hhbmdlUmF0ZQIAAAANZXhjaGFuZ2VfcmF0ZQAAAAAda2V5RXhjaGFuZ2VSYXRlU2NhbGVEZWxpbWl0ZXICAAAAHWV4Y2hhbmdlX3JhdGVfc2NhbGVfZGVsaW1pdGVyAAAAAA1rZXlDb21taXNzaW9uAgAAAApjb21taXNzaW9uAAAAABtrZXlDb21taXNzaW9uU2NhbGVEZWxpbWl0ZXICAAAAGmNvbW1pc3Npb25fc2NhbGVfZGVsaW1pdGVyAAAAAARVU0ROAQAAACC2JinDBPXOU5GkDkt1JC9kjFGx+t+vVCm9SNIdKrKq0QAAAAAGVVdPUkxEAQAAACAtGFOlUDuo5uQJ1exIGoVYlbyPhEbn5MXvOd7nG64s6QAAAAAHYXNzZXRJZAUAAAAEVVNETgAAAAAKY29tbWlzc2lvbgAAAAAAAAB1MAAAAAAYY29tbWlzc2lvblNjYWxlRGVsaW1pdGVyAAAAAAAAD0JAAAAABAAAAAFpAQAAAAlzZXRQYXJhbXMAAAACAAAADGV4Y2hh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AF0Fzc2V0IG11c3QgYmUgVVNETiBvbmx5BAAAABBhbW91bnRDb21taXNzaW9uCQAAawAAAAMFAAAACXBtdEFtb3VudAUAAAAKY29tbWlzc2lvbgUAAAAYY29tbWlzc2lvblNjYWxlRGVsaW1pdGVyBAAAABdhbW91bnRXaXRob3V0Q29tbWlzc2lvbgkAAGUAAAACBQAAAAlwbXRBbW91bnQFAAAAEGFtb3VudENvbW1pc3Npb24EAAAADmFtb3VudENhc2hiYWNrCQAAawAAAAMFAAAACXBtdEFtb3VudAAAAAAAAAAACgAAAAAAAAAAZAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAABByZWNpcGllbnRBZGRyZXNzBQAAABdhbW91bnRXaXRob3V0Q29tbWlzc2lvbgUAAAAHYXNzZXRJZAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAABByZWNpcGllbnRBZGRyZXNzBQAAAA5hbW91bnRDYXNoYmFjawUAAAAGVVdPUkxECQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAAOYW1vdW50Q2FzaGJhY2sFAAAABlVXT1JMRAUAAAADbmlsAAAAAPmNc9w=", "height": 1513044, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 2GWm7BkWcubddzHbk3gwuizvVQbvLwFcY6TPVg9fBbGN Next: 2ouMD1yZhQjWwXZm3KenK3Sn167FXGr1VVqNTgbqWaK1 Diff:
OldNewDifferences
44 let keyExchangeRate = "exchange_rate"
55
66 let keyExchangeRateScaleDelimiter = "exchange_rate_scale_delimiter"
7+
8+let keyCommission = "commission"
9+
10+let keyCommissionScaleDelimiter = "commission_scale_delimiter"
711
812 let USDN = base58'DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p'
913
1822 @Callable(i)
1923 func setParams (exchangeRate,exchangeRateScaleDelimiter) = if ((i.caller != this))
2024 then throw("Only the DApp itself can call this function")
21- else [IntegerEntry(keyExchangeRate, exchangeRate), IntegerEntry(keyExchangeRateScaleDelimiter, exchangeRateScaleDelimiter)]
25+ else [IntegerEntry(keyExchangeRate, exchangeRate), IntegerEntry(keyExchangeRateScaleDelimiter, exchangeRateScaleDelimiter), IntegerEntry(keyCommission, commission), IntegerEntry(keyCommissionScaleDelimiter, commissionScaleDelimiter)]
26+
27+
28+
29+@Callable(i)
30+func buyUWORLD () = {
31+ let $t010471122 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
32+ let pmtAmount = $t010471122._1
33+ let pmtAssetId = $t010471122._2
34+ if ((pmtAssetId != assetId))
35+ then throw("Asset must be USDN only")
36+ else {
37+ let exchangeRate = getIntegerValue(this, keyExchangeRate)
38+ let exchangeRateScaleDelimiter = getIntegerValue(this, keyExchangeRateScaleDelimiter)
39+ let amountToPay = fraction(pmtAmount, exchangeRate, exchangeRateScaleDelimiter)
40+ let amountCommission = fraction(amountToPay, commission, commissionScaleDelimiter)
41+ let amountWithoutCommission = (amountToPay - amountCommission)
42+[ScriptTransfer(i.caller, amountWithoutCommission, UWORLD)]
43+ }
44+ }
45+
46+
47+
48+@Callable(i)
49+func sellUWORLD () = {
50+ let $t017801855 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
51+ let pmtAmount = $t017801855._1
52+ let pmtAssetId = $t017801855._2
53+ if ((pmtAssetId != UWORLD))
54+ then throw("Asset must be UWORLD only")
55+ else {
56+ let exchangeRate = getIntegerValue(this, keyExchangeRate)
57+ let exchangeRateScaleDelimiter = getIntegerValue(this, keyExchangeRateScaleDelimiter)
58+ let amountToPay = fraction(pmtAmount, exchangeRateScaleDelimiter, exchangeRate)
59+ let amountCommission = fraction(amountToPay, commission, commissionScaleDelimiter)
60+ let amountWithoutCommission = (amountToPay - amountCommission)
61+[ScriptTransfer(i.caller, amountWithoutCommission, USDN)]
62+ }
63+ }
2264
2365
2466
2567 @Callable(i)
2668 func makePayment (recipient) = {
2769 let recipientAddress = addressFromStringValue(recipient)
28- let $t0912987 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
29- let pmtAmount = $t0912987._1
30- let pmtAssetId = $t0912987._2
70+ let $t025912666 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
71+ let pmtAmount = $t025912666._1
72+ let pmtAssetId = $t025912666._2
3173 if ((pmtAssetId != assetId))
3274 then throw("Asset must be USDN only")
3375 else {
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"
7+
8+let keyCommission = "commission"
9+
10+let keyCommissionScaleDelimiter = "commission_scale_delimiter"
711
812 let USDN = base58'DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p'
913
1014 let UWORLD = base58'432rwiV6mi3SJGLkhGPeyHVNUj8rEgHpXwyc1yXj4M6Y'
1115
1216 let assetId = USDN
1317
1418 let commission = 30000
1519
1620 let commissionScaleDelimiter = 1000000
1721
1822 @Callable(i)
1923 func setParams (exchangeRate,exchangeRateScaleDelimiter) = if ((i.caller != this))
2024 then throw("Only the DApp itself can call this function")
21- else [IntegerEntry(keyExchangeRate, exchangeRate), IntegerEntry(keyExchangeRateScaleDelimiter, exchangeRateScaleDelimiter)]
25+ else [IntegerEntry(keyExchangeRate, exchangeRate), IntegerEntry(keyExchangeRateScaleDelimiter, exchangeRateScaleDelimiter), IntegerEntry(keyCommission, commission), IntegerEntry(keyCommissionScaleDelimiter, commissionScaleDelimiter)]
26+
27+
28+
29+@Callable(i)
30+func buyUWORLD () = {
31+ let $t010471122 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
32+ let pmtAmount = $t010471122._1
33+ let pmtAssetId = $t010471122._2
34+ if ((pmtAssetId != assetId))
35+ then throw("Asset must be USDN only")
36+ else {
37+ let exchangeRate = getIntegerValue(this, keyExchangeRate)
38+ let exchangeRateScaleDelimiter = getIntegerValue(this, keyExchangeRateScaleDelimiter)
39+ let amountToPay = fraction(pmtAmount, exchangeRate, exchangeRateScaleDelimiter)
40+ let amountCommission = fraction(amountToPay, commission, commissionScaleDelimiter)
41+ let amountWithoutCommission = (amountToPay - amountCommission)
42+[ScriptTransfer(i.caller, amountWithoutCommission, UWORLD)]
43+ }
44+ }
45+
46+
47+
48+@Callable(i)
49+func sellUWORLD () = {
50+ let $t017801855 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
51+ let pmtAmount = $t017801855._1
52+ let pmtAssetId = $t017801855._2
53+ if ((pmtAssetId != UWORLD))
54+ then throw("Asset must be UWORLD only")
55+ else {
56+ let exchangeRate = getIntegerValue(this, keyExchangeRate)
57+ let exchangeRateScaleDelimiter = getIntegerValue(this, keyExchangeRateScaleDelimiter)
58+ let amountToPay = fraction(pmtAmount, exchangeRateScaleDelimiter, exchangeRate)
59+ let amountCommission = fraction(amountToPay, commission, commissionScaleDelimiter)
60+ let amountWithoutCommission = (amountToPay - amountCommission)
61+[ScriptTransfer(i.caller, amountWithoutCommission, USDN)]
62+ }
63+ }
2264
2365
2466
2567 @Callable(i)
2668 func makePayment (recipient) = {
2769 let recipientAddress = addressFromStringValue(recipient)
28- let $t0912987 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
29- let pmtAmount = $t0912987._1
30- let pmtAssetId = $t0912987._2
70+ let $t025912666 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
71+ let pmtAmount = $t025912666._1
72+ let pmtAssetId = $t025912666._2
3173 if ((pmtAssetId != assetId))
3274 then throw("Asset must be USDN only")
3375 else {
3476 let amountCommission = fraction(pmtAmount, commission, commissionScaleDelimiter)
3577 let amountWithoutCommission = (pmtAmount - amountCommission)
3678 let amountCashback = fraction(pmtAmount, 10, 100)
3779 [ScriptTransfer(recipientAddress, amountWithoutCommission, assetId), ScriptTransfer(recipientAddress, amountCashback, UWORLD), ScriptTransfer(i.caller, amountCashback, UWORLD)]
3880 }
3981 }
4082
4183

github/deemru/w8io/026f985 
27.00 ms