tx · HXP6zH2EzVFi2JPYT9cgow6Nyym4RL3n2jSFBL3TCt2Z 3NADYuG3G91PrmsrRqQfyeDCf2Pi53UV5id: -0.01400000 Waves 2021.04.23 01:16 [1494239] smart account 3NADYuG3G91PrmsrRqQfyeDCf2Pi53UV5id > SELF 0.00000000 Waves
{ "type": 13, "id": "HXP6zH2EzVFi2JPYT9cgow6Nyym4RL3n2jSFBL3TCt2Z", "fee": 1400000, "feeAssetId": null, "timestamp": 1619129872660, "version": 2, "chainId": 84, "sender": "3NADYuG3G91PrmsrRqQfyeDCf2Pi53UV5id", "senderPublicKey": "8agr5kfwDL7NLuMetvciXCcd9TcDKZhRwYZPPTAShaCC", "proofs": [ "33fDsd2YkpBDe3qnUNipY9dW5FpaJZ1TkJuGxSG88TTQYTWk8sxhLGbgsPE8vyqua5GvQYNmzBkbcaM2xtj3LeKj" ], "script": "base64:AAIEAAAAAAAAAAcIAhIDCgEIAAAABAAAAAAEVVNETgEAAAAgtiYpwwT1zlORpA5LdSQvZIxRsfrfr1QpvUjSHSqyqtEAAAAAB1VTRHRlc3QBAAAAIOSwcsQaO/7w9gk22WMNYWxRgCp4LSxG18pSVz66uVShAAAAAAdhc3NldElkBQAAAAdVU0R0ZXN0AQAAAAxnZXRBc3NldEluZm8AAAABAAAAB2Fzc2V0SWQEAAAAByRtYXRjaDAFAAAAB2Fzc2V0SWQDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAACkJ5dGVWZWN0b3IEAAAAAmlkBQAAAAckbWF0Y2gwBAAAAAhzdHJpbmdJZAkAAlgAAAABBQAAAAJpZAQAAAAEaW5mbwkBAAAAE3ZhbHVlT3JFcnJvck1lc3NhZ2UAAAACCQAD7AAAAAEFAAAAAmlkCQABLAAAAAIJAAEsAAAAAgIAAAAGQXNzZXQgBQAAAAhzdHJpbmdJZAIAAAAOIGRvZXNuJ3QgZXhpc3QJAAUVAAAAAwUAAAAIc3RyaW5nSWQIBQAAAARpbmZvAAAABG5hbWUIBQAAAARpbm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AETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgAAAAAAAAAAAQUAAAAHYXNzZXRJZAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAABByZWNpcGllbnRBZGRyZXNzBQAAABBhbW91bnRXaXRob3V0RmVlBQAAAAdhc3NldElkBQAAAANuaWwAAAAAItbq9A==", "height": 1494239, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 62jCt8pEFqLfQHzHiFVcwgtPmd1XFQHZFQndxWHKBifw Next: BC8monaYtxij8jUZtvQkjqDSddmn8XpvsJHSbXwjf3GD Diff:
Old | New | Differences | |
---|---|---|---|
5 | 5 | ||
6 | 6 | let USDtest = base58'GPi1Q6QVgUmuomtThbim81hBYBEUWyf5BVmE4Tnd3sNg' | |
7 | 7 | ||
8 | + | let assetId = USDtest | |
9 | + | ||
10 | + | func getAssetInfo (assetId) = match assetId { | |
11 | + | case id: ByteVector => | |
12 | + | let stringId = toBase58String(id) | |
13 | + | let info = valueOrErrorMessage(assetInfo(id), (("Asset " + stringId) + " doesn't exist")) | |
14 | + | $Tuple3(stringId, info.name, info.decimals) | |
15 | + | case waves: Unit => | |
16 | + | $Tuple3("WAVES", "WAVES", 8) | |
17 | + | case _ => | |
18 | + | throw("Match error") | |
19 | + | } | |
20 | + | ||
21 | + | ||
8 | 22 | @Callable(i) | |
9 | 23 | func call (recipient) = { | |
10 | 24 | let recipientAddress = addressFromStringValue(recipient) | |
11 | - | [ScriptTransfer(i.caller, 1, unit), ScriptTransfer(recipientAddress, 1, USDtest)] | |
25 | + | let $t0756831 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
26 | + | let pmtAmount = $t0756831._1 | |
27 | + | let pmtAssetId = $t0756831._2 | |
28 | + | let $t0834907 = getAssetInfo(pmtAssetId) | |
29 | + | let pmtStrAssetId = $t0834907._1 | |
30 | + | let pmtAssetName = $t0834907._2 | |
31 | + | let pmtDecimals = $t0834907._3 | |
32 | + | if ((pmtAssetId != assetId)) | |
33 | + | then throw("Assets must be USDN only") | |
34 | + | else { | |
35 | + | let commission = 30000 | |
36 | + | let commissionScaleDelimiter = 1000000 | |
37 | + | let fee = fraction(pmtAmount, 97, 100) | |
38 | + | let amountWithoutFee = (pmtAmount - fee) | |
39 | + | [ScriptTransfer(i.caller, 1, assetId), ScriptTransfer(recipientAddress, amountWithoutFee, assetId)] | |
40 | + | } | |
12 | 41 | } | |
13 | 42 | ||
14 | 43 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let USDN = base58'DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p' | |
5 | 5 | ||
6 | 6 | let USDtest = base58'GPi1Q6QVgUmuomtThbim81hBYBEUWyf5BVmE4Tnd3sNg' | |
7 | 7 | ||
8 | + | let assetId = USDtest | |
9 | + | ||
10 | + | func getAssetInfo (assetId) = match assetId { | |
11 | + | case id: ByteVector => | |
12 | + | let stringId = toBase58String(id) | |
13 | + | let info = valueOrErrorMessage(assetInfo(id), (("Asset " + stringId) + " doesn't exist")) | |
14 | + | $Tuple3(stringId, info.name, info.decimals) | |
15 | + | case waves: Unit => | |
16 | + | $Tuple3("WAVES", "WAVES", 8) | |
17 | + | case _ => | |
18 | + | throw("Match error") | |
19 | + | } | |
20 | + | ||
21 | + | ||
8 | 22 | @Callable(i) | |
9 | 23 | func call (recipient) = { | |
10 | 24 | let recipientAddress = addressFromStringValue(recipient) | |
11 | - | [ScriptTransfer(i.caller, 1, unit), ScriptTransfer(recipientAddress, 1, USDtest)] | |
25 | + | let $t0756831 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
26 | + | let pmtAmount = $t0756831._1 | |
27 | + | let pmtAssetId = $t0756831._2 | |
28 | + | let $t0834907 = getAssetInfo(pmtAssetId) | |
29 | + | let pmtStrAssetId = $t0834907._1 | |
30 | + | let pmtAssetName = $t0834907._2 | |
31 | + | let pmtDecimals = $t0834907._3 | |
32 | + | if ((pmtAssetId != assetId)) | |
33 | + | then throw("Assets must be USDN only") | |
34 | + | else { | |
35 | + | let commission = 30000 | |
36 | + | let commissionScaleDelimiter = 1000000 | |
37 | + | let fee = fraction(pmtAmount, 97, 100) | |
38 | + | let amountWithoutFee = (pmtAmount - fee) | |
39 | + | [ScriptTransfer(i.caller, 1, assetId), ScriptTransfer(recipientAddress, amountWithoutFee, assetId)] | |
40 | + | } | |
12 | 41 | } | |
13 | 42 | ||
14 | 43 |
github/deemru/w8io/026f985 18.78 ms ◑