tx · 9hWQQt6c6bgk4zvAPFWHv44zH7kRnbVFF7nJjJzS7dXo 3NADYuG3G91PrmsrRqQfyeDCf2Pi53UV5id: -0.01400000 Waves 2021.05.07 12:46 [1515099] smart account 3NADYuG3G91PrmsrRqQfyeDCf2Pi53UV5id > SELF 0.00000000 Waves
{ "type": 13, "id": "9hWQQt6c6bgk4zvAPFWHv44zH7kRnbVFF7nJjJzS7dXo", "fee": 1400000, "feeAssetId": null, "timestamp": 1620380815346, "version": 2, "chainId": 84, "sender": "3NADYuG3G91PrmsrRqQfyeDCf2Pi53UV5id", "senderPublicKey": "8agr5kfwDL7NLuMetvciXCcd9TcDKZhRwYZPPTAShaCC", "proofs": [ "4E7y9NziMypAyED7fdvBczxCiWRouypyFnpDSHxmyrYXspAF18BV9rwHUPMMSMRBjgyqVakCowgmmFxzGwXPdNdd" ], "script": "base64:AAIEAAAAAAAAABQIAhIECgIBARIDCgEIEgASAwoBCAAAAAkAAAAAD2tleUV4Y2hhbmdlUmF0ZQIAAAANZXhjaGFuZ2VfcmF0ZQAAAAAda2V5RXhjaGFuZ2VSYXRlU2NhbGVEZWxpbWl0ZXICAAAAHWV4Y2hhbmdlX3JhdGVfc2NhbGVfZGVsaW1pdGVyAAAAAA1rZXlDb21taXNzaW9uAgAAAApjb21taXNzaW9uAAAAABtrZXlDb21taXNzaW9uU2NhbGVEZWxpbWl0ZXICAAAAGmNvbW1pc3Npb25fc2NhbGVfZGVsaW1pdGVyAAAAAARVU0ROAQAAACDksHLEGjv+8PYJNtljDWFsUYAqeC0sRtfKUlc+urlUoQAAAAAGVVdPUkxEAQAAACAtGFOlUDuo5uQJ1exIGoVYlbyPhEbn5MXvOd7nG64s6QAAAAAHYXNzZXRJZAUAAAAEVVNETgAAAAAKY29tbWlzc2lvbgAAAAAAAAB1MAAAAAAYY29tbWlzc2lvblNjYWxlRGVsaW1pdGVyAAAAAAAAD0JAAAAABAAAAAFpAQAAAAlzZXRQYXJhbXMAAAACAAAADGV4Y2hhb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zZXRJZAkAAAIAAAABAgAAABdBc3NldCBtdXN0IGJlIFVTRE4gb25seQQAAAAQYW1vdW50Q29tbWlzc2lvbgkAAGsAAAADBQAAAAlwbXRBbW91bnQFAAAACmNvbW1pc3Npb24FAAAAGGNvbW1pc3Npb25TY2FsZURlbGltaXRlcgQAAAAXYW1vdW50V2l0aG91dENvbW1pc3Npb24JAABlAAAAAgUAAAAJcG10QW1vdW50BQAAABBhbW91bnRDb21taXNzaW9uBAAAAA5hbW91bnRDYXNoYmFjawkAAGsAAAADBQAAAAlwbXRBbW91bnQAAAAAAAAAAAoAAAAAAAAAAGQJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAAQcmVjaXBpZW50QWRkcmVzcwUAAAAXYW1vdW50V2l0aG91dENvbW1pc3Npb24FAAAAB2Fzc2V0SWQJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAAQcmVjaXBpZW50QWRkcmVzcwUAAAAOYW1vdW50Q2FzaGJhY2sFAAAABlVXT1JMRAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAADmFtb3VudENhc2hiYWNrBQAAAAZVV09STEQFAAAAA25pbAAAAAAEGQcc", "height": 1515099, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 2ouMD1yZhQjWwXZm3KenK3Sn167FXGr1VVqNTgbqWaK1 Next: 3Hs7x5F2M8zdZBjzkrgqp6PWHreM19p8QY9cwKsxk3ku Diff:
Old | New | Differences | |
---|---|---|---|
27 | 27 | ||
28 | 28 | ||
29 | 29 | @Callable(i) | |
30 | - | func buyUWORLD () = { | |
31 | - | let $ | |
32 | - | let pmtAmount = $ | |
33 | - | let pmtAssetId = $ | |
30 | + | func buyUWORLD (recipient) = { | |
31 | + | let $t011551230 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
32 | + | let pmtAmount = $t011551230._1 | |
33 | + | let pmtAssetId = $t011551230._2 | |
34 | 34 | if ((pmtAssetId != assetId)) | |
35 | 35 | then throw("Asset must be USDN only") | |
36 | 36 | else { | |
47 | 47 | ||
48 | 48 | @Callable(i) | |
49 | 49 | func sellUWORLD () = { | |
50 | - | let $ | |
51 | - | let pmtAmount = $ | |
52 | - | let pmtAssetId = $ | |
50 | + | let $t018881963 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
51 | + | let pmtAmount = $t018881963._1 | |
52 | + | let pmtAssetId = $t018881963._2 | |
53 | 53 | if ((pmtAssetId != UWORLD)) | |
54 | 54 | then throw("Asset must be UWORLD only") | |
55 | 55 | else { | |
67 | 67 | @Callable(i) | |
68 | 68 | func makePayment (recipient) = { | |
69 | 69 | let recipientAddress = addressFromStringValue(recipient) | |
70 | - | let $ | |
71 | - | let pmtAmount = $ | |
72 | - | let pmtAssetId = $ | |
70 | + | let $t026992774 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
71 | + | let pmtAmount = $t026992774._1 | |
72 | + | let pmtAssetId = $t026992774._2 | |
73 | 73 | if ((pmtAssetId != assetId)) | |
74 | 74 | then throw("Asset must be USDN only") | |
75 | 75 | else { |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let keyExchangeRate = "exchange_rate" | |
5 | 5 | ||
6 | 6 | let keyExchangeRateScaleDelimiter = "exchange_rate_scale_delimiter" | |
7 | 7 | ||
8 | 8 | let keyCommission = "commission" | |
9 | 9 | ||
10 | 10 | let keyCommissionScaleDelimiter = "commission_scale_delimiter" | |
11 | 11 | ||
12 | 12 | let USDN = base58'GPi1Q6QVgUmuomtThbim81hBYBEUWyf5BVmE4Tnd3sNg' | |
13 | 13 | ||
14 | 14 | let UWORLD = base58'432rwiV6mi3SJGLkhGPeyHVNUj8rEgHpXwyc1yXj4M6Y' | |
15 | 15 | ||
16 | 16 | let assetId = USDN | |
17 | 17 | ||
18 | 18 | let commission = 30000 | |
19 | 19 | ||
20 | 20 | let commissionScaleDelimiter = 1000000 | |
21 | 21 | ||
22 | 22 | @Callable(i) | |
23 | 23 | func setParams (exchangeRate,exchangeRateScaleDelimiter) = if ((i.caller != this)) | |
24 | 24 | then throw("Only the DApp itself can call this function") | |
25 | 25 | else [IntegerEntry(keyExchangeRate, exchangeRate), IntegerEntry(keyExchangeRateScaleDelimiter, exchangeRateScaleDelimiter), IntegerEntry(keyCommission, commission), IntegerEntry(keyCommissionScaleDelimiter, commissionScaleDelimiter)] | |
26 | 26 | ||
27 | 27 | ||
28 | 28 | ||
29 | 29 | @Callable(i) | |
30 | - | func buyUWORLD () = { | |
31 | - | let $ | |
32 | - | let pmtAmount = $ | |
33 | - | let pmtAssetId = $ | |
30 | + | func buyUWORLD (recipient) = { | |
31 | + | let $t011551230 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
32 | + | let pmtAmount = $t011551230._1 | |
33 | + | let pmtAssetId = $t011551230._2 | |
34 | 34 | if ((pmtAssetId != assetId)) | |
35 | 35 | then throw("Asset must be USDN only") | |
36 | 36 | else { | |
37 | 37 | let exchangeRate = getIntegerValue(this, keyExchangeRate) | |
38 | 38 | let exchangeRateScaleDelimiter = getIntegerValue(this, keyExchangeRateScaleDelimiter) | |
39 | 39 | let amountToPay = fraction(pmtAmount, exchangeRate, exchangeRateScaleDelimiter) | |
40 | 40 | let amountCommission = fraction(amountToPay, commission, commissionScaleDelimiter) | |
41 | 41 | let amountWithoutCommission = (amountToPay - amountCommission) | |
42 | 42 | [ScriptTransfer(i.caller, amountWithoutCommission, UWORLD)] | |
43 | 43 | } | |
44 | 44 | } | |
45 | 45 | ||
46 | 46 | ||
47 | 47 | ||
48 | 48 | @Callable(i) | |
49 | 49 | func sellUWORLD () = { | |
50 | - | let $ | |
51 | - | let pmtAmount = $ | |
52 | - | let pmtAssetId = $ | |
50 | + | let $t018881963 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
51 | + | let pmtAmount = $t018881963._1 | |
52 | + | let pmtAssetId = $t018881963._2 | |
53 | 53 | if ((pmtAssetId != UWORLD)) | |
54 | 54 | then throw("Asset must be UWORLD only") | |
55 | 55 | else { | |
56 | 56 | let exchangeRate = getIntegerValue(this, keyExchangeRate) | |
57 | 57 | let exchangeRateScaleDelimiter = getIntegerValue(this, keyExchangeRateScaleDelimiter) | |
58 | 58 | let amountToPay = fraction(pmtAmount, exchangeRateScaleDelimiter, exchangeRate) | |
59 | 59 | let amountCommission = fraction(amountToPay, commission, commissionScaleDelimiter) | |
60 | 60 | let amountWithoutCommission = (amountToPay - amountCommission) | |
61 | 61 | [ScriptTransfer(i.caller, amountWithoutCommission, USDN)] | |
62 | 62 | } | |
63 | 63 | } | |
64 | 64 | ||
65 | 65 | ||
66 | 66 | ||
67 | 67 | @Callable(i) | |
68 | 68 | func makePayment (recipient) = { | |
69 | 69 | let recipientAddress = addressFromStringValue(recipient) | |
70 | - | let $ | |
71 | - | let pmtAmount = $ | |
72 | - | let pmtAssetId = $ | |
70 | + | let $t026992774 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
71 | + | let pmtAmount = $t026992774._1 | |
72 | + | let pmtAssetId = $t026992774._2 | |
73 | 73 | if ((pmtAssetId != assetId)) | |
74 | 74 | then throw("Asset must be USDN only") | |
75 | 75 | else { | |
76 | 76 | let amountCommission = fraction(pmtAmount, commission, commissionScaleDelimiter) | |
77 | 77 | let amountWithoutCommission = (pmtAmount - amountCommission) | |
78 | 78 | let amountCashback = fraction(pmtAmount, 10, 100) | |
79 | 79 | [ScriptTransfer(recipientAddress, amountWithoutCommission, assetId), ScriptTransfer(recipientAddress, amountCashback, UWORLD), ScriptTransfer(i.caller, amountCashback, UWORLD)] | |
80 | 80 | } | |
81 | 81 | } | |
82 | 82 | ||
83 | 83 |
github/deemru/w8io/026f985 27.43 ms ◑