tx · 2V6JEWnj7NfZBPdBHPgTJNn2Tste5tL3YHPQbtMKT9Yk 3N37eLdtWjhS31FGHvu2HpGLreF11i58Bv6: -0.01000000 Waves 2023.03.16 13:20 [2492453] smart account 3N37eLdtWjhS31FGHvu2HpGLreF11i58Bv6 > SELF 0.00000000 Waves
{ "type": 13, "id": "2V6JEWnj7NfZBPdBHPgTJNn2Tste5tL3YHPQbtMKT9Yk", "fee": 1000000, "feeAssetId": null, "timestamp": 1678962108309, "version": 2, "chainId": 84, "sender": "3N37eLdtWjhS31FGHvu2HpGLreF11i58Bv6", "senderPublicKey": "3pW4h7e3NAcqGkvc1AyziZLMPSsG2eXvCGU7vLxPXkaq", "proofs": [ "53TyvShpf8SRmGkpLQgChem9zKMGp2nKDHNXrxQaht1LSQ6V15DyMoNnY7u4LWZP3CChe693mVyikWMHCeuX6JHR" ], "script": "base64:AAIFAAAAAAAAAAkIAhIFCgMBAQEAAAAAAAAAAQAAAAFpAQAAAARjYWxsAAAAAwAAAAtmaXJzdE51bWJlcgAAAAxzZWNvbmROdW1iZXIAAAAIbXVsdGlwbHkEAAAADGJpZ0ludFJlc3VsdAkAAToAAAACCQABOQAAAAIJAAE2AAAAAQUAAAALZmlyc3ROdW1iZXIJAAE2AAAAAQUAAAAIbXVsdGlwbHkJAAE5AAAAAgkAATYAAAABBQAAAAxzZWNvbmROdW1iZXIJAAE2AAAAAQUAAAAIbXVsdGlwbHkEAAAABnJlc3VsdAkAAaAAAAABBQAAAAxiaWdJbnRSZXN1bHQJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAICAAAABnJlc3VsdAUAAAAGcmVzdWx0BQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleWGhMqE=", "height": 2492453, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 6N6y16P3DaaaxaUQKcCC5WxEpJvRqL2rkUPpfWodXKk Next: 9nZL2VYJXhhWKVCeQVo17YYD9HjGb5b52jSQHk9Lk73U Diff:
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let bstUsdtAssetStorageKey = "bstUsdtAssetId" | |
5 | - | ||
6 | - | let bstSurfAssetStorageKey = "bstSurfAssetId" | |
7 | - | ||
8 | - | func unwrap (data) = match data { | |
9 | - | case v: ByteVector => | |
10 | - | v | |
11 | - | case _ => | |
12 | - | throw("Expected that data will be string") | |
13 | - | } | |
14 | 4 | ||
15 | 5 | ||
16 | 6 | @Callable(i) | |
17 | - | func issueAssets () = { | |
18 | - | let bstUsdt = Issue("bstUsdtTest1", "", 10000000, 6, true, unit, 0) | |
19 | - | let bstUsdtAssetId = calculateAssetId(bstUsdt) | |
20 | - | let bstSurf = Issue("bstSurfTest1", "", 10000000, 6, true, unit, 1) | |
21 | - | let bstSurfAssetId = calculateAssetId(bstSurf) | |
22 | - | [DeleteEntry(bstUsdtAssetStorageKey), DeleteEntry(bstSurfAssetStorageKey), BinaryEntry(bstUsdtAssetStorageKey, bstUsdtAssetId), BinaryEntry(bstSurfAssetStorageKey, bstSurfAssetId), bstUsdt, bstSurf] | |
23 | - | } | |
24 | - | ||
25 | - | ||
26 | - | ||
27 | - | @Callable(i) | |
28 | - | func sendInternalAssetsToTheCaller (id,amount) = { | |
29 | - | let assetId = if ((id == 0)) | |
30 | - | then unwrap(getBinary(bstUsdtAssetStorageKey)) | |
31 | - | else if ((id == 1)) | |
32 | - | then unwrap(getBinary(bstSurfAssetStorageKey)) | |
33 | - | else throw("Wrong Asset Id") | |
34 | - | let balance = assetBalance(this, assetId) | |
35 | - | if ((balance >= amount)) | |
36 | - | then [ScriptTransfer(i.caller, amount, assetId)] | |
37 | - | else [Reissue(assetId, amount, true), ScriptTransfer(i.caller, amount, assetId)] | |
7 | + | func call (firstNumber,secondNumber,multiply) = { | |
8 | + | let bigIntResult = ((toBigInt(firstNumber) * toBigInt(multiply)) / (toBigInt(secondNumber) * toBigInt(multiply))) | |
9 | + | let result = toInt(bigIntResult) | |
10 | + | [IntegerEntry("result", result)] | |
38 | 11 | } | |
39 | 12 | ||
40 | 13 |
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let bstUsdtAssetStorageKey = "bstUsdtAssetId" | |
5 | - | ||
6 | - | let bstSurfAssetStorageKey = "bstSurfAssetId" | |
7 | - | ||
8 | - | func unwrap (data) = match data { | |
9 | - | case v: ByteVector => | |
10 | - | v | |
11 | - | case _ => | |
12 | - | throw("Expected that data will be string") | |
13 | - | } | |
14 | 4 | ||
15 | 5 | ||
16 | 6 | @Callable(i) | |
17 | - | func issueAssets () = { | |
18 | - | let bstUsdt = Issue("bstUsdtTest1", "", 10000000, 6, true, unit, 0) | |
19 | - | let bstUsdtAssetId = calculateAssetId(bstUsdt) | |
20 | - | let bstSurf = Issue("bstSurfTest1", "", 10000000, 6, true, unit, 1) | |
21 | - | let bstSurfAssetId = calculateAssetId(bstSurf) | |
22 | - | [DeleteEntry(bstUsdtAssetStorageKey), DeleteEntry(bstSurfAssetStorageKey), BinaryEntry(bstUsdtAssetStorageKey, bstUsdtAssetId), BinaryEntry(bstSurfAssetStorageKey, bstSurfAssetId), bstUsdt, bstSurf] | |
23 | - | } | |
24 | - | ||
25 | - | ||
26 | - | ||
27 | - | @Callable(i) | |
28 | - | func sendInternalAssetsToTheCaller (id,amount) = { | |
29 | - | let assetId = if ((id == 0)) | |
30 | - | then unwrap(getBinary(bstUsdtAssetStorageKey)) | |
31 | - | else if ((id == 1)) | |
32 | - | then unwrap(getBinary(bstSurfAssetStorageKey)) | |
33 | - | else throw("Wrong Asset Id") | |
34 | - | let balance = assetBalance(this, assetId) | |
35 | - | if ((balance >= amount)) | |
36 | - | then [ScriptTransfer(i.caller, amount, assetId)] | |
37 | - | else [Reissue(assetId, amount, true), ScriptTransfer(i.caller, amount, assetId)] | |
7 | + | func call (firstNumber,secondNumber,multiply) = { | |
8 | + | let bigIntResult = ((toBigInt(firstNumber) * toBigInt(multiply)) / (toBigInt(secondNumber) * toBigInt(multiply))) | |
9 | + | let result = toInt(bigIntResult) | |
10 | + | [IntegerEntry("result", result)] | |
38 | 11 | } | |
39 | 12 | ||
40 | 13 | ||
41 | 14 | @Verifier(tx) | |
42 | 15 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
43 | 16 |
github/deemru/w8io/026f985 38.12 ms ◑